Commit 43736ab1560b1809612953a8c0bcbb82bb2387f4
1 parent
0bd18b30
0.4.3 版本 添加维修订单消息状态缓存, 添加家园礼包通知
Showing
30 changed files
with
239 additions
and
3 deletions
CNLiveNewIMAManagerKit.podspec
CNLiveNewIMAManagerKit/Classes/Playform/IMAConversationManager.m
| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | #import "CNGroupListInfoModel.h" |
| 11 | 11 | #import "CNGroupListAvaterUtil.h" |
| 12 | 12 | #import "CNUserProfileFMDBManager.h" |
| 13 | +#import "CNCommuntyOrderStatusCacheManager.h" | |
| 13 | 14 | |
| 14 | 15 | @implementation IMAConversationChangedNotifyItem |
| 15 | 16 | |
| ... | ... | @@ -1094,6 +1095,54 @@ |
| 1094 | 1095 | [[NSNotificationCenter defaultCenter] postNotificationName:kIMAMSG_ScanPaySuccessNotification object:nil userInfo:dic]; |
| 1095 | 1096 | isBreak = YES; |
| 1096 | 1097 | } |
| 1098 | + else if ([dic[@"type"] integerValue] == CustomMsgTypeFamilyGift) | |
| 1099 | + { | |
| 1100 | + //我的家园群收到礼包消息 | |
| 1101 | + NSString *familyId = dic[@"familyGiftData"][@"familyId"]; | |
| 1102 | + [[NSNotificationCenter defaultCenter] postNotificationName:kIMAMSG_FamilyGiftNotification object:nil userInfo:@{@"familyId" : familyId ? familyId : @""}]; | |
| 1103 | + | |
| 1104 | + } | |
| 1105 | + else if ([dic[@"type"] integerValue] == CustomMsgTypCommuntyOrder) | |
| 1106 | + { | |
| 1107 | + | |
| 1108 | + //社区报修订单消息数据 | |
| 1109 | + NSDictionary *repairOrder = dic[@"repairOrder"]; | |
| 1110 | + //订单id | |
| 1111 | + NSString *orderId = repairOrder[@"id"]; | |
| 1112 | + //社区报修订单状态 0:未接单 1:已接单,2:已取消 3:已完成 | |
| 1113 | + NSInteger status = [repairOrder[@"status"] integerValue]; | |
| 1114 | + | |
| 1115 | + NSDictionary *cacheData = [[CNCommuntyOrderStatusCacheManager shareCacheManager] objectForKey:conv.getReceiver]; | |
| 1116 | + | |
| 1117 | + if (cacheData) { | |
| 1118 | + //本地有存 | |
| 1119 | + NSMutableDictionary *mutableCacheData = [[NSMutableDictionary alloc] initWithDictionary:cacheData]; | |
| 1120 | + | |
| 1121 | + ///本地是否存有该订单的状态 | |
| 1122 | + __block BOOL cacheHasOrder = NO; | |
| 1123 | + | |
| 1124 | + [mutableCacheData enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSNumber *obj, BOOL * _Nonnull stop) { | |
| 1125 | + if ([key isEqualToString:@"123"]) { | |
| 1126 | + //有.更新状态 | |
| 1127 | + [mutableCacheData setValue:@(status) forKey:key]; | |
| 1128 | + cacheHasOrder = YES; | |
| 1129 | + *stop = YES; | |
| 1130 | + } | |
| 1131 | + }]; | |
| 1132 | + | |
| 1133 | + if (!cacheHasOrder) { | |
| 1134 | + //没有,保存该订单的状态 | |
| 1135 | + [mutableCacheData setObject:@(status) forKey:orderId]; | |
| 1136 | + } | |
| 1137 | + | |
| 1138 | + [[CNCommuntyOrderStatusCacheManager shareCacheManager] updateObject:mutableCacheData.copy forKey:conv.getReceiver]; | |
| 1139 | + } | |
| 1140 | + else | |
| 1141 | + { | |
| 1142 | + //本地没有 | |
| 1143 | + [[CNCommuntyOrderStatusCacheManager shareCacheManager] setObject:@{orderId : @(status)} forKey:conv.getReceiver]; | |
| 1144 | + } | |
| 1145 | + } | |
| 1097 | 1146 | return isBreak; |
| 1098 | 1147 | } |
| 1099 | 1148 | ... | ... |
CNLiveNewIMAManagerKit/Classes/PublicHeader/IMANotification.h
| ... | ... | @@ -174,4 +174,7 @@ static NSString *const kIMAMSG_ScanPaySuccessNotification = @"kIMAMSG_ScanPaySuc |
| 174 | 174 | |
| 175 | 175 | #pragma mark 收到家园群消息 |
| 176 | 176 | static NSString *const kIMAMSG_FamilyNewMessageNotification = @"kIMAMSG_FamilyNewMessageNotification"; |
| 177 | +///家园收到礼包消息推送 | |
| 178 | +static NSString *const kIMAMSG_FamilyGiftNotification = @"kIMAMSG_FamilyGiftNotification"; | |
| 179 | + | |
| 177 | 180 | #endif /* IMANotification_h */ | ... | ... |
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNAdiminFMDBManager.h renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNAdiminFMDBManager.h
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNAdiminFMDBManager.m renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNAdiminFMDBManager.m
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNAdiminObject.h renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNAdiminObject.h
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNAdiminObject.m renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNAdiminObject.m
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNChatGroupMemberInfoCacheManager.h renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNChatGroupMemberInfoCacheManager.h
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNChatGroupMemberInfoCacheManager.m renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNChatGroupMemberInfoCacheManager.m
CNLiveNewIMAManagerKit/Classes/TIMManager/CNCommuntyOrderStatusCacheManager.h
0 → 100644
| 1 | +// | |
| 2 | +// CNCommuntyOrderStatusCacheManager.h | |
| 3 | +// CNLiveNewIMAManagerKit | |
| 4 | +// | |
| 5 | +// Created by daojian on 2022/3/2. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#import <Foundation/Foundation.h> | |
| 9 | + | |
| 10 | +NS_ASSUME_NONNULL_BEGIN | |
| 11 | +/// 社区订单状态缓存管理 | |
| 12 | +@interface CNCommuntyOrderStatusCacheManager : NSObject | |
| 13 | +/// 获取管理类 | |
| 14 | ++ (instancetype)shareCacheManager; | |
| 15 | + | |
| 16 | +/// 添加 | |
| 17 | +/// @param object | |
| 18 | +/// @{ | |
| 19 | +/// orderId : orderStatus, | |
| 20 | +/// orderId : orderStatus, | |
| 21 | +/// orderId : orderStatus, | |
| 22 | +/// orderId : orderStatus, | |
| 23 | +///} | |
| 24 | +/// @param key 社区群id | |
| 25 | +- (void)setObject:(NSDictionary *)object forKey:(NSString *)key; | |
| 26 | + | |
| 27 | + | |
| 28 | +/// 获取数据 | |
| 29 | +/// @param key 社区群id | |
| 30 | +- (NSDictionary *)objectForKey:(NSString *)key; | |
| 31 | + | |
| 32 | +/// 删除 | |
| 33 | +/// @param key 社区群id | |
| 34 | +- (void)deleteForKey:(NSString *)key; | |
| 35 | + | |
| 36 | + | |
| 37 | +/// 更新 | |
| 38 | +/// @param object | |
| 39 | +/// @{ | |
| 40 | +/// orderId : orderStatus, | |
| 41 | +/// orderId : orderStatus, | |
| 42 | +/// orderId : orderStatus, | |
| 43 | +/// orderId : orderStatus, | |
| 44 | +///} | |
| 45 | +/// @param key 社区群id | |
| 46 | +- (void)updateObject:(NSDictionary *)object forKey:(NSString *)key; | |
| 47 | + | |
| 48 | + | |
| 49 | +/// 查询 社区群 里是否有新订单 | |
| 50 | +/// @param key 社区id | |
| 51 | +- (BOOL)hasNewOrderForKey:(NSString *)key; | |
| 52 | + | |
| 53 | +@end | |
| 54 | + | |
| 55 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveNewIMAManagerKit/Classes/TIMManager/CNCommuntyOrderStatusCacheManager.m
0 → 100644
| 1 | +// | |
| 2 | +// CNCommuntyOrderStatusCacheManager.m | |
| 3 | +// CNLiveNewIMAManagerKit | |
| 4 | +// | |
| 5 | +// Created by daojian on 2022/3/2. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#import "CNCommuntyOrderStatusCacheManager.h" | |
| 9 | + | |
| 10 | +#import <YYCache/YYCache.h> | |
| 11 | + | |
| 12 | +@interface CNCommuntyOrderStatusCacheManager() | |
| 13 | + | |
| 14 | +@property (nonatomic, strong)YYCache *cache; | |
| 15 | + | |
| 16 | +@end | |
| 17 | + | |
| 18 | +static NSString *CNCommuntyOrderStatusCacheName = @"CNCommuntyOrderStatusCacheName"; | |
| 19 | + | |
| 20 | +@implementation CNCommuntyOrderStatusCacheManager | |
| 21 | + | |
| 22 | +/// 获取管理类 | |
| 23 | ++ (instancetype)shareCacheManager | |
| 24 | +{ | |
| 25 | + static CNCommuntyOrderStatusCacheManager *manager = nil; | |
| 26 | + static dispatch_once_t onceToken; | |
| 27 | + dispatch_once(&onceToken, ^{ | |
| 28 | + manager = [[CNCommuntyOrderStatusCacheManager alloc] init]; | |
| 29 | + }); | |
| 30 | + return manager; | |
| 31 | +} | |
| 32 | +- (instancetype)init | |
| 33 | +{ | |
| 34 | + self = [super init]; | |
| 35 | + if (self) { | |
| 36 | + NSString *documentFolder = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]; | |
| 37 | + /**文件名拼接上用户id*/ | |
| 38 | + NSString *name = [NSString stringWithFormat:@"%@_%@",CNCommuntyOrderStatusCacheName,CNUserShareModelUid]; | |
| 39 | + NSString *path = [documentFolder stringByAppendingPathComponent:name]; | |
| 40 | + _cache = [YYCache cacheWithPath:path]; | |
| 41 | + } | |
| 42 | + return self; | |
| 43 | +} | |
| 44 | +/// 添加 | |
| 45 | +/// @param object | |
| 46 | +/// @{ | |
| 47 | +/// orderId : orderStatus, | |
| 48 | +/// orderId : orderStatus, | |
| 49 | +/// orderId : orderStatus, | |
| 50 | +/// orderId : orderStatus, | |
| 51 | +///} | |
| 52 | +/// @param key 社区群id | |
| 53 | +- (void)setObject:(NSDictionary *)object forKey:(NSString *)key | |
| 54 | +{ | |
| 55 | + [_cache setObject:object forKey:key]; | |
| 56 | +} | |
| 57 | + | |
| 58 | +/// 获取数据 | |
| 59 | +/// @param key 社区群id | |
| 60 | +- (NSDictionary *)objectForKey:(NSString *)key | |
| 61 | +{ | |
| 62 | + return (NSDictionary *)[_cache objectForKey:key]; | |
| 63 | +} | |
| 64 | + | |
| 65 | +/// 删除 | |
| 66 | +/// @param key 社区群id | |
| 67 | +- (void)deleteForKey:(NSString *)key | |
| 68 | +{ | |
| 69 | + [_cache removeObjectForKey:key]; | |
| 70 | +} | |
| 71 | + | |
| 72 | + | |
| 73 | +/// 更新 | |
| 74 | +/// @param object | |
| 75 | +/// @{ | |
| 76 | +/// orderId : orderStatus, | |
| 77 | +/// orderId : orderStatus, | |
| 78 | +/// orderId : orderStatus, | |
| 79 | +/// orderId : orderStatus, | |
| 80 | +///} | |
| 81 | +/// @param key 社区群id | |
| 82 | +- (void)updateObject:(NSDictionary *)object forKey:(NSString *)key | |
| 83 | +{ | |
| 84 | + [_cache setObject:object forKey:key]; | |
| 85 | +} | |
| 86 | + | |
| 87 | + | |
| 88 | +/// 查询 社区群 里是否有新订单 | |
| 89 | +/// @param key 社区id | |
| 90 | +- (BOOL)hasNewOrderForKey:(NSString *)key | |
| 91 | +{ | |
| 92 | + NSDictionary *data = (NSDictionary *)[_cache objectForKey:key]; | |
| 93 | + __block BOOL hasNewOrder = NO; | |
| 94 | + [data enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, NSNumber *obj, BOOL * _Nonnull stop) { | |
| 95 | + if ([obj integerValue] == 0) { | |
| 96 | + hasNewOrder = YES; | |
| 97 | + *stop = YES; | |
| 98 | + } | |
| 99 | + }]; | |
| 100 | + return hasNewOrder; | |
| 101 | +} | |
| 102 | +@end | ... | ... |
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNGroupIDFMDBManager.h renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNGroupIDFMDBManager.h
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNGroupIDFMDBManager.m renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNGroupIDFMDBManager.m
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNGroupInfoExtendFMDBManager.h renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNGroupInfoExtendFMDBManager.h
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNGroupInfoExtendFMDBManager.m renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNGroupInfoExtendFMDBManager.m
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNGroupListAvaterUtil.h renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNGroupListAvaterUtil.h
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNGroupListAvaterUtil.m renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNGroupListAvaterUtil.m
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNGroupListInfoModel.h renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNGroupListInfoModel.h
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNGroupListInfoModel.m renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNGroupListInfoModel.m
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNLiveGroupAvatorManager.h renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNLiveGroupAvatorManager.h
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNLiveGroupAvatorManager.m renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNLiveGroupAvatorManager.m
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNTransferBalanceUnreceivedCache.h renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNTransferBalanceUnreceivedCache.h
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNTransferBalanceUnreceivedCache.m renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNTransferBalanceUnreceivedCache.m
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNUserProfile.h renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNUserProfile.h
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNUserProfile.m renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNUserProfile.m
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNUserProfileFMDBManager.h renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNUserProfileFMDBManager.h
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/CNUserProfileFMDBManager.m renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/CNUserProfileFMDBManager.m
CNLiveNewIMAManagerKit/Classes/TIMFMDBManager/TIMFMDBManager.h renamed to CNLiveNewIMAManagerKit/Classes/TIMManager/TIMFMDBManager.h
CNLiveNewIMAManagerKit/Classes/TIMModel/MSG/IMAMsg.m
| ... | ... | @@ -9,6 +9,7 @@ |
| 9 | 9 | #import "IMAMsg.h" |
| 10 | 10 | |
| 11 | 11 | #import "CustomElemCmd.h" |
| 12 | +#import "CNCommuntyOrderStatusCacheManager.h" | |
| 12 | 13 | |
| 13 | 14 | @interface IMAMsg () |
| 14 | 15 | |
| ... | ... | @@ -863,6 +864,9 @@ |
| 863 | 864 | |
| 864 | 865 | - (NSAttributedString *)attributeMsgTip { |
| 865 | 866 | |
| 867 | + if (self.type == EIMAMSG_Unknown) { | |
| 868 | + return [[NSMutableAttributedString alloc] initWithString:@"未知消息"]; | |
| 869 | + } | |
| 866 | 870 | |
| 867 | 871 | NSMutableAttributedString *muAtt = [[NSMutableAttributedString alloc] initWithAttributedString:[self senderName]]; |
| 868 | 872 | [muAtt appendAttributedString:[self lastMsgContent]]; |
| ... | ... | @@ -1165,6 +1169,11 @@ |
| 1165 | 1169 | nameAtt = [[NSMutableAttributedString alloc] initWithString:@"" attributes:@{NSFontAttributeName : UIFontCNMake(14), NSForegroundColorAttributeName : KGray101Color}]; |
| 1166 | 1170 | } |
| 1167 | 1171 | |
| 1172 | + if (self.type == EIMAMSG_CommuntyOrder) { | |
| 1173 | + nameAtt = [[NSMutableAttributedString alloc] initWithString:@"" attributes:@{NSFontAttributeName : UIFontCNMake(14), NSForegroundColorAttributeName : KGray101Color}]; | |
| 1174 | + | |
| 1175 | + } | |
| 1176 | + | |
| 1168 | 1177 | } |
| 1169 | 1178 | } |
| 1170 | 1179 | } |
| ... | ... | @@ -1267,6 +1276,18 @@ |
| 1267 | 1276 | [tipAtt addAttribute:NSForegroundColorAttributeName value:[UIColor qmui_colorWithHexString:@"#FC1541"] range:NSMakeRange(0, redTipStr.length)]; |
| 1268 | 1277 | } |
| 1269 | 1278 | } |
| 1279 | + else if (type == TIM_GROUP) | |
| 1280 | + { | |
| 1281 | + | |
| 1282 | + BOOL isHave = [[CNCommuntyOrderStatusCacheManager shareCacheManager] hasNewOrderForKey:[conv getReceiver]]; | |
| 1283 | + if (isHave) { | |
| 1284 | + //有未处理的社区报修订单 | |
| 1285 | + NSString *redTipStr = @"[新报修订单]"; | |
| 1286 | + [tipAtt yy_appendString:redTipStr]; | |
| 1287 | + [tipAtt addAttribute:NSForegroundColorAttributeName value:[UIColor qmui_colorWithHexString:@"#FC1541"] range:NSMakeRange(0, redTipStr.length)]; | |
| 1288 | + } | |
| 1289 | + | |
| 1290 | + } | |
| 1270 | 1291 | return tipAtt; |
| 1271 | 1292 | } |
| 1272 | 1293 | - (void)remove | ... | ... |
CNLiveNewIMAManagerKit/Classes/TIMShow/TIMElem+ShowDescription.m
| ... | ... | @@ -847,6 +847,11 @@ static NSString *const kGroupTypeKey = @"kGroupTypeKey"; |
| 847 | 847 | } |
| 848 | 848 | } |
| 849 | 849 | } |
| 850 | + else if (msg.type == EIMAMSG_CommuntyOrder) | |
| 851 | + { | |
| 852 | + NSString *des = @"报修订单"; | |
| 853 | + return des; | |
| 854 | + } | |
| 850 | 855 | else { |
| 851 | 856 | NSString *des = [NSString stringWithFormat:@"%@", self.desc]; |
| 852 | 857 | return des; | ... | ... |