Browse Source

no message

Fenix Wang 8 năm trước cách đây
mục cha
commit
f555df66a5
74 tập tin đã thay đổi với 1349 bổ sung136 xóa
  1. 16 0
      CertificateSigningRequest.certSigningRequest
  2. BIN
      NIMDemo/NIM.xcworkspace/xcuserdata/Fenix.xcuserdatad/UserInterfaceState.xcuserstate
  3. 33 15
      NIMDemo/NIMDemo.xcodeproj/project.pbxproj
  4. 85 5
      NIMDemo/NIMDemo/Base.lproj/Main.storyboard
  5. 10 0
      NIMDemo/NIMDemo/Classes/Sections/Card/ViewController/NTESJionTeamViewController.m
  6. 3 3
      NIMDemo/NIMDemo/Classes/Util/NTESDemoConfig.m
  7. 20 1
      NIMDemo/NIMDemo/Classes/Util/NTESNotificationCenter.m
  8. 4 0
      NIMDemo/NIMDemo/FriendRequestTableViewCell.m
  9. 20 1
      NIMDemo/NIMDemo/FriendRequestViewController.m
  10. 10 0
      NIMDemo/NIMDemo/FriendViewController.m
  11. 8 0
      NIMDemo/NIMDemo/GroupMoreTableViewCell.m
  12. 16 9
      NIMDemo/NIMDemo/GroupMoreTableViewController.m
  13. 21 2
      NIMDemo/NIMDemo/GroupTableController.m
  14. 17 0
      NIMDemo/NIMDemo/HttpRequest/HttpRequest.h
  15. 91 5
      NIMDemo/NIMDemo/HttpRequest/HttpRequest.m
  16. 21 0
      NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_1.imageset/Contents.json
  17. BIN
      NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_1.imageset/tuto_1.jpg
  18. 21 0
      NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_1_min.imageset/Contents.json
  19. BIN
      NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_1_min.imageset/tuto_1_min.jpg
  20. 21 0
      NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_2.imageset/Contents.json
  21. BIN
      NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_2.imageset/tuto_2.jpg
  22. 21 0
      NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_2_min.imageset/Contents.json
  23. BIN
      NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_2_min.imageset/tuto_2_min.jpg
  24. 21 0
      NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_3.imageset/Contents.json
  25. BIN
      NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_3.imageset/tuto_3.jpg
  26. 21 0
      NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_3_min.imageset/Contents.json
  27. BIN
      NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_3_min.imageset/tuto_3_min.jpg
  28. 21 0
      NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_4.imageset/Contents.json
  29. BIN
      NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_4.imageset/tuto_4.jpg
  30. 21 0
      NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_5.imageset/Contents.json
  31. BIN
      NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_5.imageset/tuto_5.jpg
  32. 15 3
      NIMDemo/NIMDemo/IntroViewController.m
  33. 5 3
      NIMDemo/NIMDemo/LocationManager.m
  34. 79 6
      NIMDemo/NIMDemo/NearUserViewController.m
  35. 2 2
      NIMDemo/NIMDemo/PayOptionViewController.m
  36. 2 0
      NIMDemo/NIMDemo/RegisterViewController.m
  37. 3 0
      NIMDemo/NIMDemo/SectionTrade/TradeTableViewCell.m
  38. 99 20
      NIMDemo/NIMDemo/SectionTrade/TradeViewController.m
  39. 12 4
      NIMDemo/NIMDemo/SettingTopTableViewCell.m
  40. 5 5
      NIMDemo/NIMDemo/SocialCommentDetailTableViewCell.m
  41. 9 8
      NIMDemo/NIMDemo/SocialDetailTableViewCell.m
  42. 1 0
      NIMDemo/NIMDemo/SocialDetailViewController.h
  43. 19 0
      NIMDemo/NIMDemo/SocialDetailViewController.m
  44. 1 0
      NIMDemo/NIMDemo/SocialItemData.h
  45. 2 0
      NIMDemo/NIMDemo/SocialItemData.m
  46. 42 12
      NIMDemo/NIMDemo/SocialTableViewCell.m
  47. 2 0
      NIMDemo/NIMDemo/SocialTableViewController.h
  48. 45 16
      NIMDemo/NIMDemo/SocialTableViewController.m
  49. 2 1
      NIMDemo/NIMDemo/SocialTopTableViewCell.h
  50. 125 1
      NIMDemo/NIMDemo/SocialTopTableViewCell.m
  51. 21 0
      NIMDemo/NIMDemo/SocialUnreadItemData.h
  52. 21 0
      NIMDemo/NIMDemo/SocialUnreadItemData.m
  53. 16 0
      NIMDemo/NIMDemo/SocialUnreadTableViewCell.h
  54. 105 0
      NIMDemo/NIMDemo/SocialUnreadTableViewCell.m
  55. 15 0
      NIMDemo/NIMDemo/SocialUnreadTableViewController.h
  56. 130 0
      NIMDemo/NIMDemo/SocialUnreadTableViewController.m
  57. 2 2
      NIMDemo/NIMDemo/Supporting Files/Info.plist
  58. 1 1
      NIMDemo/NIMDemo/Supporting Files/NIMDev.entitlements
  59. 1 1
      NIMDemo/NIMDemo/Supporting Files/NIMPro.entitlements
  60. 20 1
      NIMDemo/NIMDemo/TabBarController.m
  61. 2 1
      NIMDemo/NIMDemo/User.h
  62. 8 4
      NIMDemo/NIMDemo/User.m
  63. 1 0
      NIMDemo/NIMDemo/UserGiftViewController.m
  64. 2 1
      NIMDemo/NIMDemo/UserInfo.h
  65. 3 0
      NIMDemo/NIMDemo/UserInfo.m
  66. 9 3
      NIMDemo/NIMDemo/UserInfoViewController.m
  67. BIN
      SSDev.p12
  68. BIN
      SSDis.p12
  69. BIN
      SheiShuoDev.mobileprovision
  70. BIN
      SheiShuoDis.mobileprovision
  71. BIN
      aps-dis.cer
  72. BIN
      aps_dev.cer
  73. BIN
      ios_development.cer
  74. BIN
      ios_distribution.cer

+ 16 - 0
CertificateSigningRequest.certSigningRequest

@@ -0,0 +1,16 @@
+-----BEGIN CERTIFICATE REQUEST-----
+MIICizCCAXMCAQAwRjEiMCAGCSqGSIb3DQEJARYTMTU5MzQ0MjU1ODVAMTYzLmNv
+bTETMBEGA1UEAwwKRmVuaXggV2FuZzELMAkGA1UEBhMCQ04wggEiMA0GCSqGSIb3
+DQEBAQUAA4IBDwAwggEKAoIBAQCTB8ymIYVA+728KRgcIAOFNDWOYoyQlcmg+nsh
+Qp1di9vO3vORLT2Bf9jlZn734YCJNsA4uQL8NX9PeaE5LtzZqwivhKxx25q2yy7j
+G+Aw/b60bw3bgZskcAyUQeZ5xrKESUWNMGoVA0WPojLP1pL5RzntCMBFCNOhGkN3
+A+/zVsEXhs/HAhuoT+F2XaZ9fCQx+PZ6oANBbave8VI9GSpxxEY6aKST3cgRkEuU
+bVQgDJD0vnyf0tlnG6EeudkYw/MUqfLJb3N/xGZ7vSafIE1a54b1nnTG/T/lHYSl
+drYWxdjXiqN86YUxh9nQ97ZNJrH6OXReiEhm0pbbdms14KJDAgMBAAGgADANBgkq
+hkiG9w0BAQsFAAOCAQEAggGrQNTlijewRx9UG9a4umD0QoTkJmh4m9vGyKyHLwGO
+y+7ok1IyGFMx1A3OwAVTzIL6WbvrCHw48S51j72q1V8iSz00yXAQMmc5rEsLPtNx
+VrLQS2qViAW181jO87iufMex1XDjR2vXpiUb6UgLN5OpdybQfqlj1/KaWyV8vPJ/
+7wBFK8D8iWO3ugrSena4EyAzqRe3EHcvcoCgXf5QNChC6iRt0kTIz49Lr6QKe5FW
+OfOlGBg1AxGXMahD9e7Ca6ak8sNPTsuZPAQDdA6jRwqsrdNQBq1W0NAibGCl3j2x
+jR3mEFxzXkslT9gslaGtejpQapefgH7tPJWPa7akag==
+-----END CERTIFICATE REQUEST-----

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


+ 33 - 15
NIMDemo/NIMDemo.xcodeproj/project.pbxproj

@@ -209,6 +209,7 @@
 		C445A2B61F1E0335005E88B6 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C445A2B51F1E0335005E88B6 /* UIKit.framework */; };
 		C445A2B81F1E033F005E88B6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C445A2B71F1E033F005E88B6 /* Foundation.framework */; };
 		C445A2BA1F1E0353005E88B6 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C445A2B91F1E0353005E88B6 /* CoreMotion.framework */; };
+		C4468CA51FD14D520054BEE0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C4468CA41FD14D520054BEE0 /* Images.xcassets */; };
 		C47564801F8F5AC90042C271 /* GroupAvatarTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C475647F1F8F5AC90042C271 /* GroupAvatarTableViewCell.m */; };
 		C482C2F51F09DAA800EF2B71 /* TradePublishManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C482C2F41F09DAA800EF2B71 /* TradePublishManager.m */; };
 		C482C2FB1F0A110E00EF2B71 /* TradePostTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C482C2FA1F0A110E00EF2B71 /* TradePostTableViewCell.m */; };
@@ -249,6 +250,9 @@
 		C4B639571ED581E2004288FC /* User.m in Sources */ = {isa = PBXBuildFile; fileRef = C4B639561ED581E2004288FC /* User.m */; };
 		C4BEB3881F6B676300CF77D3 /* ForgetTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C4BEB3871F6B676300CF77D3 /* ForgetTableViewController.m */; };
 		C4BEB38B1F6E537A00CF77D3 /* BeFollowedViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C4BEB38A1F6E537A00CF77D3 /* BeFollowedViewController.m */; };
+		C4CB3FA31FAC0E96007F9C00 /* SocialUnreadTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C4CB3FA21FAC0E96007F9C00 /* SocialUnreadTableViewController.m */; };
+		C4CB3FA61FAC1107007F9C00 /* SocialUnreadTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C4CB3FA51FAC1107007F9C00 /* SocialUnreadTableViewCell.m */; };
+		C4CB3FA91FAC1281007F9C00 /* SocialUnreadItemData.m in Sources */ = {isa = PBXBuildFile; fileRef = C4CB3FA81FAC1281007F9C00 /* SocialUnreadItemData.m */; };
 		C4D4C9261ED7C2A900ADD7B7 /* GroupTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C4D4C9251ED7C2A900ADD7B7 /* GroupTableViewCell.m */; };
 		C4D4C9321ED7C37F00ADD7B7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C4D4C9281ED7C37F00ADD7B7 /* AppDelegate.m */; };
 		C4D4C9331ED7C37F00ADD7B7 /* LoginViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C4D4C92A1ED7C37F00ADD7B7 /* LoginViewController.m */; };
@@ -259,7 +263,6 @@
 		C4D4C93C1ED7C3DE00ADD7B7 /* CreateGroupViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C4D4C9391ED7C3DE00ADD7B7 /* CreateGroupViewController.m */; };
 		C4D4C93D1ED7C3DE00ADD7B7 /* GroupTableController.m in Sources */ = {isa = PBXBuildFile; fileRef = C4D4C93B1ED7C3DE00ADD7B7 /* GroupTableController.m */; };
 		C4D4C9401ED81F2100ADD7B7 /* CityPickerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C4D4C93F1ED81F2100ADD7B7 /* CityPickerViewController.m */; };
-		C4D872FE1F905720007B2646 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C4D872FD1F905720007B2646 /* Images.xcassets */; };
 		C4D8F12C1ED48657002F9F3A /* AFHTTPSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C4D8F1201ED48657002F9F3A /* AFHTTPSessionManager.m */; };
 		C4D8F12D1ED48657002F9F3A /* AFNetworkReachabilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C4D8F1231ED48657002F9F3A /* AFNetworkReachabilityManager.m */; };
 		C4D8F12E1ED48657002F9F3A /* AFSecurityPolicy.m in Sources */ = {isa = PBXBuildFile; fileRef = C4D8F1251ED48657002F9F3A /* AFSecurityPolicy.m */; };
@@ -700,6 +703,7 @@
 		C445A2B51F1E0335005E88B6 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
 		C445A2B71F1E033F005E88B6 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
 		C445A2B91F1E0353005E88B6 /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
+		C4468CA41FD14D520054BEE0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ../../../../../fenix/XCode_Project/NIM_iOS_Demo_v3/NIMDemo/NIMDemo/Images.xcassets; sourceTree = "<group>"; };
 		C475647E1F8F5AC90042C271 /* GroupAvatarTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = GroupAvatarTableViewCell.h; path = ../../../../../fenix/XCode_Project/NIM_iOS_Demo_v3/NIMDemo/NIMDemo/GroupAvatarTableViewCell.h; sourceTree = "<group>"; };
 		C475647F1F8F5AC90042C271 /* GroupAvatarTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = GroupAvatarTableViewCell.m; path = ../../../../../fenix/XCode_Project/NIM_iOS_Demo_v3/NIMDemo/NIMDemo/GroupAvatarTableViewCell.m; sourceTree = "<group>"; };
 		C482C2F31F09DAA800EF2B71 /* TradePublishManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TradePublishManager.h; path = ../../../../../fenix/XCode_Project/NIM_iOS_Demo_v3/NIMDemo/NIMDemo/SectionTrade/TradePublishManager.h; sourceTree = "<group>"; };
@@ -780,6 +784,12 @@
 		C4BEB3871F6B676300CF77D3 /* ForgetTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ForgetTableViewController.m; path = ../../../../../fenix/XCode_Project/NIM_iOS_Demo_v3/NIMDemo/NIMDemo/ForgetTableViewController.m; sourceTree = "<group>"; };
 		C4BEB3891F6E537A00CF77D3 /* BeFollowedViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BeFollowedViewController.h; sourceTree = "<group>"; };
 		C4BEB38A1F6E537A00CF77D3 /* BeFollowedViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BeFollowedViewController.m; sourceTree = "<group>"; };
+		C4CB3FA11FAC0E96007F9C00 /* SocialUnreadTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SocialUnreadTableViewController.h; path = ../../../../../fenix/XCode_Project/NIM_iOS_Demo_v3/NIMDemo/NIMDemo/SocialUnreadTableViewController.h; sourceTree = "<group>"; };
+		C4CB3FA21FAC0E96007F9C00 /* SocialUnreadTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SocialUnreadTableViewController.m; path = ../../../../../fenix/XCode_Project/NIM_iOS_Demo_v3/NIMDemo/NIMDemo/SocialUnreadTableViewController.m; sourceTree = "<group>"; };
+		C4CB3FA41FAC1107007F9C00 /* SocialUnreadTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocialUnreadTableViewCell.h; sourceTree = "<group>"; };
+		C4CB3FA51FAC1107007F9C00 /* SocialUnreadTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SocialUnreadTableViewCell.m; sourceTree = "<group>"; };
+		C4CB3FA71FAC1281007F9C00 /* SocialUnreadItemData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocialUnreadItemData.h; sourceTree = "<group>"; };
+		C4CB3FA81FAC1281007F9C00 /* SocialUnreadItemData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SocialUnreadItemData.m; sourceTree = "<group>"; };
 		C4D4C9241ED7C2A900ADD7B7 /* GroupTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupTableViewCell.h; sourceTree = "<group>"; };
 		C4D4C9251ED7C2A900ADD7B7 /* GroupTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GroupTableViewCell.m; sourceTree = "<group>"; };
 		C4D4C9271ED7C37F00ADD7B7 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
@@ -799,7 +809,6 @@
 		C4D4C93B1ED7C3DE00ADD7B7 /* GroupTableController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GroupTableController.m; sourceTree = "<group>"; };
 		C4D4C93E1ED81F2100ADD7B7 /* CityPickerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CityPickerViewController.h; sourceTree = "<group>"; };
 		C4D4C93F1ED81F2100ADD7B7 /* CityPickerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CityPickerViewController.m; sourceTree = "<group>"; };
-		C4D872FD1F905720007B2646 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ../../../../../fenix/XCode_Project/NIM_iOS_Demo_v3/NIMDemo/NIMDemo/Images.xcassets; sourceTree = "<group>"; };
 		C4D8F11F1ED48657002F9F3A /* AFHTTPSessionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFHTTPSessionManager.h; path = AFNetworking/AFHTTPSessionManager.h; sourceTree = "<group>"; };
 		C4D8F1201ED48657002F9F3A /* AFHTTPSessionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AFHTTPSessionManager.m; path = AFNetworking/AFHTTPSessionManager.m; sourceTree = "<group>"; };
 		C4D8F1211ED48657002F9F3A /* AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AFNetworking.h; path = AFNetworking/AFNetworking.h; sourceTree = "<group>"; };
@@ -1942,8 +1951,8 @@
 				61F728281A7B23A40076C096 /* Classes */,
 				AEB8367F1A772C2F00E7493E /* NIMDemo-Prefix.pch */,
 				6195CD3E1A8C74DB00F3E239 /* NTESGlobalMacro.h */,
-				C4D872FD1F905720007B2646 /* Images.xcassets */,
 				AE5882E81A6F47E10070536A /* Supporting Files */,
+				C4468CA41FD14D520054BEE0 /* Images.xcassets */,
 			);
 			name = whosay;
 			path = NIMDemo;
@@ -2337,6 +2346,12 @@
 				C4DB33AE1F25A61A0080D72F /* NearUserViewController.m */,
 				C4DB33B01F25A69F0080D72F /* NearUserTableViewCell.h */,
 				C4DB33B11F25A69F0080D72F /* NearUserTableViewCell.m */,
+				C4CB3FA11FAC0E96007F9C00 /* SocialUnreadTableViewController.h */,
+				C4CB3FA21FAC0E96007F9C00 /* SocialUnreadTableViewController.m */,
+				C4CB3FA41FAC1107007F9C00 /* SocialUnreadTableViewCell.h */,
+				C4CB3FA51FAC1107007F9C00 /* SocialUnreadTableViewCell.m */,
+				C4CB3FA71FAC1281007F9C00 /* SocialUnreadItemData.h */,
+				C4CB3FA81FAC1281007F9C00 /* SocialUnreadItemData.m */,
 			);
 			name = SectionSocial;
 			sourceTree = "<group>";
@@ -2412,8 +2427,8 @@
 				TargetAttributes = {
 					AE5882E41A6F47E10070536A = {
 						CreatedOnToolsVersion = 6.1;
-						DevelopmentTeam = DGEMLT57K8;
-						ProvisioningStyle = Automatic;
+						DevelopmentTeam = 9292L7689A;
+						ProvisioningStyle = Manual;
 						SystemCapabilities = {
 							com.apple.BackgroundModes = {
 								enabled = 1;
@@ -2484,7 +2499,7 @@
 				6173AEC51BAAB94400854D49 /* NTESUserInfoSettingViewController.xib in Resources */,
 				61E471631B7D963E00F4A1BF /* NTESAboutViewController.xib in Resources */,
 				61E471651B7D963E00F4A1BF /* NTESSettingViewController.xib in Resources */,
-				C4D872FE1F905720007B2646 /* Images.xcassets in Resources */,
+				C4468CA51FD14D520054BEE0 /* Images.xcassets in Resources */,
 				C4D8F1521ED48840002F9F3A /* Main.storyboard in Resources */,
 				61E471221B7D963E00F4A1BF /* NTESCustomSysNotificationViewController.xib in Resources */,
 				61E471241B7D963E00F4A1BF /* NTESSystemNotificationCell.xib in Resources */,
@@ -2574,6 +2589,7 @@
 				61518A4A1CA233390061C4A9 /* NTESNavigationAnimator.m in Sources */,
 				61E471301B7D963E00F4A1BF /* NTESCustomAttachmentDecoder.m in Sources */,
 				6195CD201A8C4D3C00F3E239 /* NSString+NTES.m in Sources */,
+				C4CB3FA91FAC1281007F9C00 /* SocialUnreadItemData.m in Sources */,
 				C4DB33BB1F25F7720080D72F /* FeedBackViewController.m in Sources */,
 				61E4712A1B7D963E00F4A1BF /* NTESLoginViewController.m in Sources */,
 				61E471111B7D963E00F4A1BF /* NTESCustomSysNotificationSender.m in Sources */,
@@ -2617,6 +2633,7 @@
 				61518A551CA233BB0061C4A9 /* NTESDemoRegisterTask.m in Sources */,
 				61839A9B1BF9B60400702DF0 /* NTESFPSLabel.m in Sources */,
 				61E471141B7D963E00F4A1BF /* NTESGroupedDataCollection.m in Sources */,
+				C4CB3FA31FAC0E96007F9C00 /* SocialUnreadTableViewController.m in Sources */,
 				610B5FBF1BADCCCD001F7EFB /* NTESBirthPickerView.m in Sources */,
 				6173AEDB1BAAD03900854D49 /* NTESUserUtil.m in Sources */,
 				61E4714E1B7D963E00F4A1BF /* NTESWhiteboardDrawView.m in Sources */,
@@ -2662,6 +2679,7 @@
 				61E471541B7D963E00F4A1BF /* NTESNetChatViewController.m in Sources */,
 				61E471331B7D963E00F4A1BF /* NTESSearchLocalHistoryObject.m in Sources */,
 				6173AED81BAAC8F500854D49 /* NTESSignSettingViewController.m in Sources */,
+				C4CB3FA61FAC1107007F9C00 /* SocialUnreadTableViewCell.m in Sources */,
 				61E471201B7D963E00F4A1BF /* NTESCustomNotificationObject.m in Sources */,
 				C482C33E1F15CA8500EF2B71 /* LocationManager.m in Sources */,
 				C4A7D3661EE803E7009B5849 /* FriendViewController.m in Sources */,
@@ -2949,7 +2967,7 @@
 				CODE_SIGN_ENTITLEMENTS = NIM.entitlements;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				DEVELOPMENT_TEAM = DGEMLT57K8;
+				DEVELOPMENT_TEAM = 9292L7689A;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -2985,8 +3003,8 @@
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = com.sheishuo.app;
 				PRODUCT_NAME = NIM;
-				PROVISIONING_PROFILE = "";
-				PROVISIONING_PROFILE_SPECIFIER = "";
+				PROVISIONING_PROFILE = "95285061-bafa-4af9-8b97-8d3f7f3ec959";
+				PROVISIONING_PROFILE_SPECIFIER = SheiShuo.Dev;
 				TARGETED_DEVICE_FAMILY = 1;
 				USER_HEADER_SEARCH_PATHS = "";
 			};
@@ -3001,10 +3019,10 @@
 				CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
 				CLANG_CXX_LIBRARY = "compiler-default";
 				CODE_SIGN_ENTITLEMENTS = NIM.entitlements;
-				CODE_SIGN_IDENTITY = "iPhone Developer";
-				"CODE_SIGN_IDENTITY[sdk=*]" = "$(XCCONFIG_CODE_SIGNING)";
-				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				DEVELOPMENT_TEAM = DGEMLT57K8;
+				CODE_SIGN_IDENTITY = "iPhone Distribution";
+				"CODE_SIGN_IDENTITY[sdk=*]" = "iPhone Distribution";
+				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
+				DEVELOPMENT_TEAM = 9292L7689A;
 				ENABLE_BITCODE = NO;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -3045,8 +3063,8 @@
 				);
 				PRODUCT_BUNDLE_IDENTIFIER = com.sheishuo.app;
 				PRODUCT_NAME = NIM;
-				PROVISIONING_PROFILE = "";
-				PROVISIONING_PROFILE_SPECIFIER = "";
+				PROVISIONING_PROFILE = "0a7eea7e-c0bf-48d6-93a1-f726a9a9752b";
+				PROVISIONING_PROFILE_SPECIFIER = SheiShuo.Dis;
 				TARGETED_DEVICE_FAMILY = 1;
 				USER_HEADER_SEARCH_PATHS = "";
 			};

+ 85 - 5
NIMDemo/NIMDemo/Base.lproj/Main.storyboard

@@ -1761,6 +1761,85 @@
             </objects>
             <point key="canvasLocation" x="3370" y="1116"/>
         </scene>
+        <!--Social Unread Table View Controller-->
+        <scene sceneID="mzo-oR-WjT">
+            <objects>
+                <tableViewController storyboardIdentifier="SocialUnread" id="VYJ-7f-pdL" customClass="SocialUnreadTableViewController" sceneMemberID="viewController">
+                    <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="68" sectionHeaderHeight="18" sectionFooterHeight="18" id="DF7-2n-shx">
+                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
+                        <view key="tableHeaderView" contentMode="scaleToFill" id="nnD-kC-hR5">
+                            <rect key="frame" x="0.0" y="0.0" width="375" height="1"/>
+                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                        </view>
+                        <prototypes>
+                            <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="unread" rowHeight="68" id="8ia-ch-7kJ" customClass="SocialUnreadTableViewCell">
+                                <rect key="frame" x="0.0" y="56.5" width="375" height="68"/>
+                                <autoresizingMask key="autoresizingMask"/>
+                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="8ia-ch-7kJ" id="kpj-bx-1Th">
+                                    <rect key="frame" x="0.0" y="0.0" width="375" height="67.5"/>
+                                    <autoresizingMask key="autoresizingMask"/>
+                                    <subviews>
+                                        <view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="bm5-lk-1Ic">
+                                            <rect key="frame" x="10" y="10" width="48" height="48"/>
+                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                            <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                        </view>
+                                        <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Bnq-Br-zZk">
+                                            <rect key="frame" x="66" y="3" width="245" height="30"/>
+                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                            <state key="normal" title="Button"/>
+                                            <connections>
+                                                <action selector="onTouchNick:" destination="8ia-ch-7kJ" eventType="touchUpInside" id="GRY-58-S8Z"/>
+                                            </connections>
+                                        </button>
+                                        <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lbv-mc-kcL">
+                                            <rect key="frame" x="319" y="8" width="48" height="48"/>
+                                            <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
+                                        </imageView>
+                                        <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="朋友圈_15" translatesAutoresizingMaskIntoConstraints="NO" id="lE1-xc-3LD">
+                                            <rect key="frame" x="68" y="31" width="18" height="18"/>
+                                            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+                                        </imageView>
+                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KL6-8a-Ydu">
+                                            <rect key="frame" x="66" y="28" width="245" height="21"/>
+                                            <autoresizingMask key="autoresizingMask" flexibleMaxY="YES"/>
+                                            <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                            <nil key="textColor"/>
+                                            <nil key="highlightedColor"/>
+                                        </label>
+                                        <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="daa-WO-NIC">
+                                            <rect key="frame" x="66" y="47" width="222" height="21"/>
+                                            <autoresizingMask key="autoresizingMask" flexibleMaxY="YES"/>
+                                            <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                            <color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
+                                            <nil key="highlightedColor"/>
+                                        </label>
+                                    </subviews>
+                                </tableViewCellContentView>
+                                <inset key="separatorInset" minX="15" minY="0.0" maxX="0.0" maxY="0.0"/>
+                                <connections>
+                                    <outlet property="avatarContainer" destination="bm5-lk-1Ic" id="X8D-Ts-BXN"/>
+                                    <outlet property="commentLabel" destination="KL6-8a-Ydu" id="QFr-Oa-gg6"/>
+                                    <outlet property="likeIcon" destination="lE1-xc-3LD" id="RxB-Zx-hrw"/>
+                                    <outlet property="nickBtn" destination="Bnq-Br-zZk" id="Nmo-lk-4WQ"/>
+                                    <outlet property="socialThumb" destination="lbv-mc-kcL" id="EoK-Co-Bel"/>
+                                    <outlet property="timeLabel" destination="daa-WO-NIC" id="aQ2-Nv-vbp"/>
+                                </connections>
+                            </tableViewCell>
+                        </prototypes>
+                        <connections>
+                            <outlet property="dataSource" destination="VYJ-7f-pdL" id="tWW-zp-Q5h"/>
+                            <outlet property="delegate" destination="VYJ-7f-pdL" id="XbP-DW-cdY"/>
+                        </connections>
+                    </tableView>
+                </tableViewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="cH6-hn-mgh" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="4183.1999999999998" y="1115.8920539730136"/>
+        </scene>
         <!--Friend List View Controller-->
         <scene sceneID="U21-WT-pfP">
             <objects>
@@ -1826,7 +1905,7 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="x8s-nu-hfb" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="4204" y="919.79010494752629"/>
+            <point key="canvasLocation" x="4927" y="912"/>
         </scene>
         <!--我的-->
         <scene sceneID="Ixr-fZ-phM">
@@ -3867,7 +3946,7 @@
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="4LD-Js-h5n" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
-            <point key="canvasLocation" x="4929" y="920"/>
+            <point key="canvasLocation" x="5652" y="912"/>
         </scene>
     </scenes>
     <resources>
@@ -3891,6 +3970,7 @@
         <image name="国家法-_03" width="15" height="15"/>
         <image name="帮助与反馈_03" width="68" height="68"/>
         <image name="开启通讯录_07" width="333" height="45"/>
+        <image name="朋友圈_15" width="11" height="10"/>
         <image name="登录界面_03" width="632" height="90"/>
         <image name="登录界面_06" width="632" height="90"/>
         <image name="箭头_下" width="30" height="22"/>
@@ -3901,10 +3981,10 @@
         <image name="选择群组_13" width="20" height="20"/>
     </resources>
     <inferredMetricsTieBreakers>
-        <segue reference="3R5-Pr-2W2"/>
         <segue reference="26v-7j-kWO"/>
-        <segue reference="Tha-4U-vsU"/>
-        <segue reference="gKG-Mt-Dsc"/>
+        <segue reference="eSY-kI-O9t"/>
+        <segue reference="3R5-Pr-2W2"/>
         <segue reference="crz-lb-2c2"/>
+        <segue reference="gKG-Mt-Dsc"/>
     </inferredMetricsTieBreakers>
 </document>

+ 10 - 0
NIMDemo/NIMDemo/Classes/Sections/Card/ViewController/NTESJionTeamViewController.m

@@ -11,6 +11,7 @@
 #import "UIView+Toast.h"
 #import "NTESSessionViewController.h"
 #import "UIAlertView+NTESBlock.h"
+#import "User.h"
 
 @interface NTESJionTeamViewController ()
 @property (strong, nonatomic) IBOutlet UIImageView *imageView;
@@ -57,6 +58,15 @@
         if (!error) {
             switch (applyStatus) {
                 case NIMTeamApplyStatusAlreadyInTeam:{
+                    
+                    if([[User sharedInfo] isSystemTeam:teamId])
+                    {
+                        [[[NIMSDK sharedSDK] teamManager] updateNotifyState:NO
+                                                                     inTeam:teamId
+                                                                 completion:^(NSError *error) {
+                                                                 }];
+                    }
+                    
                     NIMSession *session = [NIMSession session:self.joinTeam.teamId type:NIMSessionTypeTeam];
                     NTESSessionViewController * vc = [[NTESSessionViewController alloc] initWithSession:session];
                     [self.navigationController pushViewController:vc animated:YES];

+ 3 - 3
NIMDemo/NIMDemo/Classes/Util/NTESDemoConfig.m

@@ -27,10 +27,10 @@
 {
     if (self = [super init])
     {
-        _appKey = @"7b8c319e77664d91d28520b83840b221";
+        _appKey = @"1bee11fdc6befd6fd447d30cdff96c4a";
         _apiURL = @"https://app.netease.im/api";
-        _cerName= @"sheishuopush";
-        //_cerName= @"sheishuopushdist";
+//        _cerName= @"ss2017dev";
+        _cerName= @"ss2017dis";
     }
     return self;
 }

+ 20 - 1
NIMDemo/NIMDemo/Classes/Util/NTESNotificationCenter.m

@@ -22,6 +22,7 @@
 #import "NTESLiveViewController.h"
 #import "NTESSessionMsgConverter.h"
 #import "NTESSessionUtil.h"
+#import "User.h"
 
 NSString *NTESCustomNotificationCountChanged = @"NTESCustomNotificationCountChanged";
 
@@ -78,7 +79,25 @@ NSString *NTESCustomNotificationCountChanged = @"NTESCustomNotificationCountChan
         return;
     }
     isPlaying = YES;
-    [self playMessageAudioTip];
+    
+    bool playTip = NO;
+    for (NIMMessage *message in messages) {
+        if (message.session.sessionType == NIMSessionTypeP2P) {
+            if([[NIMSDK sharedSDK].userManager notifyForNewMsg:message.session.sessionId])
+            {
+                playTip = YES;
+            }
+        }
+        else if(![[User sharedInfo] isSystemTeam:message.session.sessionId])
+        {
+            if([[NIMSDK sharedSDK].teamManager notifyForNewMsg:message.session.sessionId])
+            {
+                playTip = YES;
+            }
+        }
+    }
+    if(playTip)
+        [self playMessageAudioTip];
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
         isPlaying = NO;
     });

+ 4 - 0
NIMDemo/NIMDemo/FriendRequestTableViewCell.m

@@ -74,6 +74,10 @@
         {
             [_btn setTitle:@"查看" forState:UIControlStateNormal];
         }
+        else if(friendRequestData.type == 3)
+        {
+            [_btn setTitle:@"删除" forState:UIControlStateNormal];
+        }
         else
         {
             [_btn setTitle:@"接受" forState:UIControlStateNormal];

+ 20 - 1
NIMDemo/NIMDemo/FriendRequestViewController.m

@@ -188,7 +188,26 @@
     }
     else if(friendRequestData.type == 2)
     {
-        [User showUserInfo:friendRequestData.userId viewController:self];
+        [SVProgressHUD show];
+        [[HttpRequest shared] deleteFriendRequest:friendRequestData.requestId success:^{
+            [SVProgressHUD dismiss];
+            [wself removeData:friendRequestData.requestId];
+            [User showUserInfo:friendRequestData.userId viewController:self];
+        } failure:^{
+            [SVProgressHUD dismiss];
+            [wself.view makeToast:@"删除失败" duration:2.0 position:CSToastPositionCenter];
+        }];
+    }
+    else if(friendRequestData.type == 3)
+    {
+        [SVProgressHUD show];
+        [[HttpRequest shared] deleteFriendRequest:friendRequestData.requestId success:^{
+            [SVProgressHUD dismiss];
+            [wself removeData:friendRequestData.requestId];
+        } failure:^{
+            [SVProgressHUD dismiss];
+            [wself.view makeToast:@"删除失败" duration:2.0 position:CSToastPositionCenter];
+        }];
     }
 }
 

+ 10 - 0
NIMDemo/NIMDemo/FriendViewController.m

@@ -133,6 +133,7 @@
     _badgeView = [NTESBadgeView viewWithBadgeTip:@""];
     _badgeView.right = 20;
     _badgeView.top = -10;
+    [_badgeView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showContact:)]];
     [_contactBtn addSubview:_badgeView];
     
     UIButton *spaceBtn = [UIButton buttonWithType:UIButtonTypeCustom];
@@ -158,6 +159,9 @@
         wself.badgeView.badgeValue = [NSString stringWithFormat:@"%ld", (long)badge];
     } failure:^{
     }];
+    
+    [_searchArr removeAllObjects];
+    [self.tableView reloadData];
 }
 
 - (void)viewWillDisappear:(BOOL)animated
@@ -184,6 +188,12 @@
                 [_searchArr addObject:recent];
             }
         }
+        
+//        NIMMessageSearchOption *option = [[NIMMessageSearchOption alloc] init];
+//        option.
+//        [NIMSDK sharedSDK].conversationManager searchAllMessages:(nonnull NIMMessageSearchOption *) result:^(NSError * _Nullable error, NSDictionary<NIMSession *,NSArray<NIMMessage *> *> * _Nullable messages) {
+//            
+//        }];
     }
     else
     {

+ 8 - 0
NIMDemo/NIMDemo/GroupMoreTableViewCell.m

@@ -10,6 +10,7 @@
 
 #import "NIMAvatarImageView.h"
 #import "User.h"
+#import "HttpRequest.h"
 
 @interface GroupMoreTableViewCell ()
 
@@ -40,6 +41,13 @@
     NSString *teamId = [data objectForKey:@"sid"];
     __weak typeof(self) wself = self;
     [[NIMSDK sharedSDK].teamManager fetchTeamInfo:teamId completion:^(NSError * _Nullable error, NIMTeam * _Nullable team) {
+        
+        if(team == nil)
+        {
+            [[HttpRequest shared] removeTeam:@[teamId]];
+            return;
+        }
+        
         wself.descTextField.text = team.intro ? team.intro : @"";
         if(!wself.avatar)
         {

+ 16 - 9
NIMDemo/NIMDemo/GroupMoreTableViewController.m

@@ -14,6 +14,7 @@
 #import "NIMSDK/NIMSDK.h"
 #import "GroupMoreTableViewCell.h"
 #import "NTESSessionViewController.h"
+#import "HttpRequest.h"
 
 @interface GroupMoreTableViewController ()
 
@@ -109,7 +110,7 @@
                                  @"city":city,
                                  @"district":district
                                  };
-    NSString *urlString = @"http://whosay.dashgame.com/index.php?m=who&c=index&a=all_district";
+    NSString *urlString = [NSString stringWithFormat:@"%@%@", [HttpRequest shared].urlRoot, @"index.php?m=who&c=index&a=all_district"];
     //请求的managers
     AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
     manager.responseSerializer = [AFJSONResponseSerializer new];
@@ -180,8 +181,7 @@
                                  @"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=near_room";
-    //请求的managers
+    NSString *urlString = [NSString stringWithFormat:@"%@%@", [HttpRequest shared].urlRoot, @"index.php?m=who&c=index&a=near_room"];    //请求的managers
     AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
     manager.responseSerializer = [AFJSONResponseSerializer new];
     manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", nil];
@@ -190,6 +190,8 @@
     
     NSLog(@"%@", parameters);
     
+    __weak typeof(self) wself = self;
+    
     [manager POST:urlString parameters:parameters progress:nil success:^(NSURLSessionDataTask *task, id responseObject) {
         
         [SVProgressHUD dismiss];
@@ -214,12 +216,7 @@
             [myTeams addObject:teamData];
         }
         
-        if(!self.groupArr)
-        {
-            self.groupArr = [[NSMutableArray alloc] init];
-        }
-        [self.groupArr addObjectsFromArray:myTeams];
-        [self.tableView reloadData];
+        [wself removeNotExistTeam:myTeams];
         
     } failure:^(NSURLSessionDataTask *task, NSError * error) {
         [SVProgressHUD dismiss];
@@ -227,6 +224,16 @@
     }];
 }
 
+- (void)removeNotExistTeam:(NSMutableArray *)teams
+{
+    if(!self.groupArr)
+    {
+        self.groupArr = [[NSMutableArray alloc] init];
+    }
+    [self.groupArr addObjectsFromArray:teams];
+    [self.tableView reloadData];
+}
+
 
 - (IBAction)createGroup:(id)sender {
     

+ 21 - 2
NIMDemo/NIMDemo/GroupTableController.m

@@ -184,7 +184,8 @@
     
     NIMTeam *team = [[[NIMSDK sharedSDK] teamManager] teamById:user.countryRoomId];
     NSString *desc = [NSString stringWithFormat:@"%ld%@", (long)team.memberNumber, @"人热聊中"];
-    NSDictionary *county = @{@"cid":@"Group", @"name":@"国家频道", @"desc":desc, @"sid":user.countryRoomId, @"avatar":@""};
+    
+    NSDictionary *county = @{@"cid":@"Group", @"name":@"全国频道", @"desc":desc, @"sid":user.countryRoomId, @"avatar":@""};
     [myTeams addObject:county];
     
     if(![user.provinceRoomId isEqualToString:@""] && user.provinceRoomId != nil)
@@ -407,7 +408,8 @@
                 NSLog(@"applyToTeam error %@", error);
                 if(!error && applyStatus == NIMTeamApplyStatusAlreadyInTeam)
                 {
-                    [self startTeamChat:teamId animated:animated];
+                    
+                    [self attempStartTeamChat:teamId animated:animated];
                 }
             }];
         }
@@ -418,6 +420,23 @@
     }
 }
 
+- (void)attempStartTeamChat:(NSString *)teamId animated:(BOOL)animated
+{
+    if([[User sharedInfo] isSystemTeam:teamId])
+    {
+        __weak typeof(self) wself = self;
+        [[[NIMSDK sharedSDK] teamManager] updateNotifyState:NO
+                                                     inTeam:teamId
+                                                 completion:^(NSError *error) {
+                                                     [wself startTeamChat:teamId animated:animated];
+                                                 }];
+    }
+    else
+    {
+        [self startTeamChat:teamId animated:animated];
+    }
+}
+
 - (void)startTeamChat:(NSString *)teamId animated:(BOOL)animated
 {
     NIMSession *session = [NIMSession session:teamId type:NIMSessionTypeTeam];

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

@@ -12,6 +12,7 @@
 #import "TradeData.h"
 #import "UserInfo.h"
 #import "FriendRequestViewController.h"
+#import "GiftInputContainer.h"
 
 @interface HttpRequest : NSObject
 
@@ -76,6 +77,7 @@
                  failure:(void (^_Nullable)())failure;
 
 - (void)socialLike:(NSString *_Nullable)socialId
+              like:(int)like
            success:(void (^_Nullable)(NSString * _Nullable socialId, int currentLikes, NSMutableArray *_Nullable likeList))success
            failure:(void (^_Nullable)())failure;
 
@@ -94,6 +96,15 @@
                   success:(void (^_Nullable)(NSMutableArray * _Nullable dataList))success
                   failure:(void (^_Nullable)())failure;
 
+- (void)socialUnreadList:(long)lastLikeId
+              lastCommId:(int)lastCommId
+                 success:(void (^_Nullable)(NSMutableArray * _Nullable dataList))success
+                 failure:(void (^_Nullable)())failure;
+
+- (void)socialData:(NSString *_Nonnull)socialId
+           success:(void (^_Nullable)(SocialItemData * _Nullable socialData))success
+           failure:(void (^_Nullable)())failure;
+
 - (void)follow:(NSString *_Nullable)userId
        success:(void (^_Nullable)(int follow))success
        failure:(void (^_Nullable)())failure;
@@ -148,6 +159,12 @@
            success:(void (^_Nullable)())success
            failure:(void (^_Nullable)())failure;
 
+- (void)teamKicked:(NSString *_Nonnull)userId
+               msg:(NSString *_Nonnull)msg
+            teamId:(NSString *_Nonnull)teamId;
+
+- (void)removeTeam:(NSArray *_Nonnull)teamIds;
+
 - (void)requestFriend:(NSString *_Nullable)userId
                   msg:(NSString *_Nullable)msg
               success:(void (^_Nullable)())success

+ 91 - 5
NIMDemo/NIMDemo/HttpRequest/HttpRequest.m

@@ -14,6 +14,7 @@
 #import "NTESLoginManager.h"
 #import "TradePriorityItemData.h"
 #import "CityManager.h"
+#import "SocialUnreadItemData.h"
 
 
 @interface HttpRequest()
@@ -36,6 +37,8 @@
 @property (nonatomic, strong) NSString *urlSocialLikeList;
 @property (nonatomic, strong) NSString *urlSocialComment;
 @property (nonatomic, strong) NSString *urlSocialCommentList;
+@property (nonatomic, strong) NSString *urlSocialUnreadList;
+@property (nonatomic, strong) NSString *urlSocialData;
 @property (nonatomic, strong) NSString *urlFollow;
 @property (nonatomic, strong) NSString *urlFollowList;
 @property (nonatomic, strong) NSString *urlBefollowedList;
@@ -54,10 +57,12 @@
 @property (nonatomic, strong) NSString *urlFriendRequestList;
 @property (nonatomic, strong) NSString *urlAddFriend;
 @property (nonatomic, strong) NSString *urlDeleteFriendRequest;
+@property (nonatomic, strong) NSString *urlTeamKicked;
 
 //chat
 @property (nonatomic, strong) NSString *urlChatRoomIntro;
 @property (nonatomic, strong) NSString *urlLastSystemMsg;
+@property (nonatomic, strong) NSString *urlRemoveTeam;
 
 //trade
 @property (nonatomic, strong) NSString *urlTradePublish;
@@ -82,6 +87,7 @@
 @property (nonatomic, strong) NSString *urlChatStickList;
 @property (nonatomic, strong) NSString *urlChatStick;
 @property (nonatomic, strong) NSString *urlResetLocation;
+@property (nonatomic, strong) NSString *urlGiftList;
 
 //sms
 @property (nonatomic, strong) NSString *urlSendCode;
@@ -110,7 +116,7 @@
     self = [super init];
     if(self)
     {
-        self.urlRoot = @"http://118.31.11.27/";
+        self.urlRoot = @"http://shuishuoapp.com/";
         
         
         self.urlRegister = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=index&a=register"];
@@ -120,6 +126,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.urlRemoveTeam = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=index&a=remove_room"];
         
         
         self.urlSocialDataList = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=lists"];
@@ -128,6 +135,9 @@
         self.urlSocialLikeList = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=like_list"];
         self.urlSocialComment = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=comment"];
         self.urlSocialCommentList = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=comment_list"];
+        self.urlSocialUnreadList = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=unread_list"];
+        self.urlSocialData = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=info"];
+        
         self.urlFollow = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=follow"];
         self.urlFollowList = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=follows"];
         self.urlBefollowedList = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=befollowed"];
@@ -142,12 +152,14 @@
         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"];
         self.urlDeleteFriendRequest = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=delete_request"];
-        
+        self.urlTeamKicked = [NSString stringWithFormat:@"%@%@", self.urlRoot, @"index.php?m=who&c=social&a=team_kick"];
         
         
         
@@ -213,7 +225,7 @@
     [manager POST:URLString parameters:parameters progress:uploadProgress success:^(NSURLSessionDataTask *task, id responseObject) {
         
         NSString *string = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
-        NSLog(@"请求成功,服务器返回的信息%@", string);
+        NSLog(@"请求成功,服务器返回的信息 %@", string);
         
         NSError* error = nil;
         NSData *strData = [string dataUsingEncoding:NSASCIIStringEncoding];
@@ -648,11 +660,14 @@
 }
 
 - (void)socialLike:(NSString *)socialId
+              like:(int)like
            success:(void (^_Nullable)(NSString * _Nullable socialId, int currentLikes, NSMutableArray *_Nullable likeList))success
            failure:(void (^_Nullable)())failure{
     
     NSString *userId = [NSString stringWithFormat:@"%d", [User sharedInfo].userId];
-    NSDictionary *parameters = @{@"user_id":userId, @"social_id":socialId};
+    NSDictionary *parameters = @{@"user_id":userId,
+                                 @"like":@(like),
+                                 @"social_id":socialId};
     
     [self request:_urlSocialLike parameters:parameters progress:nil success:^(id jsonData) {
         
@@ -767,6 +782,51 @@
 
 }
 
+- (void)socialUnreadList:(long)lastLikeId
+              lastCommId:(int)lastCommId
+                 success:(void (^)(NSMutableArray * _Nullable))success
+                 failure:(void (^)())failure{
+    
+    User *user = [User sharedInfo];
+    NSDictionary *parameters = @{@"user_id":[NSString stringWithFormat:@"%d", user.userId],
+                                 @"last_like":@(lastLikeId),
+                                 @"last_comm":@(lastCommId)};
+    
+    [self request:_urlSocialUnreadList parameters:parameters progress:nil success:^(id jsonData) {
+        NSMutableArray *list = [jsonData objectForKey:@"list"];
+        NSMutableArray<SocialUnreadItemData *> *dataList = [[NSMutableArray alloc] init];
+        for(int i=0; i<list.count; i++)
+        {
+            SocialUnreadItemData *data = [[SocialUnreadItemData alloc] init];
+            [data setData:[list objectAtIndex:i]];
+            [dataList addObject:data];
+        }
+        if(success)
+            success(dataList);
+    } failure:^{
+        if(failure)
+            failure();
+    }];
+}
+
+- (void)socialData:(NSString *)socialId
+           success:(void (^)(SocialItemData * _Nullable))success
+           failure:(void (^)())failure{
+    User *user = [User sharedInfo];
+    NSDictionary *parameters = @{@"user_id":[NSString stringWithFormat:@"%d", user.userId],
+                                 @"social_id":socialId};
+    
+    [self request:_urlSocialData parameters:parameters progress:nil success:^(id jsonData) {
+
+        SocialItemData *data = [[SocialItemData alloc] init];
+        [data setData:[jsonData objectForKey:@"social"]];
+        if(success)
+            success(data);
+    } failure:^{
+        if(failure)
+            failure();
+    }];
+}
 
 - (void)follow:(NSString *_Nullable)userId
        success:(void (^_Nullable)(int follow))success
@@ -1023,7 +1083,15 @@
         if(failure)
             failure();
     }];
-    
+}
+
+- (void)removeTeam:(NSArray *)teamIds{
+    NSDictionary *dict = @{@"tids":teamIds};
+    [self request:_urlRemoveTeam parameters:dict progress:nil success:^(id jsonData) {
+        
+    } failure:^{
+        
+    }];
 }
 
 - (void)uploadPhoto:(UIImage *_Nullable)image
@@ -1085,6 +1153,22 @@
     }];
 }
 
+- (void)teamKicked:(NSString *)userId
+               msg:(NSString *)msg
+            teamId:(NSString *)teamId{
+    
+    NSDictionary *parameters = @{@"target_id":userId,
+                                 @"user_id":[NIMSDK sharedSDK].loginManager.currentAccount,
+                                 @"msg":msg,
+                                 @"team_id":teamId};
+    
+    [self request:_urlTeamKicked parameters:parameters progress:nil success:^(id jsonData) {
+        
+    } failure:^{
+        
+    }];
+}
+
 - (void)requestFriend:(NSString *)userId msg:(NSString *)msg success:(void (^)())success failure:(void (^)())failure{
     
     NSDictionary *parameters = @{@"target_id":userId,
@@ -1171,6 +1255,8 @@
 
 
 
+
+
 //trade
 - (void)tradePublish:(NSString *)msg
               picArr:(NSMutableArray *)picArr

+ 21 - 0
NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_1.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "tuto_1.jpg",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_1.imageset/tuto_1.jpg


+ 21 - 0
NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_1_min.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "tuto_1_min.jpg",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_1_min.imageset/tuto_1_min.jpg


+ 21 - 0
NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_2.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "tuto_2.jpg",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_2.imageset/tuto_2.jpg


+ 21 - 0
NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_2_min.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "tuto_2_min.jpg",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_2_min.imageset/tuto_2_min.jpg


+ 21 - 0
NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_3.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "tuto_3.jpg",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_3.imageset/tuto_3.jpg


+ 21 - 0
NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_3_min.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "tuto_3_min.jpg",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_3_min.imageset/tuto_3_min.jpg


+ 21 - 0
NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_4.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "tuto_4.jpg",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_4.imageset/tuto_4.jpg


+ 21 - 0
NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_5.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "tuto_5.jpg",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
NIMDemo/NIMDemo/Images.xcassets/Whosay/tuto_5.imageset/tuto_5.jpg


+ 15 - 3
NIMDemo/NIMDemo/IntroViewController.m

@@ -53,25 +53,37 @@
 - (void)layoutPics{
     
     UIImageView *imageView = [[UIImageView alloc] init];
-    [imageView setImage:[UIImage imageNamed:@"tuto-1-min"]];
+    [imageView setImage:[UIImage imageNamed:@"tuto_1_min"]];
     [imageView setContentMode:UIViewContentModeScaleAspectFill];
     imageView.frame = CGRectMake(0 * _scrollView.nim_width, 0, _scrollView.nim_width, _scrollView.nim_height);
     [_scrollView addSubview:imageView];
     
     
     imageView = [[UIImageView alloc] init];
-    [imageView setImage:[UIImage imageNamed:@"tuto-2-min"]];
+    [imageView setImage:[UIImage imageNamed:@"tuto_2_min"]];
     [imageView setContentMode:UIViewContentModeScaleAspectFill];
     imageView.frame = CGRectMake(1 * _scrollView.nim_width, 0, _scrollView.nim_width, _scrollView.nim_height);
     [_scrollView addSubview:imageView];
     
     
     imageView = [[UIImageView alloc] init];
-    [imageView setImage:[UIImage imageNamed:@"tuto-3-min"]];
+    [imageView setImage:[UIImage imageNamed:@"tuto_3_min"]];
     [imageView setContentMode:UIViewContentModeScaleAspectFill];
     imageView.frame = CGRectMake(2 * _scrollView.nim_width, 0, _scrollView.nim_width, _scrollView.nim_height);
     [_scrollView addSubview:imageView];
     
+//    imageView = [[UIImageView alloc] init];
+//    [imageView setImage:[UIImage imageNamed:@"tuto_4"]];
+//    [imageView setContentMode:UIViewContentModeScaleAspectFill];
+//    imageView.frame = CGRectMake(3 * _scrollView.nim_width, 0, _scrollView.nim_width, _scrollView.nim_height);
+//    [_scrollView addSubview:imageView];
+//    
+//    imageView = [[UIImageView alloc] init];
+//    [imageView setImage:[UIImage imageNamed:@"tuto_5"]];
+//    [imageView setContentMode:UIViewContentModeScaleAspectFill];
+//    imageView.frame = CGRectMake(4 * _scrollView.nim_width, 0, _scrollView.nim_width, _scrollView.nim_height);
+//    [_scrollView addSubview:imageView];
+    
     
     
     _scrollView.contentSize = CGSizeMake(_count * _scrollView.nim_width, _scrollView.nim_height);

+ 5 - 3
NIMDemo/NIMDemo/LocationManager.m

@@ -130,10 +130,11 @@
 
 - (void)toTabBarView{
     
+    __weak typeof(self) wself = self;
     [[User sharedInfo] requestGiftList:^(NSMutableArray * _Nullable list) {
-        [self showTabBarView];
+        [wself showTabBarView];
     } failure:^(NSError * _Nullable error) {
-        [self showTabBarView];
+        [wself showTabBarView];
     }];
     
 }
@@ -145,7 +146,8 @@
     
     UIViewController *vc = [[[UIApplication sharedApplication] keyWindow] rootViewController];
     UINavigationController *nav = vc.navigationController ? vc.navigationController : (UINavigationController *)vc;
-    [nav pushViewController:next animated:NO];
+    if(nav)
+        [nav pushViewController:next animated:NO];
     [SVProgressHUD dismiss];
 }
 

+ 79 - 6
NIMDemo/NIMDemo/NearUserViewController.m

@@ -10,10 +10,14 @@
 #import "HttpRequest.h"
 #import "NearUserTableViewCell.h"
 #import "User.h"
+#import "UIActionSheet+NTESBlock.h"
 
 @interface NearUserViewController ()
 
 @property (nonatomic, strong) NSMutableArray            *dataArr;
+@property (nonatomic, strong) NSMutableArray            *displayArr;
+@property int sort;
+@property (nonatomic, strong) UIButton                  *sortBtn;
 
 @end
 
@@ -24,9 +28,9 @@
     
     __weak typeof(self) wself = self;
     [[HttpRequest shared] nearUsers:1 success:^(NSMutableArray * _Nullable list) {
-        
         wself.dataArr = list;
-        [wself.tableView reloadData];
+        wself.displayArr = [[NSMutableArray alloc] init];
+        [wself refresh];
     } failure:^{
         
     }];
@@ -41,6 +45,75 @@
     [super viewWillAppear:animated];
     
     [self.navigationItem setTitle:@"附近的人"];
+    
+    _sortBtn = [UIButton buttonWithType:UIButtonTypeCustom];
+    [_sortBtn setTitle:@"全部" forState:UIControlStateNormal];
+    [_sortBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
+    [_sortBtn addTarget:self action:@selector(onTouchSort:) forControlEvents:UIControlEventTouchUpInside];
+    [_sortBtn sizeToFit];
+    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithCustomView:_sortBtn];
+    
+    [self.navigationItem setRightBarButtonItems:@[rightItem]];
+}
+
+- (void)onTouchSort:(id)sender{
+    
+    UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"选择操作" delegate:nil cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"全部",@"男",@"女", nil];
+    __weak typeof(self) wself = self;
+    int oldSort = _sort;
+    [sheet showInView:self.view completionHandler:^(NSInteger index) {
+        switch (index) {
+            case 0:{
+                wself.sort = 0;
+                [wself.sortBtn setTitle:@"全部" forState:UIControlStateNormal];
+                break;
+            }
+            case 1:{
+                wself.sort = 1;
+                [wself.sortBtn setTitle:@"男" forState:UIControlStateNormal];
+                break;
+            }
+            case 2:{
+                wself.sort = 2;
+                [wself.sortBtn setTitle:@"女" forState:UIControlStateNormal];
+                break;
+            }
+            default:
+                break;
+        }
+        
+        if(wself.sort != oldSort)
+        {
+            [wself refresh];
+//            [wself reset];
+//            [wself fetchDataList];
+        }
+    }];
+    
+}
+
+- (void)refresh
+{
+    [_displayArr removeAllObjects];
+    for(int i=0; i<_dataArr.count; i++)
+    {
+        NSDictionary *dict = [_dataArr objectAtIndex:i];
+        NSString *userId = [dict objectForKey:@"id"];
+        NIMUser *user = [[NIMSDK sharedSDK].userManager userInfo:userId];
+        if(user.userInfo.gender == NIMUserGenderMale && _sort == 1)
+        {
+            [_displayArr addObject:dict];
+        }
+        else if(user.userInfo.gender == NIMUserGenderFemale && _sort == 2)
+        {
+            [_displayArr addObject:dict];
+        }
+        else if(_sort == 0)
+        {
+            [_displayArr addObject:dict];
+        }
+    }
+    [self.tableView reloadData];
 }
 
 #pragma mark - Table view data source
@@ -51,8 +124,8 @@
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
 
-    if(_dataArr)
-        return _dataArr.count;
+    if(_displayArr)
+        return _displayArr.count;
     return 0;
 }
 
@@ -60,7 +133,7 @@
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
     NearUserTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"nearUser" forIndexPath:indexPath];
     
-    NSDictionary *dict = [_dataArr objectAtIndex:indexPath.row];
+    NSDictionary *dict = [_displayArr objectAtIndex:indexPath.row];
     NSString *userId = [dict objectForKey:@"id"];
     int distance = [[dict objectForKey:@"dist"] intValue];
     [cell setUser:userId distance:distance];
@@ -70,7 +143,7 @@
 
 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
-    NSDictionary *dict = [_dataArr objectAtIndex:indexPath.row];
+    NSDictionary *dict = [_displayArr objectAtIndex:indexPath.row];
     NSString *userId = [dict objectForKey:@"id"];
     [User showUserInfo:userId viewController:self];
 }

+ 2 - 2
NIMDemo/NIMDemo/PayOptionViewController.m

@@ -12,6 +12,7 @@
 #import "Order.h"
 #import "RSADataSigner.h"
 #import "UIView+Toast.h"
+#import "HttpRequest.h"
 
 @interface PayOptionViewController ()
 @property (weak, nonatomic) IBOutlet UILabel *moneyLabel;
@@ -79,8 +80,7 @@
     [formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
     order.timestamp = [formatter stringFromDate:[NSDate date]];
     
-    order.notify_url = @"http://whosay.dashgame.com/alipay_notify.php";    
-    
+    order.notify_url = [NSString stringWithFormat:@"%@%@", [HttpRequest shared].urlRoot, @"alipay_notify.php"];    
     // NOTE: 支付版本
     order.version = @"1.0";
     

+ 2 - 0
NIMDemo/NIMDemo/RegisterViewController.m

@@ -123,6 +123,7 @@
     
     _pwdTextField = [[UITextField alloc] initWithFrame:CGRectMake(pwdBorder.left+padding, pwdBorder.top+padding, pwdBorder.width-padding*2, pwdBorder.height-padding*2)];
     _pwdTextField.placeholder = @"密码 (8位以上数字、字母和符号组成)";
+    _pwdTextField.secureTextEntry = YES;
     [self.view addSubview:_pwdTextField];
     
     
@@ -134,6 +135,7 @@
     
     _pwdConfirmTextField = [[UITextField alloc] initWithFrame:CGRectMake(pwdVFBorder.left+padding, pwdVFBorder.top+padding, pwdVFBorder.width-padding*2, pwdVFBorder.height-padding*2)];
     _pwdConfirmTextField.placeholder = @"确认密码";
+    _pwdConfirmTextField.secureTextEntry = YES;
     [self.view addSubview:_pwdConfirmTextField];
     
     

+ 3 - 0
NIMDemo/NIMDemo/SectionTrade/TradeTableViewCell.m

@@ -122,6 +122,9 @@ return self;
 
 - (void)setData:(TradeData *)data{
     
+    if(data == nil)
+        return;
+    
     _data = data;
     
     NIMUser *user = [[NIMSDK sharedSDK].userManager userInfo:data.userId];

+ 99 - 20
NIMDemo/NIMDemo/SectionTrade/TradeViewController.m

@@ -19,6 +19,7 @@
 #import "TradeTopBarItem.h"
 #import "SVProgressHUD.h"
 #import "TradeDetailViewController.h"
+#import "UIAlertView+NTESBlock.h"
 
 
 @interface TradeViewController () <
@@ -29,6 +30,7 @@ UISearchBarDelegate,
 UISearchControllerDelegate>
 
 @property (nonatomic, strong) NSMutableArray            *dataList;
+@property (nonatomic, assign) BOOL                      needReset;
 
 @property (nonatomic, strong) NSString                  *searchKey;
 @property (nonatomic, strong) NSMutableArray            *searchList;
@@ -54,6 +56,11 @@ UISearchControllerDelegate>
 @property (nonatomic,strong)  NSTimer                   *timer;
 
 @property (nonatomic, strong) UISearchController        *searchController;
+@property (nonatomic, assign) BOOL                      cancelColorChanged;
+
+@property (nonatomic, strong) NSString                  *lastSearchKey;
+
+@property (nonatomic, strong) TradeTableViewCell        *viewCell;
 
 @end
 
@@ -67,6 +74,9 @@ float postHeight = 30;
     
     [self tableView];
     
+    _viewCell = [[TradeTableViewCell alloc] init];
+    [_viewCell initWidth:self.view.width];
+    
     UIButton *showInputBtn = [UIButton buttonWithType:UIButtonTypeCustom];
     float btnSize = 60;
     showInputBtn.frame = CGRectMake(self.view.width - btnSize - 25, self.view.height - btnSize - 75, btnSize, btnSize);
@@ -183,7 +193,6 @@ float postHeight = 30;
     _searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
     _searchController.searchBar.barTintColor = User.orangeColor;
     _searchController.hidesNavigationBarDuringPresentation = YES;
-    _searchController.searchBar.tintColor = UIColor.whiteColor;
     _searchController.delegate = self;
     _searchController.dimsBackgroundDuringPresentation = NO;
     
@@ -215,10 +224,11 @@ float postHeight = 30;
     if((_district && ![_district isEqualToString:user.district]) || (!_district && user.district))
     {
         _district = user.district;
-        [self reset];
-        [self fetchDataList];
     }
     
+    [self reset];
+    [self fetchDataList];
+    
     
     
     UINavigationItem *navItem = self.parentViewController.navigationItem;
@@ -309,6 +319,44 @@ float postHeight = 30;
 - (void)onTouchSearch:(int)sender{
     NSLog(@"onTouchSearch");
     [_searchController setActive:YES];
+    _searchController.searchBar.text = _lastSearchKey;
+}
+
+
+- (void)didPresentSearchController:(UISearchController *)searchController{
+    
+    if(_cancelColorChanged)
+        return;
+    
+    if(_searchController.searchBar.subviews.count > 0)
+    {
+        for (id searchbuttons in [_searchController.searchBar.subviews[0] subviews])
+        {
+            if ([searchbuttons isKindOfClass:[UIButton class]])
+            {
+                UIButton *cancelButton = (UIButton*)searchbuttons;
+                // 修改文字颜色
+                [cancelButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
+                [cancelButton setTitleColor:UIColor.whiteColor forState:UIControlStateHighlighted];
+                _cancelColorChanged = true;
+                return;
+            }
+        }
+    }
+    
+    for (id searchbuttons in [_searchController.searchBar subviews])
+    {
+        if ([searchbuttons isKindOfClass:[UIButton class]])
+        {
+            UIButton *cancelButton = (UIButton*)searchbuttons;
+            // 修改文字颜色
+            [cancelButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
+            [cancelButton setTitleColor:UIColor.whiteColor forState:UIControlStateHighlighted];
+            _cancelColorChanged = true;
+            return;
+        }
+    }
+    
     
 }
 
@@ -317,9 +365,9 @@ float postHeight = 30;
     
     if(searchBar.text.length > 0)
     {
-        _searchKey = searchBar.text;
+        _lastSearchKey = _searchKey = searchBar.text;
         [SVProgressHUD show];
-        [self reset];
+        _page = 1;
         [self fetchSearchDataList];
     }
 }
@@ -393,7 +441,7 @@ float postHeight = 30;
 - (void)reset{
     
     _page = 1;
-    _dataList = nil;
+    _needReset = YES;
     _searchList = nil;
 }
 
@@ -406,15 +454,20 @@ float postHeight = 30;
     
     _page = MAX(1, _page);
     
+    __weak typeof(self) wself = self;
+    
     [SVProgressHUD show];
     [[HttpRequest shared] tradeList:_tradeSort page:_page success:^(NSMutableArray * _Nullable dataList) {
         [SVProgressHUD dismiss];
-        if(!self.dataList)
-            self.dataList = dataList;
+        if(wself.needReset || !wself.dataList)
+        {
+            wself.needReset = NO;
+            wself.dataList = dataList;
+        }
         else
-            [self.dataList addObjectsFromArray:dataList];
+            [wself.dataList addObjectsFromArray:dataList];
         
-        [self.tableView reloadData];
+        [wself.tableView reloadData];
         
         if(dataList.count > 0)
             _page++;
@@ -439,18 +492,32 @@ float postHeight = 30;
     [SVProgressHUD show];
     __weak typeof(self) wself = self;
     [[HttpRequest shared] tradeSearchList:_searchKey tradeSort:_tradeSort page:_page success:^(NSMutableArray * _Nullable dataList) {
-        [SVProgressHUD dismiss];
-        if(!wself.searchList)
-            wself.searchList = dataList;
-        else
-            [wself.searchList addObjectsFromArray:dataList];
-        
-        [wself.tableView reloadData];
-        
+
         if(dataList.count > 0)
+        {
+            if(!wself.searchList || wself.page == 1)
+                wself.searchList = dataList;
+            else
+                [wself.searchList addObjectsFromArray:dataList];
+            
+            
             wself.page++;
+        }
+        else
+        {
+            if(wself.page == 1)
+            {
+                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"没有搜索到相关内容" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
+                [alert showAlertWithCompletionHandler:^(NSInteger optIndex) {
+                    [wself.searchController setActive:NO];
+                    [wself reset];
+                    [wself fetchDataList];
+                }];
+            }
+        }
         
         wself.isFetching = NO;
+        [wself.tableView reloadData];
         
         [SVProgressHUD dismiss];
     } failure:^{
@@ -460,6 +527,12 @@ float postHeight = 30;
 }
 
 
+- (void)setCellHeight:(TradeData *)tradeData{
+    
+    
+}
+
+
 #pragma mark - Table view data source
 
 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
@@ -486,7 +559,7 @@ float postHeight = 30;
     
     NSObject *dataObj = nil;
     
-    if(_searchController.isActive)
+    if(_searchController.isActive && _searchList)
     {
         dataObj = [_searchList objectAtIndex:indexPath.row];
     }
@@ -516,7 +589,7 @@ float postHeight = 30;
     
     NSObject *dataObj = nil;
     
-    if(_searchController.isActive)
+    if(_searchController.isActive && _searchList)
     {
         dataObj = [_searchList objectAtIndex:indexPath.row];
     }
@@ -528,6 +601,10 @@ float postHeight = 30;
     if([dataObj isKindOfClass:[TradeData class]])
     {
         TradeData *tradeData = (TradeData *)dataObj;
+        if(tradeData.cellHeight == 0)
+        {
+            [_viewCell setData:tradeData];
+        }
         return tradeData.cellHeight;
     }
     
@@ -535,6 +612,8 @@ float postHeight = 30;
 }
 
 
+
+
 - (void)scrollViewDidScroll:(UIScrollView *)scrollView{
     //康海涛测试Ok的
     CGPoint offset1 = scrollView.contentOffset;

+ 12 - 4
NIMDemo/NIMDemo/SettingTopTableViewCell.m

@@ -137,13 +137,21 @@
 {
     NSString *userId = [NIMSDK sharedSDK].loginManager.currentAccount;
     NIMUser *nimUser = [[NIMSDK sharedSDK].userManager userInfo:userId];
-    if(nimUser.userInfo.gender == NIMUserGenderMale || nimUser.userInfo.gender == NIMUserGenderUnknown)
+    if(nimUser.userInfo.gender == NIMUserGenderUnknown)
     {
-        [_genderImg setImage:[UIImage imageNamed:@"我的_07 (3)"]];
+        _genderImg.hidden = YES;
     }
-    else if(nimUser.userInfo.gender == NIMUserGenderFemale)
+    else
     {
-        [_genderImg setImage:[UIImage imageNamed:@"我的_07 (4)"]];
+        _genderImg.hidden = NO;
+        if(nimUser.userInfo.gender == NIMUserGenderMale)
+        {
+            [_genderImg setImage:[UIImage imageNamed:@"我的_07 (3)"]];
+        }
+        else if(nimUser.userInfo.gender == NIMUserGenderFemale)
+        {
+            [_genderImg setImage:[UIImage imageNamed:@"我的_07 (4)"]];
+        }
     }
     _userNameLabel.text = [[User sharedInfo] getUserName:nimUser];
 

+ 5 - 5
NIMDemo/NIMDemo/SocialCommentDetailTableViewCell.m

@@ -93,7 +93,7 @@
         //append sender name
         NSString *userId = socialCommentData.userId;
         user = [[NIMSDK sharedSDK].userManager userInfo:userId];
-        NSString *nick = user && user.userInfo.nickName ? user.userInfo.nickName : userId;
+        NSString *nick = [[User sharedInfo] getUserNameById:userId];
         NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
                                [UIFont systemFontOfSize:15.0], NSFontAttributeName,
                                UIColorFromRGB(0x4c82b0), NSForegroundColorAttributeName, nil];
@@ -111,11 +111,11 @@
         //append reply name
         userId = socialCommentData.replyId;
         user = [[NIMSDK sharedSDK].userManager userInfo:userId];
-        nick = user && user.userInfo.nickName ? user.userInfo.nickName : userId;
+        nick = [[User sharedInfo] getUserNameById:userId];
         attrs = [NSDictionary dictionaryWithObjectsAndKeys:
                  [UIFont systemFontOfSize:15.0], NSFontAttributeName,
                  UIColorFromRGB(0x4c82b0), NSForegroundColorAttributeName, nil];
-        appendString = [[NSMutableAttributedString alloc] initWithString:user.userId attributes:attrs];
+        appendString = [[NSMutableAttributedString alloc] initWithString:nick attributes:attrs];
         range = NSMakeRange(0, appendString.length);
         [appendString addAttribute:NSLinkAttributeName value:user.userId range:range];
         [attrString appendAttributedString:appendString];
@@ -127,7 +127,7 @@
         //append sender name
         NSString *userId = socialCommentData.userId;
         user = [[NIMSDK sharedSDK].userManager userInfo:userId];
-        NSString *nick = user && user.userInfo.nickName ? user.userInfo.nickName : userId;
+        NSString *nick = [[User sharedInfo] getUserNameById:userId];
         NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
                                [UIFont systemFontOfSize:15.0], NSFontAttributeName,
                                UIColorFromRGB(0x4c82b0), NSForegroundColorAttributeName, nil];
@@ -158,7 +158,7 @@
     SocialDetailViewController *vc = (SocialDetailViewController *)self.viewController;
     if(vc)
     {
-        [vc beginComment:nil];
+        [vc beginComment:_data.userId];
     }
 }
      

+ 9 - 8
NIMDemo/NIMDemo/SocialDetailTableViewCell.m

@@ -15,6 +15,7 @@
 #import "HttpRequest.h"
 #import "SocialDetailViewController.h"
 #import "SocialTableViewController.h"
+#import "SVProgressHUD.h"
 
 @interface SocialDetailTableViewCell() <UITextViewDelegate>
 
@@ -177,7 +178,6 @@
 
 }
 
-
 - (void)setSocialData:(SocialItemData *)data{
     
     self.data = data;
@@ -239,6 +239,7 @@
     [_locationBtn sizeToFit];
     _locationBtn.width = _locationBtn.width + 12;
     _locationBtn.height = 24;
+    _locationBtn.hidden = !data.showLocal;
     
     [_viewsBtn setTitle:[NSString stringWithFormat:@"%d", data.views] forState:UIControlStateNormal];
     [_likeBtn setTitle:[NSString stringWithFormat:@"%d", data.likes] forState:UIControlStateNormal];
@@ -368,17 +369,17 @@
 
 - (void)onTouchLike:(int)sender{
     
-    if(_data.liked > 0)
-    {
-        return;
-    }
-    
     __weak typeof(self) wself = self;
-    [[HttpRequest shared] socialLike:_data.socialId success:^(NSString * _Nullable socialId, int currentLikes, NSMutableArray *likeList) {
+    if(_data.liked > 0)
+        _data.liked = 0;
+    else
+        _data.liked = 1;
+        
+        
+    [[HttpRequest shared] socialLike:_data.socialId like:_data.liked success:^(NSString * _Nullable socialId, int currentLikes, NSMutableArray *likeList) {
         
         wself.data.likes = currentLikes;
         wself.data.likeArr = likeList;
-        wself.data.liked = 1;
         wself.likeArr = likeList;
         
         [wself setSocialData:_data];

+ 1 - 0
NIMDemo/NIMDemo/SocialDetailViewController.h

@@ -13,6 +13,7 @@
 
 @property (nonatomic, strong) UITableView               *tableView;
 
+- (void)setSocialId:(NSString *)socialId;
 - (void)setSocialData:(SocialItemData *)socialData;
 - (void)beginComment:(NSString *)replyId;
 - (void)deleteSocial:(NSString *)socialId;

+ 19 - 0
NIMDemo/NIMDemo/SocialDetailViewController.m

@@ -15,6 +15,7 @@
 #import "UIView+NTES.h"
 #import "SVProgressHUD.h"
 #import "UIAlertView+NTESBlock.h"
+#import "User.h"
 
 @interface SocialDetailViewController ()<UIScrollViewDelegate, UITextFieldDelegate>
 
@@ -101,6 +102,15 @@
     return _tableView;
 }
 
+- (void)setSocialId:(NSString *)socialId{
+    [SVProgressHUD show];
+    [[HttpRequest shared] socialData:socialId success:^(SocialItemData * _Nullable socialData) {
+        [SVProgressHUD dismiss];
+        [self setSocialData:socialData];
+    } failure:^{
+        [SVProgressHUD dismiss];
+    }];
+}
 
 - (void)setSocialData:(SocialItemData *)socialData{
     
@@ -287,6 +297,15 @@
     
     _replyId = replyId;
     _commentTextField.text = @"";
+    if(_replyId && _replyId.length > 0)
+    {
+        NSString *nick = [[User sharedInfo] getUserNameById:replyId];
+        _commentTextField.placeholder = [NSString stringWithFormat:@"回复%@", nick];
+    }
+    else
+    {
+        _commentTextField.placeholder = @"我要评论";
+    }
     [_commentTextField becomeFirstResponder];
     
 }

+ 1 - 0
NIMDemo/NIMDemo/SocialItemData.h

@@ -13,6 +13,7 @@
 @property (nonatomic, strong) NSString          *socialId;
 @property (nonatomic, strong) NSString          *userId;
 @property (nonatomic, strong) NSString          *local;
+@property (nonatomic, assign) BOOL              showLocal;
 @property (nonatomic, assign) double            lat;
 @property (nonatomic, assign) double            lng;
 @property (nonatomic, strong) NSString          *msg;

+ 2 - 0
NIMDemo/NIMDemo/SocialItemData.m

@@ -16,6 +16,8 @@
     _userId  = [data objectForKey:@"user_id"];
     
     _local = [data objectForKey:@"local"];
+    _showLocal = [[data objectForKey:@"show_local"] boolValue];
+    
     _lat = [[data objectForKey:@"latitude"] doubleValue];
     _lng = [[data objectForKey:@"longitude"] doubleValue];
     

+ 42 - 12
NIMDemo/NIMDemo/SocialTableViewCell.m

@@ -260,6 +260,8 @@
     _locationBtn.width = _locationBtn.width + 12;
     _locationBtn.height = 24;
     
+    _locationBtn.hidden = !_data.showLocal;
+    
     if(_data.thumbArr.count > 0)
     {
         int rows = ceilf((float)_data.thumbArr.count / (float)columns);
@@ -370,6 +372,8 @@
             commentView = [[UIView alloc] initWithFrame:CGRectMake(0, startY, _commentContainer.width, 0)];
             [_commentContainer addSubview:commentView];
             
+            [commentView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTouchCommentView:)]];
+            
             NIMAvatarImageView *commentAvatar = [[NIMAvatarImageView alloc] initWithFrame:CGRectMake(5, 5, 20, 20)];
             [commentView addSubview:commentAvatar];
             
@@ -379,10 +383,12 @@
 //            commentTxt.scrollEnabled = NO;
             commentTxt.editable = NO;
             commentTxt.textContainerInset = UIEdgeInsetsMake(7, 5, 0, 5);
+            [commentTxt setUserInteractionEnabled:NO];
             [commentView addSubview:commentTxt];
         }
         
         SocialCommentData *commentData = [_data.commentArr objectAtIndex:i];
+        commentView.tag = [commentData.userId intValue];
         
         //set comment avatar
         NIMAvatarImageView *avatar = [commentView.subviews objectAtIndex:0];
@@ -400,7 +406,7 @@
             //append sender name
             NSString *userId = commentData.userId;
             NIMUser *user = [[NIMSDK sharedSDK].userManager userInfo:userId];
-            NSString *nick = user && user.userInfo.nickName ? user.userInfo.nickName : userId;
+            NSString *nick = [[User sharedInfo] getUserNameById:userId];
             NSDictionary *attrs = [NSDictionary dictionaryWithObjectsAndKeys:
                                    [UIFont systemFontOfSize:15.0], NSFontAttributeName,
                                    UIColorFromRGB(0x4c82b0), NSForegroundColorAttributeName, nil];
@@ -411,25 +417,27 @@
             
             //append reply label
             attrs = [NSDictionary dictionaryWithObjectsAndKeys:
-                                   [UIFont systemFontOfSize:15.0], NSFontAttributeName, nil];
+                                   [UIFont systemFontOfSize:15.0], NSFontAttributeName,
+                                    UIColor.blackColor, NSForegroundColorAttributeName, nil];
             appendString = [[NSMutableAttributedString alloc] initWithString:@" 回复 " attributes:attrs];
             [attrString appendAttributedString:appendString];
             
             //append reply name
             userId = commentData.replyId;
             user = [[NIMSDK sharedSDK].userManager userInfo:userId];
-            nick = user && user.userInfo.nickName ? user.userInfo.nickName : userId;
+            nick = [[User sharedInfo] getUserNameById:userId];
             attrs = [NSDictionary dictionaryWithObjectsAndKeys:
                      [UIFont systemFontOfSize:15.0], NSFontAttributeName,
                      UIColorFromRGB(0x4c82b0), NSForegroundColorAttributeName, nil];
-            appendString = [[NSMutableAttributedString alloc] initWithString:user.userId attributes:attrs];
+            appendString = [[NSMutableAttributedString alloc] initWithString:nick attributes:attrs];
             range = NSMakeRange(0, appendString.length);
-            [appendString addAttribute:NSLinkAttributeName value:user.userId range:range];
+            [appendString addAttribute:NSLinkAttributeName value:commentData.userId range:range];
             [attrString appendAttributedString:appendString];
             
             //append comment
             attrs = [NSDictionary dictionaryWithObjectsAndKeys:
-                     [UIFont systemFontOfSize:15.0], NSFontAttributeName, nil];
+                     [UIFont systemFontOfSize:15.0], NSFontAttributeName,
+                     UIColor.blackColor, NSForegroundColorAttributeName, nil];
             appendString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@" %@", commentData.comment] attributes:attrs];
             [attrString appendAttributedString:appendString];
             
@@ -451,7 +459,8 @@
             
             //append comment
             attrs = [NSDictionary dictionaryWithObjectsAndKeys:
-                     [UIFont systemFontOfSize:15.0], NSFontAttributeName, nil];
+                     [UIFont systemFontOfSize:15.0], NSFontAttributeName,
+                     UIColor.blackColor, NSForegroundColorAttributeName, nil];
             appendString = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@" %@", commentData.comment] attributes:attrs];
             [attrString appendAttributedString:appendString];
             
@@ -459,6 +468,7 @@
         }
         
         
+        
         txt.height = txt.contentSize.height;
         commentView.height = txt.contentSize.height;
         
@@ -509,7 +519,7 @@
 - (void)showUserInfo:(int)sender{
     
     [User showUserInfo:_data.userId viewController:self.viewController];
-    
+    [self holdDataList];
 }
 
 - (void)onTouchAvatar:(UITapGestureRecognizer *)gestureRecognizer{
@@ -517,26 +527,29 @@
     UIView *viewClicked = [gestureRecognizer view];
     
     [User showUserInfo:[NSString stringWithFormat:@"%ld", (long)viewClicked.tag] viewController:self.viewController];
+    [self holdDataList];
 }
 
 - (void)showUserView:(NSString *)userId{
     
     [User showUserInfo:_data.userId viewController:self.viewController];
-    
+    [self holdDataList];
 }
 
 
 - (void)onTouchLike:(int)sender{
     
     if(_data.liked > 0)
-        return;
+        _data.liked = 0;
+    else
+        _data.liked = 1;
     
     __weak typeof(self) wself = self;
-    [[HttpRequest shared] socialLike:_data.socialId success:^(NSString * _Nullable socialId, int currentLikes, NSMutableArray *likeList) {
+    
+    [[HttpRequest shared] socialLike:_data.socialId like:_data.liked success:^(NSString * _Nullable socialId, int currentLikes, NSMutableArray *likeList) {
         
         if([_data.socialId isEqualToString:socialId])
         {
-            _data.liked = 1;
             _data.likes = currentLikes;
             _data.likeArr = likeList;
             [wself setData:_data];
@@ -553,6 +566,13 @@
     [((SocialTableViewController *)self.viewController) inputComment:_data.socialId targetId:nil];
 }
 
+- (void)onTouchCommentView:(UITapGestureRecognizer *)gestureRecognizer{
+    UIView *viewClicked = [gestureRecognizer view];
+    NSString *userId = [NSString stringWithFormat:@"%d", viewClicked.tag];
+    NSLog(@"replyTo  %@", userId);
+    [((SocialTableViewController *)self.viewController) inputComment:_data.socialId targetId:userId];
+}
+
 - (void)replyTo:(NSString *)userId{
     NSLog(@"replyTo  %@", userId);
     [((SocialTableViewController *)self.viewController) inputComment:_data.socialId targetId:userId];
@@ -572,6 +592,8 @@
     SocialDetailViewController *next = (SocialDetailViewController *)[board instantiateViewControllerWithIdentifier:@"SocialDetail"];
     [next setSocialData:_data];
     [self.viewController.navigationController pushViewController:next animated:YES];
+    
+    [self holdDataList];
 }
 
 
@@ -586,6 +608,14 @@
     [imagePageVC setImages:_data.picArr thumbs:_data.thumbArr startIndex:(int)viewClicked.tag];
 
     [self.viewController.navigationController pushViewController:imagePageVC animated:YES];
+    
+    [self holdDataList];
+}
+
+- (void)holdDataList{
+    
+    SocialTableViewController * vc = (SocialTableViewController *)self.viewController;
+    vc.holdDataList = YES;
 }
 
 

+ 2 - 0
NIMDemo/NIMDemo/SocialTableViewController.h

@@ -14,6 +14,8 @@
 @property (nonatomic, strong) UITableView       *tableView;
 @property (nonatomic, strong) UserInfo          *userInfo;
 
+@property (nonatomic, assign) BOOL              holdDataList;
+
 - (void)inputComment:(NSString *)socialId targetId:(NSString *)targetId;
 - (void)deleteSocial:(NSString *)socialId;
 

+ 45 - 16
NIMDemo/NIMDemo/SocialTableViewController.m

@@ -15,6 +15,7 @@
 #import "User.h"
 #import "SVProgressHUD.h"
 #import "UIAlertView+NTESBlock.h"
+#import "SocialUnreadItemData.h"
 
 @interface SocialTableViewController () <UIScrollViewDelegate, UITextFieldDelegate>
 
@@ -29,6 +30,9 @@
 @property (nonatomic, strong) NSString          *commentSocialId;
 @property (nonatomic, strong) NSString          *commentTargetId;
 
+@property (nonatomic, strong) NSMutableArray<SocialUnreadItemData *>  *unreadDataList;
+@property (nonatomic, assign) BOOL              needReset;
+
 @end
 
 @implementation SocialTableViewController
@@ -42,8 +46,6 @@
     _dataList = [[NSMutableArray alloc] init];
     [_dataList addObject:[User sharedInfo]];
     
-    [self fetchDataList];
-    
     
     _commentContainer = [[UIView alloc] initWithFrame:CGRectMake(0, self.view.height - 50, self.view.width, 50)];
     _commentContainer.backgroundColor = UIColor.whiteColor;
@@ -106,11 +108,20 @@
         [self reset];
     }
     
-    
     if(_userInfo)
        [self.navigationItem setTitle:@"动态"];
     
+    if(!_holdDataList)
+    {
+        [self reset];
+    }
+    else
+    {
+        _holdDataList = NO;
+    }
+    
     [self.tableView reloadData];
+    
 }
 
 - (UITableView *)tableView
@@ -134,9 +145,9 @@
 }
 
 - (void)reset{
-    _dataList = [[NSMutableArray alloc] init];
-    [_dataList addObject:[User sharedInfo]];
+    _needReset = true;
     [self fetchDataList];
+    [self fetchUnreadList];
 }
 
 - (void)fetchDataList{
@@ -147,7 +158,7 @@
     _isFetching = YES;
     
     NSString *lastId = nil;
-    if(self.dataList && self.dataList.count > 1){
+    if(!_needReset && self.dataList && self.dataList.count > 1){
         NSObject *lastData = [self.dataList objectAtIndex:1];
         if([lastData isKindOfClass:[SocialItemData class]])
             lastId = ((SocialItemData *)lastData).socialId;
@@ -155,20 +166,21 @@
         
     [SVProgressHUD show];
     NSString *targetId = _userInfo ? _userInfo.userId : @"";
+    __weak typeof(self) wself = self;
     [[HttpRequest shared] getSocialDataList:lastId targetId:targetId success:^(NSMutableArray *dataList) {
         [SVProgressHUD dismiss];
-        if(!self.dataList)
-        {
-            self.dataList = dataList;
-        }
-        else
+        if(_needReset)
         {
-            NSRange range = NSMakeRange(1, dataList.count);
-            NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:range];
-            [self.dataList insertObjects:dataList atIndexes:set];
+            [wself.dataList removeAllObjects];
+            [wself.dataList addObject:[User sharedInfo]];
+            _needReset = NO;
         }
+
+        NSRange range = NSMakeRange(1, dataList.count);
+        NSIndexSet *set = [NSIndexSet indexSetWithIndexesInRange:range];
+        [wself.dataList insertObjects:dataList atIndexes:set];
         
-        [self.tableView reloadData];
+        [wself.tableView reloadData];
         
         _isFetching = NO;
     } failure:^{
@@ -177,6 +189,18 @@
     }];
 }
 
+- (void)fetchUnreadList{
+    long lastLikeId = [User sharedInfo].userInfo.socialLastLikeId;
+    int lastCommId = [User sharedInfo].userInfo.socialLastCommId;
+    __weak typeof(self) wself = self;
+    [[HttpRequest shared] socialUnreadList:lastLikeId lastCommId:lastCommId success:^(NSMutableArray * _Nullable dataList) {
+        wself.unreadDataList = dataList;
+        [wself.tableView reloadData];
+    } failure:^{
+        
+    }];
+}
+
 
 #pragma mark - Table view data source
 
@@ -216,12 +240,14 @@
         if(!cell)
         {
             cell = [[SocialTopTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
-            [cell initSize:self.view.frame.size.width cellHeight:240];
+            [cell initSize:self.view.frame.size.width cellHeight:240 unreadHeight:60];
         }
         if(_userInfo)
             [cell setData:_userInfo];
         else
             [cell setData:[User sharedInfo].userInfo];
+        
+        [cell setUnread:_unreadDataList];
         baseCell = cell;
     }
     return baseCell;
@@ -239,6 +265,9 @@
     {
         return ((SocialItemData *)data).cellHeight;
     }
+    
+    if(_unreadDataList && _unreadDataList.count > 0 && ([User sharedInfo].userInfo.socialLastLikeId > 0 || [User sharedInfo].userInfo.socialLastCommId > 0))
+        return 240 + 60;
     return 240;
 }
 

+ 2 - 1
NIMDemo/NIMDemo/SocialTopTableViewCell.h

@@ -11,7 +11,8 @@
 
 @interface SocialTopTableViewCell : UITableViewCell
 
-- (void)initSize:(CGFloat)cellWidth cellHeight:(CGFloat)cellHeight;
+- (void)initSize:(CGFloat)cellWidth cellHeight:(CGFloat)cellHeight unreadHeight:(CGFloat)unreadHeight;
 - (void)setData:(UserInfo *)userInfo;
+- (void)setUnread:(NSMutableArray *)unreadList;
 
 @end

+ 125 - 1
NIMDemo/NIMDemo/SocialTopTableViewCell.m

@@ -14,6 +14,8 @@
 #import "HttpRequest.h"
 #import "UIActionSheet+NTESBlock.h"
 #import "SVProgressHUD.h"
+#import "SocialUnreadItemData.h"
+#import "SocialUnreadTableViewController.h"
 
 @interface SocialTopTableViewCell()<UINavigationControllerDelegate, UIImagePickerControllerDelegate>
 
@@ -23,6 +25,16 @@
 @property (nonatomic, strong) UILabel               *nameLabel;
 @property (nonatomic, strong) UserInfo              *userInfo;
 
+@property (nonatomic, strong) UIView                *unreadContainer;
+@property (nonatomic, strong) NIMAvatarImageView    *unreadAvatar;
+@property (nonatomic, strong) UILabel               *unreadLabel;
+
+@property (nonatomic, strong) NSMutableArray        *unreadList;
+
+@property (nonatomic, assign) CGFloat               cellWidth;
+@property (nonatomic, assign) long                  lastLike;
+@property (nonatomic, assign) int                   lastComm;
+
 @end
 
 @implementation SocialTopTableViewCell
@@ -36,7 +48,9 @@
     return self;
 }
 
-- (void)initSize:(CGFloat)cellWidth cellHeight:(CGFloat)cellHeight{
+- (void)initSize:(CGFloat)cellWidth cellHeight:(CGFloat)cellHeight unreadHeight:(CGFloat)unreadHeight{
+    
+    _cellWidth = cellWidth;
     
     _imgBg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, cellWidth, cellHeight)];
     _imgBg.userInteractionEnabled = YES;
@@ -65,6 +79,20 @@
     _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(_avatarImg.right+10, _avatarImg.centerY-15, 200, 30)];
     _nameLabel.textColor = UIColor.whiteColor;
     [self addSubview:_nameLabel];
+    
+    
+    _unreadContainer = [[UIView alloc] initWithFrame:CGRectMake(0, cellHeight+(unreadHeight-40)/2, 0, 40)];
+    [_unreadContainer setBackgroundColor:UIColor.darkGrayColor];
+    [_unreadContainer addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTouchUnread:)]];
+    [self addSubview:_unreadContainer];
+    
+    _unreadAvatar = [[NIMAvatarImageView alloc] initWithFrame:CGRectMake(10, 8, 24, 24)];
+    [_unreadContainer addSubview:_unreadAvatar];
+    
+    _unreadLabel = [[UILabel alloc] initWithFrame:CGRectMake(_unreadAvatar.right+5, 8, 0, 24)];
+    [_unreadLabel setFont:[UIFont systemFontOfSize:15]];
+    _unreadLabel.textColor = UIColor.whiteColor;
+    [_unreadContainer addSubview:_unreadLabel];
 }
 
 - (void)setData:(UserInfo *)userInfo{
@@ -87,6 +115,71 @@
     [self updateBanner];
 }
 
+- (void)setUnread:(NSMutableArray *)unreadList{
+    
+    _lastLike = [User sharedInfo].userInfo.socialLastLikeId;
+    _lastComm = [User sharedInfo].userInfo.socialLastCommId;
+    
+    self.unreadList = unreadList;
+    if(unreadList && unreadList.count)
+    {
+        _unreadContainer.hidden = NO;
+        
+        SocialUnreadItemData *unreadData = [unreadList lastObject];
+        NIMUser *nimUser = [[NIMSDK sharedSDK].userManager userInfo:unreadData.userId];
+        if(nimUser)
+        {
+            [self setUnreadUser:nimUser];
+        }
+        else
+        {
+            __weak typeof(self) wself = self;
+            [[NIMSDK sharedSDK].userManager fetchUserInfos:@[unreadData.userId] completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
+                [wself setUnreadUser:[users objectAtIndex:0]];
+            }];
+        }
+        
+        [_unreadLabel setText:[NSString stringWithFormat:@"%lu%@", (unsigned long)unreadList.count, @"条新消息"]];
+        [_unreadLabel sizeToFit];
+        _unreadLabel.centerY = _unreadContainer.height / 2;
+        _unreadContainer.width = _unreadLabel.right + 10;
+        _unreadContainer.centerX = _cellWidth / 2;
+        
+        for(int i=0; i<unreadList.count; i++)
+        {
+            SocialUnreadItemData *data = [unreadList objectAtIndex:i];
+            if(data.comment.length == 0)
+            {
+                long dataId = [data.dataId longLongValue];
+                if(dataId > _lastLike)
+                    _lastLike = dataId;
+            }
+            else
+            {
+                int dataId = [data.dataId intValue];
+                if(dataId > _lastComm)
+                    _lastComm = dataId;
+            }
+        }
+        
+        if([User sharedInfo].userInfo.socialLastLikeId == 0 && [User sharedInfo].userInfo.socialLastCommId == 0)
+        {
+            _unreadContainer.hidden = YES;
+            [self syncUnread];
+        }
+    }
+    else
+    {
+        _unreadContainer.hidden = YES;
+    }
+}
+
+- (void)setUnreadUser:(NIMUser *)nimUser
+{
+    NSURL *url = nimUser.userInfo.avatarUrl && nimUser.userInfo.avatarUrl.length ? [[NSURL alloc] initWithString:nimUser.userInfo.avatarUrl] : nil;
+    [_unreadAvatar nim_setImageWithURL:url placeholderImage:[User defaultUserAvatar]];
+}
+
 - (void)onTouchBanner:(UITapGestureRecognizer *)gestureRecognizer{
     
     if(![_userInfo.userId isEqualToString:[NIMSDK sharedSDK].loginManager.currentAccount])
@@ -151,4 +244,35 @@
     [User showUserInfo:_userInfo.userId viewController:self.viewController];
 }
 
+- (void)onTouchUnread:(id)sender{
+    [self syncUnread];
+    UIStoryboard *board = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
+    SocialUnreadTableViewController *next = (SocialUnreadTableViewController *)[board instantiateViewControllerWithIdentifier:@"SocialUnread"];
+    [next setDataList:_unreadList];
+    [self.viewController.navigationController pushViewController:next animated:YES];
+}
+
+- (void)syncUnread{
+    if([User sharedInfo].userInfo.socialLastLikeId < _lastLike || [User sharedInfo].userInfo.socialLastCommId < _lastComm)
+    {
+        NSMutableDictionary *data = [[NSMutableDictionary alloc] init];
+        if([User sharedInfo].userInfo.socialLastLikeId < _lastLike)
+        {
+            [User sharedInfo].userInfo.socialLastLikeId = _lastLike;
+            [data setValue:@(_lastLike) forKey:@"social_last_like"];
+        }
+        if([User sharedInfo].userInfo.socialLastCommId < _lastComm)
+        {
+            [User sharedInfo].userInfo.socialLastCommId = _lastComm;
+            [data setValue:@(_lastComm) forKey:@"social_last_comment"];
+        }
+        
+        [[HttpRequest shared] updateUserInfo:data success:^{
+            
+        } failure:^{
+            
+        }];
+    }
+}
+
 @end

+ 21 - 0
NIMDemo/NIMDemo/SocialUnreadItemData.h

@@ -0,0 +1,21 @@
+//
+//  SocialUnreadItemData.h
+//  NIMDemo
+//
+//  Created by Fenix Wang on 2017/11/3.
+//  Copyright © 2017年 Netease. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface SocialUnreadItemData : NSObject
+
+@property (nonatomic, strong) NSString          *dataId;
+@property (nonatomic, strong) NSString          *socialId;
+@property (nonatomic, strong) NSString          *userId;
+@property (nonatomic, strong) NSString          *comment;
+@property (nonatomic, strong) NSString          *socialThumb;
+@property (nonatomic, strong) NSString          *inputtime;
+
+- (void)setData:(NSDictionary *)data;
+@end

+ 21 - 0
NIMDemo/NIMDemo/SocialUnreadItemData.m

@@ -0,0 +1,21 @@
+//
+//  SocialUnreadItemData.m
+//  NIMDemo
+//
+//  Created by Fenix Wang on 2017/11/3.
+//  Copyright © 2017年 Netease. All rights reserved.
+//
+
+#import "SocialUnreadItemData.h"
+
+@implementation SocialUnreadItemData
+
+- (void)setData:(NSDictionary *)data{
+    _dataId = [data objectForKey:@"id"];
+    _socialId = [data objectForKey:@"social_id"];
+    _userId  = [data objectForKey:@"user_id"];
+    _comment = [data objectForKey:@"comment"];
+    _socialThumb = [data objectForKey:@"thumb"];
+    _inputtime = [data objectForKey:@"inputtime"];
+}
+@end

+ 16 - 0
NIMDemo/NIMDemo/SocialUnreadTableViewCell.h

@@ -0,0 +1,16 @@
+//
+//  SocialUnreadTableViewCell.h
+//  NIMDemo
+//
+//  Created by Fenix Wang on 2017/11/3.
+//  Copyright © 2017年 Netease. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "SocialUnreadItemData.h"
+
+@interface SocialUnreadTableViewCell : UITableViewCell
+
+- (void)setData:(SocialUnreadItemData *)data;
+
+@end

+ 105 - 0
NIMDemo/NIMDemo/SocialUnreadTableViewCell.m

@@ -0,0 +1,105 @@
+//
+//  SocialUnreadTableViewCell.m
+//  NIMDemo
+//
+//  Created by Fenix Wang on 2017/11/3.
+//  Copyright © 2017年 Netease. All rights reserved.
+//
+
+#import "SocialUnreadTableViewCell.h"
+#import "NIMAvatarImageView.h"
+#import "UIView+NTES.h"
+#import "User.h"
+#import "UIImageView+WebCache.h"
+
+@interface SocialUnreadTableViewCell()
+@property (weak, nonatomic) IBOutlet UIView *avatarContainer;
+@property (weak, nonatomic) IBOutlet UIButton *nickBtn;
+@property (weak, nonatomic) IBOutlet UIImageView *likeIcon;
+@property (weak, nonatomic) IBOutlet UILabel *commentLabel;
+@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
+@property (weak, nonatomic) IBOutlet UIImageView *socialThumb;
+
+@property (strong, nonatomic) NIMAvatarImageView *avatar;
+
+@property (strong, nonatomic) SocialUnreadItemData *data;
+
+@end
+
+@implementation SocialUnreadTableViewCell
+
+- (void)awakeFromNib {
+    [super awakeFromNib];
+    // Initialization code
+}
+
+- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
+    [super setSelected:selected animated:animated];
+
+    // Configure the view for the selected state
+}
+
+- (void)setData:(SocialUnreadItemData *)data{
+    _data = data;
+    
+    if(!_avatar)
+    {
+        _avatar = [[NIMAvatarImageView alloc] initWithFrame:CGRectMake(0, 0, _avatarContainer.width, _avatarContainer.height)];
+        [_avatar setUserInteractionEnabled:NO];
+        [_avatarContainer addSubview:_avatar];
+    }
+    
+    NIMUser *nimUser = [[NIMSDK sharedSDK].userManager userInfo:data.userId];
+    if(!nimUser)
+    {
+        [[NIMSDK sharedSDK].userManager fetchUserInfos:@[data.userId] completion:^(NSArray<NIMUser *> * _Nullable users, NSError * _Nullable error) {
+            [self setUser:[users objectAtIndex:0]];
+        }];
+    }
+    else
+    {
+        [self setUser:nimUser];
+    }
+    
+    if(data.comment.length)
+    {
+        _likeIcon.hidden = YES;
+        
+    }
+    else
+    {
+        _likeIcon.hidden = NO;
+        
+    }
+    
+    [_commentLabel setText:data.comment];
+    [_timeLabel setText:data.inputtime];
+    
+    NSURL *url = data.socialThumb.length ? [[NSURL alloc] initWithString:data.socialThumb] : nil;
+    if(url)
+    {
+        _socialThumb.hidden = NO;
+        [_socialThumb sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"聊天-_17"]];
+    }
+    else
+    {
+        _socialThumb.hidden = YES;
+    }
+}
+
+- (void)setUser:(NIMUser *)nimUser
+{
+    NSURL *url = nimUser.userInfo.avatarUrl ? [[NSURL alloc] initWithString:nimUser.userInfo.avatarUrl] : nil;
+    [_avatar nim_setImageWithURL:url placeholderImage:[User defaultUserAvatar]];
+    [_nickBtn setTitle:[[User sharedInfo] getUserName:nimUser] forState:UIControlStateNormal];
+    [_nickBtn sizeToFit];
+}
+
+- (IBAction)onTouchNick:(id)sender {
+    if(_data)
+    {
+        [User showUserInfo:_data.userId viewController:self.viewController];
+    }
+}
+
+@end

+ 15 - 0
NIMDemo/NIMDemo/SocialUnreadTableViewController.h

@@ -0,0 +1,15 @@
+//
+//  SocialUnreadTableViewController.h
+//  NIMDemo
+//
+//  Created by Fenix Wang on 2017/11/3.
+//  Copyright © 2017年 Netease. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface SocialUnreadTableViewController : UITableViewController
+
+- (void) setDataList:(NSMutableArray *)list;
+
+@end

+ 130 - 0
NIMDemo/NIMDemo/SocialUnreadTableViewController.m

@@ -0,0 +1,130 @@
+//
+//  SocialUnreadTableViewController.m
+//  NIMDemo
+//
+//  Created by Fenix Wang on 2017/11/3.
+//  Copyright © 2017年 Netease. All rights reserved.
+//
+
+#import "SocialUnreadTableViewController.h"
+#import "SocialUnreadItemData.h"
+#import "SocialUnreadTableViewCell.h"
+#import "SocialDetailViewController.h"
+
+@interface SocialUnreadTableViewController ()
+
+@property (nonatomic, strong) NSMutableArray<SocialUnreadItemData *> *dataList;
+
+@end
+
+@implementation SocialUnreadTableViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    
+    // Uncomment the following line to preserve selection between presentations.
+    // self.clearsSelectionOnViewWillAppear = NO;
+    
+    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
+    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+- (void)viewWillAppear:(BOOL)animated{
+    [super viewWillAppear:animated];
+    
+    UINavigationItem *navItem = self.navigationItem;
+
+    navItem.title = @"新消息";
+}
+
+- (void)setDataList:(NSMutableArray *)list{
+    _dataList = list;
+    [self.tableView reloadData];
+}
+
+#pragma mark - Table view data source
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+    return 1;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    if(_dataList)
+        return _dataList.count;
+    return 0;
+}
+
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"unread" forIndexPath:indexPath];
+    if(cell)
+    {
+        SocialUnreadTableViewCell *unreadCell = (SocialUnreadTableViewCell *)cell;
+        [unreadCell setData:[_dataList objectAtIndex:indexPath.row]];
+    }
+    return cell;
+}
+
+-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    SocialUnreadItemData *itemData = [_dataList objectAtIndex:indexPath.row];
+    UIStoryboard *board = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
+    SocialDetailViewController *next = (SocialDetailViewController *)[board instantiateViewControllerWithIdentifier:@"SocialDetail"];
+    [next setSocialId:itemData.socialId];
+    [self.navigationController pushViewController:next animated:YES];
+    
+    [_dataList removeObject:itemData];
+    [self.tableView reloadData];
+}
+
+
+/*
+// Override to support conditional editing of the table view.
+- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
+    // Return NO if you do not want the specified item to be editable.
+    return YES;
+}
+*/
+
+/*
+// Override to support editing the table view.
+- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
+    if (editingStyle == UITableViewCellEditingStyleDelete) {
+        // Delete the row from the data source
+        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
+    } else if (editingStyle == UITableViewCellEditingStyleInsert) {
+        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
+    }   
+}
+*/
+
+/*
+// Override to support rearranging the table view.
+- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
+}
+*/
+
+/*
+// Override to support conditional rearranging of the table view.
+- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
+    // Return NO if you do not want the item to be re-orderable.
+    return YES;
+}
+*/
+
+/*
+#pragma mark - Navigation
+
+// In a storyboard-based application, you will often want to do a little preparation before navigation
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+    // Get the new view controller using [segue destinationViewController].
+    // Pass the selected object to the new view controller.
+}
+*/
+
+@end

+ 2 - 2
NIMDemo/NIMDemo/Supporting Files/Info.plist

@@ -21,7 +21,7 @@
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>1.0.2</string>
+	<string>1.0.4</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleURLTypes</key>
@@ -36,7 +36,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>4</string>
+	<string>6</string>
 	<key>LSApplicationCategoryType</key>
 	<string></string>
 	<key>LSApplicationQueriesSchemes</key>

+ 1 - 1
NIMDemo/NIMDemo/Supporting Files/NIMDev.entitlements

@@ -3,6 +3,6 @@
 <plist version="1.0">
 <dict>
 	<key>aps-environment</key>
-	<string>sheishuopush</string>
+	<string>ss2017dev</string>
 </dict>
 </plist>

+ 1 - 1
NIMDemo/NIMDemo/Supporting Files/NIMPro.entitlements

@@ -3,6 +3,6 @@
 <plist version="1.0">
 <dict>
 	<key>aps-environment</key>
-	<string>sheishuopushdist</string>
+	<string>ss2017dis</string>
 </dict>
 </plist>

+ 20 - 1
NIMDemo/NIMDemo/TabBarController.m

@@ -11,6 +11,7 @@
 #import "AFNetworking/AFNetworking.h"
 #import "NIMKit.h"
 #import "User.h"
+#import "HttpRequest.h"
 
 @interface TabBarController ()<NIMSystemNotificationManagerDelegate,NIMConversationManagerDelegate>
 
@@ -33,6 +34,14 @@
     self.sessionUnreadCount  = [NIMSDK sharedSDK].conversationManager.allUnreadCount;
     self.systemUnreadCount   = [NIMSDK sharedSDK].systemNotificationManager.allUnreadCount;
     
+    for(NIMRecentSession * recentSession in [NIMSDK sharedSDK].conversationManager.allRecentSessions)
+    {
+        if(recentSession.session.sessionType == NIMSessionTypeTeam && [[User sharedInfo] isSystemTeam:recentSession.session.sessionId])
+        {
+            [[NIMSDK sharedSDK].conversationManager markAllMessagesReadInSession:recentSession.session];
+        }
+    }
+    
     [[User sharedInfo] fetchUserInfo:^(UserInfo * _Nonnull userInfo) {}];
 }
 
@@ -57,7 +66,7 @@
 - (void)deleteTeam:(NSString *)teamId
 {
     NSDictionary *parameters = @{@"id":teamId};
-    NSString *urlString = @"http://whosay.dashgame.com/index.php?m=who&c=index&a=delete_chatroom";
+    NSString *urlString = [NSString stringWithFormat:@"%@%@", [HttpRequest shared].urlRoot, @"index.php?m=who&c=index&a=delete_chatroom"];
     //请求的managers
     AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
     manager.responseSerializer = [AFJSONResponseSerializer new];
@@ -81,6 +90,11 @@
            totalUnreadCount:(NSInteger)totalUnreadCount{
     self.sessionUnreadCount = totalUnreadCount;
     [self refreshSessionBadge];
+    
+    if(recentSession.session.sessionType == NIMSessionTypeTeam && [[User sharedInfo] isSystemTeam:recentSession.session.sessionId])
+    {
+        [[NIMSDK sharedSDK].conversationManager markAllMessagesReadInSession:recentSession.session];
+    }
 }
 
 
@@ -88,6 +102,11 @@
               totalUnreadCount:(NSInteger)totalUnreadCount{
     self.sessionUnreadCount = totalUnreadCount;
     [self refreshSessionBadge];
+    
+    if(recentSession.session.sessionType == NIMSessionTypeTeam && [[User sharedInfo] isSystemTeam:recentSession.session.sessionId])
+    {
+        [[NIMSDK sharedSDK].conversationManager markAllMessagesReadInSession:recentSession.session];
+    }
 }
 
 

+ 2 - 1
NIMDemo/NIMDemo/User.h

@@ -149,7 +149,8 @@
 - (NSAttributedString *_Nonnull)getUserNameStr:(NIMUser *_Nullable)user;
 - (NSString *_Nullable)getUserName:(NIMUser *_Nullable)nimUser;
 - (NSString *_Nullable)getUserNameById:(NSString *_Nullable)userId;
-- (UIImage *_Nullable)getGenderImg:(NIMUser *_Nullable)nimUser;
+- (UIImage *_Nullable)getGenderImg:(NIMUser *_Nonnull)nimUser;
+- (BOOL)hideGenderImg:(NIMUser *_Nonnull)nimUser;
 - (NSString *_Nullable)getDistanceStr:(int)distance;
 - (void)putUserInfo:(UserInfo *_Nullable)userInfo;
 - (UserInfo *_Nullable)pickUserInfo:(NSString *_Nullable)userId;

+ 8 - 4
NIMDemo/NIMDemo/User.m

@@ -228,7 +228,7 @@ int newCreateTeamId;
     
     
     NSDictionary *parameters = @{};
-    NSString *urlString = @"http://whosay.dashgame.com/index.php?m=who&c=index&a=gift_list";
+    NSString *urlString = [NSString stringWithFormat:@"%@%@", [HttpRequest shared].urlRoot, @"index.php?m=who&c=index&a=gift_list"];
     //请求的managers
     AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
     manager.responseSerializer = [AFJSONResponseSerializer new];
@@ -380,7 +380,7 @@ int newCreateTeamId;
                                  @"target":targetId,
                                  @"msg":msg != nil ? msg : @""
                                  };
-    NSString *urlString = @"http://whosay.dashgame.com/index.php?m=who&c=index&a=send_gift";
+    NSString *urlString = [NSString stringWithFormat:@"%@%@", [HttpRequest shared].urlRoot, @"index.php?m=who&c=index&a=send_gift"];
     //请求的managers
     AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
     manager.responseSerializer = [AFJSONResponseSerializer new];
@@ -431,7 +431,7 @@ int newCreateTeamId;
                                  @"team":teamId,
                                  @"target":targetId
                                  };
-    NSString *urlString = @"http://whosay.dashgame.com/index.php?m=who&c=index&a=request_gift";
+    NSString *urlString = [NSString stringWithFormat:@"%@%@", [HttpRequest shared].urlRoot, @"index.php?m=who&c=index&a=request_gift"];
     //请求的managers
     AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
     manager.responseSerializer = [AFJSONResponseSerializer new];
@@ -771,13 +771,17 @@ int newCreateTeamId;
     return nil;
 }
 
-- (UIImage *_Nullable)getGenderImg:(NIMUser *_Nullable)nimUser{
+- (UIImage *_Nullable)getGenderImg:(NIMUser *_Nonnull)nimUser{
     
     if(nimUser.userInfo.gender == NIMUserGenderFemale)
         return [UIImage imageNamed:@"我的_07 (4)"];
     return [UIImage imageNamed:@"我的_07 (3)"];
 }
 
+- (BOOL)hideGenderImg:(NIMUser *_Nonnull)nimUser{
+    return nimUser.userInfo.gender == NIMUserGenderUnknown;
+}
+
 - (BOOL)isSystemTeam:(NSString *_Nonnull)teamId{
     
     NIMTeam *team = [[NIMSDK sharedSDK].teamManager teamById:teamId];

+ 1 - 0
NIMDemo/NIMDemo/UserGiftViewController.m

@@ -187,6 +187,7 @@
     NSURL *url = _nimUser.userInfo.avatarUrl ? [NSURL URLWithString:_nimUser.userInfo.avatarUrl] : nil;
     [_avatar nim_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"avatar_user2"]];
     [_genderImage setImage:[[User sharedInfo] getGenderImg:_nimUser]];
+    _genderImage.hidden = [[User sharedInfo] hideGenderImg:_nimUser];
     NSString *nick = [[User sharedInfo] getUserName:_nimUser];
     
     _nickLabel.text = [NSString stringWithFormat:@"送给:%@", nick];

+ 2 - 1
NIMDemo/NIMDemo/UserInfo.h

@@ -43,7 +43,8 @@
 
 @property (nonatomic, strong) NSString              *address;
 
-
+@property (nonatomic, assign) long                  socialLastLikeId;
+@property (nonatomic, assign) int                   socialLastCommId;
 
 
 - (void)updateHobby:(NSString *)hobbyStr;

+ 3 - 0
NIMDemo/NIMDemo/UserInfo.m

@@ -42,6 +42,9 @@
         
         _address = [data objectForKey:@"address"];
         _alias = [data objectForKey:@"alias"];
+        
+        _socialLastLikeId = [[data objectForKey:@"social_last_like"] longLongValue];
+        _socialLastCommId = [[data objectForKey:@"social_last_comment"] intValue];
     }
     return self;
 }

+ 9 - 3
NIMDemo/NIMDemo/UserInfoViewController.m

@@ -92,6 +92,8 @@
     [self fetchGift];
     
     [_picContainer addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTouchMorePic:)]];
+    
+    [self checkTeamKick];
 }
 
 - (void)didReceiveMemoryWarning {
@@ -239,6 +241,7 @@
         url = _nimUser.userInfo.avatarUrl ? [NSURL URLWithString:_nimUser.userInfo.avatarUrl] : nil;
         [_avatar nim_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"avatar_user2"]];
         [_genderImage setImage:[[User sharedInfo] getGenderImg:_nimUser]];
+        _genderImage.hidden = [[User sharedInfo] hideGenderImg:_nimUser];
         _nickLabel.text = [[User sharedInfo] getUserName:_nimUser];
         _idLabel.text = [NSString stringWithFormat:@"ID:%@", _userInfo.ssid];
     }
@@ -442,14 +445,17 @@
 }
 
 - (void)removeMember{
+    __weak typeof(self) wself = self;
     [SVProgressHUD show];
     [[NIMSDK sharedSDK].teamManager kickUsers:@[_userId] fromTeam:_team.teamId completion:^(NSError * _Nullable error) {
         [SVProgressHUD dismiss];
         if(!error) {
-            [self.view makeToast:@"移除成功"];
-            [self.navigationController popViewControllerAnimated:YES];
+            [wself.view makeToast:@"移除成功"];
+            NSString *msg = [NSString stringWithFormat:@"%@%@", @"你已经被移出群组 ",_team.teamName];
+            [[HttpRequest shared] teamKicked:_userId msg:msg teamId:_team.teamId];
+            [wself.navigationController popViewControllerAnimated:YES];
         } else {
-            [self.view makeToast:@"移除失败"];
+            [wself.view makeToast:@"移除失败"];
         }
     }];
 }

BIN
SSDev.p12


BIN
SSDis.p12


BIN
SheiShuoDev.mobileprovision


BIN
SheiShuoDis.mobileprovision


BIN
aps-dis.cer


BIN
aps_dev.cer


BIN
ios_development.cer


BIN
ios_distribution.cer