Browse Source

no message

Fenix Wang 8 years ago
parent
commit
ae686c0b34

+ 8 - 0
NIMDemo/NIM.entitlements

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>aps-environment</key>
+	<string>development</string>
+</dict>
+</plist>

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


+ 6 - 4
NIMDemo/NIMDemo.xcodeproj/project.pbxproj

@@ -677,6 +677,7 @@
 		C482C33D1F15CA8500EF2B71 /* LocationManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LocationManager.m; path = ../../../../../fenix/XCode_Project/NIM_iOS_Demo_v3/NIMDemo/NIMDemo/LocationManager.m; sourceTree = "<group>"; };
 		C482C3451F16360100EF2B71 /* CityManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CityManager.h; path = ../../../../../fenix/XCode_Project/NIM_iOS_Demo_v3/NIMDemo/NIMDemo/CityManager.h; sourceTree = "<group>"; };
 		C482C3461F16360100EF2B71 /* CityManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CityManager.m; path = ../../../../../fenix/XCode_Project/NIM_iOS_Demo_v3/NIMDemo/NIMDemo/CityManager.m; sourceTree = "<group>"; };
+		C482C3481F17200A00EF2B71 /* NIM.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = NIM.entitlements; sourceTree = "<group>"; };
 		C4A7345E1EE6BBD300D6489D /* GroupMoreTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupMoreTableViewController.h; sourceTree = "<group>"; };
 		C4A7345F1EE6BBD300D6489D /* GroupMoreTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GroupMoreTableViewController.m; sourceTree = "<group>"; };
 		C4A734611EE6D4DE00D6489D /* GroupMoreTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupMoreTableViewCell.h; sourceTree = "<group>"; };
@@ -1643,6 +1644,7 @@
 		AE5882DC1A6F47E10070536A = {
 			isa = PBXGroup;
 			children = (
+				C482C3481F17200A00EF2B71 /* NIM.entitlements */,
 				AE5882E71A6F47E10070536A /* whosay */,
 				AE5882E61A6F47E10070536A /* Products */,
 				5176189D0086B38FE643A26A /* Frameworks */,
@@ -2473,7 +2475,7 @@
 				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
 				CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
 				CLANG_CXX_LIBRARY = "compiler-default";
-				CODE_SIGN_ENTITLEMENTS = "NIMDemo/Supporting Files/NIMDev.entitlements";
+				CODE_SIGN_ENTITLEMENTS = NIM.entitlements;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				DEVELOPMENT_TEAM = DGEMLT57K8;
@@ -2500,7 +2502,7 @@
 					"-framework",
 					"\"NIMAVChat\"",
 				);
-				PRODUCT_BUNDLE_IDENTIFIER = com.dashgame.whosay;
+				PRODUCT_BUNDLE_IDENTIFIER = com.sheishuo.app;
 				PRODUCT_NAME = NIM;
 				PROVISIONING_PROFILE = "";
 				PROVISIONING_PROFILE_SPECIFIER = "";
@@ -2517,7 +2519,7 @@
 				ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
 				CLANG_CXX_LANGUAGE_STANDARD = "compiler-default";
 				CLANG_CXX_LIBRARY = "compiler-default";
-				CODE_SIGN_ENTITLEMENTS = "NIMDemo/Supporting Files/NIMPro.entitlements";
+				CODE_SIGN_ENTITLEMENTS = NIM.entitlements;
 				CODE_SIGN_IDENTITY = "iPhone Developer";
 				"CODE_SIGN_IDENTITY[sdk=*]" = "$(XCCONFIG_CODE_SIGNING)";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -2550,7 +2552,7 @@
 					"-framework",
 					"\"NIMAVChat\"",
 				);
-				PRODUCT_BUNDLE_IDENTIFIER = com.dashgame.whosay;
+				PRODUCT_BUNDLE_IDENTIFIER = com.sheishuo.app;
 				PRODUCT_NAME = NIM;
 				PROVISIONING_PROFILE = "";
 				PROVISIONING_PROFILE_SPECIFIER = "";

+ 0 - 9
NIMDemo/NIMDemo/Classes/Sections/Session/Model/Object/NTESGiftAttachment.m

@@ -93,15 +93,6 @@
     self.targetId = [data jsonString:@"targetId"];
     self.count = [data jsonString:@"count"];
     
-    AppDelegate *appdelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-    UINavigationController* navController = (UINavigationController *)appdelegate.window.rootViewController;
-    UIViewController *topViewController = navController.topViewController;
-//    NSLog(@"%@", topViewController);
-    
-    if([topViewController isKindOfClass:[NTESSessionViewController class]])
-    {
-        [(NTESSessionViewController *)topViewController handleGiftMessage:self];
-    }
 }
 
 @end

+ 35 - 3
NIMDemo/NIMDemo/Classes/Sections/Session/ViewController/NTESSessionViewController.m

@@ -73,7 +73,8 @@ NIMContactSelectDelegate,
 NIMEventSubscribeManagerDelegate,
 GiftDataSourceDelegate,
 TradeInputDelegate,
-NIMInputDelegate>
+NIMInputDelegate,
+NIMSessionDelegate>
 
 @property (nonatomic,strong)    NTESCustomSysNotificationSender *notificaionSender;
 @property (nonatomic,strong)    NTESSessionConfig       *sessionConfig;
@@ -1045,8 +1046,32 @@ NIMInputDelegate>
     [self handleGiftMessage:attachment];
 }
 
-- (void)handleGiftMessage:(NTESGiftAttachment *)giftAttachment{
+
+- (void)handleCustomizeMessages:(NSArray *)messages
+{
+    NIMMessage *message = messages.firstObject;
+    NIMSession *session = message.session;
+    if (![session isEqual:self.session] || !messages.count){
+        return;
+    }
     
+    for(int i=0; i<messages.count; i++)
+    {
+        NIMMessage *msg = [messages objectAtIndex:i];
+        if(msg.messageType == NIMMessageTypeCustom)
+        {
+            NIMCustomObject *cusObj = (NIMCustomObject *)msg.messageObject;
+            if([cusObj.attachment isKindOfClass:[NTESGiftAttachment class]])
+            {
+                NTESGiftAttachment *giftAttachment = (NTESGiftAttachment *)cusObj.attachment;
+                [self handleGiftMessage:giftAttachment];
+            }
+        }
+    }
+}
+
+
+- (void)handleGiftMessage:(NTESGiftAttachment *)giftAttachment{
     
     NSString *giftId = giftAttachment.giftId;
     NSString *senderId = giftAttachment.senderId;
@@ -1094,6 +1119,13 @@ NIMInputDelegate>
         NSURL *url = [NSURL URLWithString:giftAttachment.movieURL];
         [_giftMovie sd_setImageWithURL:url placeholderImage:nil];
         [_giftMovieContainer setHidden:NO];
+        
+        [_giftMovieContainer setNeedsLayout];
+        [_giftMovieContainer setNeedsDisplay];
+        
+        [self.view setNeedsLayout];
+        [self.view setNeedsDisplay];
+        
     }
     
 }
@@ -1133,7 +1165,7 @@ NIMInputDelegate>
 
 - (void)hideGiftMovie:(id)sender
 {
-    _giftMovieContainer.hidden = YES;
+    [_giftMovieContainer setHidden:YES];
 }
 
 - (void)inputTabSelected{

+ 4 - 0
NIMDemo/NIMDemo/LoginViewController.m

@@ -64,11 +64,14 @@
     NSString *mobile = self.mobileTextField.text;
     NSString *pwd = self.pwdTextField.text;
     
+    [SVProgressHUD show];
+    
     [[HttpRequest shared] loginAccount:mobile password:pwd success:^{
         User *user = [User sharedInfo];
         [self loginNIM:[NSString stringWithFormat:@"%d", user.userId] token:user.token];
     } failure:^{
         [self.view makeToast:@"登录谁说失败" duration:2.0 position:CSToastPositionCenter];
+        [SVProgressHUD dismiss];
     }];
 }
 
@@ -77,6 +80,7 @@
         [self showTabBarView];
     } failure:^(NSError * _Nullable error) {
         [self.view makeToast:[NSString stringWithFormat:@"进入聊天失败 error:%@", error] duration:2.0 position:CSToastPositionCenter];
+        [SVProgressHUD dismiss];
     }];
 }
 

+ 9 - 0
NIMDemo/NIMDemo/SectionTrade/MyTradeTableViewCell.m

@@ -123,6 +123,7 @@
     _priorityBtn.layer.borderWidth = 1;
     _priorityBtn.layer.borderColor = UIColor.lightGrayColor.CGColor;
     [_priorityBtn setTitleColor:User.greenColor forState:UIControlStateNormal];
+    [_priorityBtn addTarget:self action:@selector(onTouchPrioirty:) forControlEvents:UIControlEventTouchUpInside];
     [_actionContainer addSubview:_priorityBtn];
     
     _followCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(cellWidth-90, 8, 80, 24)];
@@ -314,6 +315,14 @@
     
 }
 
+- (void)onTouchPrioirty:(id)sender{
+    
+    if([[User sharedInfo] isMe:_data.userId])
+    {
+        [self onTouchModifyImage:nil];
+    }
+    
+}
 
 - (void)onTouchModifyImage:(id)sender{
     

+ 31 - 0
NIMDemo/NIMDemo/SectionTrade/TradeModifyViewController.m

@@ -171,6 +171,33 @@
 }
 
 
+
+- (void)reloadData{
+    
+    while(_imgArr.count > 0)
+    {
+        TradeModifyImageView *imgView = [_imgArr objectAtIndex:0];
+        [_imgArr removeObjectAtIndex:0];
+        [_imgReuseArr addObject:imgView];
+    }
+    
+    for(int i=0; i<_data.thumbArr.count; i++)
+    {
+        NSString *picId = [_data.picIdArr objectAtIndex:i];
+        NSString *pic = [_data.picArr objectAtIndex:i];
+        NSString *thumb = [_data.thumbArr objectAtIndex:i];
+        
+        [self createTradeImage:thumb pic:pic index:i picId:picId];
+    }
+    [self layoutImages:NO];
+    
+    
+    _slider.value = 0;
+    [self sliderValueChanged];
+}
+
+
+
 - (TradeModifyImageView *)createTradeImage:(NSString *)thumb pic:(NSString *)pic index:(int)index picId:(NSString *)picId{
     
     TradeModifyImageView *imgView = nil;
@@ -346,6 +373,8 @@
 
 
 
+
+
 - (void)sliderValueChanged{
     _countLabel.text = [NSString stringWithFormat:@"x%d(+%.0f) (%@ 单价%d)", _data.priority, roundf(_slider.value), _priorityTypeItem.name, _priorityTypeItem.price];
 }
@@ -395,6 +424,8 @@
             _data.picArr = tradeData.picArr;
             _data.thumbArr = tradeData.thumbArr;
             _data.priority = tradeData.priority;
+            
+            [self reloadData];
         }
         
         [self.view makeToast:@"修改成功" duration:2 position:CSToastPositionCenter];

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

@@ -16,6 +16,7 @@
 #import "HttpRequest.h"
 #import "TradeUtil.h"
 #import "TradeDetailViewController.h"
+#import "TradeModifyViewController.h"
 
 
 @interface TradeTableViewCell() <UITextViewDelegate>
@@ -110,6 +111,7 @@ return self;
     _priorityBtn.layer.borderWidth = 1;
     _priorityBtn.layer.borderColor = UIColor.lightGrayColor.CGColor;
     [_priorityBtn setTitleColor:User.greenColor forState:UIControlStateNormal];
+    [_priorityBtn addTarget:self action:@selector(onTouchPrioirty:) forControlEvents:UIControlEventTouchUpInside];
     [_actionContainer addSubview:_priorityBtn];
     
     UIView *step = [[UIView alloc] initWithFrame:CGRectMake(0, 39, cellWidth, 0.5)];
@@ -274,6 +276,15 @@ return self;
 }
 
 
+- (void)onTouchPrioirty:(id)sender{
+    
+    if([[User sharedInfo] isMe:_data.userId])
+    {
+        TradeModifyViewController *vc = [[TradeModifyViewController alloc] initWithTradeData:_data];
+        [self.viewController.navigationController pushViewController:vc animated:YES];
+    }
+    
+}
 
 
 @end

+ 3 - 1
NIMDemo/NIMDemo/SectionTrade/TradeViewController.m

@@ -201,7 +201,7 @@ float postHeight = 30;
 - (void)viewWillAppear:(BOOL)animated{
     [super viewWillAppear:animated];
     
-    //[_timer setFireDate:[NSDate distantPast]];
+    [_timer setFireDate:[NSDate distantPast]];
     
     User *user = [User sharedInfo];
     
@@ -273,6 +273,8 @@ float postHeight = 30;
     
     
     _balanceLabel.text = [NSString stringWithFormat:@"余额:%d", [User sharedInfo].coin];
+    
+    [self.tableView reloadData];
 }
 
 

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

@@ -1,8 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
-<dict>
-	<key>aps-environment</key>
-	<string>development</string>
-</dict>
+<dict/>
 </plist>

+ 2 - 0
NIMDemo/NIMDemo/User.h

@@ -94,6 +94,8 @@
 + (NSString *_Nonnull)distance:(double)originLat originLng:(double)originLng targetLat:(double)targetLat targetLng:(double)targetLng;
 
 + (void)showUserInfo:(NSString *_Nullable)userId;
+
+- (BOOL)isMe:(NSString *_Nullable)userId;
 - (BOOL)isTeamOwner:(NIMTeam *_Nullable)team;
 - (NSAttributedString *_Nonnull)getUserNameStr:(NIMUser *_Nullable)user;
 

+ 7 - 1
NIMDemo/NIMDemo/User.m

@@ -108,7 +108,13 @@ int newCreateTeamId;
 }
 
 
-
+- (BOOL)isMe:(NSString *_Nullable)userId{
+    if(userId && [userId isEqualToString:[NIMSDK sharedSDK].loginManager.currentAccount])
+    {
+        return YES;
+    }
+    return NO;
+}
 
 
 - (void)requestGiftList:(void (^_Nullable)(NSMutableArray * _Nullable list))sucCallBack

+ 9 - 0
NIMKit/NIMKit/Classes/Sections/Session/ViewController/NIMSessionViewController.h

@@ -13,6 +13,14 @@
 #import "NIMSessionConfigurateProtocol.h"
 #import "NIMInputView.h"
 
+
+@protocol NIMSessionDelegate <NSObject>
+
+- (void)handleCustomizeMessages:(NSArray *)messages;
+
+@end
+
+
 @interface NIMSessionViewController : UIViewController<NIMSessionInteractorDelegate,NIMInputActionDelegate,NIMMessageCellDelegate,NIMChatManagerDelegate,NIMConversationManagerDelegate>
 
 @property (nonatomic, strong)  UITableView *tableView;
@@ -86,6 +94,7 @@
  */
 - (void)sendMessage:(NIMMessage *)message;
 
+
 #pragma mark - 录音接口
 /**
  *  录音失败回调

+ 7 - 0
NIMKit/NIMKit/Classes/Sections/Session/ViewController/NIMSessionViewController.m

@@ -245,9 +245,16 @@
     [self sendMessageReceipt:messages];
     
     [self.conversationManager markAllMessagesReadInSession:self.session];
+    
+    id<NIMSessionDelegate> delegate = (id<NIMSessionDelegate>)self;
+    if(delegate && [delegate respondsToSelector:@selector(handleCustomizeMessages:)])
+    {
+        [delegate handleCustomizeMessages:messages];
+    }
 }
 
 
+
 - (void)fetchMessageAttachment:(NIMMessage *)message progress:(float)progress
 {
     if ([message.session isEqual:_session]) {

BIN
SheiShuoDev.mobileprovision


BIN
SheiShuoDis.mobileprovision