Commit 3c3aa6b4 by ludi

1.完成一级页面所有红点,与提示

2.调整home的追踪点击逻辑
parent b3c3a7c4
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
} }
+ (UIColor *)fus_themeColor{ + (UIColor *)fus_themeColor{
return [self fus_diamondBlue]; return [self colorWithHex:@"##00F7FF"];
} }
+ (UIColor *)fus_themeThirdColor{ + (UIColor *)fus_themeThirdColor{
......
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) { if (self) {
// [self.detailTextLabel addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil]; [self.detailTextLabel addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil];
// 副标题显示多行 // 副标题显示多行
self.detailTextLabel.numberOfLines = 0; self.detailTextLabel.numberOfLines = 0;
// 图标居中 // 图标居中
...@@ -69,8 +69,8 @@ ...@@ -69,8 +69,8 @@
// 内容居右 // 内容居右
self.detailTextLabel.textAlignment = NSTextAlignmentRight; self.detailTextLabel.textAlignment = NSTextAlignmentRight;
[self.contentView addSubview:self.theImageView]; // [self.contentView addSubview:self.theImageView];
[self.contentView addSubview:self.leftCircleRedView]; // [self.contentView addSubview:self.leftCircleRedView];
} }
return self; return self;
} }
...@@ -336,12 +336,12 @@ ...@@ -336,12 +336,12 @@
_theRightLabel = nil; _theRightLabel = nil;
[_thirdPartyCell removeFromSuperview]; [_thirdPartyCell removeFromSuperview];
_thirdPartyCell = nil; _thirdPartyCell = nil;
// [_theImageView removeFromSuperview]; [_theImageView removeFromSuperview];
// _theImageView = nil; _theImageView = nil;
// [_leftCircleRedView removeFromSuperview]; [_leftCircleRedView removeFromSuperview];
// _leftCircleRedView = nil; _leftCircleRedView = nil;
self.theImageView.hidden = YES; // self.theImageView.hidden = YES;
self.leftCircleRedView.hidden = YES; // self.leftCircleRedView.hidden = YES;
// 接收模型 // 接收模型
_item = item; _item = item;
...@@ -416,7 +416,7 @@ ...@@ -416,7 +416,7 @@
self.accessoryView = self.theArrowImageView; self.accessoryView = self.theArrowImageView;
} }
// [self.contentView addSubview:self.theImageView]; [self.contentView addSubview:self.theImageView];
self.theImageView.hidden = NO; self.theImageView.hidden = NO;
} }
break; break;
...@@ -427,14 +427,14 @@ ...@@ -427,14 +427,14 @@
break; break;
case CustomSettingItemTypeShowImage: case CustomSettingItemTypeShowImage:
{ {
// [self.contentView addSubview:self.theImageView]; [self.contentView addSubview:self.theImageView];
self.theImageView.hidden = NO; self.theImageView.hidden = NO;
} }
break; break;
case CustomSettingItemTypeShowImageAndArrow: case CustomSettingItemTypeShowImageAndArrow:
{ {
self.accessoryView = self.theArrowImageView; self.accessoryView = self.theArrowImageView;
// [self.contentView addSubview:self.theImageView]; [self.contentView addSubview:self.theImageView];
self.theImageView.hidden = NO; self.theImageView.hidden = NO;
} }
break; break;
...@@ -463,44 +463,45 @@ ...@@ -463,44 +463,45 @@
break; break;
} }
if (self.theImageView.isHidden == NO && (_item.rightShowImage != nil || ![NSString isNull:_item.rightShowImageUrl])) { // if (self.theImageView.isHidden == NO && (_item.rightShowImage != nil || ![NSString isNull:_item.rightShowImageUrl])) {
[self.theImageView mas_remakeConstraints:^(MASConstraintMaker *make) { // [self.theImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.detailTextLabel.mas_left).offset(-3); // make.right.equalTo(self.detailTextLabel.mas_left).offset(-3);
// make.centerY.equalTo(self.detailTextLabel.mas_centerY); //// make.centerY.equalTo(self.detailTextLabel.mas_centerY);
make.centerY.offset(0); // make.centerY.offset(0);
if (!CGRectEqualToRect(_item.rightShowImageFrame, CGRectZero)) { // if (!CGRectEqualToRect(_item.rightShowImageFrame, CGRectZero)) {
make.size.mas_equalTo(_item.rightShowImageFrame.size); // make.size.mas_equalTo(_item.rightShowImageFrame.size);
}else{ // }else{
make.size.mas_equalTo(CGSizeMake(22, 22)); // make.size.mas_equalTo(CGSizeMake(22, 22));
} // }
}]; // }];
}else { // }else {
self.theImageView.hidden = YES; // self.theImageView.hidden = YES;
} // }
//
if (item.isShowRedCirclePoint) {
self.leftCircleRedView.hidden = NO;
if (item.redCircleColor) {
self.leftCircleRedView.backgroundColor = item.redCircleColor;
}else{
self.leftCircleRedView.backgroundColor = [UIColor redColor];
}
[self.leftCircleRedView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.centerY.equalTo(self.detailTextLabel.mas_centerY);
make.centerY.offset(0);
make.size.mas_equalTo(CGSizeMake(kRightRedViewWidth, kRightRedViewWidth));
if (self.theImageView.isHidden) {
make.right.equalTo(self.detailTextLabel.mas_left).offset(-2);
}else{
make.right.equalTo(self.theImageView.mas_left).offset(-2);
}
}];
}
// if (item.isShowRedCirclePoint) { // if (item.isShowRedCirclePoint) {
// //放在这里add是解决不圆的bug
// [self.contentView addSubview:self.leftCircleRedView]; // [self.contentView addSubview:self.leftCircleRedView];
// self.leftCircleRedView.hidden = NO;
// if (item.redCircleColor) {
// self.leftCircleRedView.backgroundColor = item.redCircleColor;
// }else{
// self.leftCircleRedView.backgroundColor = [UIColor redColor];
// }
// [self.leftCircleRedView mas_makeConstraints:^(MASConstraintMaker *make) {
//// make.centerY.equalTo(self.detailTextLabel.mas_centerY);
// make.centerY.offset(0);
// make.size.mas_equalTo(CGSizeMake(kRightRedViewWidth, kRightRedViewWidth));
// if (self.theImageView.isHidden) {
// make.right.equalTo(self.detailTextLabel.mas_left).offset(-2);
// }else{
// make.right.equalTo(self.theImageView.mas_left).offset(-2);
// }
// }];
// } // }
if (item.isShowRedCirclePoint) {
//放在这里add是解决不圆的bug
[self.contentView addSubview:self.leftCircleRedView];
}
} }
- (void)setItemsGroup:(FUSCustomSettingGroup *)itemsGroup { - (void)setItemsGroup:(FUSCustomSettingGroup *)itemsGroup {
...@@ -510,37 +511,38 @@ ...@@ -510,37 +511,38 @@
self.maskLayer = nil; self.maskLayer = nil;
} }
//-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context { -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
//// FUSLogInfo(@""); // FUSLogInfo(@"");
// NSValue *value = [change objectForKey:@"new"]; NSValue *value = [change objectForKey:@"new"];
// CGRect frame = [value CGRectValue]; CGRect frame = [value CGRectValue];
//
// if (!CGRectEqualToRect(_item.rightShowImageFrame, CGRectZero)) { if (!CGRectEqualToRect(_item.rightShowImageFrame, CGRectZero)) {
//// _theImageView.centerY = frame.origin.y + frame.size.height / 2.0f; // _theImageView.centerY = frame.origin.y + frame.size.height / 2.0f;
// _theImageView.y = (frame.origin.y + frame.size.height / 2.0f) - _item.rightShowImageFrame.size.height / 2.0f; // _theImageView.y = (frame.origin.y + frame.size.height / 2.0f) - _item.rightShowImageFrame.size.height / 2.0f;
// if (FUSRTL.isRTL) { _theImageView.centerY = self.contentView.height / 2.0f;
// _theImageView.x = self.detailTextLabel.right + 3; if (FUSRTL.isRTL) {
// } else { _theImageView.x = self.detailTextLabel.right + 3;
// _theImageView.x = self.detailTextLabel.x - _item.rightShowImageFrame.size.width - 3; } else {
// } _theImageView.x = self.detailTextLabel.x - _item.rightShowImageFrame.size.width - 3;
// frame = _theImageView.frame; }
// } frame = _theImageView.frame;
// }
// if (_item.isShowRedCirclePoint) {
//// [self.contentView addSubview:self.leftCircleRedView]; if (_item.isShowRedCirclePoint) {
// if (FUSRTL.isRTL) { // [self.contentView addSubview:self.leftCircleRedView];
// self.leftCircleRedView.x = CGRectGetMaxX(frame) + 2; if (FUSRTL.isRTL) {
// } else { self.leftCircleRedView.x = CGRectGetMaxX(frame) + 2;
// self.leftCircleRedView.x = CGRectGetMinX(frame) - kRightRedViewWidth - 2; } else {
// } self.leftCircleRedView.x = CGRectGetMinX(frame) - kRightRedViewWidth - 2;
//// self.leftCircleRedView.y = 28; }
// self.leftCircleRedView.centerY = frame.origin.y + frame.size.height / 2.0f; // self.leftCircleRedView.centerY = frame.origin.y + frame.size.height / 2.0f;
// self.leftCircleRedView.backgroundColor = self.item.redCircleColor; self.leftCircleRedView.centerY = self.contentView.height / 2.0f;
// } self.leftCircleRedView.backgroundColor = self.item.redCircleColor;
//} }
// }
//- (void)dealloc {
// [self.detailTextLabel removeObserver:self forKeyPath:@"frame"]; - (void)dealloc {
//} [self.detailTextLabel removeObserver:self forKeyPath:@"frame"];
}
@end @end
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#import "FUSLangAreaCountryModel.h" #import "FUSLangAreaCountryModel.h"
#import "FUSSettingInitDataModel.h" #import "FUSSettingInitDataModel.h"
#import "FUSUserTradeRemindModel.h" #import "FUSUserTradeRemindModel.h"
#import "FUSZoneInfosModel.h"
@interface FUSCacheDataShare : NSObject @interface FUSCacheDataShare : NSObject
...@@ -34,6 +35,9 @@ ...@@ -34,6 +35,9 @@
// 当前登录用户详细信息 // 当前登录用户详细信息
@property (nonatomic, strong) FUSUserInfosModel *userDetailInfo; @property (nonatomic, strong) FUSUserInfosModel *userDetailInfo;
/// 记录当前最新的myZoneInfoModel,网络请求的总会覆盖掉缓存的
@property (nonatomic, strong) FUSZoneInfosModel *myZoneInfoModel;
@property (nonatomic, strong) FUSLangAreaCountryModel *areaCountryInfo; // 語言、語區、註冊國家相關信息 @property (nonatomic, strong) FUSLangAreaCountryModel *areaCountryInfo; // 語言、語區、註冊國家相關信息
......
...@@ -255,3 +255,6 @@ ...@@ -255,3 +255,6 @@
// 获取用户数据交易提醒 // 获取用户数据交易提醒
#define FUS_USER_TRADE_REMIND_CHANGE_NOTIFICATION @"FUS_USER_TRADE_REMIND_CHANGE_NOTIFICATION" #define FUS_USER_TRADE_REMIND_CHANGE_NOTIFICATION @"FUS_USER_TRADE_REMIND_CHANGE_NOTIFICATION"
// 通知:我的页面红点改变
#define FUS_NOTIFICATION_MYZONE_ITEM_BADGEVALUE_CHANGE @"FUS_NOTIFICATION_MYZONE_ITEM_BADGEVALUE_CHANGE"
...@@ -39,18 +39,26 @@ ...@@ -39,18 +39,26 @@
[[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:UNAuthorizationOptionBadge|UNAuthorizationOptionSound|UNAuthorizationOptionAlert completionHandler:^(BOOL granted, NSError * _Nullable error) { [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:UNAuthorizationOptionBadge|UNAuthorizationOptionSound|UNAuthorizationOptionAlert completionHandler:^(BOOL granted, NSError * _Nullable error) {
}]; }];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(fus_applicationDidBecomeActiveNotification:)
name:UIApplicationDidBecomeActiveNotification
object:nil];
[self fus_setupProperties]; [self fus_setupProperties];
[self fus_createHomeScrollView];
[self fus_createTabbarView]; [self fus_createTabbarView];
[self fus_createHomeScrollView];
[self.view bringSubviewToFront:self.tabbarView];
} }
-(void)fus_setupProperties{ -(void)fus_setupProperties{
self.contentViewList = [[NSMutableArray alloc] initWithArray:@[[[FUSMyView alloc] init], [[FUSHomeView alloc] init], [[FUSMessageView alloc] init]]];
} }
-(void)fus_createHomeScrollView{ -(void)fus_createHomeScrollView{
self.contentViewList = [[NSMutableArray alloc] initWithArray:@[[[FUSMyView alloc] init], [[FUSHomeView alloc] init], [[FUSMessageView alloc] init]]];
_scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, UIView.fus_screenW, UIView.fus_screenH)]; _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, UIView.fus_screenW, UIView.fus_screenH)];
_scrollView.contentSize = CGSizeMake(UIView.fus_screenW * self.contentViewList.count, UIView.fus_screenH); _scrollView.contentSize = CGSizeMake(UIView.fus_screenW * self.contentViewList.count, UIView.fus_screenH);
_scrollView.pagingEnabled = YES; _scrollView.pagingEnabled = YES;
...@@ -97,6 +105,18 @@ ...@@ -97,6 +105,18 @@
self.firstLoad = NO; self.firstLoad = NO;
} }
- (void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated];
[self.contentViewList[self.tabbarView.currentIndex] fus_viewDidDisappear];
}
#pragma mark --- observer
-(void)fus_applicationDidBecomeActiveNotification:(NSNotification *)noti{
[self.contentViewList enumerateObjectsUsingBlock:^(FUSHomePageBaseView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
[obj fus_applicationDidBecomeActiveNotification:noti];
}];
}
#pragma mark --- FUSHomeViewBaseDelegate #pragma mark --- FUSHomeViewBaseDelegate
- (void)fus_homeView:(UIView *)view didUpdateCollectionCntentMaxHeightWithFloor:(CGFloat)maxHeight{ - (void)fus_homeView:(UIView *)view didUpdateCollectionCntentMaxHeightWithFloor:(CGFloat)maxHeight{
self.tabbarView.shouldBarCenterTransparency = maxHeight > (UIView.fus_screenH - [FUSFloatTabbarView fus_barHeight]); self.tabbarView.shouldBarCenterTransparency = maxHeight > (UIView.fus_screenH - [FUSFloatTabbarView fus_barHeight]);
...@@ -116,6 +136,7 @@ ...@@ -116,6 +136,7 @@
[self.scrollView scrollRectToVisible:scFrame animated:NO]; [self.scrollView scrollRectToVisible:scFrame animated:NO];
[self.contentViewList[index] fus_viewWillShow]; [self.contentViewList[index] fus_viewWillShow];
[self.contentViewList[lastIndex] fus_viewDidDisappear];
} }
} }
...@@ -123,11 +144,15 @@ ...@@ -123,11 +144,15 @@
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{ - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
if ( scrollView == self.scrollView ) { if ( scrollView == self.scrollView ) {
NSInteger lastIndex = self.tabbarView.currentIndex;
NSInteger index = (NSInteger)(scrollView.contentOffset.x/scrollView.width + 0.5); NSInteger index = (NSInteger)(scrollView.contentOffset.x/scrollView.width + 0.5);
if (index >= 0 && index < self.contentViewList.count) { if (index >= 0 && index < self.contentViewList.count) {
[self.tabbarView fus_setSelect:index autoCall:NO]; [self.tabbarView fus_setSelect:index autoCall:NO];
} }
[self.contentViewList[index] fus_viewWillShow]; [self.contentViewList[index] fus_viewWillShow];
if (lastIndex != index) {
[self.contentViewList[lastIndex] fus_viewDidDisappear];
}
} }
} }
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{ - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
...@@ -139,4 +164,9 @@ ...@@ -139,4 +164,9 @@
} }
} }
#pragma mark --- other
- (void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
@end @end
...@@ -37,6 +37,10 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -37,6 +37,10 @@ NS_ASSUME_NONNULL_BEGIN
-(void)fus_viewWillShow; -(void)fus_viewWillShow;
-(void)fus_viewDidDisappear;
-(void)fus_applicationDidBecomeActiveNotification:(NSNotification *)noti;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -18,4 +18,12 @@ ...@@ -18,4 +18,12 @@
} }
- (void)fus_viewDidDisappear{
}
- (void)fus_applicationDidBecomeActiveNotification:(NSNotification *)noti{
}
@end @end
...@@ -287,6 +287,9 @@ ...@@ -287,6 +287,9 @@
if ([self.collectionView.mj_header isRefreshing]) { if ([self.collectionView.mj_header isRefreshing]) {
[self.collectionView.mj_header endRefreshing]; [self.collectionView.mj_header endRefreshing];
} }
[self.naviView fus_setButton:FUSHomeNaviViewClickTypeFollow selected:type == FUSHomeViewAnchorListTypeFollow ? YES : NO];
[self.collectionView reloadData];
if (type == FUSHomeViewAnchorListTypeFollow && [NSArray isNull:self.viewModel.dataList]) { if (type == FUSHomeViewAnchorListTypeFollow && [NSArray isNull:self.viewModel.dataList]) {
[self.viewModel fus_switchToList:FUSHomeViewAnchorListTypeNormal]; [self.viewModel fus_switchToList:FUSHomeViewAnchorListTypeNormal];
if (self.viewModel.recommendModel != nil) { if (self.viewModel.recommendModel != nil) {
...@@ -296,10 +299,7 @@ ...@@ -296,10 +299,7 @@
}]; }];
} }
return;
} }
[self.naviView fus_setButton:FUSHomeNaviViewClickTypeFollow selected:type == FUSHomeViewAnchorListTypeFollow ? YES : NO];
[self.collectionView reloadData];
} }
#pragma mark --- FUSHomeLanguageSegmentViewDelegate #pragma mark --- FUSHomeLanguageSegmentViewDelegate
......
...@@ -52,10 +52,6 @@ ...@@ -52,10 +52,6 @@
self.isUserCloseNotificationRemind = NO; self.isUserCloseNotificationRemind = NO;
[self fus_reloadnotificationRemindTips]; [self fus_reloadnotificationRemindTips];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(fus_applicationDidBecomeActiveNotification:)
name:UIApplicationDidBecomeActiveNotification
object:nil];
} }
return self; return self;
} }
...@@ -65,6 +61,9 @@ ...@@ -65,6 +61,9 @@
[self fus_loadUserTradeRemind]; [self fus_loadUserTradeRemind];
} }
-(void)fus_applicationDidBecomeActiveNotification:(NSNotification *)noti{
[self fus_reloadnotificationRemindTips];
}
-(void)fus_createUI{ -(void)fus_createUI{
...@@ -310,11 +309,6 @@ ...@@ -310,11 +309,6 @@
[self fus_reloadMessageFunctionColumnUI]; [self fus_reloadMessageFunctionColumnUI];
} }
#pragma mark --- observer
-(void)fus_applicationDidBecomeActiveNotification:(NSNotification *)noti{
[self fus_reloadnotificationRemindTips];
}
#pragma mark --- button did clicked #pragma mark --- button did clicked
-(void)fus_notificationRemindCloseBtnDidClicked:(UIButton *)btn{ -(void)fus_notificationRemindCloseBtnDidClicked:(UIButton *)btn{
self.notificationRemindView.hidden = YES; self.notificationRemindView.hidden = YES;
...@@ -338,9 +332,5 @@ ...@@ -338,9 +332,5 @@
} }
} }
#pragma mark --- other
- (void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
@end @end
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
[self.onlyLiveRoomList addObject:tempModel]; [self.onlyLiveRoomList addObject:tempModel];
} }
} }
[self fus_sortNormalDataListAutoCall:autoCall]; [self fus_sortDataListAutoCall:autoCall];
} failure:^(NSString *msg, int code) { } failure:^(NSString *msg, int code) {
[FUSDialogView fus_showDialog:msg]; [FUSDialogView fus_showDialog:msg];
...@@ -144,12 +144,7 @@ ...@@ -144,12 +144,7 @@
self.followAnchorOriginalList = modelList; self.followAnchorOriginalList = modelList;
self.recommendModel = recommendModel; self.recommendModel = recommendModel;
if (autoCall) { [self fus_sortDataListAutoCall:autoCall];
// 为了让下拉刷新可以回调
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeViewViewModelAnchorListDidUpdate:)]) {
[self.delegate fus_homeViewViewModelAnchorListDidUpdate:FUSHomeViewAnchorListTypeFollow];
}
}
} failure:^(NSString *msg, int code) { } failure:^(NSString *msg, int code) {
...@@ -183,7 +178,7 @@ ...@@ -183,7 +178,7 @@
return NO; return NO;
}else { }else {
self.anchorListType = anchorListType; self.anchorListType = anchorListType;
[self fus_sortNormalDataListAutoCall:YES]; [self fus_sortDataListAutoCall:YES];
return YES; return YES;
} }
}else { }else {
...@@ -191,18 +186,16 @@ ...@@ -191,18 +186,16 @@
return NO; return NO;
}else { }else {
self.anchorListType = anchorListType; self.anchorListType = anchorListType;
self.dataList = [[NSMutableArray alloc] initWithArray:self.followAnchorOriginalList]; [self fus_sortDataListAutoCall:YES];
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeViewViewModelAnchorListDidUpdate:)]) {
[self.delegate fus_homeViewViewModelAnchorListDidUpdate:FUSHomeViewAnchorListTypeFollow];
}
return YES; return YES;
} }
} }
} }
/// 选择语言后讲数据排序 /// 数据排序,根据当前选的的类型和语言
-(void)fus_sortNormalDataListAutoCall:(BOOL)autoCall{ -(void)fus_sortDataListAutoCall:(BOOL)autoCall{
if (self.anchorListType == FUSHomeViewAnchorListTypeNormal) {
if (self.selectLanguageModel != nil) { if (self.selectLanguageModel != nil) {
[self.dataList removeAllObjects]; [self.dataList removeAllObjects];
...@@ -218,10 +211,13 @@ ...@@ -218,10 +211,13 @@
[preDataList addObjectsFromArray:subDataList]; [preDataList addObjectsFromArray:subDataList];
self.dataList = preDataList; self.dataList = preDataList;
} }
}else if (self.anchorListType == FUSHomeViewAnchorListTypeFollow) {
self.dataList = [[NSMutableArray alloc] initWithArray:self.followAnchorOriginalList];
}
if (autoCall) { if (autoCall) {
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeViewViewModelAnchorListDidUpdate:)]) { if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeViewViewModelAnchorListDidUpdate:)]) {
[self.delegate fus_homeViewViewModelAnchorListDidUpdate:FUSHomeViewAnchorListTypeNormal]; [self.delegate fus_homeViewViewModelAnchorListDidUpdate:self.anchorListType];
} }
} }
} }
...@@ -258,7 +254,7 @@ ...@@ -258,7 +254,7 @@
self.selectLanguageModel = self.showingOtherLanguagelist[index]; self.selectLanguageModel = self.showingOtherLanguagelist[index];
[self fus_updateSelectLanguageModel]; [self fus_updateSelectLanguageModel];
if (self.anchorListType == FUSHomeViewAnchorListTypeNormal) { if (self.anchorListType == FUSHomeViewAnchorListTypeNormal) {
[self fus_sortNormalDataListAutoCall:YES]; [self fus_sortDataListAutoCall:YES];
} }
} }
......
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
@property (nonatomic, strong) NSMutableArray *btnList; @property (nonatomic, strong) NSMutableArray *btnList;
@property (nonatomic, assign) NSInteger zhaixinUnreadCount;
@property (nonatomic, assign) NSInteger fansUnreadCount;
@end @end
@implementation FUSFloatTabbarView @implementation FUSFloatTabbarView
...@@ -34,13 +37,24 @@ ...@@ -34,13 +37,24 @@
if (self) { if (self) {
[self fus_setupPropeties]; [self fus_setupPropeties];
[self fus_createUI]; [self fus_createUI];
[self fus_setupNotification];
} }
return self; return self;
} }
-(void)fus_setupNotification{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_refreshZhaixinUnreadCount:) name:Tabbar_Unread_Count object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_refreshTradeRemindChange:) name:FUS_USER_TRADE_REMIND_CHANGE_NOTIFICATION object:nil];
//我的
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_refreshFansUnreadCount:) name:Tabbar_Unread_Count_Fans object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_reloadUserUnreadUI) name:FUS_NOTIFICATION_MYZONE_ITEM_BADGEVALUE_CHANGE object:nil];
}
-(void)fus_setupPropeties{ -(void)fus_setupPropeties{
_zhaixinUnreadCount = 0;
_currentIndex = 1; _currentIndex = 1;
_fansUnreadCount = 0;
self.shouldBarCenterTransparency = NO; self.shouldBarCenterTransparency = NO;
self.barItemImageNameList = @[@"fus_tabbar_item_my_unselect", @"fus_tabbar_item_home_unselect", @"fus_tabbar_item_message_unselect"]; self.barItemImageNameList = @[@"fus_tabbar_item_my_unselect", @"fus_tabbar_item_home_unselect", @"fus_tabbar_item_message_unselect"];
self.barItemImageNameWhiteList = @[@"fus_tabbar_item_my_white", @"fus_tabbar_item_home_unselect", @"fus_tabbar_item_message_white"]; self.barItemImageNameWhiteList = @[@"fus_tabbar_item_my_white", @"fus_tabbar_item_home_unselect", @"fus_tabbar_item_message_white"];
...@@ -109,8 +123,6 @@ ...@@ -109,8 +123,6 @@
self.btnList = [[NSMutableArray alloc] initWithArray:@[self.myBtn, self.homeBtn, self.messageBtn]]; self.btnList = [[NSMutableArray alloc] initWithArray:@[self.myBtn, self.homeBtn, self.messageBtn]];
[self.myBtn fus_setBadgeValue:0];
[self.messageBtn fus_setBadgeValue:99];
} }
-(void)fus_reloadBarUI{ -(void)fus_reloadBarUI{
...@@ -137,6 +149,97 @@ ...@@ -137,6 +149,97 @@
} }
} }
-(void)fus_reloadMessageUnreadUI{
NSInteger unreadCount = self.zhaixinUnreadCount;
unreadCount += [FUSCacheDataShare shareStore].userTradeRemindModel.gemRemindSum;
unreadCount += [FUSCacheDataShare shareStore].userTradeRemindModel.chipRemindSum;
unreadCount += [FUSCacheDataShare shareStore].userTradeRemindModel.bondsRemindSum;
if (unreadCount == 0 && [FUSCacheDataShare shareStore].userTradeRemindModel.inviteRemindSum == 0) {
unreadCount = -1;
}
[self.messageBtn fus_setBadgeValue:unreadCount];
}
-(void)fus_reloadUserUnreadUI{
//粉丝
NSInteger unreadCount = self.fansUnreadCount;
//如果粉丝新增是0,那么看看其他的需不需要显示红点
if (unreadCount == 0) {
BOOL otherShouldShow = NO;
// 绑定经济人
BOOL agentIsClick = [[[NSUserDefaults standardUserDefaults] objectForKey:ZONE_BOUND_AGENT_RED_CLICK] boolValue];
if (!agentIsClick) {
//没有被点击,看看经纪人是否有在显示
BOOL needShow = [[[NSUserDefaults standardUserDefaults] objectForKey:ZONE_TASK_INVITE_DEW_ITEM_SWITCH] boolValue];
if (needShow) {
NSDictionary *infoDic = [[NSUserDefaults standardUserDefaults] objectForKey:BOUND_AGENT_INFO];
if (infoDic && [infoDic[@"bindagent"] integerValue] == 1){
if ([FUSCacheDataShare shareStore].myZoneInfoModel &&
[[FUSCacheDataShare shareStore].myZoneInfoModel.invite[@"isShow"] boolValue]) {
otherShouldShow = YES;
}
}
}
}
//邀请奖励
BOOL isClickInviteItem = [[[NSUserDefaults standardUserDefaults] objectForKey:INVITEITEM_IS_CLICK] boolValue];
if (!isClickInviteItem) {
//没有被点击,看看邀请有奖是否有在展示
BOOL needShow = [[[NSUserDefaults standardUserDefaults] objectForKey:ZONE_TASK_INVITE_DEW_ITEM_SWITCH] boolValue];
if (needShow) {
NSDictionary *infoDic = [[NSUserDefaults standardUserDefaults] objectForKey:BOUND_AGENT_INFO];
if (!infoDic) {
if ([FUSCacheDataShare shareStore].myZoneInfoModel &&
[[FUSCacheDataShare shareStore].myZoneInfoModel.invite[@"isShow"] boolValue]) {
otherShouldShow = YES;
}
}
}
}
//任务奖励
if ([FUSCacheDataShare shareStore].myZoneInfoModel &&
[[FUSCacheDataShare shareStore].myZoneInfoModel.waitReceiveTotal integerValue] > 0){
otherShouldShow = YES;
}
if (!otherShouldShow) {
unreadCount = -1;
}
}
[self.myBtn fus_setBadgeValue:unreadCount];
}
#pragma mark --- observer
/// 新增粉丝
-(void)fus_refreshFansUnreadCount:(NSNotification *)notification{
if ([notification.object isKindOfClass:[NSDictionary class]]) {
NSDictionary *countDic = notification.object;
NSString *loginUid = [FUSCacheDataShare shareStore].userDetailInfo.uid;
if ([[countDic allKeys] containsObject:loginUid]) {
NSInteger unreadCount = [countDic[loginUid][@"unreaderCount"] intValue];
self.fansUnreadCount = unreadCount;
[self fus_reloadUserUnreadUI];
}
}
}
/// 寨信数据
-(void)fus_refreshZhaixinUnreadCount:(NSNotification *)notification{
if (notification.object == nil){ return; }
NSNumber *count = notification.object;
_zhaixinUnreadCount = count.integerValue;
[self fus_reloadMessageUnreadUI];
}
/// 四个消息的数据
-(void)fus_refreshTradeRemindChange:(NSNotification*)notification{
[self fus_reloadMessageUnreadUI];
}
#pragma mark --- method #pragma mark --- method
-(void)fus_setSelect:(NSInteger)index autoCall:(BOOL)autoCall{ -(void)fus_setSelect:(NSInteger)index autoCall:(BOOL)autoCall{
...@@ -191,4 +294,9 @@ ...@@ -191,4 +294,9 @@
[self fus_reloadBarUI]; [self fus_reloadBarUI];
} }
#pragma mark --- other
- (void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
@end @end
...@@ -379,6 +379,9 @@ ...@@ -379,6 +379,9 @@
NSMutableDictionary *zoneInfosDict = [[FUSCacheDataShare shareStore] zoneInfosDict]; NSMutableDictionary *zoneInfosDict = [[FUSCacheDataShare shareStore] zoneInfosDict];
FUSZoneInfosModel *zoneModel = [zoneInfosDict objectForKey:uid]; FUSZoneInfosModel *zoneModel = [zoneInfosDict objectForKey:uid];
if (![FUSBaseModel fus_isNullWithModel:zoneModel]) { if (![FUSBaseModel fus_isNullWithModel:zoneModel]) {
if (![FUSCacheDataShare shareStore].myZoneInfoModel) {
[FUSCacheDataShare shareStore].myZoneInfoModel = zoneModel;
}
// 回调查询数据 // 回调查询数据
if (success) success(zoneModel); if (success) success(zoneModel);
return; return;
...@@ -389,6 +392,9 @@ ...@@ -389,6 +392,9 @@
if (type <= 2) { if (type <= 2) {
FUSZoneInfosModel *zoneModel = [FUSZoneDBOperate selectZoneInfosTableWithUid:uid]; FUSZoneInfosModel *zoneModel = [FUSZoneDBOperate selectZoneInfosTableWithUid:uid];
if (![FUSBaseModel fus_isNullWithModel:zoneModel]) { if (![FUSBaseModel fus_isNullWithModel:zoneModel]) {
if (![FUSCacheDataShare shareStore].myZoneInfoModel) {
[FUSCacheDataShare shareStore].myZoneInfoModel = zoneModel;
}
// 更新内存数据 // 更新内存数据
[[[FUSCacheDataShare shareStore] zoneInfosDict] setObject:zoneModel forKey:zoneModel.uid]; [[[FUSCacheDataShare shareStore] zoneInfosDict] setObject:zoneModel forKey:zoneModel.uid];
// 回调查询数据 // 回调查询数据
...@@ -407,6 +413,8 @@ ...@@ -407,6 +413,8 @@
[FUSZoneDBOperate fus_writeDataToZoneInfosTableWithModel:zoneModel]; [FUSZoneDBOperate fus_writeDataToZoneInfosTableWithModel:zoneModel];
// 更新内存数据 // 更新内存数据
[[[FUSCacheDataShare shareStore] zoneInfosDict] setObject:zoneModel forKey:zoneModel.uid]; [[[FUSCacheDataShare shareStore] zoneInfosDict] setObject:zoneModel forKey:zoneModel.uid];
// 记录一下最新的
[FUSCacheDataShare shareStore].myZoneInfoModel = zoneModel;
// 回调查询数据 // 回调查询数据
if (success) success(zoneModel); if (success) success(zoneModel);
}else{ }else{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment