优化数组操作,新增 NSMutableArray 的安全方法,包括安全移除、插入和替换对象,确保在索引超出范围时不发生崩溃。更新相关文件以使用新方法,保持代码结构一致性。
This commit is contained in:
@@ -485,6 +485,7 @@
|
|||||||
23FF42762AA6E1480055733C /* XPHomeRecommendOtherRoomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FF42752AA6E1480055733C /* XPHomeRecommendOtherRoomView.m */; };
|
23FF42762AA6E1480055733C /* XPHomeRecommendOtherRoomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FF42752AA6E1480055733C /* XPHomeRecommendOtherRoomView.m */; };
|
||||||
23FF42792AA6E19C0055733C /* HomeMenuSourceModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FF42782AA6E19C0055733C /* HomeMenuSourceModel.m */; };
|
23FF42792AA6E19C0055733C /* HomeMenuSourceModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FF42782AA6E19C0055733C /* HomeMenuSourceModel.m */; };
|
||||||
23FF428E2AAB2D3A0055733C /* XPCandyTreeBuyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FF428D2AAB2D3A0055733C /* XPCandyTreeBuyView.m */; };
|
23FF428E2AAB2D3A0055733C /* XPCandyTreeBuyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FF428D2AAB2D3A0055733C /* XPCandyTreeBuyView.m */; };
|
||||||
|
4C1064882E0014CF007E1586 /* NSMutableArray+Safe.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1064872E0014CF007E1586 /* NSMutableArray+Safe.m */; };
|
||||||
4C1119722DD7218300C18416 /* MyEventsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1119712DD7218300C18416 /* MyEventsViewController.m */; };
|
4C1119722DD7218300C18416 /* MyEventsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1119712DD7218300C18416 /* MyEventsViewController.m */; };
|
||||||
4C1392932D6D963700A6DFB5 /* SubRechargersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1392922D6D963600A6DFB5 /* SubRechargersViewController.m */; };
|
4C1392932D6D963700A6DFB5 /* SubRechargersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1392922D6D963600A6DFB5 /* SubRechargersViewController.m */; };
|
||||||
4C1392962D6DA22B00A6DFB5 /* RechargerTransferHistoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1392952D6DA22B00A6DFB5 /* RechargerTransferHistoryViewController.m */; };
|
4C1392962D6DA22B00A6DFB5 /* RechargerTransferHistoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1392952D6DA22B00A6DFB5 /* RechargerTransferHistoryViewController.m */; };
|
||||||
@@ -2629,6 +2630,8 @@
|
|||||||
23FF42782AA6E19C0055733C /* HomeMenuSourceModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeMenuSourceModel.m; sourceTree = "<group>"; };
|
23FF42782AA6E19C0055733C /* HomeMenuSourceModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeMenuSourceModel.m; sourceTree = "<group>"; };
|
||||||
23FF428C2AAB2D3A0055733C /* XPCandyTreeBuyView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPCandyTreeBuyView.h; sourceTree = "<group>"; };
|
23FF428C2AAB2D3A0055733C /* XPCandyTreeBuyView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPCandyTreeBuyView.h; sourceTree = "<group>"; };
|
||||||
23FF428D2AAB2D3A0055733C /* XPCandyTreeBuyView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPCandyTreeBuyView.m; sourceTree = "<group>"; };
|
23FF428D2AAB2D3A0055733C /* XPCandyTreeBuyView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPCandyTreeBuyView.m; sourceTree = "<group>"; };
|
||||||
|
4C1064862E0014CF007E1586 /* NSMutableArray+Safe.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+Safe.h"; sourceTree = "<group>"; };
|
||||||
|
4C1064872E0014CF007E1586 /* NSMutableArray+Safe.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSMutableArray+Safe.m"; sourceTree = "<group>"; };
|
||||||
4C1119702DD7218300C18416 /* MyEventsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyEventsViewController.h; sourceTree = "<group>"; };
|
4C1119702DD7218300C18416 /* MyEventsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyEventsViewController.h; sourceTree = "<group>"; };
|
||||||
4C1119712DD7218300C18416 /* MyEventsViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyEventsViewController.m; sourceTree = "<group>"; };
|
4C1119712DD7218300C18416 /* MyEventsViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyEventsViewController.m; sourceTree = "<group>"; };
|
||||||
4C1392912D6D963600A6DFB5 /* SubRechargersViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SubRechargersViewController.h; sourceTree = "<group>"; };
|
4C1392912D6D963600A6DFB5 /* SubRechargersViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SubRechargersViewController.h; sourceTree = "<group>"; };
|
||||||
@@ -11690,6 +11693,8 @@
|
|||||||
E8F61356291E269700E12650 /* Safe */ = {
|
E8F61356291E269700E12650 /* Safe */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
4C1064862E0014CF007E1586 /* NSMutableArray+Safe.h */,
|
||||||
|
4C1064872E0014CF007E1586 /* NSMutableArray+Safe.m */,
|
||||||
E8F6135A291E26BD00E12650 /* NSMutableDictionary+Saft.h */,
|
E8F6135A291E26BD00E12650 /* NSMutableDictionary+Saft.h */,
|
||||||
E8F6135B291E26BD00E12650 /* NSMutableDictionary+Saft.m */,
|
E8F6135B291E26BD00E12650 /* NSMutableDictionary+Saft.m */,
|
||||||
E8F6135D291E274E00E12650 /* NSArray+Safe.h */,
|
E8F6135D291E274E00E12650 /* NSArray+Safe.h */,
|
||||||
@@ -13109,6 +13114,7 @@
|
|||||||
E801275527E3326000BAC3F2 /* XPRoomPKUserView.m in Sources */,
|
E801275527E3326000BAC3F2 /* XPRoomPKUserView.m in Sources */,
|
||||||
2305EF132AD8036B00AD403C /* PIRoomMessagePhotoAlbumView.m in Sources */,
|
2305EF132AD8036B00AD403C /* PIRoomMessagePhotoAlbumView.m in Sources */,
|
||||||
E8FE3C2C2994D0E80006C6C7 /* XPSwitch.m in Sources */,
|
E8FE3C2C2994D0E80006C6C7 /* XPSwitch.m in Sources */,
|
||||||
|
4C1064882E0014CF007E1586 /* NSMutableArray+Safe.m in Sources */,
|
||||||
E8D4824D278D2CE4003C1D08 /* XPAcrossRoomPKInviteResultView.m in Sources */,
|
E8D4824D278D2CE4003C1D08 /* XPAcrossRoomPKInviteResultView.m in Sources */,
|
||||||
E81E09CC290F732600A1F410 /* XPAdImageTool.m in Sources */,
|
E81E09CC290F732600A1F410 /* XPAdImageTool.m in Sources */,
|
||||||
9BD8D4E628911F7700AE03FF /* XPMineCollectRoomListPresenter.m in Sources */,
|
9BD8D4E628911F7700AE03FF /* XPMineCollectRoomListPresenter.m in Sources */,
|
||||||
|
@@ -146,12 +146,18 @@ UIKIT_EXTERN NSString * adImageName;
|
|||||||
NSArray * emojiArray = dic[@"data"];
|
NSArray * emojiArray = dic[@"data"];
|
||||||
NSMutableArray * array = [NSMutableArray array];
|
NSMutableArray * array = [NSMutableArray array];
|
||||||
for (int i = 0; i < emojiArray.count; i++) {
|
for (int i = 0; i < emojiArray.count; i++) {
|
||||||
NSDictionary * dic = [emojiArray objectAtIndex:i];
|
|
||||||
UIImage * image = [UIImage imageNamed:dic[@"file"]];
|
UIImage * image = [UIImage imageNamed:dic[@"file"]];
|
||||||
QEmotion * info = [[QEmotion alloc] init];
|
QEmotion * info = [[QEmotion alloc] init];
|
||||||
info.identifier = dic[@"id"];
|
|
||||||
|
NSDictionary * dic = [emojiArray xpSafeObjectAtIndex:i];
|
||||||
|
if (dic) {
|
||||||
|
info.displayName = dic[@"tag"];
|
||||||
|
info.identifier = dic[@"id"];
|
||||||
|
}
|
||||||
|
|
||||||
info.image = image;
|
info.image = image;
|
||||||
info.displayName = dic[@"tag"];
|
|
||||||
[array addObject:info];
|
[array addObject:info];
|
||||||
}
|
}
|
||||||
//在这里强烈建议先预加载一下表情
|
//在这里强烈建议先预加载一下表情
|
||||||
|
@@ -18,7 +18,7 @@ typedef NS_ENUM(NSInteger, SplashInfoSkipType) {
|
|||||||
SplashInfoSkipTypeWeb_Custom = 6,
|
SplashInfoSkipTypeWeb_Custom = 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
@interface AdvertiseFillModel : PIBaseModel<NSCoding>
|
@interface AdvertiseFillModel : PIBaseModel//<NSCoding>
|
||||||
|
|
||||||
@property(nonatomic, copy) NSString *loverNick;
|
@property(nonatomic, copy) NSString *loverNick;
|
||||||
@property(nonatomic, copy) NSString *loverErbanNo;
|
@property(nonatomic, copy) NSString *loverErbanNo;
|
||||||
@@ -32,7 +32,7 @@ typedef NS_ENUM(NSInteger, SplashInfoSkipType) {
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface AdvertiseModel : PIBaseModel<NSCopying>
|
@interface AdvertiseModel : PIBaseModel//<NSCopying>
|
||||||
@property (nonatomic, strong) NSString *link;
|
@property (nonatomic, strong) NSString *link;
|
||||||
@property (nonatomic, assign) SplashInfoSkipType type;// 1跳app页面,2跳聊天室,3跳h5页面,
|
@property (nonatomic, assign) SplashInfoSkipType type;// 1跳app页面,2跳聊天室,3跳h5页面,
|
||||||
@property (nonatomic, copy) NSString *pict;
|
@property (nonatomic, copy) NSString *pict;
|
||||||
|
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
@implementation AdvertiseFillModel
|
@implementation AdvertiseFillModel
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation AdvertiseModel
|
@implementation AdvertiseModel
|
||||||
@@ -20,4 +19,5 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -42,7 +42,7 @@ static XPAdImageTool* tool;
|
|||||||
- (AdvertiseModel *)getAdInfoFromCacheInMainWith:(NSString *)link {
|
- (AdvertiseModel *)getAdInfoFromCacheInMainWith:(NSString *)link {
|
||||||
if (link.length > 0) {
|
if (link.length > 0) {
|
||||||
if ([self.yyCache containsObjectForKey:link]) {
|
if ([self.yyCache containsObjectForKey:link]) {
|
||||||
return [self.yyCache objectForKey:link];
|
return (AdvertiseModel *)[self.yyCache objectForKey:link];
|
||||||
}else {
|
}else {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ static XPAdImageTool* tool;
|
|||||||
self.infoModel = adInfo;
|
self.infoModel = adInfo;
|
||||||
NSArray *stringArr = [adInfo.pict componentsSeparatedByString:@"/"];
|
NSArray *stringArr = [adInfo.pict componentsSeparatedByString:@"/"];
|
||||||
NSString *key = stringArr.lastObject;
|
NSString *key = stringArr.lastObject;
|
||||||
[self.yyCache setObject:adInfo forKey:key withBlock:^{
|
[self.yyCache setObject:(id<NSCoding> )adInfo forKey:key withBlock:^{
|
||||||
|
|
||||||
}];
|
}];
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ static XPAdImageTool* tool;
|
|||||||
- (NSString *)getFilePathWithImageName:(NSString *)imageName {
|
- (NSString *)getFilePathWithImageName:(NSString *)imageName {
|
||||||
if (imageName) {
|
if (imageName) {
|
||||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask, YES);
|
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask, YES);
|
||||||
NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:imageName];
|
NSString *filePath = [[paths xpSafeObjectAtIndex:0] stringByAppendingPathComponent:imageName];
|
||||||
|
|
||||||
return filePath;
|
return filePath;
|
||||||
}
|
}
|
||||||
|
@@ -202,7 +202,10 @@ const int UIInputTextViewMaxHeight = 147;
|
|||||||
[self addSubview:textView];
|
[self addSubview:textView];
|
||||||
textView.frame = CGRectMake(textViewFrameX + textViewHorizontalMargin, (UIInputBarViewMinHeight - UIInputTextViewMinHeight)/2, textViewWidth, UIInputTextViewMinHeight);
|
textView.frame = CGRectMake(textViewFrameX + textViewHorizontalMargin, (UIInputBarViewMinHeight - UIInputTextViewMinHeight)/2, textViewWidth, UIInputTextViewMinHeight);
|
||||||
|
|
||||||
self.inputTextView = textView;
|
if ([textView isKindOfClass:[SZTextView class]]) {
|
||||||
|
self.inputTextView = (SZTextView *)textView;
|
||||||
|
}
|
||||||
|
|
||||||
for (id view in textView.subviews) {
|
for (id view in textView.subviews) {
|
||||||
if ([view isKindOfClass:[UITextView class]]){
|
if ([view isKindOfClass:[UITextView class]]){
|
||||||
UITextView *textView = view;
|
UITextView *textView = view;
|
||||||
|
@@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
- (void)msrtl_setPlaceholder:(NSString *)placeholder {
|
- (void)msrtl_setPlaceholder:(NSString *)placeholder {
|
||||||
NSAttributedString * attribute = [[NSAttributedString alloc] initWithString:placeholder];
|
// NSAttributedString * attribute = [[NSAttributedString alloc] initWithString:placeholder];
|
||||||
// self.attributedPlaceholder = attribute;
|
// self.attributedPlaceholder = attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -169,7 +169,7 @@
|
|||||||
|
|
||||||
self.shareInfo.shareType = item.type;
|
self.shareInfo.shareType = item.type;
|
||||||
|
|
||||||
SSDKPlatformType platformType;
|
SSDKPlatformType platformType = SSDKPlatformTypeCopy;
|
||||||
|
|
||||||
if (item.type == XPShareItemTagLine) {
|
if (item.type == XPShareItemTagLine) {
|
||||||
title = YMLocalizedString(@"XPShareView1");
|
title = YMLocalizedString(@"XPShareView1");
|
||||||
|
@@ -472,7 +472,7 @@ typedef NS_ENUM(NSUInteger, LoginType) {
|
|||||||
- (NSArray *)shiftedColorsFromColors:(NSArray *)colors {
|
- (NSArray *)shiftedColorsFromColors:(NSArray *)colors {
|
||||||
NSMutableArray *mutableColors = [colors mutableCopy];
|
NSMutableArray *mutableColors = [colors mutableCopy];
|
||||||
id firstColor = [mutableColors firstObject];
|
id firstColor = [mutableColors firstObject];
|
||||||
[mutableColors removeObjectAtIndex:0];
|
[mutableColors xpSafeRemoveObjectAtIndex:0];
|
||||||
[mutableColors addObject:firstColor];
|
[mutableColors addObject:firstColor];
|
||||||
return [mutableColors copy];
|
return [mutableColors copy];
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
if (self = [super initWithMessage:message]) {
|
if (self = [super initWithMessage:message]) {
|
||||||
self.messageType = SessionMessageType_Custom;
|
self.messageType = SessionMessageType_Custom;
|
||||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||||
AttachmentModel * attach = obj.attachment;
|
AttachmentModel * attach = (AttachmentModel *)obj.attachment;
|
||||||
NSDictionary * dic = attach.data;
|
NSDictionary * dic = attach.data;
|
||||||
GuildMessageModel *model = [GuildMessageModel modelWithDictionary:dic];
|
GuildMessageModel *model = [GuildMessageModel modelWithDictionary:dic];
|
||||||
GuildMessageLayoutModel * layout = model.layout;
|
GuildMessageLayoutModel * layout = model.layout;
|
||||||
|
@@ -1194,14 +1194,16 @@
|
|||||||
[YYUtility checkAssetsLibrayAvailable:^{
|
[YYUtility checkAssetsLibrayAvailable:^{
|
||||||
@kStrongify(self);
|
@kStrongify(self);
|
||||||
[TZImagePickerConfig sharedInstance].allowPickingImage = YES;
|
[TZImagePickerConfig sharedInstance].allowPickingImage = YES;
|
||||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
dispatch_async(dispatch_get_global_queue(0, 0),
|
||||||
|
^{
|
||||||
[[TZImageManager manager] getCameraRollAlbumWithFetchAssets:NO completion:^(TZAlbumModel *model) {
|
[[TZImageManager manager] getCameraRollAlbumWithFetchAssets:NO completion:^(TZAlbumModel *model) {
|
||||||
[[TZImageManager manager] getAssetsFromFetchResult:model.result completion:^(NSArray<TZAssetModel *> *models) {
|
[[TZImageManager manager] getAssetsFromFetchResult:model.result completion:^(NSArray<TZAssetModel *> *models) {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(),
|
||||||
|
^{
|
||||||
NSMutableArray * array = [NSMutableArray array];
|
NSMutableArray * array = [NSMutableArray array];
|
||||||
if (models.count > 40) {
|
if (models.count > 40) {
|
||||||
for (int i = 0; i < 40; i++) {
|
for (int i = 0; i < 40; i++) {
|
||||||
TZAssetModel * assets = [models objectAtIndex:i];
|
TZAssetModel * assets = [models xpSafeObjectAtIndex:i];
|
||||||
QPhotoImageModel * infor = [[QPhotoImageModel alloc] init];
|
QPhotoImageModel * infor = [[QPhotoImageModel alloc] init];
|
||||||
infor.isOrigin = NO;
|
infor.isOrigin = NO;
|
||||||
infor.assetInfo = assets;
|
infor.assetInfo = assets;
|
||||||
@@ -1209,7 +1211,7 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < models.count; i++) {
|
for (int i = 0; i < models.count; i++) {
|
||||||
TZAssetModel * assets = [models objectAtIndex:i];
|
TZAssetModel * assets = [models xpSafeObjectAtIndex:i];
|
||||||
QPhotoImageModel * infor = [[QPhotoImageModel alloc] init];
|
QPhotoImageModel * infor = [[QPhotoImageModel alloc] init];
|
||||||
infor.isOrigin = NO;
|
infor.isOrigin = NO;
|
||||||
infor.assetInfo = assets;
|
infor.assetInfo = assets;
|
||||||
|
@@ -251,7 +251,7 @@ NSString * const kMessageShowReadDotKey = @"kMessageShowReadDotKey";
|
|||||||
totalUnreadCount:(NSInteger)totalUnreadCount {
|
totalUnreadCount:(NSInteger)totalUnreadCount {
|
||||||
// 清理本地数据
|
// 清理本地数据
|
||||||
NSUInteger index = [self.recentSessions indexOfObject:recentSession];
|
NSUInteger index = [self.recentSessions indexOfObject:recentSession];
|
||||||
[self.recentSessions removeObjectAtIndex:index];
|
[self.recentSessions xpSafeRemoveObjectAtIndex:index];
|
||||||
|
|
||||||
// 如果删除本地会话后就不允许漫游当前会话,则需要进行一次删除服务器会话的操作
|
// 如果删除本地会话后就不允许漫游当前会话,则需要进行一次删除服务器会话的操作
|
||||||
BOOL deleteRemote = NO;
|
BOOL deleteRemote = NO;
|
||||||
|
@@ -156,14 +156,12 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
/// 验证凭据
|
/// 验证凭据
|
||||||
/// @param complection 完成
|
/// @param complection 完成
|
||||||
/// @param receipt base 64 recepit
|
|
||||||
/// @param chooseEnv @"true"
|
/// @param chooseEnv @"true"
|
||||||
/// @param chargeRecordId 服务端生成的订单编号
|
/// @param chargeRecordId 服务端生成的订单编号
|
||||||
/// @param transcationId 内购的唯一标识符
|
/// @param transcationId 内购的唯一标识符
|
||||||
/// @param uid 用户uid
|
/// @param uid 用户uid
|
||||||
/// @param ticket ticket
|
/// @param ticket ticket
|
||||||
+ (void)checkReceipt:(HttpRequestHelperCompletion)complection
|
+ (void)checkReceipt:(HttpRequestHelperCompletion)complection
|
||||||
|
|
||||||
chooseEnv:(NSString *)chooseEnv
|
chooseEnv:(NSString *)chooseEnv
|
||||||
chargeRecordId:(NSString *)chargeRecordId
|
chargeRecordId:(NSString *)chargeRecordId
|
||||||
transcationId:(NSString *)transcationId
|
transcationId:(NSString *)transcationId
|
||||||
|
@@ -526,4 +526,11 @@
|
|||||||
__FUNCTION__, pageNo, pageSize];
|
__FUNCTION__, pageNo, pageSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
+ (void)medalMine:(HttpRequestHelperCompletion)completion pageNo:(NSNumber *)pageNo pageSize:(NSNumber *)pageSize uid:(NSNumber *)uid type:(NSNumber *)type {
|
||||||
|
[self makeRequest:@"medal/mine"
|
||||||
|
method:HttpRequestHelperMethodGET
|
||||||
|
completion:completion,
|
||||||
|
__FUNCTION__, pageNo, pageSize, uid, type];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@property (nonatomic,copy) NSArray<XPIncomeRecordGoldDetailItemModel *> *hallMember;
|
@property (nonatomic,copy) NSArray<XPIncomeRecordGoldDetailItemModel *> *hallMember;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
|
|
||||||
|
|
||||||
@interface XPIncomeRecordGoldDetailItemModel : PIBaseModel
|
@interface XPIncomeRecordGoldDetailItemModel : PIBaseModel
|
||||||
@@ -39,3 +39,5 @@ NS_ASSUME_NONNULL_END
|
|||||||
@property (nonatomic,copy) NSString *ownerAvatar;
|
@property (nonatomic,copy) NSString *ownerAvatar;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -190,10 +190,13 @@
|
|||||||
self.thirdPhotoImageView.hidden = YES;
|
self.thirdPhotoImageView.hidden = YES;
|
||||||
for (int i = 0; i < array.count; i++) {
|
for (int i = 0; i < array.count; i++) {
|
||||||
NetImageView * imageView = [self.photoViewArray xpSafeObjectAtIndex:i];
|
NetImageView * imageView = [self.photoViewArray xpSafeObjectAtIndex:i];
|
||||||
NSString * imageUrl = [array objectAtIndex:i].photoUrl;
|
UserPhoto *photo = [array xpSafeObjectAtIndex:i];
|
||||||
if (imageUrl.length > 0) {
|
if (photo) {
|
||||||
imageView.imageUrl = imageUrl;
|
NSString *imageUrl = photo.photoUrl;
|
||||||
imageView.hidden = NO;
|
if (imageUrl.length > 0) {
|
||||||
|
imageView.imageUrl = imageUrl;
|
||||||
|
imageView.hidden = NO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -269,7 +269,7 @@
|
|||||||
NSArray * timeArray = [timeStr componentsSeparatedByString:@"-"];
|
NSArray * timeArray = [timeStr componentsSeparatedByString:@"-"];
|
||||||
NSMutableArray * timeArr = [[NSMutableArray alloc]init];
|
NSMutableArray * timeArr = [[NSMutableArray alloc]init];
|
||||||
for (int i = 0; i<timeArray.count; i++) {
|
for (int i = 0; i<timeArray.count; i++) {
|
||||||
NSString * str = [timeArray objectAtIndex:i];
|
NSString * str = [timeArray xpSafeObjectAtIndex:i];
|
||||||
if (str.length == 1) {
|
if (str.length == 1) {
|
||||||
[timeArr addObject:[NSString stringWithFormat:@"0%@",str]];
|
[timeArr addObject:[NSString stringWithFormat:@"0%@",str]];
|
||||||
}else if(str.length == 0){
|
}else if(str.length == 0){
|
||||||
|
@@ -659,8 +659,8 @@ HWDMP4PlayDelegate>
|
|||||||
if(browser.isAvatar == YES){
|
if(browser.isAvatar == YES){
|
||||||
return [NSURL URLWithString:self.avatarView.imageUrl];
|
return [NSURL URLWithString:self.avatarView.imageUrl];
|
||||||
}
|
}
|
||||||
NSString * photoUrl = [self.imageUrls objectAtIndex:index];
|
NSString *photoUrl = [self.imageUrls xpSafeObjectAtIndex:index];
|
||||||
return [NSURL URLWithString:photoUrl];
|
return [NSURL URLWithString:photoUrl ? photoUrl : @""];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIImage *)photoBrowser:(SDPhotoBrowser *)browser placeholderImageForIndex:(NSInteger)index {
|
- (UIImage *)photoBrowser:(SDPhotoBrowser *)browser placeholderImageForIndex:(NSInteger)index {
|
||||||
@@ -670,7 +670,7 @@ HWDMP4PlayDelegate>
|
|||||||
#pragma mark - SDCycleScrollViewDelegate
|
#pragma mark - SDCycleScrollViewDelegate
|
||||||
-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index {
|
-(void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didScrollToIndex:(NSInteger)index {
|
||||||
[self.pageButton setTitle:[NSString stringWithFormat:@"%ld/%lu",(index + 1), (unsigned long)self.imageUrls.count] forState:UIControlStateNormal];
|
[self.pageButton setTitle:[NSString stringWithFormat:@"%ld/%lu",(index + 1), (unsigned long)self.imageUrls.count] forState:UIControlStateNormal];
|
||||||
UserPhoto * photo = [self.userPhotoArray objectAtIndex:index];
|
UserPhoto * photo = [self.userPhotoArray xpSafeObjectAtIndex:index];
|
||||||
self.reviewIcon.hidden = !photo.isReview;
|
self.reviewIcon.hidden = !photo.isReview;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -840,7 +840,7 @@ HWDMP4PlayDelegate>
|
|||||||
}
|
}
|
||||||
if (self.userInfo.privatePhoto.count > 0) {
|
if (self.userInfo.privatePhoto.count > 0) {
|
||||||
for (int i = 0; i < self.userInfo.privatePhoto.count; i++) {
|
for (int i = 0; i < self.userInfo.privatePhoto.count; i++) {
|
||||||
UserPhoto * photo = [self.userInfo.privatePhoto objectAtIndex:i];
|
UserPhoto * photo = [self.userInfo.privatePhoto xpSafeObjectAtIndex:i];
|
||||||
if (photo.photoUrl.length > 0) {
|
if (photo.photoUrl.length > 0) {
|
||||||
[self.userPhotoArray addObject:photo];
|
[self.userPhotoArray addObject:photo];
|
||||||
[imageUrls addObject:photo.photoUrl];
|
[imageUrls addObject:photo.photoUrl];
|
||||||
@@ -854,7 +854,10 @@ HWDMP4PlayDelegate>
|
|||||||
[self.pageButton setTitle:[NSString stringWithFormat:@"1/%lu",(unsigned long)imageUrls.count] forState:UIControlStateNormal];;
|
[self.pageButton setTitle:[NSString stringWithFormat:@"1/%lu",(unsigned long)imageUrls.count] forState:UIControlStateNormal];;
|
||||||
// 要初始化一下当前的审核状态
|
// 要初始化一下当前的审核状态
|
||||||
if(self.userPhotoArray.count > 0){
|
if(self.userPhotoArray.count > 0){
|
||||||
self.reviewIcon.hidden = ![self.userPhotoArray objectAtIndex:0].isReview;
|
UserPhoto * photo = [self.userPhotoArray xpSafeObjectAtIndex:0];
|
||||||
|
if (photo) {
|
||||||
|
self.reviewIcon.hidden = !photo.isReview;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -194,6 +194,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)requesstShieldingSuccess:(NSString *)monentsInfo {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - JXPagingViewListViewDelegate
|
#pragma mark - JXPagingViewListViewDelegate
|
||||||
- (UIScrollView *)listScrollView {
|
- (UIScrollView *)listScrollView {
|
||||||
|
@@ -265,11 +265,11 @@
|
|||||||
- (void)XPMonentsPublishCollectionViewCell:(XPMonentsPublishCollectionViewCell *)view didDeleteItem:(UIImage *)image {
|
- (void)XPMonentsPublishCollectionViewCell:(XPMonentsPublishCollectionViewCell *)view didDeleteItem:(UIImage *)image {
|
||||||
[TTPopup alertWithMessage:YMLocalizedString(@"XPMonentsPublishViewController1") confirmHandler:^{
|
[TTPopup alertWithMessage:YMLocalizedString(@"XPMonentsPublishViewController1") confirmHandler:^{
|
||||||
if ([self.datasource containsObject:image]) {
|
if ([self.datasource containsObject:image]) {
|
||||||
[self.datasource removeObject:image];
|
[self.datasource xpSafeRemoveObject:image];
|
||||||
}
|
}
|
||||||
NSIndexPath * indexPath = [self.collectionView indexPathForCell:view];
|
NSIndexPath * indexPath = [self.collectionView indexPathForCell:view];
|
||||||
if (indexPath.row < self.originAssets.count) {
|
if (indexPath.row < self.originAssets.count) {
|
||||||
[self.originAssets removeObjectAtIndex:indexPath.row];
|
[self.originAssets xpSafeRemoveObjectAtIndex:indexPath.row];
|
||||||
}
|
}
|
||||||
|
|
||||||
[self.collectionView reloadData];
|
[self.collectionView reloadData];
|
||||||
|
@@ -48,14 +48,14 @@
|
|||||||
[menu sendCompleted];
|
[menu sendCompleted];
|
||||||
} errorToast:NO] uid:uid type:@"1"];
|
} errorToast:NO] uid:uid type:@"1"];
|
||||||
|
|
||||||
// [Api requestCurrentResourceListCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
[Api requestCurrentResourceListCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||||
// NSArray *list = [PIHomeItemModel modelsWithArray:data.data];
|
NSArray *list = [PIHomeItemModel modelsWithArray:data.data];
|
||||||
// [menu sendNext:list];
|
[menu sendNext:list];
|
||||||
// [menu sendCompleted];
|
[menu sendCompleted];
|
||||||
// }fail:^(NSInteger code, NSString * _Nullable msg) {
|
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||||
// [menu sendError:nil];
|
[menu sendError:nil];
|
||||||
// [menu sendCompleted];
|
[menu sendCompleted];
|
||||||
// }]];
|
}]];
|
||||||
}
|
}
|
||||||
|
|
||||||
//- (void)getHomeAllTopsData {
|
//- (void)getHomeAllTopsData {
|
||||||
|
@@ -210,7 +210,7 @@
|
|||||||
/// @param cycleScrollView cycleScrollView description
|
/// @param cycleScrollView cycleScrollView description
|
||||||
/// @param index 索引
|
/// @param index 索引
|
||||||
- (GKCycleScrollViewCell *)cycleScrollView:(GKCycleScrollView *)cycleScrollView cellForViewAtIndex:(NSInteger)index {
|
- (GKCycleScrollViewCell *)cycleScrollView:(GKCycleScrollView *)cycleScrollView cellForViewAtIndex:(NSInteger)index {
|
||||||
XPCycleScrollViewCell * cell = cycleScrollView.dequeueReusableCell;
|
XPCycleScrollViewCell *cell = (XPCycleScrollViewCell*)cycleScrollView.dequeueReusableCell;
|
||||||
if (!cell) {
|
if (!cell) {
|
||||||
cell = [[XPCycleScrollViewCell alloc] init];
|
cell = [[XPCycleScrollViewCell alloc] init];
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
[Api requestCleanFootPrint:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
[Api requestCleanFootPrint:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||||
@kStrongify(self);
|
@kStrongify(self);
|
||||||
[[self getView] cleanInRoomRecordSuccess];
|
[[self getView] cleanInRoomRecordSuccess];
|
||||||
}] uid:uid roomUid:NULL];
|
}] uid:uid roomUid:@""];
|
||||||
}
|
}
|
||||||
|
|
||||||
///大家都在搜
|
///大家都在搜
|
||||||
|
@@ -49,6 +49,9 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
|||||||
|
|
||||||
@implementation XPRoomSearchContainerViewController
|
@implementation XPRoomSearchContainerViewController
|
||||||
|
|
||||||
|
- (void)searchRoomSuccess:(NSArray *)data type:(NSString *)type {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
- (XPHomeSearchPresenter *)createPresenter {
|
- (XPHomeSearchPresenter *)createPresenter {
|
||||||
return [[XPHomeSearchPresenter alloc] init];
|
return [[XPHomeSearchPresenter alloc] init];
|
||||||
|
@@ -28,16 +28,20 @@
|
|||||||
self = [super initWithDelegate:delegate];
|
self = [super initWithDelegate:delegate];
|
||||||
if (self) {
|
if (self) {
|
||||||
_engine = [TRTCCloud sharedInstance];
|
_engine = [TRTCCloud sharedInstance];
|
||||||
[_engine enableAudioVolumeEvaluation:900];
|
TRTCAudioVolumeEvaluateParams *AudioVolumeParams = [[TRTCAudioVolumeEvaluateParams alloc] init];
|
||||||
|
AudioVolumeParams.interval = 300;
|
||||||
|
AudioVolumeParams.enableVadDetection = YES;
|
||||||
|
AudioVolumeParams.enablePitchCalculation = YES;
|
||||||
|
AudioVolumeParams.enableSpectrumCalculation = YES;
|
||||||
|
[self.engine enableAudioVolumeEvaluation:900 withParams:AudioVolumeParams];
|
||||||
[TRTCCloud setConsoleEnabled:NO];
|
[TRTCCloud setConsoleEnabled:NO];
|
||||||
_engine.delegate = self;
|
[_engine addDelegate:self];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - RtcInterface impl
|
#pragma mark - RtcInterface impl
|
||||||
- (BOOL)joinChannel:(NSString *)channelId sign:(nonnull NSString *)sign completion:(void (^)(void))completion {
|
- (BOOL)joinChannel:(NSString *)channelId sign:(nonnull NSString *)sign completion:(void (^)(void))completion {
|
||||||
[self.engine enableAudioVolumeEvaluation:900];
|
|
||||||
TRTCParams *params = [[TRTCParams alloc] init];
|
TRTCParams *params = [[TRTCParams alloc] init];
|
||||||
UInt32 appId;
|
UInt32 appId;
|
||||||
NSString *curTtcKey = [[NSUserDefaults standardUserDefaults]valueForKey:@"kTrtcAppId"];
|
NSString *curTtcKey = [[NSUserDefaults standardUserDefaults]valueForKey:@"kTrtcAppId"];
|
||||||
@@ -118,7 +122,8 @@
|
|||||||
NSString *aecString = @"{\"api\":\"enableAudioAEC\",\"params\":{\"enable\":1,\"level\":100}}";
|
NSString *aecString = @"{\"api\":\"enableAudioAEC\",\"params\":{\"enable\":1,\"level\":100}}";
|
||||||
[self.engine callExperimentalAPI:aecString];
|
[self.engine callExperimentalAPI:aecString];
|
||||||
[self.engine startLocalAudio:TRTCAudioQualityDefault];
|
[self.engine startLocalAudio:TRTCAudioQualityDefault];
|
||||||
[self.engine.getDeviceManager setSystemVolumeType:TXSystemVolumeTypeMedia];
|
// [self.engine.getDeviceManager setSystemVolumeType:TXSystemVolumeTypeMedia];
|
||||||
|
[[TRTCCloud sharedInstance] startLocalAudio:TRTCAudioQualityDefault];
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
[self.engine stopLocalAudio];
|
[self.engine stopLocalAudio];
|
||||||
@@ -147,7 +152,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)destory {
|
- (void)destory {
|
||||||
[TRTCCloud destroySharedIntance];
|
[TRTCCloud destroySharedInstance];
|
||||||
|
[self.engine removeDelegate:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 播放背景音乐
|
/// 播放背景音乐
|
||||||
|
@@ -139,7 +139,7 @@
|
|||||||
NSString *url_1 = @"";
|
NSString *url_1 = @"";
|
||||||
NSString *url_2 = @"";
|
NSString *url_2 = @"";
|
||||||
id obj = self.boomEventsQueue.firstObject;
|
id obj = self.boomEventsQueue.firstObject;
|
||||||
[self.boomEventsQueue removeObjectAtIndex:0];
|
[self.boomEventsQueue xpSafeRemoveObjectAtIndex:0];
|
||||||
if ([obj isKindOfClass:[AttachmentModel class]]) {
|
if ([obj isKindOfClass:[AttachmentModel class]]) {
|
||||||
Boom632Model *m = [Boom632Model modelWithJSON:[(AttachmentModel *)obj data]];
|
Boom632Model *m = [Boom632Model modelWithJSON:[(AttachmentModel *)obj data]];
|
||||||
if ([XPSkillCardPlayerManager shareInstance].roomUid.integerValue != m.roomUid) {
|
if ([XPSkillCardPlayerManager shareInstance].roomUid.integerValue != m.roomUid) {
|
||||||
@@ -167,7 +167,7 @@
|
|||||||
}
|
}
|
||||||
self.isGifting = YES;
|
self.isGifting = YES;
|
||||||
id obj = self.giftEventsQueue.firstObject;
|
id obj = self.giftEventsQueue.firstObject;
|
||||||
[self.giftEventsQueue removeObjectAtIndex:0];
|
[self.giftEventsQueue xpSafeRemoveObjectAtIndex:0];
|
||||||
[self handleBoomGiftUpdate:obj];
|
[self handleBoomGiftUpdate:obj];
|
||||||
} else {
|
} else {
|
||||||
self.isBooming = NO;
|
self.isBooming = NO;
|
||||||
@@ -188,7 +188,7 @@
|
|||||||
if (self.bannerEventsQueue.count > 0) {
|
if (self.bannerEventsQueue.count > 0) {
|
||||||
self.isBannering = YES;
|
self.isBannering = YES;
|
||||||
id obj = self.bannerEventsQueue.firstObject;
|
id obj = self.bannerEventsQueue.firstObject;
|
||||||
[self.bannerEventsQueue removeObjectAtIndex:0];
|
[self.bannerEventsQueue xpSafeRemoveObjectAtIndex:0];
|
||||||
[self handleBannerUpdate:obj];
|
[self handleBannerUpdate:obj];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -88,7 +88,7 @@
|
|||||||
// 安全地移除第一个元素
|
// 安全地移除第一个元素
|
||||||
dispatch_async(self.queue, ^{
|
dispatch_async(self.queue, ^{
|
||||||
if (self.giftQueue.count > 0) {
|
if (self.giftQueue.count > 0) {
|
||||||
[self.giftQueue removeObjectAtIndex:0];
|
[self.giftQueue xpSafeRemoveObjectAtIndex:0];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -288,6 +288,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
///自己的隐身进房提示
|
///自己的隐身进房提示
|
||||||
- (void)createEnterHideAnimation {
|
- (void)createEnterHideAnimation {
|
||||||
NSDictionary * dic= @{@"title":@"隐身进房",
|
NSDictionary * dic= @{@"title":@"隐身进房",
|
||||||
|
@"isMe":@"",
|
||||||
@"experLevelSeq":@"",
|
@"experLevelSeq":@"",
|
||||||
@"effectPath" : @""};
|
@"effectPath" : @""};
|
||||||
[self.enterRoomAnimationQueue addObject:dic];
|
[self.enterRoomAnimationQueue addObject:dic];
|
||||||
@@ -315,7 +316,9 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
|
|
||||||
// 取出队列头部的动画信息并移除
|
// 取出队列头部的动画信息并移除
|
||||||
NSDictionary *dic = [self.enterRoomAnimationQueue firstObject];
|
NSDictionary *dic = [self.enterRoomAnimationQueue firstObject];
|
||||||
[self.enterRoomAnimationQueue removeObjectAtIndex:0];
|
if (self.enterRoomAnimationQueue.count > 0) {
|
||||||
|
[self.enterRoomAnimationQueue xpSafeRemoveObjectAtIndex:0];
|
||||||
|
}
|
||||||
|
|
||||||
NSString *title = [dic objectForKey:@"title"];
|
NSString *title = [dic objectForKey:@"title"];
|
||||||
if ([title isEqualToString:@"隐身进房"]) {
|
if ([title isEqualToString:@"隐身进房"]) {
|
||||||
@@ -526,7 +529,9 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
|
|
||||||
// 从队列中取出第一个元素并移出队列
|
// 从队列中取出第一个元素并移出队列
|
||||||
AttachmentModel *nextAttachment = [self.roomBannertModelsQueueV2 firstObject];
|
AttachmentModel *nextAttachment = [self.roomBannertModelsQueueV2 firstObject];
|
||||||
[self.roomBannertModelsQueueV2 removeObjectAtIndex:0];
|
if (self.roomBannertModelsQueueV2.count > 0) {
|
||||||
|
[self.roomBannertModelsQueueV2 xpSafeRemoveObjectAtIndex:0];
|
||||||
|
}
|
||||||
|
|
||||||
// 设置为正在显示的状态
|
// 设置为正在显示的状态
|
||||||
self.isRoomBannerV2Displaying = YES;
|
self.isRoomBannerV2Displaying = YES;
|
||||||
@@ -920,7 +925,9 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
|
|
||||||
- (void)nextCarEffect {
|
- (void)nextCarEffect {
|
||||||
if (self.carEffectQueue.count > 0) {
|
if (self.carEffectQueue.count > 0) {
|
||||||
[self.carEffectQueue removeObjectAtIndex:0];
|
if (self.carEffectQueue.count > 0) {
|
||||||
|
[self.carEffectQueue xpSafeRemoveObjectAtIndex:0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (self.carEffectQueue.count > 0) {
|
if (self.carEffectQueue.count > 0) {
|
||||||
[self playCarEffect:self.carEffectQueue.firstObject];
|
[self playCarEffect:self.carEffectQueue.firstObject];
|
||||||
@@ -1552,7 +1559,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
}
|
}
|
||||||
if (model.enterHide) {
|
if (model.enterHide) {
|
||||||
//隐身进房
|
//隐身进房
|
||||||
if ([message.from isEqualToString:[AccountInfoStorage instance].getUid]) {
|
if (model.uid == [AccountInfoStorage instance].getUid.integerValue) {
|
||||||
[self createEnterHideAnimation];
|
[self createEnterHideAnimation];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2268,7 +2275,9 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
- (void)removeFromSvgaQueueAtIndex:(NSInteger)index {
|
- (void)removeFromSvgaQueueAtIndex:(NSInteger)index {
|
||||||
dispatch_async(self.giftEffectsQueue, ^{
|
dispatch_async(self.giftEffectsQueue, ^{
|
||||||
if (index < self.svgaQueue.count) {
|
if (index < self.svgaQueue.count) {
|
||||||
[self.svgaQueue removeObjectAtIndex:index];
|
if (index < self.svgaQueue.count) {
|
||||||
|
[self.svgaQueue xpSafeRemoveObjectAtIndex:index];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -2404,7 +2413,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
[tarrowVeiw removeFromSuperview];
|
[tarrowVeiw removeFromSuperview];
|
||||||
self.isPlayOfB = NO;
|
self.isPlayOfB = NO;
|
||||||
if (self.animationListB.count > 0) {
|
if (self.animationListB.count > 0) {
|
||||||
[self.animationListB removeObjectAtIndex:0];
|
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||||
}
|
}
|
||||||
[self playAnimationWithModel];
|
[self playAnimationWithModel];
|
||||||
}
|
}
|
||||||
@@ -2455,7 +2464,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
if (finished) {
|
if (finished) {
|
||||||
[luckyGiftEffectView removeFromSuperview];
|
[luckyGiftEffectView removeFromSuperview];
|
||||||
if (self.animationListB.count > 0) {
|
if (self.animationListB.count > 0) {
|
||||||
[self.animationListB removeObjectAtIndex:0];
|
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||||
}
|
}
|
||||||
self.isPlayOfB = NO;
|
self.isPlayOfB = NO;
|
||||||
[self playAnimationWithModel];
|
[self playAnimationWithModel];
|
||||||
@@ -2510,7 +2519,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
[candyTreeView removeFromSuperview];
|
[candyTreeView removeFromSuperview];
|
||||||
self.isPlayOfB = NO;
|
self.isPlayOfB = NO;
|
||||||
if (self.animationListB.count > 0) {
|
if (self.animationListB.count > 0) {
|
||||||
[self.animationListB removeObjectAtIndex:0];
|
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||||
}
|
}
|
||||||
[self playAnimationWithModel];
|
[self playAnimationWithModel];
|
||||||
}
|
}
|
||||||
@@ -2566,7 +2575,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
self.isPlayOfB = NO;
|
self.isPlayOfB = NO;
|
||||||
[nobleLevelUpView removeFromSuperview];
|
[nobleLevelUpView removeFromSuperview];
|
||||||
if (self.animationListB.count > 0) {
|
if (self.animationListB.count > 0) {
|
||||||
[self.animationListB removeObjectAtIndex:0];
|
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||||
}
|
}
|
||||||
[self playAnimationWithModel];
|
[self playAnimationWithModel];
|
||||||
}
|
}
|
||||||
@@ -2620,7 +2629,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
self.isPlayOfB = NO;
|
self.isPlayOfB = NO;
|
||||||
|
|
||||||
if(self.animationListB.count > 0){
|
if(self.animationListB.count > 0){
|
||||||
[self.animationListB removeObjectAtIndex:0];
|
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||||
}
|
}
|
||||||
[self playAnimationWithModel];
|
[self playAnimationWithModel];
|
||||||
}
|
}
|
||||||
@@ -2658,7 +2667,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
[anchorRankView removeFromSuperview];
|
[anchorRankView removeFromSuperview];
|
||||||
self.isPlayOfB = NO;
|
self.isPlayOfB = NO;
|
||||||
if(self.animationListB.count > 0){
|
if(self.animationListB.count > 0){
|
||||||
[self.animationListB removeObjectAtIndex:0];
|
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||||
[self playAnimationWithModel];
|
[self playAnimationWithModel];
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
@@ -2730,7 +2739,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
[treasureView removeFromSuperview];
|
[treasureView removeFromSuperview];
|
||||||
self.isPlayOfB = NO;
|
self.isPlayOfB = NO;
|
||||||
if (self.animationListB.count > 0) {
|
if (self.animationListB.count > 0) {
|
||||||
[self.animationListB removeObjectAtIndex:0];
|
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||||
}
|
}
|
||||||
[self playAnimationWithModel];
|
[self playAnimationWithModel];
|
||||||
}
|
}
|
||||||
@@ -2784,7 +2793,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
[tarrowVeiw removeFromSuperview];
|
[tarrowVeiw removeFromSuperview];
|
||||||
self.isPlayOfB = NO;
|
self.isPlayOfB = NO;
|
||||||
if (self.animationListB.count > 0) {
|
if (self.animationListB.count > 0) {
|
||||||
[self.animationListB removeObjectAtIndex:0];
|
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||||
}
|
}
|
||||||
[self playAnimationWithModel];
|
[self playAnimationWithModel];
|
||||||
}
|
}
|
||||||
@@ -2821,7 +2830,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
[compoundGiftView removeFromSuperview];
|
[compoundGiftView removeFromSuperview];
|
||||||
self.isPlayOfB = NO;
|
self.isPlayOfB = NO;
|
||||||
if(self.animationListB.count > 0){
|
if(self.animationListB.count > 0){
|
||||||
[self.animationListB removeObjectAtIndex:0];
|
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||||
}
|
}
|
||||||
[self playAnimationWithModel];
|
[self playAnimationWithModel];
|
||||||
}
|
}
|
||||||
@@ -2860,7 +2869,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
[bannerView removeFromSuperview];
|
[bannerView removeFromSuperview];
|
||||||
self.isPlayOfB = NO;
|
self.isPlayOfB = NO;
|
||||||
if(self.animationListB.count > 0){
|
if(self.animationListB.count > 0){
|
||||||
[self.animationListB removeObjectAtIndex:0];
|
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||||
}
|
}
|
||||||
[self playAnimationWithModel];
|
[self playAnimationWithModel];
|
||||||
}];
|
}];
|
||||||
@@ -2887,7 +2896,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
[bannerView removeFromSuperview];
|
[bannerView removeFromSuperview];
|
||||||
self.isPlayOfB = NO;
|
self.isPlayOfB = NO;
|
||||||
if(self.animationListB.count > 0){
|
if(self.animationListB.count > 0){
|
||||||
[self.animationListB removeObjectAtIndex:0];
|
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||||
}
|
}
|
||||||
[self playAnimationWithModel];
|
[self playAnimationWithModel];
|
||||||
}];
|
}];
|
||||||
@@ -2931,7 +2940,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
[self.universalBannerViewCaches removeObject:bannerView];
|
[self.universalBannerViewCaches removeObject:bannerView];
|
||||||
self.isPlayOfB = NO;
|
self.isPlayOfB = NO;
|
||||||
if(self.animationListB.count > 0){
|
if(self.animationListB.count > 0){
|
||||||
[self.animationListB removeObjectAtIndex:0];
|
[self.animationListB xpSafeRemoveObjectAtIndex:0];
|
||||||
}
|
}
|
||||||
[self playAnimationWithModel];
|
[self playAnimationWithModel];
|
||||||
}
|
}
|
||||||
@@ -3116,7 +3125,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
if (finished) {
|
if (finished) {
|
||||||
[sailingView removeFromSuperview];
|
[sailingView removeFromSuperview];
|
||||||
if (self.sailingQueue.count > 0) {
|
if (self.sailingQueue.count > 0) {
|
||||||
[self.sailingQueue removeObjectAtIndex:0];
|
[self.sailingQueue xpSafeRemoveObjectAtIndex:0];
|
||||||
}
|
}
|
||||||
if (self.sailingQueue.count > 0) {
|
if (self.sailingQueue.count > 0) {
|
||||||
[self createSailingBannerAnimation:self.sailingQueue.firstObject];
|
[self createSailingBannerAnimation:self.sailingQueue.firstObject];
|
||||||
|
@@ -64,6 +64,7 @@
|
|||||||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.leading.mas_equalTo(self.avaratImageView.mas_trailing).offset(10);
|
make.leading.mas_equalTo(self.avaratImageView.mas_trailing).offset(10);
|
||||||
make.centerY.mas_equalTo(self.contentView);
|
make.centerY.mas_equalTo(self.contentView);
|
||||||
|
// make.width.mas_lessThanOrEqualTo(KScreenWidth - 20 - 30 - 75);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
@@ -77,6 +78,7 @@
|
|||||||
make.height.mas_equalTo(25);
|
make.height.mas_equalTo(25);
|
||||||
make.trailing.mas_equalTo(self.contentView).offset(-15);
|
make.trailing.mas_equalTo(self.contentView).offset(-15);
|
||||||
make.centerY.mas_equalTo(self.contentView);
|
make.centerY.mas_equalTo(self.contentView);
|
||||||
|
make.leading.mas_greaterThanOrEqualTo(self.sexImageView.mas_trailing).offset(2);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,9 +94,6 @@
|
|||||||
_userInfo = userInfo;
|
_userInfo = userInfo;
|
||||||
if (_userInfo) {
|
if (_userInfo) {
|
||||||
NSString * nick = _userInfo.nick;
|
NSString * nick = _userInfo.nick;
|
||||||
if (nick.length > 6) {
|
|
||||||
nick = [nick substringToIndex:6];
|
|
||||||
}
|
|
||||||
self.nameLabel.text= nick;
|
self.nameLabel.text= nick;
|
||||||
self.avaratImageView.imageUrl = _userInfo.avatar;
|
self.avaratImageView.imageUrl = _userInfo.avatar;
|
||||||
[self.sexImageView setTitle:[NSString getAgeWithBirth:_userInfo.birth] forState:UIControlStateNormal];
|
[self.sexImageView setTitle:[NSString getAgeWithBirth:_userInfo.birth] forState:UIControlStateNormal];
|
||||||
|
@@ -135,11 +135,14 @@
|
|||||||
|
|
||||||
#pragma mark - Private Method
|
#pragma mark - Private Method
|
||||||
- (void)configDefaultData {
|
- (void)configDefaultData {
|
||||||
if (self.userInfo.isManager) {
|
#if DEBUG
|
||||||
[self.applyButton setTitle:YMLocalizedString(@"XPArrangeMicViewController1") forState:UIControlStateNormal];
|
self.userInfo.isManager = NO;
|
||||||
} else {
|
#endif
|
||||||
[self.applyButton setTitle:YMLocalizedString(@"XPArrangeMicViewController2") forState:UIControlStateNormal];
|
if (self.userInfo.isManager) {
|
||||||
}
|
[self.applyButton setTitle:YMLocalizedString(@"XPArrangeMicViewController1") forState:UIControlStateNormal];
|
||||||
|
} else {
|
||||||
|
[self.applyButton setTitle:YMLocalizedString(@"XPArrangeMicViewController2") forState:UIControlStateNormal];
|
||||||
|
}
|
||||||
|
|
||||||
if (self.userInfo.type == ArrangeMicType_Dating) {
|
if (self.userInfo.type == ArrangeMicType_Dating) {
|
||||||
self.femaleButton.hidden = self.userInfo.isManager;
|
self.femaleButton.hidden = self.userInfo.isManager;
|
||||||
@@ -660,6 +663,9 @@
|
|||||||
|
|
||||||
#pragma mark - Event Response
|
#pragma mark - Event Response
|
||||||
- (void)applyButtonAction:(UIButton *)sender {
|
- (void)applyButtonAction:(UIButton *)sender {
|
||||||
|
#if DEBUG
|
||||||
|
self.userInfo.isManager = NO;
|
||||||
|
#endif
|
||||||
if (self.userInfo.isManager) {
|
if (self.userInfo.isManager) {
|
||||||
XPShareItem *cycle = [XPShareItem itemWitTag:XPShareItemTagFaceBook title:@"FaceBook" imageName:@"share_fb" disableImageName:@"share_fb"];
|
XPShareItem *cycle = [XPShareItem itemWitTag:XPShareItemTagFaceBook title:@"FaceBook" imageName:@"share_fb" disableImageName:@"share_fb"];
|
||||||
XPShareItem *wechat = [XPShareItem itemWitTag:XPShareItemTagLine title:@"Line" imageName:@"share_line" disableImageName:@"share_line"];
|
XPShareItem *wechat = [XPShareItem itemWitTag:XPShareItemTagLine title:@"Line" imageName:@"share_line" disableImageName:@"share_line"];
|
||||||
|
@@ -1442,7 +1442,7 @@
|
|||||||
if (self.trumpetQueue.count) {
|
if (self.trumpetQueue.count) {
|
||||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||||
[self createTrumpetAnimation:self.trumpetQueue.firstObject];
|
[self createTrumpetAnimation:self.trumpetQueue.firstObject];
|
||||||
[self.trumpetQueue removeObjectAtIndex:0];
|
[self.trumpetQueue xpSafeRemoveObjectAtIndex:0];
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||||
|
@@ -100,7 +100,7 @@
|
|||||||
- (void)removeReceivedLuckyPackage {
|
- (void)removeReceivedLuckyPackage {
|
||||||
NSMutableArray *array = [self.infoModel.redEnvelopeListVoList mutableCopy];
|
NSMutableArray *array = [self.infoModel.redEnvelopeListVoList mutableCopy];
|
||||||
if (array.count>0) {
|
if (array.count>0) {
|
||||||
[array removeObjectAtIndex:0];
|
[array xpSafeRemoveObjectAtIndex:0];
|
||||||
}
|
}
|
||||||
self.infoModel.redEnvelopeListVoList = array.copy;
|
self.infoModel.redEnvelopeListVoList = array.copy;
|
||||||
self.packageNum = self.infoModel.redEnvelopeListVoList.count;
|
self.packageNum = self.infoModel.redEnvelopeListVoList.count;
|
||||||
@@ -157,8 +157,8 @@
|
|||||||
}];
|
}];
|
||||||
|
|
||||||
if (count == 0 && index != NSNotFound) {
|
if (count == 0 && index != NSNotFound) {
|
||||||
[self.selectedGiftModels removeObjectAtIndex:index];
|
[self.selectedGiftModels xpSafeRemoveObjectAtIndex:index];
|
||||||
[self.selectedGiftCounts removeObjectAtIndex:index];
|
[self.selectedGiftCounts xpSafeRemoveObjectAtIndex:index];
|
||||||
} else {
|
} else {
|
||||||
if (index != NSNotFound) {
|
if (index != NSNotFound) {
|
||||||
[self.selectedGiftCounts replaceObjectAtIndex:index withObject:@(count)];
|
[self.selectedGiftCounts replaceObjectAtIndex:index withObject:@(count)];
|
||||||
|
@@ -281,7 +281,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
|||||||
|
|
||||||
- (void)safelyRemoveLocationAtIndex:(NSUInteger)index {
|
- (void)safelyRemoveLocationAtIndex:(NSUInteger)index {
|
||||||
if (index < self.locationArray.count) {
|
if (index < self.locationArray.count) {
|
||||||
[self.locationArray removeObjectAtIndex:index];
|
[self.locationArray xpSafeRemoveObjectAtIndex:index];
|
||||||
self.atCount = MAX(0, self.atCount - 1);
|
self.atCount = MAX(0, self.atCount - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -167,7 +167,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(self.photoList.count > 0){
|
if(self.photoList.count > 0){
|
||||||
[self.photoList removeObjectAtIndex:index];
|
[self.photoList xpSafeRemoveObjectAtIndex:index];
|
||||||
[self.collectionView reloadData];
|
[self.collectionView reloadData];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -248,8 +248,8 @@
|
|||||||
}
|
}
|
||||||
///删除图片
|
///删除图片
|
||||||
-(void)delPhotoWidthIndex:(NSInteger)index{
|
-(void)delPhotoWidthIndex:(NSInteger)index{
|
||||||
[self.datasource removeObjectAtIndex:index];
|
[self.datasource xpSafeRemoveObjectAtIndex:index];
|
||||||
[self.originAssets removeObjectAtIndex:index];
|
[self.originAssets xpSafeRemoveObjectAtIndex:index];
|
||||||
}
|
}
|
||||||
///返回,需要清空图片
|
///返回,需要清空图片
|
||||||
-(void)cleanPhotoList{
|
-(void)cleanPhotoList{
|
||||||
|
@@ -213,7 +213,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
GiftReceiveInfoModel *receiveInfo = [self.giftComboQueue firstObject];
|
GiftReceiveInfoModel *receiveInfo = [self.giftComboQueue firstObject];
|
||||||
[self.giftComboQueue removeObjectAtIndex:0];
|
[self.giftComboQueue xpSafeRemoveObjectAtIndex:0];
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[self handleGiftInfo:receiveInfo];
|
[self handleGiftInfo:receiveInfo];
|
||||||
});
|
});
|
||||||
@@ -377,7 +377,7 @@
|
|||||||
if (self.giftComboQueue.count > 0) {
|
if (self.giftComboQueue.count > 0) {
|
||||||
// 获取并移除队列中的第一个元数据
|
// 获取并移除队列中的第一个元数据
|
||||||
AttachmentModel *attachment = [self.giftComboQueue firstObject];
|
AttachmentModel *attachment = [self.giftComboQueue firstObject];
|
||||||
[self.giftComboQueue removeObjectAtIndex:0];
|
[self.giftComboQueue xpSafeRemoveObjectAtIndex:0];
|
||||||
|
|
||||||
// 处理逻辑
|
// 处理逻辑
|
||||||
[self processGiftComboWith:attachment];
|
[self processGiftComboWith:attachment];
|
||||||
|
@@ -273,7 +273,7 @@
|
|||||||
@synchronized (self.updateGoldQueue) {
|
@synchronized (self.updateGoldQueue) {
|
||||||
if (self.updateGoldQueue.count > 0) {
|
if (self.updateGoldQueue.count > 0) {
|
||||||
NSString *goldString = [self.updateGoldQueue firstObject];
|
NSString *goldString = [self.updateGoldQueue firstObject];
|
||||||
[self.updateGoldQueue removeObjectAtIndex:0];
|
[self.updateGoldQueue xpSafeRemoveObjectAtIndex:0];
|
||||||
return goldString;
|
return goldString;
|
||||||
}
|
}
|
||||||
return @"";
|
return @"";
|
||||||
|
@@ -981,10 +981,12 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView;
|
|||||||
for (int i = 0 ; i < self.packGiftList.count; i++) {
|
for (int i = 0 ; i < self.packGiftList.count; i++) {
|
||||||
GiftInfoModel *infoModel = self.packGiftList[i];
|
GiftInfoModel *infoModel = self.packGiftList[i];
|
||||||
if(infoModel.giftId == self.freeModel.giftId.integerValue){
|
if(infoModel.giftId == self.freeModel.giftId.integerValue){
|
||||||
[giftArray removeObjectAtIndex:i];
|
if (i < giftArray.count) {
|
||||||
[giftArray insertObject:infoModel atIndex:0];
|
[giftArray xpSafeRemoveObjectAtIndex:i];
|
||||||
isHaveFreeGift = YES;
|
[giftArray xpSafeInsertObject:infoModel atIndex:0];
|
||||||
break;
|
isHaveFreeGift = YES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isHaveFreeGift == NO && self.freeModel.curStage != nil && self.freeModel.curStage.integerValue == 0 ){
|
if(isHaveFreeGift == NO && self.freeModel.curStage != nil && self.freeModel.curStage.integerValue == 0 ){
|
||||||
|
@@ -30,6 +30,7 @@ isEnterprise = [bundleID isEqualToString:@"com.hflighting.yumi"];\
|
|||||||
#import "YUMIMacroUitls.h"
|
#import "YUMIMacroUitls.h"
|
||||||
#import <Masonry/Masonry.h>
|
#import <Masonry/Masonry.h>
|
||||||
#import "NSArray+Safe.h"
|
#import "NSArray+Safe.h"
|
||||||
|
#import "NSMutableArray+Safe.h"
|
||||||
#import "UIImage+Utils.h"
|
#import "UIImage+Utils.h"
|
||||||
#import "XNDJTDDLoadingTool.h"
|
#import "XNDJTDDLoadingTool.h"
|
||||||
#import "DJDKMIMOMColor.h"
|
#import "DJDKMIMOMColor.h"
|
||||||
|
64
YuMi/Tools/Safe/NSMutableArray+Safe.h
Normal file
64
YuMi/Tools/Safe/NSMutableArray+Safe.h
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
//
|
||||||
|
// NSMutableArray+Safe.h
|
||||||
|
// YUMI
|
||||||
|
//
|
||||||
|
// Created by YUMI on 2023/11/15.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface NSMutableArray (Safe)
|
||||||
|
|
||||||
|
/**
|
||||||
|
安全地从数组中移除指定索引的对象
|
||||||
|
如果索引超出范围,则不执行任何操作
|
||||||
|
|
||||||
|
@param index 要移除的对象的索引
|
||||||
|
*/
|
||||||
|
- (void)xpSafeRemoveObjectAtIndex:(NSUInteger)index;
|
||||||
|
|
||||||
|
/**
|
||||||
|
安全地从数组中移除指定的对象
|
||||||
|
如果对象不存在,则不执行任何操作
|
||||||
|
|
||||||
|
@param anObject 要移除的对象
|
||||||
|
*/
|
||||||
|
- (void)xpSafeRemoveObject:(id)anObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
安全地从数组中移除指定索引集合中的对象
|
||||||
|
如果索引集合中的任何索引超出范围,则跳过该索引
|
||||||
|
|
||||||
|
@param indexes 要移除的对象的索引集合
|
||||||
|
*/
|
||||||
|
- (void)xpSafeRemoveObjectsAtIndexes:(NSIndexSet *)indexes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
安全地在指定索引处插入对象
|
||||||
|
如果索引超出范围,则不执行任何操作或在末尾添加(取决于索引)
|
||||||
|
|
||||||
|
@param anObject 要插入的对象
|
||||||
|
@param index 要插入的位置
|
||||||
|
*/
|
||||||
|
- (void)xpSafeInsertObject:(id)anObject atIndex:(NSUInteger)index;
|
||||||
|
|
||||||
|
/**
|
||||||
|
安全地替换指定索引处的对象
|
||||||
|
如果索引超出范围,则不执行任何操作
|
||||||
|
|
||||||
|
@param index 要替换的对象的索引
|
||||||
|
@param anObject 替换的对象
|
||||||
|
*/
|
||||||
|
- (void)xpSafeReplaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
安全地移除数组中的所有对象
|
||||||
|
如果数组为空,则不执行任何操作
|
||||||
|
*/
|
||||||
|
- (void)xpSafeRemoveAllObjects;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
69
YuMi/Tools/Safe/NSMutableArray+Safe.m
Normal file
69
YuMi/Tools/Safe/NSMutableArray+Safe.m
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
//
|
||||||
|
// NSMutableArray+Safe.m
|
||||||
|
// YUMI
|
||||||
|
//
|
||||||
|
// Created by YUMI on 2023/11/15.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "NSMutableArray+Safe.h"
|
||||||
|
|
||||||
|
@implementation NSMutableArray (Safe)
|
||||||
|
|
||||||
|
- (void)xpSafeRemoveObjectAtIndex:(NSUInteger)index {
|
||||||
|
if ([self isKindOfClass:[NSMutableArray class]]) {
|
||||||
|
if (self.count > 0 && index < self.count) {
|
||||||
|
[self removeObjectAtIndex:index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)xpSafeRemoveObject:(id)anObject {
|
||||||
|
if ([self isKindOfClass:[NSMutableArray class]]) {
|
||||||
|
if (anObject && [self containsObject:anObject]) {
|
||||||
|
[self removeObject:anObject];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)xpSafeRemoveObjectsAtIndexes:(NSIndexSet *)indexes {
|
||||||
|
if ([self isKindOfClass:[NSMutableArray class]] && indexes) {
|
||||||
|
// 创建一个有效索引的集合
|
||||||
|
NSMutableIndexSet *validIndexes = [NSMutableIndexSet indexSet];
|
||||||
|
[indexes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
|
||||||
|
if (idx < self.count) {
|
||||||
|
[validIndexes addIndex:idx];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
|
||||||
|
if (validIndexes.count > 0) {
|
||||||
|
[self removeObjectsAtIndexes:validIndexes];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)xpSafeInsertObject:(id)anObject atIndex:(NSUInteger)index {
|
||||||
|
if ([self isKindOfClass:[NSMutableArray class]] && anObject) {
|
||||||
|
if (index <= self.count) {
|
||||||
|
[self insertObject:anObject atIndex:index];
|
||||||
|
} else if (index > self.count) {
|
||||||
|
// 如果索引超出范围,则添加到末尾
|
||||||
|
[self addObject:anObject];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)xpSafeReplaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject {
|
||||||
|
if ([self isKindOfClass:[NSMutableArray class]] && anObject) {
|
||||||
|
if (index < self.count) {
|
||||||
|
[self replaceObjectAtIndex:index withObject:anObject];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)xpSafeRemoveAllObjects {
|
||||||
|
if ([self isKindOfClass:[NSMutableArray class]] && self.count > 0) {
|
||||||
|
[self removeAllObjects];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@@ -557,8 +557,10 @@
|
|||||||
@kWeakify(self)
|
@kWeakify(self)
|
||||||
UITableViewRowAction * deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"置頂" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
|
UITableViewRowAction * deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"置頂" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
|
||||||
@kStrongify(self)
|
@kStrongify(self)
|
||||||
[ self.dataArr removeObjectAtIndex:indexPath.row];
|
if (indexPath.row < self.dataArr.count) {
|
||||||
[self.tableView reloadData];
|
[self.dataArr xpSafeRemoveObjectAtIndex:indexPath.row];
|
||||||
|
[self.tableView reloadData];
|
||||||
|
}
|
||||||
}];
|
}];
|
||||||
deleteAction.title = @"刪除";
|
deleteAction.title = @"刪除";
|
||||||
deleteAction.backgroundColor = [UIColor redColor];
|
deleteAction.backgroundColor = [UIColor redColor];
|
||||||
|
Reference in New Issue
Block a user