2
0
桂欢 1 жил өмнө
parent
commit
5d1c3664d3

+ 2 - 2
SLAiELTS/SLAiELTS.xcodeproj/project.pbxproj

@@ -2482,7 +2482,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 21;
+				CURRENT_PROJECT_VERSION = 24;
 				DEVELOPMENT_TEAM = 5WKRWDTA83;
 				DEVELOPMENT_TEAM = 5WKRWDTA83;
 				FRAMEWORK_SEARCH_PATHS = (
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(inherited)",
@@ -2570,7 +2570,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_IDENTITY = "Apple Development";
 				CODE_SIGN_STYLE = Automatic;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 21;
+				CURRENT_PROJECT_VERSION = 24;
 				DEVELOPMENT_TEAM = 5WKRWDTA83;
 				DEVELOPMENT_TEAM = 5WKRWDTA83;
 				FRAMEWORK_SEARCH_PATHS = (
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
 					"$(inherited)",

+ 1 - 1
SLAiELTS/SLAiELTS/AppDelegate.mm

@@ -29,7 +29,7 @@
 //    [SLHttpCenter SharedInstance].serverUrl = @"http://10.0.0.14:8088";
 //    [SLHttpCenter SharedInstance].serverUrl = @"http://10.0.0.14:8088";
     NSString *userPhone = [[NSUserDefaults standardUserDefaults] objectForKey:@"SLUserPhone"];
     NSString *userPhone = [[NSUserDefaults standardUserDefaults] objectForKey:@"SLUserPhone"];
     NSString *userPassword = [[NSUserDefaults standardUserDefaults] objectForKey:@"SLUserPassword"];
     NSString *userPassword = [[NSUserDefaults standardUserDefaults] objectForKey:@"SLUserPassword"];
-    if (userPassword.length) {
+    if (userPhone.length && userPassword.length) {
         NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:@{@"phone" : userPhone, @"password" : userPassword, @"code" : @"0", @"deviceBrand" : @"iPhone", @"deviceModel" : [NSString deviceModel]}];
         NSMutableDictionary *parameter = [NSMutableDictionary dictionaryWithDictionary:@{@"phone" : userPhone, @"password" : userPassword, @"code" : @"0", @"deviceBrand" : @"iPhone", @"deviceModel" : [NSString deviceModel]}];
         [self cacheLoginWhit:parameter];
         [self cacheLoginWhit:parameter];
     }else {
     }else {

+ 18 - 4
SLAiELTS/SLAiELTS/ViewControllers/BaseVC/SLBaseTabBarController.m

@@ -69,11 +69,13 @@
         } else {
         } else {
             // Fallback on earlier versions
             // Fallback on earlier versions
         }
         }
+        if (idx == 2) {
+            [self setMomentTabBadgeWith:item];
+        }
     }];
     }];
     self.selectedIndex = 0;
     self.selectedIndex = 0;
     self.tabBar.delegate = self;
     self.tabBar.delegate = self;
     [self.tabBar setHeight:SLTabBarHeight + kSafeAreaBottom];
     [self.tabBar setHeight:SLTabBarHeight + kSafeAreaBottom];
- 
 }
 }
 
 
 - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{
 - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{
@@ -85,9 +87,21 @@
     return YES;
     return YES;
 }
 }
 
 
-- (void)didReceiveMemoryWarning {
-    [super didReceiveMemoryWarning];
-    // Dispose of any resources that can be recreated.
+- (void)setMomentTabBadgeWith:(RDVTabBarItem *)item {
+    NSDictionary *parameter = @{@"PageIndex": @(1),
+                                @"PageSize": @(0),
+                                @"type" : @"0",
+                                @"userId" : [SLGlobalInfo SharedInstance].loginInfo.user.userId,
+    };
+    [[SLHttpCenter SharedInstance] getWithUrl:@"/api/Friend/GetFriendList" parameter:parameter success:^(id responseObject) {
+        NSDictionary *data = [responseObject objectForKey:@"data"];
+        NSInteger unReadCount = [[data objectForKey:@"unread"] integerValue];
+        item.badgeValue = unReadCount < 99 ? [NSString stringWithFormat:@"%ld",unReadCount] : @"99+";
+        item.badgePositionAdjustment = UIOffsetMake(-10, 0);
+        item.badgeTextFont = [UIFont systemFontOfSize:10];
+    } failure:^(SPRequestError *error) {
+        
+    }];
 }
 }
 
 
 @end
 @end

+ 6 - 1
SLAiELTS/SLAiELTS/ViewControllers/Moments/MomentsVc/SLMomentsVc.m

@@ -113,15 +113,20 @@ static CGFloat textFieldH = 56;
     [self.headerView confignHeaderWith:self.userModel];
     [self.headerView confignHeaderWith:self.userModel];
     SLUserModel *userModel = [SLGlobalInfo SharedInstance].loginInfo.user;
     SLUserModel *userModel = [SLGlobalInfo SharedInstance].loginInfo.user;
     if ([self.userModel.userId isEqualToString:userModel.userId]) {
     if ([self.userModel.userId isEqualToString:userModel.userId]) {
+        self.userModel = userModel;
         [self.headerView updateHeaderViewWith:userModel.momentsMsgNotice];
         [self.headerView updateHeaderViewWith:userModel.momentsMsgNotice];
         if (self.isFriendList) {
         if (self.isFriendList) {
             self.headerView.bgSelImageView.hidden = NO;
             self.headerView.bgSelImageView.hidden = NO;
             self.headerView.frame = CGRectMake(0, 0, 0, 220 * KScaleW);
             self.headerView.frame = CGRectMake(0, 0, 0, 220 * KScaleW);
             self.tableView.tableHeaderView.frame = CGRectMake(0, 0, kSCREEN_WIDTH, 250 * KScaleW);
             self.tableView.tableHeaderView.frame = CGRectMake(0, 0, kSCREEN_WIDTH, 250 * KScaleW);
         }else {
         }else {
-            CGFloat h = [self.userModel.momentsMsgNotice integerValue] ?  70 : 0;
+            NSInteger unReadCount = [self.userModel.momentsMsgNotice integerValue];
+            CGFloat h = unReadCount ? 70 : 0;
             self.headerView.frame = CGRectMake(0, 0, 0, (220 + h) * KScaleW);
             self.headerView.frame = CGRectMake(0, 0, 0, (220 + h) * KScaleW);
             self.tableView.tableHeaderView.frame = CGRectMake(0, 0, kSCREEN_WIDTH, (250 + h) * KScaleW);
             self.tableView.tableHeaderView.frame = CGRectMake(0, 0, kSCREEN_WIDTH, (250 + h) * KScaleW);
+            self.rdv_tabBarItem.badgeValue = unReadCount < 99 ? [NSString stringWithFormat:@"%ld",unReadCount] : @"99+";
+            self.rdv_tabBarItem.badgePositionAdjustment = UIOffsetMake(-10, 0);
+            self.rdv_tabBarItem.badgeTextFont = [UIFont systemFontOfSize:10];
         }
         }
     }
     }
 }
 }