Commit cadca63b13a209956a1c0ca2fa985771be0d9fff

Authored by niudaojian
1 parent a00658b4

0.6.9 存家园共享消息到本地

CNLiveNewIMAManagerKit.podspec
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 8
9 Pod::Spec.new do |s| 9 Pod::Spec.new do |s|
10 s.name = 'CNLiveNewIMAManagerKit' 10 s.name = 'CNLiveNewIMAManagerKit'
11 - s.version = '0.6.8' 11 + s.version = '0.6.9'
12 s.summary = 'A short description of CNLiveNewIMAManagerKit.' 12 s.summary = 'A short description of CNLiveNewIMAManagerKit.'
13 13
14 #s.description = <<-DESC 14 #s.description = <<-DESC
CNLiveNewIMAManagerKit/Classes/Playform/IMAConversationManager.m
@@ -1092,6 +1092,7 @@ @@ -1092,6 +1092,7 @@
1092 } 1092 }
1093 else if ([dic[@"type"] integerValue] == CustomMsgTypeShareGift) 1093 else if ([dic[@"type"] integerValue] == CustomMsgTypeShareGift)
1094 { 1094 {
  1095 + //礼物消息
1095 NSDictionary *giftInfoData = [dic objectForKey:@"giftInfoData"]; 1096 NSDictionary *giftInfoData = [dic objectForKey:@"giftInfoData"];
1096 if ([giftInfoData[@"toType"] intValue] == 2 && [giftInfoData[@"giftType"] intValue] == 1) { 1097 if ([giftInfoData[@"toType"] intValue] == 2 && [giftInfoData[@"giftType"] intValue] == 1) {
1097 //对方已收礼 1098 //对方已收礼
@@ -1100,6 +1101,7 @@ @@ -1100,6 +1101,7 @@
1100 } 1101 }
1101 else if ([dic[@"type"] integerValue] == CustomMsgTypeTransferExpired) 1102 else if ([dic[@"type"] integerValue] == CustomMsgTypeTransferExpired)
1102 { 1103 {
  1104 + //转余额过期,无人领取 消息
1103 NSDictionary *transferBalanceExpiredData = [dic objectForKey:@"transferBalanceExpiredData"]; 1105 NSDictionary *transferBalanceExpiredData = [dic objectForKey:@"transferBalanceExpiredData"];
1104 1106
1105 [[NSNotificationCenter defaultCenter] postNotificationName:@"CNTransferBalanceExpiredSuccessNotification" object:nil userInfo:transferBalanceExpiredData]; 1107 [[NSNotificationCenter defaultCenter] postNotificationName:@"CNTransferBalanceExpiredSuccessNotification" object:nil userInfo:transferBalanceExpiredData];
@@ -1111,6 +1113,7 @@ @@ -1111,6 +1113,7 @@
1111 } 1113 }
1112 else if ([dic[@"type"] integerValue] == CustomMsgTypeTransferBalance) 1114 else if ([dic[@"type"] integerValue] == CustomMsgTypeTransferBalance)
1113 { 1115 {
  1116 + //转余额消息
1114 NSDictionary *transferBalanceData = [dic objectForKey:@"transferBalanceData"]; 1117 NSDictionary *transferBalanceData = [dic objectForKey:@"transferBalanceData"];
1115 NSString *type = [NSString stringWithFormat:@"%@",transferBalanceData[@"type"]]; 1118 NSString *type = [NSString stringWithFormat:@"%@",transferBalanceData[@"type"]];
1116 if ([transferBalanceData[@"toId"] isEqualToString:CNUserShareModel.uid] && [type isEqualToString:@"1"]) { 1119 if ([transferBalanceData[@"toId"] isEqualToString:CNUserShareModel.uid] && [type isEqualToString:@"1"]) {
@@ -1188,6 +1191,58 @@ @@ -1188,6 +1191,58 @@
1188 [[CNCommuntyOrderStatusCacheManager shareCacheManager] setObject:@{orderId : @(status)} forKey:conv.getReceiver]; 1191 [[CNCommuntyOrderStatusCacheManager shareCacheManager] setObject:@{orderId : @(status)} forKey:conv.getReceiver];
1189 } 1192 }
1190 } 1193 }
  1194 + else if ([dic[@"type"] integerValue] == CustomMsgTypCommuntyOrder)
  1195 + {
  1196 + //共享商品到家园消息
  1197 + NSDictionary *shareGoodsData = dic[@"shareGoodsData"];
  1198 + //获取家园id,院子仓库类型, 商品类别
  1199 + NSString *familyId = shareGoodsData[@"familyId"];
  1200 + NSString *type = [NSString stringWithFormat:@"%@",shareGoodsData[@"type"]];
  1201 + NSString *idStr = [NSString stringWithFormat:@"%@",shareGoodsData[@"id"]];
  1202 + i
  1203 + //把新消息提醒存入本地,通过NSUserDefaults 存储, 已家庭id为key, 以包含json字符串的数组承载消息提醒,通过NSSet去重
  1204 + NSDictionary *valueDic = @{@"type":type,
  1205 + @"id":idStr,
  1206 + };
  1207 +
  1208 + NSString *valueStr = [valueDic mj_JSONString];
  1209 +
  1210 + //以家庭id为key
  1211 + NSString *key = [NSString stringWithFormat:@"CNFamilyId_%@",familyId];
  1212 +
  1213 + NSArray *array = [[NSUserDefaults standardUserDefaults] objectForKey:key];
  1214 + if (array) {
  1215 + //本地已有数据,进行更新
  1216 + NSMutableSet *mutSet = [NSMutableSet setWithArray:array];
  1217 + [mutSet addObject:valueStr];
  1218 +
  1219 + NSMutableArray *mutArray = [[NSMutableArray alloc] init];
  1220 + for (NSString *value in mutSet) {
  1221 + [mutArray addObject:value];
  1222 + }
  1223 + [[NSUserDefaults standardUserDefaults] setObject:mutArray.copy forKey:key];
  1224 + [[NSUserDefaults standardUserDefaults] synchronize];
  1225 +
  1226 + NSLog(@"array = %@",array);
  1227 + }
  1228 + else
  1229 + {
  1230 + //本地没有数据,进行添加
  1231 + NSMutableSet *mutSet = [NSMutableSet new];
  1232 + [mutSet addObject:valueStr];
  1233 +
  1234 + NSMutableArray *mutArray = [[NSMutableArray alloc] init];
  1235 + for (NSString *value in mutSet) {
  1236 + [mutArray addObject:value];
  1237 + }
  1238 + [[NSUserDefaults standardUserDefaults] setObject:mutArray.copy forKey:key];
  1239 + [[NSUserDefaults standardUserDefaults] synchronize];
  1240 +
  1241 + }
  1242 +
  1243 + [[NSNotificationCenter defaultCenter] postNotificationName:kIMAMSG_FamilyShareGoodsNotification object:nil userInfo:valueDic];
  1244 +
  1245 + }
1191 return isBreak; 1246 return isBreak;
1192 } 1247 }
1193 1248
CNLiveNewIMAManagerKit/Classes/PublicHeader/IMANotification.h
@@ -176,5 +176,7 @@ static NSString *const kIMAMSG_ScanPaySuccessNotification = @&quot;kIMAMSG_ScanPaySuc @@ -176,5 +176,7 @@ static NSString *const kIMAMSG_ScanPaySuccessNotification = @&quot;kIMAMSG_ScanPaySuc
176 static NSString *const kIMAMSG_FamilyNewMessageNotification = @"kIMAMSG_FamilyNewMessageNotification"; 176 static NSString *const kIMAMSG_FamilyNewMessageNotification = @"kIMAMSG_FamilyNewMessageNotification";
177 ///家园收到礼包消息推送 177 ///家园收到礼包消息推送
178 static NSString *const kIMAMSG_FamilyGiftNotification = @"kIMAMSG_FamilyGiftNotification"; 178 static NSString *const kIMAMSG_FamilyGiftNotification = @"kIMAMSG_FamilyGiftNotification";
  179 +///家园收到商品共享消息
  180 +static NSString *const kIMAMSG_FamilyShareGoodsNotification = @"kIMAMSG_FamilyShareGoodsNotification";
179 181
180 #endif /* IMANotification_h */ 182 #endif /* IMANotification_h */