我的,网络下载优化

This commit is contained in:
liyuhua
2023-11-02 11:14:35 +08:00
parent 79015ca5ce
commit 723e946141
5 changed files with 100 additions and 137 deletions

View File

@@ -85,8 +85,7 @@ UIKIT_EXTERN NSString *kRequestRicket;
@property(nonatomic,assign)BOOL isHavePermission;
///
@property (nonatomic,assign) BOOL isRefreshRoomInfo;
///,
@property (nonatomic,assign) BOOL isRequestData;
///
@property (nonatomic, strong) NSMutableArray<LittleGameInfoModel *> *littleGameArray;
@@ -503,7 +502,7 @@ UIKIT_EXTERN NSString *kRequestRicket;
#pragma mark - XPMineProtocol
///
- (void)onGetMineFuntionItemSuccess:(NSArray<XPMineFuntionItemModel *> *)items WithGroup:(nonnull dispatch_group_t)group{
- (void)onGetMineFuntionItemSuccess:(NSArray<XPMineFuntionItemModel *> *)items {
[self.functionArray removeAllObjects];
[self.functionArray addObjectsFromArray:items];
[self.functionArray enumerateObjectsUsingBlock:^(XPMineFuntionItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
@@ -517,45 +516,46 @@ UIKIT_EXTERN NSString *kRequestRicket;
}
NSString *trackName = [array componentsJoinedByString:@","];
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventusercenter_function_show eventAttributes:@{@"functionName" : trackName}];
dispatch_group_leave(group);
[self.tableView reloadData];
}
- (void)onGetMineFuntionItemFailWithGroup:(dispatch_group_t)group{
dispatch_group_leave(group);
- (void)onGetMineFuntionItemFail{
}
///
- (void)onGetLittleGameListSuccess:(NSArray<LittleGameInfoModel *> *)items WithGroup:(nonnull dispatch_group_t)group{
- (void)onGetLittleGameListSuccess:(NSArray<LittleGameInfoModel *> *)items {
[self.littleGameArray removeAllObjects];
[self.littleGameArray addObjectsFromArray:items];
dispatch_group_leave(group);
NSMutableArray *array = [NSMutableArray array];
for (LittleGameInfoModel *item in self.littleGameArray) {
[array addObject:item.name];
}
NSString *trackName = [array componentsJoinedByString:@","];
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventusercenter_quick_entry_show eventAttributes:@{@"gameName" : trackName}];
[self.tableView reloadData];
}
- (void)onGetLittleGameListFailWithGroup:(dispatch_group_t)group{
dispatch_group_leave(group);
- (void)onGetLittleGameListFail{
}
///banner
- (void)onGetPersonalBannerListSuccess:(NSArray<HomeBannerInfoModel *> *)items WithGroup:(nonnull dispatch_group_t)group{
- (void)onGetPersonalBannerListSuccess:(NSArray<HomeBannerInfoModel *> *)items {
[self.bannerArray removeAllObjects];
[self.bannerArray addObjectsFromArray:items];
dispatch_group_leave(group);
NSMutableArray *array = [NSMutableArray array];
for (HomeBannerInfoModel *item in self.bannerArray) {
[array addObject:item.bannerId];
}
NSString *trackName = [array componentsJoinedByString:@","];
[StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventusercenter_banner_show eventAttributes:@{@"bannerId" : trackName}];
[self.tableView reloadData];
}
-(void)onGetPersonalBannerListFailWithGroup:(dispatch_group_t)group{
dispatch_group_leave(group);
-(void)onGetPersonalBannerListFail{
}
- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo {
@synchronized (self.presenter) {
///401
if (!userInfo.isBindPhone && [ClientConfig shareConfig].iosPhoneBind) {
return;
@@ -563,78 +563,47 @@ UIKIT_EXTERN NSString *kRequestRicket;
if (userInfo.nick == nil || userInfo.avatar == nil ) {
return;
}
if(self.isRequestData == YES){
return;
}
self.isRequestData = YES;
// group
dispatch_group_t group =dispatch_group_create();
//
dispatch_queue_t queue =dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0);
dispatch_group_enter(group);
dispatch_group_async(group, queue, ^{
[self.presenter getClanDetailInfoWithGroup:group];
});
dispatch_group_enter(group);
dispatch_group_async(group, queue, ^{
[self.presenter getUserWalletInfoWithGroup:group];
});
dispatch_group_enter(group);
dispatch_group_async(group, queue, ^{
[self.presenter getPersonItemListWithGroup:group];
});
dispatch_group_enter(group);
dispatch_group_async(group, queue, ^{
[self.presenter getLittleGameListWithGroup:group];
});
dispatch_group_enter(group);
dispatch_group_async(group, queue, ^{
[self.presenter getMineBannerListWithGroup:group];
});
dispatch_group_enter(group);
dispatch_group_async(group, queue, ^{
[self.presenter getNobleInfoWithGroup:group];
});
self.userInfo = userInfo;
[self.presenter getClanDetailInfo];
[self.presenter getUserWalletInfo];
[self.presenter getPersonItemList];
[self.presenter getLittleGameList];
[self.presenter getMineBannerList];
[self.presenter getNobleInfo];
dispatch_group_notify(group,dispatch_get_main_queue(), ^{
self.isRequestData = NO;
self.userInfo = userInfo;
[self checkHaveGiveDiamondsPermission];
userInfo.idAtt = [self.headView creatNameplateIdLabelAttribute:userInfo];
[self.headView creatNameplateLevleAttribute:userInfo complete:^(NSMutableAttributedString *textAtt) {
userInfo.levelAtt = textAtt;
self.headView.userInfo = userInfo;
}];
[self.tableView reloadData];
});
}
[self checkHaveGiveDiamondsPermission];
userInfo.idAtt = [self.headView creatNameplateIdLabelAttribute:userInfo];
[self.headView creatNameplateLevleAttribute:userInfo complete:^(NSMutableAttributedString *textAtt) {
userInfo.levelAtt = textAtt;
self.headView.userInfo = userInfo;
}];
[self.tableView reloadData];
}
- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo WithGroup:(nonnull dispatch_group_t)group{
- (void)getUserWalletInfo:(WalletInfoModel *)balanceInfo{
self.headView.walletInfo = balanceInfo;
dispatch_group_leave(group);
[self.tableView reloadData];
}
- (void)getUserWalletInfoFailWithGroup:(dispatch_group_t)group{
dispatch_group_leave(group);
- (void)getUserWalletInfoFail{
}
///
- (void)getNobleCenterInfoSuccess:(NobleCenterModel *)model WithGroup:(nonnull dispatch_group_t)group {
- (void)getNobleCenterInfoSuccess:(NobleCenterModel *)model {
self.headView.nobleInfo = model;
dispatch_group_leave(group);
[self.tableView reloadData];
}
-(void)getNobleCenterInfoFailWithGroup:(dispatch_group_t)group{
dispatch_group_leave(group);
-(void)getNobleCenterInfoFail{
}
///
- (void)onGetClanDetailInfoSuccess:(ClanDetailInfoModel *)clanInfo WithGroup:(nonnull dispatch_group_t)group{
- (void)onGetClanDetailInfoSuccess:(ClanDetailInfoModel *)clanInfo {
self.clanInfo = clanInfo;
dispatch_group_leave(group);
[self.tableView reloadData];
}
- (void)onGetClanDetailInfofailWithGroup:(dispatch_group_t)group{
dispatch_group_leave(group);
- (void)onGetClanDetailInfofail{
}
///