Fenix Wang 8 роки тому
батько
коміт
a9e89fadf3
33 змінених файлів з 328 додано та 527 видалено
  1. BIN
      NIMDemo/NIM.xcworkspace/xcuserdata/Fenix.xcuserdatad/UserInterfaceState.xcuserstate
  2. 1 49
      NIMDemo/NIM.xcworkspace/xcuserdata/Fenix.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
  3. 1 1
      NIMDemo/NIMDemo/AddFriendViewController.m
  4. 2 2
      NIMDemo/NIMDemo/Base.lproj/Main.storyboard
  5. 1 1
      NIMDemo/NIMDemo/Classes/Sections/Card/ViewController/NTESTeamListViewController.m
  6. 1 0
      NIMDemo/NIMDemo/Classes/Sections/Contact/View/NTESContactUtilCell.m
  7. 6 4
      NIMDemo/NIMDemo/ContactTableViewCell.m
  8. 10 0
      NIMDemo/NIMDemo/ContactViewController.m
  9. 8 38
      NIMDemo/NIMDemo/CreateGroupViewController.m
  10. 1 2
      NIMDemo/NIMDemo/FriendListViewController.m
  11. 75 75
      NIMDemo/NIMDemo/FriendRequestTableViewCell.m
  12. 2 0
      NIMDemo/NIMDemo/FriendRequestViewController.h
  13. 53 299
      NIMDemo/NIMDemo/FriendRequestViewController.m
  14. 1 2
      NIMDemo/NIMDemo/FriendViewController.m
  15. 0 2
      NIMDemo/NIMDemo/GroupInfoViewController.m
  16. 8 0
      NIMDemo/NIMDemo/HttpRequest/HttpRequest.h
  17. 45 2
      NIMDemo/NIMDemo/HttpRequest/HttpRequest.m
  18. 21 0
      NIMDemo/NIMDemo/Images.xcassets/Whosay/聊天-_03(2).imageset/Contents.json
  19. BIN
      NIMDemo/NIMDemo/Images.xcassets/Whosay/聊天-_03(2).imageset/聊天-_03(2).png
  20. 21 0
      NIMDemo/NIMDemo/Images.xcassets/Whosay/通讯录_新的关注.imageset/Contents.json
  21. BIN
      NIMDemo/NIMDemo/Images.xcassets/Whosay/通讯录_新的关注.imageset/通讯录_新的关注.png
  22. 6 6
      NIMDemo/NIMDemo/RechargeViewController.m
  23. 13 12
      NIMDemo/NIMDemo/SectionGroup/GroupMenberTableViewCell.m
  24. 12 4
      NIMDemo/NIMDemo/SectionTrade/MyTradeTableViewCell.m
  25. 4 1
      NIMDemo/NIMDemo/SectionTrade/TradeData.m
  26. 0 2
      NIMDemo/NIMDemo/SectionTrade/TradeUtil.m
  27. 1 1
      NIMDemo/NIMDemo/SettingTableViewController.m
  28. 3 3
      NIMDemo/NIMDemo/SettingTopTableViewCell.m
  29. 2 1
      NIMDemo/NIMDemo/SocialDetailTableViewCell.m
  30. 17 17
      NIMDemo/NIMDemo/User.m
  31. 2 0
      NIMDemo/NIMDemo/UserInfoViewController.m
  32. 1 1
      NIMKit/NIMKit/Classes/Sections/Input/TradeInputContainer.m
  33. 10 2
      NIMKit/NIMKit/Classes/Sections/Session/ViewController/NIMSessionViewController.m

BIN
NIMDemo/NIM.xcworkspace/xcuserdata/Fenix.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 49
NIMDemo/NIM.xcworkspace/xcuserdata/Fenix.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -6,7 +6,7 @@
       <BreakpointProxy
          BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
          <BreakpointContent
-            shouldBeEnabled = "No"
+            shouldBeEnabled = "Yes"
             ignoreCount = "0"
             continueAfterRunningActions = "No"
             filePath = "../../../../Fenix/XCode_Project/NIM_iOS_Demo_v3/NIMDemo/NIMDemo/ImagePagerViewController.h"
@@ -17,53 +17,5 @@
             endingLineNumber = "6">
          </BreakpointContent>
       </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "../../../../Fenix/XCode_Project/NIM_iOS_Demo_v3/NIMDemo/NIMDemo/TabBarController.m"
-            timestampString = "523178770.396612"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "106"
-            endingLineNumber = "106"
-            landmarkName = "-allMessagesDeleted"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "../NIMKit/NIMKit/Classes/Sections/Session/Object/NIMSessionInteractorImpl.m"
-            timestampString = "523182366.178267"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "190"
-            endingLineNumber = "190"
-            landmarkName = "-markAllMessagesRead"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
-      <BreakpointProxy
-         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
-         <BreakpointContent
-            shouldBeEnabled = "Yes"
-            ignoreCount = "0"
-            continueAfterRunningActions = "No"
-            filePath = "../../../../Fenix/XCode_Project/NIM_iOS_Demo_v3/NIMDemo/NIMDemo/Classes/Sections/Session/ViewController/NTESSessionPeekViewController.m"
-            timestampString = "523182372.389647"
-            startingColumnNumber = "9223372036854775807"
-            endingColumnNumber = "9223372036854775807"
-            startingLineNumber = "53"
-            endingLineNumber = "53"
-            landmarkName = "-previewActionItems"
-            landmarkType = "7">
-         </BreakpointContent>
-      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

+ 1 - 1
NIMDemo/NIMDemo/AddFriendViewController.m

@@ -57,7 +57,7 @@
     __weak typeof(self)wself = self;
     [[HttpRequest shared] requestFriend:_userId msg:_textField.text success:^{
         
-        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"发送成功" message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:nil];
+        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"发送成功" message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil];
         [alertView showAlertWithCompletionHandler:^(NSInteger index) {
             [wself.navigationController popViewControllerAnimated:YES];
         }];

+ 2 - 2
NIMDemo/NIMDemo/Base.lproj/Main.storyboard

@@ -72,7 +72,7 @@
             <objects>
                 <navigationController storyboardIdentifier="NavController" id="ryW-gA-XNT" sceneMemberID="viewController">
                     <simulatedNavigationBarMetrics key="simulatedTopBarMetrics" prompted="NO"/>
-                    <navigationBar key="navigationBar" contentMode="scaleToFill" misplaced="YES" id="Hk7-II-cEF">
+                    <navigationBar key="navigationBar" contentMode="scaleToFill" id="Hk7-II-cEF">
                         <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </navigationBar>
@@ -1525,7 +1525,7 @@
                                             <rect key="frame" x="302" y="19" width="65" height="30"/>
                                             <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
                                             <color key="backgroundColor" red="0.46407229719999998" green="0.77504044770000002" blue="0.63122357750000002" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
-                                            <state key="normal" title="接">
+                                            <state key="normal" title="接">
                                                 <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                             </state>
                                             <connections>

+ 1 - 1
NIMDemo/NIMDemo/Classes/Sections/Card/ViewController/NTESTeamListViewController.m

@@ -94,7 +94,7 @@
 }
 
 - (NSMutableArray *)fetchTeams{
-    NSMutableArray *myTeams = [[NSMutableArray alloc]init];
+    NSMutableArray *myTeams = [[NSMutableArray alloc] init];
     for (NIMTeam *team in [NIMSDK sharedSDK].teamManager.allMyTeams) {
         if (team.type == NIMTeamTypeAdvanced && ![[User sharedInfo] isSystemTeam:team.teamId]) {
             [myTeams addObject:team];

+ 1 - 0
NIMDemo/NIMDemo/Classes/Sections/Contact/View/NTESContactUtilCell.m

@@ -24,6 +24,7 @@
     self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
     if (self) {
         _badgeView = [NTESBadgeView viewWithBadgeTip:@""];
+        _badgeView.userInteractionEnabled = NO;
         [self addSubview:_badgeView];
     }
     return self;

+ 6 - 4
NIMDemo/NIMDemo/ContactTableViewCell.m

@@ -124,12 +124,14 @@
     }
     else
     {
-        [[HttpRequest shared] sendMsg:_data.phones[0] success:^{
-            [self makeToast:@"发送成功" duration:2.0 position:CSToastPositionCenter];
+        __weak typeof(self) wself = self;
+        NSString *phone = _data.phones[0];
+        [[HttpRequest shared] sendMsg:phone success:^{
+            [wself makeToast:@"发送成功" duration:2.0 position:CSToastPositionCenter];
             _data.msgSend = YES;
-            [self setData:_data];
+            [wself setData:_data];
         } failure:^{
-            [self makeToast:@"发送失败,请重试" duration:2.0 position:CSToastPositionCenter];
+            [wself makeToast:@"发送失败,请重试" duration:2.0 position:CSToastPositionCenter];
         }];
     }
 }

+ 10 - 0
NIMDemo/NIMDemo/ContactViewController.m

@@ -202,6 +202,16 @@
             [_contactArr addObject:data];
     }
     
+    //test start
+//    ContactData *data = [[ContactData alloc] init];
+//    data.name = @"0061";
+//    NSString *phone = @"13996080061";
+//    data.phones = [[NSMutableArray alloc] initWithObjects:phone, nil];
+//    [_contactDict setValue:data forKey:phone];
+//    [_contactArr addObject:data];
+//    [mobiles addObject:phone];    
+    //test end
+    
     if(mobiles.count > 0)
     {
         [self requestState:mobiles];

+ 8 - 38
NIMDemo/NIMDemo/CreateGroupViewController.m

@@ -20,6 +20,7 @@
 #import "UIImage+NIM.h"
 #import "NIMAvatarImageView.h"
 #import "CityManager.h"
+#import "HttpRequest.h"
 
 @interface CreateGroupViewController ()
 <UIActionSheetDelegate,
@@ -235,58 +236,27 @@ UIActionSheet *_avatarActionSheet;
     option.name       = teamName;
     option.intro      = self.descTextView.text;
     option.type       = NIMTeamTypeAdvanced;
-    option.joinMode   = NIMTeamJoinModeNeedAuth;
-    option.postscript = @"邀请你加入群组";
+//    option.joinMode   = NIMTeamJoinModeNeedAuth;
+    option.postscript = [NSString stringWithFormat:@"%@%@", @"邀请你加入群组:", teamName];
     if(![self.avatarUrl isEqualToString:@""] && self.avatarUrl != nil)
         option.avatarUrl = self.avatarUrl;
+    
+    __weak typeof(self) wself = wself;
     [SVProgressHUD show];
     [[NIMSDK sharedSDK].teamManager createTeam:option users:members completion:^(NSError *error, NSString *teamId) {
+        [SVProgressHUD dismiss];
         if (!error) {
             NSLog(@"create team id %@", teamId);
             [User sharedInfo].newCreateTeamId = [teamId intValue];
-            [self syncRoom:teamId teamName:self.nickTextField.text];
+            [[HttpRequest shared] syncRoom:teamId teamName:teamName];
+            [[HttpRequest shared] teamInvite:members msg:option.postscript teamId:teamId success:^{} failure:^{}];
             [self.navigationController popViewControllerAnimated:YES];
         }else{
-            [SVProgressHUD dismiss];
             [self.view makeToast:@"创建失败" duration:2.0 position:CSToastPositionCenter];
         }
     }];
-}
-
-- (void)syncRoom:(NSString *)teamId teamName:(NSString *)teamName
-{
-    User *user = [User sharedInfo];
-    
-    NSDictionary *parameters = @{@"id":teamId,
-                                 @"name":teamName,
-                                 @"latitude":[NSString stringWithFormat:@"%F", user.latitude],
-                                 @"longitude":[NSString stringWithFormat:@"%F", user.longitude],
-                                 };
-    NSString *urlString = @"http://whosay.dashgame.com/index.php?m=who&c=index&a=sync_chatroom";
-    //请求的managers
-    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
-    manager.responseSerializer = [AFJSONResponseSerializer new];
-    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", nil];
-    
-    //请求的方式:POST
     
-    NSLog(@"%@", parameters);
     
-    [manager POST:urlString parameters:parameters progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
-        
-        [SVProgressHUD dismiss];
-        
-        NSLog(@"请求成功,服务器返回的信息%@", responseObject);
-        NSDictionary * dic = responseObject;
-        int code = [[dic valueForKey:@"c"] intValue];
-        NSDictionary *data = (NSDictionary *)[dic objectForKey:@"d"];
-        
-        NSLog(@"Json解析结果 = %d   %@", code, data);
-        
-    } failure:^(NSURLSessionDataTask *task, NSError * error) {
-        [SVProgressHUD dismiss];
-        NSLog(@"请求失败,服务器返回的错误信息%@",error);
-    }];
 }
 
 

+ 1 - 2
NIMDemo/NIMDemo/FriendListViewController.m

@@ -101,7 +101,6 @@ NIMContactDataCellDelegate, UISearchBarDelegate>
         [infoArr addObject:contact];
     }
     
-    NSInteger systemCount = [[[NIMSDK sharedSDK] systemNotificationManager] allUnreadCount];
     _contacts = [[GroupedContacts alloc] initWithMembers:infoArr];
     
     NSString *contactCellUtilIcon   = @"icon";
@@ -118,7 +117,7 @@ NIMContactDataCellDelegate, UISearchBarDelegate>
            contactCellUtilIcon:@"通讯录_03",
            contactCellUtilTitle:@"新的朋友",
            contactCellUtilStory:@"FriendRequest",
-           contactCellUtilBadge:@(_requestArr.count+systemCount)
+           contactCellUtilBadge:@(_requestArr.count)
            },
        @{
            contactCellUtilIcon:@"通讯录_新的关注",

+ 75 - 75
NIMDemo/NIMDemo/FriendRequestTableViewCell.m

@@ -70,81 +70,81 @@
         
         _btn.hidden = NO;
     }
-    else if([data isKindOfClass:[NIMSystemNotification class]])
-    {
-        NIMSystemNotification *systemData = data;
-        NIMKitInfo *sourceMember = [[NIMKit sharedKit] infoByUser:systemData.sourceID option:nil];
-        NIMSystemNotificationType type = systemData.type;
-        NSString *avatarUrlString = sourceMember.avatarUrlString;
-        NSURL *url;
-        if (avatarUrlString.length) {
-            url = [NSURL URLWithString:avatarUrlString];
-        }
-        [self.avatar nim_setImageWithURL:url placeholderImage:User.defaultUserAvatar];
-        
-        NIMUser *nimUser = [[NIMSDK sharedSDK].userManager userInfo:systemData.sourceID];
-        wself.nameLabel.text = [[User sharedInfo] getUserName:nimUser];
-        
-        switch (type) {
-            case NIMSystemNotificationTypeTeamApply:
-            {
-                NIMTeam *team = [[NIMSDK sharedSDK].teamManager teamById:systemData.targetID];
-                self.descLabel.text = [NSString stringWithFormat:@"申请加入群 %@ %@", team.teamName, systemData.postscript ? systemData.postscript : @""];
-                _btn.hidden = NO;
-            }
-                break;
-            case NIMSystemNotificationTypeTeamApplyReject:
-            {
-                NIMTeam *team = [[NIMSDK sharedSDK].teamManager teamById:systemData.targetID];
-                self.descLabel.text = [NSString stringWithFormat:@"群 %@ 拒绝你加入", team.teamName];
-                _btn.hidden = YES;
-            }
-                break;
-            case NIMSystemNotificationTypeTeamInvite:
-            {
-                NIMTeam *team = [[NIMSDK sharedSDK].teamManager teamById:systemData.targetID];
-                self.descLabel.text = [NSString stringWithFormat:@"群 %@ 邀请你加入", team.teamName];
-                _btn.hidden = NO;
-            }
-                break;
-            case NIMSystemNotificationTypeTeamIviteReject:
-            {
-                NIMTeam *team = [[NIMSDK sharedSDK].teamManager teamById:systemData.targetID];
-                self.descLabel.text = [NSString stringWithFormat:@"拒绝了群 %@ 邀请", team.teamName];
-                _btn.hidden = YES;
-            }
-                break;
-            case NIMSystemNotificationTypeFriendAdd:
-            {
-                NSString *text = @"未知请求";
-                id object = systemData.attachment;
-                if ([object isKindOfClass:[NIMUserAddAttachment class]]) {
-                    NIMUserOperation operation = [(NIMUserAddAttachment *)object operationType];
-                    switch (operation) {
-                        case NIMUserOperationAdd:
-                            text = @"已添加你为好友";
-                            break;
-                        case NIMUserOperationRequest:
-                            text = @"请求添加你为好友";
-                            break;
-                        case NIMUserOperationVerify:
-                            text = @"通过了你的好友请求";
-                            break;
-                        case NIMUserOperationReject:
-                            text = @"拒绝了你的好友请求";
-                            break;
-                        default:
-                            break;
-                    }
-                }
-                self.descLabel.text = text;
-            }
-                break;
-            default:
-                break;
-        }
-
-    }
+//    else if([data isKindOfClass:[NIMSystemNotification class]])
+//    {
+//        NIMSystemNotification *systemData = data;
+//        NIMKitInfo *sourceMember = [[NIMKit sharedKit] infoByUser:systemData.sourceID option:nil];
+//        NIMSystemNotificationType type = systemData.type;
+//        NSString *avatarUrlString = sourceMember.avatarUrlString;
+//        NSURL *url;
+//        if (avatarUrlString.length) {
+//            url = [NSURL URLWithString:avatarUrlString];
+//        }
+//        [self.avatar nim_setImageWithURL:url placeholderImage:User.defaultUserAvatar];
+//        
+//        NIMUser *nimUser = [[NIMSDK sharedSDK].userManager userInfo:systemData.sourceID];
+//        wself.nameLabel.text = [[User sharedInfo] getUserName:nimUser];
+//        
+//        switch (type) {
+//            case NIMSystemNotificationTypeTeamApply:
+//            {
+//                NIMTeam *team = [[NIMSDK sharedSDK].teamManager teamById:systemData.targetID];
+//                self.descLabel.text = [NSString stringWithFormat:@"申请加入群 %@ %@", team.teamName, systemData.postscript ? systemData.postscript : @""];
+//                _btn.hidden = NO;
+//            }
+//                break;
+//            case NIMSystemNotificationTypeTeamApplyReject:
+//            {
+//                NIMTeam *team = [[NIMSDK sharedSDK].teamManager teamById:systemData.targetID];
+//                self.descLabel.text = [NSString stringWithFormat:@"群 %@ 拒绝你加入", team.teamName];
+//                _btn.hidden = YES;
+//            }
+//                break;
+//            case NIMSystemNotificationTypeTeamInvite:
+//            {
+//                NIMTeam *team = [[NIMSDK sharedSDK].teamManager teamById:systemData.targetID];
+//                self.descLabel.text = [NSString stringWithFormat:@"群 %@ 邀请你加入", team.teamName];
+//                _btn.hidden = NO;
+//            }
+//                break;
+//            case NIMSystemNotificationTypeTeamIviteReject:
+//            {
+//                NIMTeam *team = [[NIMSDK sharedSDK].teamManager teamById:systemData.targetID];
+//                self.descLabel.text = [NSString stringWithFormat:@"拒绝了群 %@ 邀请", team.teamName];
+//                _btn.hidden = YES;
+//            }
+//                break;
+//            case NIMSystemNotificationTypeFriendAdd:
+//            {
+//                NSString *text = @"未知请求";
+//                id object = systemData.attachment;
+//                if ([object isKindOfClass:[NIMUserAddAttachment class]]) {
+//                    NIMUserOperation operation = [(NIMUserAddAttachment *)object operationType];
+//                    switch (operation) {
+//                        case NIMUserOperationAdd:
+//                            text = @"已添加你为好友";
+//                            break;
+//                        case NIMUserOperationRequest:
+//                            text = @"请求添加你为好友";
+//                            break;
+//                        case NIMUserOperationVerify:
+//                            text = @"通过了你的好友请求";
+//                            break;
+//                        case NIMUserOperationReject:
+//                            text = @"拒绝了你的好友请求";
+//                            break;
+//                        default:
+//                            break;
+//                    }
+//                }
+//                self.descLabel.text = text;
+//            }
+//                break;
+//            default:
+//                break;
+//        }
+//
+//    }
 }
 
 - (void)longGesturePress:(UIGestureRecognizer*)gestureRecognizer

+ 2 - 0
NIMDemo/NIMDemo/FriendRequestViewController.h

@@ -11,6 +11,8 @@
 @interface FriendRequestData : NSObject
 @property (nonatomic, strong) NSString            *requestId;
 @property (nonatomic, strong) NSString            *userId;
+@property (nonatomic, assign) int                 type;
+@property (nonatomic, strong) NSString            *extraId;
 @property (nonatomic, strong) NSString            *msg;
 @end
 

+ 53 - 299
NIMDemo/NIMDemo/FriendRequestViewController.m

@@ -22,7 +22,6 @@
 @interface FriendRequestViewController ()<FriendRequestAction, UISearchBarDelegate>
 
 @property (nonatomic, strong) NSMutableArray            *dataArr;
-@property (nonatomic, strong) NSMutableArray            *systemArr;
 
 @property (nonatomic, strong) UISearchController    *searchController;
 @property (nonatomic, strong) NSMutableArray        *searchArr;
@@ -35,51 +34,6 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     
-    _systemArr = [[NSMutableArray alloc] init];
-    
-    id<NIMSystemNotificationManager> systemNotificationManager = [[NIMSDK sharedSDK] systemNotificationManager];
-    NSArray *notifications = [systemNotificationManager fetchSystemNotifications:nil
-                                                                           limit:20];
-    
-    NSMutableArray *ids = [[NSMutableArray alloc] init];
-    if ([notifications count])
-    {
-        for(int i=0; i<notifications.count; i++)
-        {
-            NIMSystemNotification *notification = [notifications objectAtIndex:i];
-            if(notification.type == NIMSystemNotificationTypeFriendAdd)
-            {
-                [self deleteNotification:notification];
-                continue;
-            }
-            
-            BOOL found = NO;
-            for(int j=0; j<_systemArr.count; j++)
-            {
-                NIMSystemNotification *existNotification = [_systemArr objectAtIndex:j];
-                if(existNotification.type == notification.type &&
-                   [existNotification.targetID isEqualToString:notification.targetID] &&
-                   [existNotification.sourceID isEqualToString:notification.sourceID])
-                {
-                    [self deleteNotification:notification];
-                    found = YES;
-                    break;
-                }
-            }
-            
-            if(!found)
-            {
-                [_systemArr addObject:notification];
-                [ids addObject:notification.sourceID];
-            }
-        }
-    }
-    
-    [[NIMSDK sharedSDK].userManager fetchUserInfos:ids completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
-        [self.tableView reloadData];
-    }];
-    
-    
     _searchArr = [[NSMutableArray alloc] init];
     
     _searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
@@ -129,16 +83,6 @@
                 [_searchArr addObject:data];
             }
         }
-        
-        for(int i=0; i<_systemArr.count; i++)
-        {
-            NIMSystemNotification *notification = [_systemArr objectAtIndex:i];
-            NSString *name = [[User sharedInfo] getUserNameById:notification.sourceID];
-            if([[name lowercaseString] containsString:[searchText lowercaseString]])
-            {
-                [_searchArr addObject:notification];
-            }
-        }
     }
     else
     {
@@ -166,7 +110,7 @@
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
     if(_searchArr.count)
         return _searchArr.count;
-    return _dataArr.count + _systemArr.count;
+    return _dataArr.count;
 }
 
 
@@ -180,14 +124,7 @@
     }
     else
     {
-        if(indexPath.row < _dataArr.count)
-        {
-            [cell setData:[_dataArr objectAtIndex:indexPath.row]];
-        }
-        else
-        {
-            [cell setData:[_systemArr objectAtIndex:indexPath.row-_dataArr.count]];
-        }
+        [cell setData:[_dataArr objectAtIndex:indexPath.row]];
     }
     return cell;
 }
@@ -198,14 +135,10 @@
 
 - (void)friendRequestAccept:(id)data{
     
-    if([data isKindOfClass:[NIMSystemNotification class]])
-    {
-        [self onAccept:(NIMSystemNotification *)data];
-    }
-    else
+    FriendRequestData *friendRequestData = (FriendRequestData *)data;
+    __weak typeof(self) wself = self;
+    if(friendRequestData.type == 0)
     {
-        FriendRequestData *friendRequestData = (FriendRequestData *)data;
-        __weak typeof(self) wself = self;
         [[HttpRequest shared] addFriend:friendRequestData.requestId targetId:friendRequestData.userId success:^{
             [wself.view makeToast:@"添加成功" duration:2.0 position:CSToastPositionCenter];
             [wself removeData:friendRequestData.requestId];
@@ -213,52 +146,62 @@
             [wself.view makeToast:@"添加失败" duration:2.0 position:CSToastPositionCenter];
         }];
     }
-}
-
-
-- (void)friendRequestDelete:(id)data{
-    
-    if([data isKindOfClass:[NIMSystemNotification class]])
+    else if(friendRequestData.type == 1)
     {
-        UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"删除", nil];
-        
-        __weak typeof(self) wself = self;
-        [sheet showInView:self.view completionHandler:^(NSInteger index) {
-            switch (index) {
-                case 0:
-                {
-                    [wself onRefuse:(NIMSystemNotification *)data];
-                    break;
+        [SVProgressHUD show];
+        [[NIMSDK sharedSDK].teamManager applyToTeam:friendRequestData.extraId message:@"" completion:^(NSError *error, NIMTeamApplyStatus applyStatus) {
+            [SVProgressHUD dismiss];
+            if (!error) {
+                switch (applyStatus) {
+                    case NIMTeamApplyStatusAlreadyInTeam:{
+                        [wself.view makeToast:@"加入成功" duration:2.0 position:CSToastPositionCenter];
+                        [[HttpRequest shared] deleteFriendRequest:friendRequestData.requestId success:^{
+                            [wself removeData:friendRequestData.requestId];
+                        } failure:^{
+                            [wself.view makeToast:@"删除失败" duration:2.0 position:CSToastPositionCenter];
+                        }];
+                        break;
+                    }
+                    default:
+                        break;
                 }
-                default:
-                    break;
             }
-        }];
-        
-    }
-    else
-    {
-        UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"删除", nil];
-        FriendRequestData *friendRequestData = data;
-        __weak typeof(self) wself = self;
-        [sheet showInView:self.view completionHandler:^(NSInteger index) {
-            switch (index) {
-                case 0:
-                {
-                    [[HttpRequest shared] deleteFriendRequest:friendRequestData.requestId success:^{
-                        [wself removeData:friendRequestData.requestId];
-                    } failure:^{
-                        [wself.view makeToast:@"删除失败" duration:2.0 position:CSToastPositionCenter];
-                    }];
-                    break;
-                }
-                default:
-                    break;
+            else if(error.code == 809)
+            {
+                [wself.view makeToast:@"已经在群里" duration:2.0 position:CSToastPositionCenter];
+                [[HttpRequest shared] deleteFriendRequest:friendRequestData.requestId success:^{
+                    [wself removeData:friendRequestData.requestId];
+                } failure:^{
+                    [wself.view makeToast:@"删除失败" duration:2.0 position:CSToastPositionCenter];
+                }];
             }
         }];
     }
 }
 
+
+- (void)friendRequestDelete:(id)data{
+    
+    UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"删除", nil];
+    FriendRequestData *friendRequestData = data;
+    __weak typeof(self) wself = self;
+    [sheet showInView:self.view completionHandler:^(NSInteger index) {
+        switch (index) {
+            case 0:
+            {
+                [[HttpRequest shared] deleteFriendRequest:friendRequestData.requestId success:^{
+                    [wself removeData:friendRequestData.requestId];
+                } failure:^{
+                    [wself.view makeToast:@"删除失败" duration:2.0 position:CSToastPositionCenter];
+                }];
+                break;
+            }
+            default:
+                break;
+        }
+    }];
+}
+
 - (void)removeData:(NSString *)requestId
 {
     for(int i=0; i<_dataArr.count; i++)
@@ -277,195 +220,6 @@
 
 
 
-- (void)onAccept:(NIMSystemNotification *)notification
-{
-    __weak typeof(self) wself = self;
-    switch (notification.type) {
-        case NIMSystemNotificationTypeTeamApply:{
-            [[NIMSDK sharedSDK].teamManager passApplyToTeam:notification.targetID userId:notification.sourceID completion:^(NSError *error, NIMTeamApplyStatus applyStatus) {
-                if (!error) {
-                    [wself.navigationController.view makeToast:@"同意成功"
-                                                      duration:2
-                                                      position:CSToastPositionCenter];
-                    notification.handleStatus = NotificationHandleTypeOk;
-                    [wself deleteNotification:notification];
-                    [wself.tableView reloadData];
-                }else {
-                    if(error.code == NIMRemoteErrorCodeTimeoutError) {
-                        [wself.navigationController.view makeToast:@"网络问题,请重试"
-                                                          duration:2
-                                                          position:CSToastPositionCenter];
-                    } else {
-                        notification.handleStatus = NotificationHandleTypeOutOfDate;
-                    }
-                    [wself.tableView reloadData];
-                    DDLogDebug(@"%@",error.localizedDescription);
-                }
-            }];
-            break;
-        }
-        case NIMSystemNotificationTypeTeamInvite:{
-            [[NIMSDK sharedSDK].teamManager acceptInviteWithTeam:notification.targetID invitorId:notification.sourceID completion:^(NSError *error) {
-                if (!error) {
-                    [wself.navigationController.view makeToast:@"接受成功"
-                                                      duration:2
-                                                      position:CSToastPositionCenter];
-                    notification.handleStatus = NotificationHandleTypeOk;
-                    [wself deleteNotification:notification];
-                    [wself.tableView reloadData];
-                }else {
-                    if(error.code == NIMRemoteErrorCodeTimeoutError) {
-                        [wself.navigationController.view makeToast:@"网络问题,请重试"
-                                                          duration:2
-                                                          position:CSToastPositionCenter];
-                    }
-                    else if (error.code == NIMRemoteErrorCodeTeamNotExists) {
-                        [wself.navigationController.view makeToast:@"群不存在"
-                                                          duration:2
-                                                          position:CSToastPositionCenter];
-                    }
-                    else {
-                        notification.handleStatus = NotificationHandleTypeOutOfDate;
-                    }
-                    [wself.tableView reloadData];
-                    DDLogDebug(@"%@",error.localizedDescription);
-                }
-            }];
-        }
-            break;
-        case NIMSystemNotificationTypeFriendAdd:
-        {
-            NIMUserRequest *request = [[NIMUserRequest alloc] init];
-            request.userId = notification.sourceID;
-            request.operation = NIMUserOperationVerify;
-            
-            [[[NIMSDK sharedSDK] userManager] requestFriend:request
-                                                 completion:^(NSError *error) {
-                                                     if (!error) {
-                                                         [wself.navigationController.view makeToast:@"验证成功"
-                                                                                           duration:2
-                                                                                           position:CSToastPositionCenter];
-                                                         notification.handleStatus = NotificationHandleTypeOk;
-                                                     }
-                                                     else
-                                                     {
-                                                         [wself.navigationController.view makeToast:@"验证失败,请重试"
-                                                                                           duration:2
-                                                                                           position:CSToastPositionCenter];
-                                                     }
-                                                     [wself.tableView reloadData];
-                                                     DDLogDebug(@"%@",error.localizedDescription);
-                                                 }];
-        }
-            break;
-        default:
-            break;
-    }
-}
 
-- (void)onRefuse:(NIMSystemNotification *)notification
-{
-    __weak typeof(self) wself = self;
-    switch (notification.type) {
-        case NIMSystemNotificationTypeTeamApply:{
-            [[NIMSDK sharedSDK].teamManager rejectApplyToTeam:notification.targetID userId:notification.sourceID rejectReason:@"" completion:^(NSError *error) {
-                if (!error) {
-                    [wself.navigationController.view makeToast:@"拒绝成功"
-                                                      duration:2
-                                                      position:CSToastPositionCenter];
-                    notification.handleStatus = NotificationHandleTypeNo;
-                    [wself deleteNotification:notification];
-                    [wself.tableView reloadData];
-                }else {
-                    if(error.code == NIMRemoteErrorCodeTimeoutError) {
-                        [wself.navigationController.view makeToast:@"网络问题,请重试"
-                                                          duration:2
-                                                          position:CSToastPositionCenter];
-                    } else {
-                        notification.handleStatus = NotificationHandleTypeOutOfDate;
-                        [wself deleteNotification:notification];
-                    }
-                    [wself.tableView reloadData];
-                    DDLogDebug(@"%@",error.localizedDescription);
-                }
-            }];
-        }
-            break;
-            
-        case NIMSystemNotificationTypeTeamInvite:{
-            [[NIMSDK sharedSDK].teamManager rejectInviteWithTeam:notification.targetID invitorId:notification.sourceID rejectReason:@"" completion:^(NSError *error) {
-                if (!error) {
-                    [wself.navigationController.view makeToast:@"拒绝成功"
-                                                      duration:2
-                                                      position:CSToastPositionCenter];
-                    notification.handleStatus = NotificationHandleTypeNo;
-                    [wself deleteNotification:notification];
-                    [wself.tableView reloadData];
-                }else {
-                    if(error.code == NIMRemoteErrorCodeTimeoutError) {
-                        [wself.navigationController.view makeToast:@"网络问题,请重试"
-                                                          duration:2
-                                                          position:CSToastPositionCenter];
-                    }
-                    else if (error.code == NIMRemoteErrorCodeTeamNotExists) {
-                        [wself.navigationController.view makeToast:@"群不存在"
-                                                          duration:2
-                                                          position:CSToastPositionCenter];
-                    }
-                    else {
-                        notification.handleStatus = NotificationHandleTypeOutOfDate;
-                    }
-                    [wself.tableView reloadData];
-                    DDLogDebug(@"%@",error.localizedDescription);
-                }
-            }];
-            
-        }
-            break;
-        case NIMSystemNotificationTypeFriendAdd:
-        {
-            NIMUserRequest *request = [[NIMUserRequest alloc] init];
-            request.userId = notification.sourceID;
-            request.operation = NIMUserOperationReject;
-            
-            [[[NIMSDK sharedSDK] userManager] requestFriend:request
-                                                 completion:^(NSError *error) {
-                                                     if (!error) {
-                                                         [wself.navigationController.view makeToast:@"拒绝成功"
-                                                                                           duration:2
-                                                                                           position:CSToastPositionCenter];
-                                                         notification.handleStatus = NotificationHandleTypeNo;
-                                                     }
-                                                     else
-                                                     {
-                                                         [wself.navigationController.view makeToast:@"拒绝失败,请重试"
-                                                                                           duration:2
-                                                                                           position:CSToastPositionCenter];
-                                                     }
-                                                     [wself.tableView reloadData];
-                                                     DDLogDebug(@"%@",error.localizedDescription);
-                                                 }];
-        }
-            break;
-        case NIMSystemNotificationTypeTeamApplyReject:
-        case NIMSystemNotificationTypeTeamIviteReject:
-        {
-            [wself deleteNotification:notification];
-            [wself.tableView reloadData];
-        }
-            break;
-        default:
-            break;
-    }
-}
-
-
-- (void)deleteNotification:(NIMSystemNotification *)notification
-{
-    id<NIMSystemNotificationManager> systemNotificationManager = [[NIMSDK sharedSDK] systemNotificationManager];
-    [systemNotificationManager deleteNotification:notification];
-    
-    [_systemArr removeObject:notification];
-}
 
 @end

+ 1 - 2
NIMDemo/NIMDemo/FriendViewController.m

@@ -153,8 +153,7 @@
     __weak typeof(self) wself = self;
     [[HttpRequest shared] requestFriendList:^(NSMutableArray<FriendRequestData *> * _Nullable dataArr) {
         wself.requestArr = dataArr;
-        NSInteger systemCount = [[[NIMSDK sharedSDK] systemNotificationManager] allUnreadCount];
-        NSInteger badge = dataArr.count + systemCount;
+        NSInteger badge = dataArr.count;
         wself.badgeView.hidden = badge == 0;
         wself.badgeView.badgeValue = [NSString stringWithFormat:@"%ld", (long)badge];
     } failure:^{

+ 0 - 2
NIMDemo/NIMDemo/GroupInfoViewController.m

@@ -540,8 +540,6 @@ UINavigationControllerDelegate>
         {
             [self showTeamIntro:_team.intro ? _team.intro : @""];
         }
-        
-        
     }
 }
 

+ 8 - 0
NIMDemo/NIMDemo/HttpRequest/HttpRequest.h

@@ -63,6 +63,8 @@
 - (void)coordinate2Location:(void (^_Nullable)())success
                     failure:(void (^_Nullable)())failure;
 
+- (void)syncRoom:(NSString *_Nonnull)teamId teamName:(NSString *_Nonnull)teamName;
+
 //social
 - (void)getSocialDataList:(NSString *_Nullable)lastId
                  targetId:(NSString *_Nullable)targetId
@@ -140,6 +142,12 @@
             success:(void (^_Nullable)())success
             failure:(void (^_Nullable)())failure;
 
+- (void)teamInvite:(NSArray *_Nullable)userIds
+               msg:(NSString *_Nonnull)msg
+            teamId:(NSString *_Nonnull)teamId
+           success:(void (^_Nullable)())success
+           failure:(void (^_Nullable)())failure;
+
 - (void)requestFriend:(NSString *_Nullable)userId
                   msg:(NSString *_Nullable)msg
               success:(void (^_Nullable)())success

+ 45 - 2
NIMDemo/NIMDemo/HttpRequest/HttpRequest.m

@@ -27,6 +27,7 @@
 //location
 @property (nonatomic, strong) NSString *urlLocation;
 @property (nonatomic, strong) NSString *urlCoordinate2Location;
+@property (nonatomic, strong) NSString *urlSyncTeam;
 
 //social
 @property (nonatomic, strong) NSString *urlSocialDataList;
@@ -48,6 +49,7 @@
 @property (nonatomic, strong) NSString *urlPhotoUpload;
 @property (nonatomic, strong) NSString *urlPhotoDelete;
 
+@property (nonatomic, strong) NSString *urlTeamInvite;
 @property (nonatomic, strong) NSString *urlRequestFriend;
 @property (nonatomic, strong) NSString *urlFriendRequestList;
 @property (nonatomic, strong) NSString *urlAddFriend;
@@ -117,6 +119,7 @@
         
         self.urlLocation = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=index&a=location"];
         self.urlCoordinate2Location = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=index&a=coordinate_2_location"];
+        self.urlSyncTeam = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=index&a=sync_chatroom"];
         
         
         self.urlSocialDataList = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=lists"];
@@ -139,6 +142,7 @@
         self.urlPhotoDelete = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=photo_delete"];
         self.urlContact = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=contact"];
         
+        self.urlTeamInvite = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=team_invite"];
         self.urlRequestFriend = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=request_friend"];
         self.urlFriendRequestList = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=request_list"];
         self.urlAddFriend = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=add_friend"];
@@ -556,6 +560,21 @@
      }];
 }
 
+- (void)syncRoom:(NSString *)teamId teamName:(NSString *)teamName{
+    User *user = [User sharedInfo];
+    
+    NSDictionary *parameters = @{@"id":teamId,
+                                 @"name":teamName,
+                                 @"latitude":[NSString stringWithFormat:@"%F", user.latitude],
+                                 @"longitude":[NSString stringWithFormat:@"%F", user.longitude],
+                                 };
+    
+    [self request:_urlSyncTeam parameters:parameters progress:nil success:^(id jsonData) {
+        
+    } failure:^{
+
+    }];
+}
 
 
 
@@ -1044,11 +1063,33 @@
 }
 
 
-
+- (void)teamInvite:(NSArray *)userIds
+               msg:(NSString *)msg
+            teamId:(NSString *_Nonnull)teamId
+           success:(void (^)())success
+           failure:(void (^)())failure{
+    
+    NSDictionary *parameters = @{@"target_id":userIds,
+                                 @"user_id":[NSString stringWithFormat:@"%d", [User sharedInfo].userId],
+                                 @"msg":msg,
+                                 @"team_id":teamId};
+    
+    [self request:_urlTeamInvite parameters:parameters progress:nil success:^(id jsonData) {
+        
+        if(success)
+            success();
+        
+    } failure:^{
+        if(failure)
+            failure();
+    }];
+}
 
 - (void)requestFriend:(NSString *)userId msg:(NSString *)msg success:(void (^)())success failure:(void (^)())failure{
     
-    NSDictionary *parameters = @{@"target_id":userId, @"user_id":[NSString stringWithFormat:@"%d", [User sharedInfo].userId]};
+    NSDictionary *parameters = @{@"target_id":userId,
+                                 @"user_id":[NSString stringWithFormat:@"%d", [User sharedInfo].userId],
+                                 @"msg":msg};
     
     [self request:_urlRequestFriend parameters:parameters progress:nil success:^(id jsonData) {
         
@@ -1077,6 +1118,8 @@
             requestData.requestId = [data objectForKey:@"id"];
             requestData.userId = [data objectForKey:@"user_id"];
             requestData.msg = [data objectForKey:@"msg"];
+            requestData.type = [[data objectForKey:@"type"] intValue];
+            requestData.extraId = [data objectForKey:@"extra_id"];
             
             [requestList addObject:requestData];
             [userIds addObject:requestData.userId];

+ 21 - 0
NIMDemo/NIMDemo/Images.xcassets/Whosay/聊天-_03(2).imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "聊天-_03(2).png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
NIMDemo/NIMDemo/Images.xcassets/Whosay/聊天-_03(2).imageset/聊天-_03(2).png


+ 21 - 0
NIMDemo/NIMDemo/Images.xcassets/Whosay/通讯录_新的关注.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "通讯录_新的关注.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
NIMDemo/NIMDemo/Images.xcassets/Whosay/通讯录_新的关注.imageset/通讯录_新的关注.png


+ 6 - 6
NIMDemo/NIMDemo/RechargeViewController.m

@@ -36,12 +36,12 @@
     self.view.backgroundColor = UIColor.whiteColor;
     
     _datas = [[NSMutableArray alloc] init];
-    [_datas addObject:@{@"id":@"1", @"title":@"28元", @"desc":@"28说币", @"num":@"28", @"code":@"com.sheishuo.app.cny28"}];
-    [_datas addObject:@{@"id":@"2", @"title":@"68元", @"desc":@"68说币", @"num":@"68", @"code":@"com.sheishuo.app.cny68"}];
-    [_datas addObject:@{@"id":@"3", @"title":@"98元", @"desc":@"98说币", @"num":@"98", @"code":@"com.sheishuo.app.cny98"}];
-    [_datas addObject:@{@"id":@"4", @"title":@"188元", @"desc":@"188说币", @"num":@"188", @"code":@"com.sheishuo.app.cny188"}];
-    [_datas addObject:@{@"id":@"5", @"title":@"288元", @"desc":@"288说币", @"num":@"288", @"code":@"com.sheishuo.app.cny288"}];
-    [_datas addObject:@{@"id":@"6", @"title":@"388元", @"desc":@"388说币", @"num":@"388", @"code":@"com.sheishuo.app.cny388"}];
+    [_datas addObject:@{@"id":@"1", @"title":@"28元", @"desc":@"28说币", @"num":@"28", @"code":@"com.shuishuo.app.cny28"}];
+    [_datas addObject:@{@"id":@"2", @"title":@"68元", @"desc":@"68说币", @"num":@"68", @"code":@"com.shuishuo.app.cny68"}];
+    [_datas addObject:@{@"id":@"3", @"title":@"98元", @"desc":@"98说币", @"num":@"98", @"code":@"com.shuishuo.app.cny98"}];
+    [_datas addObject:@{@"id":@"4", @"title":@"188元", @"desc":@"188说币", @"num":@"188", @"code":@"com.shuishuo.app.cny188"}];
+    [_datas addObject:@{@"id":@"5", @"title":@"288元", @"desc":@"288说币", @"num":@"288", @"code":@"com.shuishuo.app.cny288"}];
+    [_datas addObject:@{@"id":@"6", @"title":@"388元", @"desc":@"388说币", @"num":@"388", @"code":@"com.shuishuo.app.cny388"}];
     
     
     _itemViews = [[NSMutableArray alloc] init];

+ 13 - 12
NIMDemo/NIMDemo/SectionGroup/GroupMenberTableViewCell.m

@@ -13,6 +13,7 @@
 #import "NIMContactSelectViewController.h"
 #import "UIView+Toast.h"
 #import "User.h"
+#import "HttpRequest.h"
 
 @interface GroupMenberTableViewCell()<NIMContactSelectDelegate>
 
@@ -56,7 +57,8 @@
     int index = 0;
     
     BOOL isTeamOwner = [[User sharedInfo] isTeamOwner:_team];
-    if(isTeamOwner)
+    BOOL isSystemTeam = [[User sharedInfo] isSystemTeam:_team.teamId];
+    if(isTeamOwner || !isSystemTeam)
     {
         if(!_addBtn)
         {
@@ -123,17 +125,16 @@
         return;
     }
     
-    NSString *postscript = @"邀请你加入群组";
-    [[NIMSDK sharedSDK].teamManager addUsers:selectedContacts toTeam:self.team.teamId postscript:postscript completion:^(NSError *error, NSArray *members) {
-        if (!error) {
-            [self makeToast:@"邀请成功"
-                        duration:2
-                        position:CSToastPositionCenter];
-        }else{
-            [self makeToast:[NSString stringWithFormat:@"邀请失败 code:%zd",error.code]
-                        duration:2
-                        position:CSToastPositionCenter];
-        }
+    __weak typeof(self) wself = self;
+    NSString *postscript = [NSString stringWithFormat:@"%@%@", @"邀请你加入群组:", _team.teamName];
+    [[HttpRequest shared] teamInvite:selectedContacts msg:postscript teamId:_team.teamId success:^{
+        [wself makeToast:@"邀请成功"
+               duration:2
+               position:CSToastPositionCenter];
+    } failure:^{
+        [wself makeToast:@"邀请失败"
+               duration:2
+               position:CSToastPositionCenter];
     }];
 }
 

+ 12 - 4
NIMDemo/NIMDemo/SectionTrade/MyTradeTableViewCell.m

@@ -30,6 +30,7 @@
 @property (nonatomic, strong) UIView                        *actionContainer;
 @property (nonatomic, strong) UIButton                      *priorityBtn;
 @property (nonatomic, strong) UILabel                       *followCountLabel;
+@property (nonatomic, strong) UIImageView                   *followIcon;
 
 @property (nonatomic, strong) UIButton                      *modifyBtn;
 
@@ -76,11 +77,11 @@
     
     _followContainer = [[UIView alloc] initWithFrame:CGRectMake(cellWidth-padding-40, padding, 50, 40)];
     [_followContainer addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTouchFollow:)]];
-    //[self.contentView addSubview:_followContainer];
+    [self.contentView addSubview:_followContainer];
     
-    UIImageView *followIcon = [[UIImageView alloc] initWithFrame:CGRectMake(15, 0, 20, 20)];
-    [followIcon setImage:[UIImage imageNamed:@"交易帖_03"]];
-    [_followContainer addSubview:followIcon];
+    _followIcon = [[UIImageView alloc] initWithFrame:CGRectMake(15, 0, 20, 20)];
+    [_followIcon setImage:[UIImage imageNamed:@"交易帖_03"]];
+    [_followContainer addSubview:_followIcon];
     
     _followLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 20, _followContainer.width, 20)];
     _followLabel.font = [UIFont systemFontOfSize:13];
@@ -261,13 +262,20 @@
 
 - (void)updateFollow{
     
+    if([_data.userId isEqualToString:[NIMSDK sharedSDK].loginManager.currentAccount])
+        _followContainer.hidden = YES;
+    else
+        _followContainer.hidden = NO;
+    
     if(_data.followed)
     {
         _followLabel.text = @"已关注";
+        [_followIcon setImage:[UIImage imageNamed:@"交易帖_03 (2)"]];
     }
     else
     {
         _followLabel.text = @"关注";
+        [_followIcon setImage:[UIImage imageNamed:@"交易帖_03"]];
     }
     
 }

+ 4 - 1
NIMDemo/NIMDemo/SectionTrade/TradeData.m

@@ -15,7 +15,10 @@
     _userId  = [data objectForKey:@"user_id"];
     _type = [[data objectForKey:@"type"] intValue];
     
-    _msg = [data objectForKey:@"msg"];
+    if([[data objectForKey:@"msg"] isKindOfClass:NSNull.class])
+        _msg = @"";
+    else
+        _msg = [data objectForKey:@"msg"];
     
     _picArr = [data objectForKey:@"pics"];
     _thumbArr = [data objectForKey:@"thumbs"];

+ 0 - 2
NIMDemo/NIMDemo/SectionTrade/TradeUtil.m

@@ -26,8 +26,6 @@
     
     NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] init];
     
-    
-    
     UIColor *priorityColor = nil;
     NSString *priorityText = nil;
     

+ 1 - 1
NIMDemo/NIMDemo/SettingTableViewController.m

@@ -86,7 +86,7 @@
     _dataArr = [[NSMutableArray alloc] init];
     
     float topHeight = 340;
-    float photoHeight = [User sharedInfo].userInfo.photeArr.count >= 4 ? self.view.width / 4 * 2 : self.view.width / 4;
+    float photoHeight = [User sharedInfo].userInfo.photeArr.count >= 5 ? self.view.width / 5 * 2 : self.view.width / 5;
     float socialHeight = 130;
     topHeight += photoHeight + socialHeight;
     

+ 3 - 3
NIMDemo/NIMDemo/SettingTopTableViewCell.m

@@ -159,8 +159,8 @@
     }
     
     float space = 1;
-    int columns = 4;
-    int maxPhoto = 7;
+    int columns = 5;
+    int maxPhoto = 9;
     float picWidth = (_cellWidth - (columns - 1) * space) / columns;
     
     [_thumbArr removeAllObjects];
@@ -221,7 +221,7 @@
         [addIcon setImage:[UIImage imageNamed:@"编辑照片_03"]];
         [_photoAddBtn addSubview:addIcon];
         
-        UILabel *addLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, picWidth/2+10, picWidth, 30)];
+        UILabel *addLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, picWidth/2+5, picWidth, 30)];
         addLabel.text = @"添加照片";
         addLabel.textColor = User.greenColor;
         addLabel.textAlignment = NSTextAlignmentCenter;

+ 2 - 1
NIMDemo/NIMDemo/SocialDetailTableViewCell.m

@@ -234,7 +234,8 @@
     User *myUser = [User sharedInfo];
     
     _actionContainer.top = _imgContainer.bottom;
-    [_locationBtn setTitle:[User distance:data.lat originLng:data.lng targetLat:myUser.latitude targetLng:myUser.longitude] forState:UIControlStateNormal];
+    //[_locationBtn setTitle:[User distance:data.lat originLng:data.lng targetLat:myUser.latitude targetLng:myUser.longitude] forState:UIControlStateNormal];
+    [_locationBtn setTitle:data.local forState:UIControlStateNormal];
     [_locationBtn sizeToFit];
     _locationBtn.width = _locationBtn.width + 12;
     _locationBtn.height = 24;

+ 17 - 17
NIMDemo/NIMDemo/User.m

@@ -626,23 +626,23 @@ int newCreateTeamId;
         }
         else
         {
-            NSArray<NIMTeam *> *allMyTeams = [[NIMSDK sharedSDK].teamManager allMyTeams];
-            int countTeamJoined = 0;
-            for(int i=0; i<allMyTeams.count; i++)
-            {
-                NIMTeam *myTeam = [allMyTeams objectAtIndex:i];
-                if(![[User sharedInfo] isSystemTeam:myTeam.teamId])
-                {
-                    countTeamJoined++;
-                }
-            }
-            
-            if(countTeamJoined >= 6)
-            {
-                UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"最多只允许加6个群" message:nil delegate:nil cancelButtonTitle:@"确认" otherButtonTitles:nil];
-                [alertView show];
-                return;
-            }
+//            NSArray<NIMTeam *> *allMyTeams = [[NIMSDK sharedSDK].teamManager allMyTeams];
+//            int countTeamJoined = 0;
+//            for(int i=0; i<allMyTeams.count; i++)
+//            {
+//                NIMTeam *myTeam = [allMyTeams objectAtIndex:i];
+//                if(![[User sharedInfo] isSystemTeam:myTeam.teamId])
+//                {
+//                    countTeamJoined++;
+//                }
+//            }
+//            
+//            if(countTeamJoined >= 6)
+//            {
+//                UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"最多只允许加6个群" message:nil delegate:nil cancelButtonTitle:@"确认" otherButtonTitles:nil];
+//                [alertView show];
+//                return;
+//            }
             
             
             NTESJionTeamViewController *joinVC = [[NTESJionTeamViewController alloc] initWithNibName:nil bundle:nil];

+ 2 - 0
NIMDemo/NIMDemo/UserInfoViewController.m

@@ -84,6 +84,8 @@
         [self setUserId:self.title];
     }
     
+    [self fetchGift];
+    
     [_picContainer addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTouchMorePic:)]];
 }
 

+ 1 - 1
NIMKit/NIMKit/Classes/Sections/Input/TradeInputContainer.m

@@ -197,7 +197,7 @@
             maxWidth = btn.nim_width;
         }
         
-        if(i == 0)
+        if(i == 0 && !_layoutHold)
         {
             [self selectPriorityType:btn];
         }

+ 10 - 2
NIMKit/NIMKit/Classes/Sections/Session/ViewController/NIMSessionViewController.m

@@ -36,6 +36,8 @@
 
 @property (nonatomic,weak)    id<NIMSessionInteractor> interactor;
 
+@property (nonatomic, assign) BOOL notRemoveListener;
+
 @end
 
 @implementation NIMSessionViewController
@@ -147,7 +149,10 @@
     [self.interactor onViewWillAppear];
     
     //添加监听
-    [self addListener];
+    if(_notRemoveListener)
+        _notRemoveListener = NO;
+    else
+        [self addListener];
 }
 
 - (void)viewDidDisappear:(BOOL)animated{
@@ -157,7 +162,8 @@
     [self.sessionInputView endEditing:YES];
     
     //添加监听
-    [self removeListener];
+    if(!_notRemoveListener)
+        [self removeListener];
 }
 
 
@@ -591,11 +597,13 @@
 #pragma mark - NIMMeidaButton
 - (void)onTapMediaItemPicture:(NIMMediaItem *)item
 {
+    _notRemoveListener = YES;
     [self.interactor mediaPicturePressed];
 }
 
 - (void)onTapMediaItemShoot:(NIMMediaItem *)item
 {
+    _notRemoveListener = YES;
     [self.interactor mediaShootPressed];
 }