Commit aef2a506 by pierce

Merge branch 'feature/UI修改版本' of http://git.yabolive.net:88/pidan/FuSiLive into feature/UI修改版本

# Conflicts:
#	FuSiLive/Classes/Foundation/DataShare/FUSCacheDataShare.h
parents 249c130b fb44b850
......@@ -53,7 +53,7 @@
}
+ (UIColor *)fus_themeColor{
return [self fus_diamondBlue];
return [self colorWithHex:@"##00F7FF"];
}
+ (UIColor *)fus_themeThirdColor{
......
......@@ -61,7 +61,7 @@
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
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;
// 图标居中
......@@ -69,8 +69,8 @@
// 内容居右
self.detailTextLabel.textAlignment = NSTextAlignmentRight;
[self.contentView addSubview:self.theImageView];
[self.contentView addSubview:self.leftCircleRedView];
// [self.contentView addSubview:self.theImageView];
// [self.contentView addSubview:self.leftCircleRedView];
}
return self;
}
......@@ -336,12 +336,12 @@
_theRightLabel = nil;
[_thirdPartyCell removeFromSuperview];
_thirdPartyCell = nil;
// [_theImageView removeFromSuperview];
// _theImageView = nil;
// [_leftCircleRedView removeFromSuperview];
// _leftCircleRedView = nil;
self.theImageView.hidden = YES;
self.leftCircleRedView.hidden = YES;
[_theImageView removeFromSuperview];
_theImageView = nil;
[_leftCircleRedView removeFromSuperview];
_leftCircleRedView = nil;
// self.theImageView.hidden = YES;
// self.leftCircleRedView.hidden = YES;
// 接收模型
_item = item;
......@@ -416,7 +416,7 @@
self.accessoryView = self.theArrowImageView;
}
// [self.contentView addSubview:self.theImageView];
[self.contentView addSubview:self.theImageView];
self.theImageView.hidden = NO;
}
break;
......@@ -427,14 +427,14 @@
break;
case CustomSettingItemTypeShowImage:
{
// [self.contentView addSubview:self.theImageView];
[self.contentView addSubview:self.theImageView];
self.theImageView.hidden = NO;
}
break;
case CustomSettingItemTypeShowImageAndArrow:
{
self.accessoryView = self.theArrowImageView;
// [self.contentView addSubview:self.theImageView];
[self.contentView addSubview:self.theImageView];
self.theImageView.hidden = NO;
}
break;
......@@ -463,44 +463,45 @@
break;
}
if (self.theImageView.isHidden == NO && (_item.rightShowImage != nil || ![NSString isNull:_item.rightShowImageUrl])) {
[self.theImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.detailTextLabel.mas_left).offset(-3);
// make.centerY.equalTo(self.detailTextLabel.mas_centerY);
make.centerY.offset(0);
if (!CGRectEqualToRect(_item.rightShowImageFrame, CGRectZero)) {
make.size.mas_equalTo(_item.rightShowImageFrame.size);
}else{
make.size.mas_equalTo(CGSizeMake(22, 22));
}
}];
}else {
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 (self.theImageView.isHidden == NO && (_item.rightShowImage != nil || ![NSString isNull:_item.rightShowImageUrl])) {
// [self.theImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.right.equalTo(self.detailTextLabel.mas_left).offset(-3);
//// make.centerY.equalTo(self.detailTextLabel.mas_centerY);
// make.centerY.offset(0);
// if (!CGRectEqualToRect(_item.rightShowImageFrame, CGRectZero)) {
// make.size.mas_equalTo(_item.rightShowImageFrame.size);
// }else{
// make.size.mas_equalTo(CGSizeMake(22, 22));
// }
// }];
// }else {
// self.theImageView.hidden = YES;
// }
//
// if (item.isShowRedCirclePoint) {
// //放在这里add是解决不圆的bug
// [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 {
......@@ -510,37 +511,38 @@
self.maskLayer = nil;
}
//-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
//// FUSLogInfo(@"");
// NSValue *value = [change objectForKey:@"new"];
// CGRect frame = [value CGRectValue];
//
// if (!CGRectEqualToRect(_item.rightShowImageFrame, CGRectZero)) {
//// _theImageView.centerY = frame.origin.y + frame.size.height / 2.0f;
-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
// FUSLogInfo(@"");
NSValue *value = [change objectForKey:@"new"];
CGRect frame = [value CGRectValue];
if (!CGRectEqualToRect(_item.rightShowImageFrame, CGRectZero)) {
// _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;
// if (FUSRTL.isRTL) {
// _theImageView.x = self.detailTextLabel.right + 3;
// } else {
// _theImageView.x = self.detailTextLabel.x - _item.rightShowImageFrame.size.width - 3;
// }
// frame = _theImageView.frame;
// }
//
// if (_item.isShowRedCirclePoint) {
//// [self.contentView addSubview:self.leftCircleRedView];
// if (FUSRTL.isRTL) {
// self.leftCircleRedView.x = CGRectGetMaxX(frame) + 2;
// } else {
// self.leftCircleRedView.x = CGRectGetMinX(frame) - kRightRedViewWidth - 2;
// }
//// self.leftCircleRedView.y = 28;
_theImageView.centerY = self.contentView.height / 2.0f;
if (FUSRTL.isRTL) {
_theImageView.x = self.detailTextLabel.right + 3;
} else {
_theImageView.x = self.detailTextLabel.x - _item.rightShowImageFrame.size.width - 3;
}
frame = _theImageView.frame;
}
if (_item.isShowRedCirclePoint) {
// [self.contentView addSubview:self.leftCircleRedView];
if (FUSRTL.isRTL) {
self.leftCircleRedView.x = CGRectGetMaxX(frame) + 2;
} else {
self.leftCircleRedView.x = CGRectGetMinX(frame) - kRightRedViewWidth - 2;
}
// self.leftCircleRedView.centerY = frame.origin.y + frame.size.height / 2.0f;
// self.leftCircleRedView.backgroundColor = self.item.redCircleColor;
// }
//}
//
//- (void)dealloc {
// [self.detailTextLabel removeObserver:self forKeyPath:@"frame"];
//}
self.leftCircleRedView.centerY = self.contentView.height / 2.0f;
self.leftCircleRedView.backgroundColor = self.item.redCircleColor;
}
}
- (void)dealloc {
[self.detailTextLabel removeObserver:self forKeyPath:@"frame"];
}
@end
......@@ -21,6 +21,7 @@
#import "FUSSettingInitDataModel.h"
#import "FUSUserTradeRemindModel.h"
#import "FUSLiveStartConfigModel.h"
#import "FUSZoneInfosModel.h"
@interface FUSCacheDataShare : NSObject
......@@ -35,6 +36,9 @@
// 当前登录用户详细信息
@property (nonatomic, strong) FUSUserInfosModel *userDetailInfo;
/// 记录当前最新的myZoneInfoModel,网络请求的总会覆盖掉缓存的
@property (nonatomic, strong) FUSZoneInfosModel *myZoneInfoModel;
@property (nonatomic, strong) FUSLangAreaCountryModel *areaCountryInfo; // 語言、語區、註冊國家相關信息
......
......@@ -255,3 +255,6 @@
// 获取用户数据交易提醒
#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 @@
[[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_createHomeScrollView];
[self fus_createTabbarView];
[self fus_createHomeScrollView];
[self.view bringSubviewToFront:self.tabbarView];
}
-(void)fus_setupProperties{
self.contentViewList = [[NSMutableArray alloc] initWithArray:@[[[FUSMyView alloc] init], [[FUSHomeView alloc] init], [[FUSMessageView alloc] init]]];
}
-(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.contentSize = CGSizeMake(UIView.fus_screenW * self.contentViewList.count, UIView.fus_screenH);
_scrollView.pagingEnabled = YES;
......@@ -97,6 +105,18 @@
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
- (void)fus_homeView:(UIView *)view didUpdateCollectionCntentMaxHeightWithFloor:(CGFloat)maxHeight{
self.tabbarView.shouldBarCenterTransparency = maxHeight > (UIView.fus_screenH - [FUSFloatTabbarView fus_barHeight]);
......@@ -116,6 +136,7 @@
[self.scrollView scrollRectToVisible:scFrame animated:NO];
[self.contentViewList[index] fus_viewWillShow];
[self.contentViewList[lastIndex] fus_viewDidDisappear];
}
}
......@@ -123,11 +144,15 @@
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
if ( scrollView == self.scrollView ) {
NSInteger lastIndex = self.tabbarView.currentIndex;
NSInteger index = (NSInteger)(scrollView.contentOffset.x/scrollView.width + 0.5);
if (index >= 0 && index < self.contentViewList.count) {
[self.tabbarView fus_setSelect:index autoCall:NO];
}
[self.contentViewList[index] fus_viewWillShow];
if (lastIndex != index) {
[self.contentViewList[lastIndex] fus_viewDidDisappear];
}
}
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
......@@ -139,4 +164,9 @@
}
}
#pragma mark --- other
- (void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
@end
......@@ -37,6 +37,10 @@ NS_ASSUME_NONNULL_BEGIN
-(void)fus_viewWillShow;
-(void)fus_viewDidDisappear;
-(void)fus_applicationDidBecomeActiveNotification:(NSNotification *)noti;
@end
NS_ASSUME_NONNULL_END
......@@ -18,4 +18,12 @@
}
- (void)fus_viewDidDisappear{
}
- (void)fus_applicationDidBecomeActiveNotification:(NSNotification *)noti{
}
@end
......@@ -287,6 +287,9 @@
if ([self.collectionView.mj_header isRefreshing]) {
[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]) {
[self.viewModel fus_switchToList:FUSHomeViewAnchorListTypeNormal];
if (self.viewModel.recommendModel != nil) {
......@@ -296,10 +299,7 @@
}];
}
return;
}
[self.naviView fus_setButton:FUSHomeNaviViewClickTypeFollow selected:type == FUSHomeViewAnchorListTypeFollow ? YES : NO];
[self.collectionView reloadData];
}
#pragma mark --- FUSHomeLanguageSegmentViewDelegate
......
......@@ -52,10 +52,6 @@
self.isUserCloseNotificationRemind = NO;
[self fus_reloadnotificationRemindTips];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(fus_applicationDidBecomeActiveNotification:)
name:UIApplicationDidBecomeActiveNotification
object:nil];
}
return self;
}
......@@ -65,6 +61,9 @@
[self fus_loadUserTradeRemind];
}
-(void)fus_applicationDidBecomeActiveNotification:(NSNotification *)noti{
[self fus_reloadnotificationRemindTips];
}
-(void)fus_createUI{
......@@ -310,11 +309,6 @@
[self fus_reloadMessageFunctionColumnUI];
}
#pragma mark --- observer
-(void)fus_applicationDidBecomeActiveNotification:(NSNotification *)noti{
[self fus_reloadnotificationRemindTips];
}
#pragma mark --- button did clicked
-(void)fus_notificationRemindCloseBtnDidClicked:(UIButton *)btn{
self.notificationRemindView.hidden = YES;
......@@ -338,9 +332,5 @@
}
}
#pragma mark --- other
- (void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
@end
......@@ -25,6 +25,7 @@
#import "FUSZoneSendJewelRankController.h"
#import "FUSMotoringWareHouseViewController.h"
#import "FUSBoundAgentInfoView.h"
#import "FUSZoneCanSendNewsFeedTipView.h"
typedef NS_ENUM(NSInteger, FUSMySettingItemType){
FUSMySettingItemTypeImAnchor = 0,
......@@ -45,7 +46,6 @@ typedef NS_ENUM(NSInteger, FUSMySettingItemType){
@property (nonatomic, strong) NSMutableArray *allGroups;
@property (nonatomic, strong) UIView *naviView;
//@property (nonatomic, strong) UIButton *myzoneBtn;
@property (nonatomic, strong) UIButton *publishBtn;
@property (nonatomic, strong) FUSMyHeaderView *headerView;
......@@ -59,6 +59,9 @@ typedef NS_ENUM(NSInteger, FUSMySettingItemType){
/// 数据
@property (nonatomic, strong) FUSZoneInfosModel *zoneModel;
// 是否显示可以分享的tips
@property (nonatomic, strong) FUSZoneCanSendNewsFeedTipView *zoneCanSendNewsFeedTipView;
@end
@implementation FUSMyView
......@@ -69,7 +72,7 @@ typedef NS_ENUM(NSInteger, FUSMySettingItemType){
if (self) {
[self fus_createUI];
[self fus_rebuildItemsUI];
[self fus_updateDataSourceWithType:ReadMemoryBegin];
[self fus_updateMyZoneDataSourceWithType:ReadMemoryBegin];
if (self.fus_needShowInviteTaskDewItems) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveBoundAgentResult:) name:BOUND_AGENT_RESULT object:nil];
......@@ -81,7 +84,15 @@ typedef NS_ENUM(NSInteger, FUSMySettingItemType){
}
- (void)fus_viewWillShow{
[self fus_updateDataSourceWithType:ReadServerBegin];
[self fus_updateMyZoneDataSourceWithType:ReadServerBegin];
self.zoneCanSendNewsFeedTipView = [FUSZoneCanSendNewsFeedTipView fus_showZoneCanSendNewsFeedTipViewIfNeededOnSuperView:self];
}
- (void)fus_viewDidDisappear{
if (self.zoneCanSendNewsFeedTipView) {
[self.zoneCanSendNewsFeedTipView removeFromSuperview];
self.zoneCanSendNewsFeedTipView = nil;
}
}
-(void)fus_createUI{
......@@ -105,23 +116,11 @@ typedef NS_ENUM(NSInteger, FUSMySettingItemType){
self.naviView = [[UIView alloc] initWithFrame:CGRectMake(0, UIView.fus_StatusBarHeight, UIView.fus_screenW, UIView.fus_NavgationBarHeight)];
[self addSubview:self.naviView];
// self.myzoneBtn = [UIButton buttonWithType:UIButtonTypeCustom];
// [self.myzoneBtn setImage:[UIImage imageNamed:@"fus_my_setting_navi_zone_icon"] forState:UIControlStateNormal];
// [self.naviView addSubview:self.myzoneBtn];
// [self.myzoneBtn mas_makeConstraints:^(MASConstraintMaker *make) {
// make.right.top.bottom.offset(0);
// make.width.equalTo(self.myzoneBtn.mas_height);
// }];
// [self.myzoneBtn.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.size.mas_offset(CGSizeMake(18, 18));
// }];
self.publishBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[self.publishBtn setImage:[UIImage imageNamed:@"fus_my_setting_navi_publish_icon"] forState:UIControlStateNormal];
[self.naviView addSubview:self.publishBtn];
[self.publishBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.bottom.offset(0);
// make.right.equalTo(self.myzoneBtn.mas_left);
make.right.offset(0);
make.width.equalTo(self.publishBtn.mas_height);
}];
......@@ -130,7 +129,6 @@ typedef NS_ENUM(NSInteger, FUSMySettingItemType){
self.headerView.buttonDidClickedHander = ^(FUSMyHeaderButtonType type) {
[weakself fus_headerItemDidClicked:type];
};
// [self.myzoneBtn addTarget:self action:@selector(myzoneBtnDidClicked:) forControlEvents:UIControlEventTouchUpInside];
[self.publishBtn addTarget:self action:@selector(publishBtnDidClicked:) forControlEvents:UIControlEventTouchUpInside];
}
......@@ -195,27 +193,23 @@ typedef NS_ENUM(NSInteger, FUSMySettingItemType){
itemModel.rightShowImage = [UIImage fus_fireIcon];
break;
case FUSMySettingItemTypeSetIntitationCode:
// itemModel.rightShowText = @"23:06:23";
itemModel.rightShowTextFont = [UIFont fus_themeFont:17];
itemModel.rightShowTextColor = [UIColor fus_textColorLight];
self.inputInviteCodeItem = itemModel;
self.inputInviteCodeIndexPath = [NSIndexPath indexPathForRow:j inSection:i];
break;
case FUSMySettingItemTypeIntitationReward:
// itemModel.rightShowText = @"798";
itemModel.rightShowTextColor = [UIColor fus_fireGreen];
itemModel.rightShowImage = [UIImage fus_fireIcon];
break;
case FUSMySettingItemTypeGiveAwayDiamond:
// itemModel.rightShowText = @"520";
itemModel.rightShowTextColor = [UIColor fus_diamondBlue];
itemModel.rightShowImage = [UIImage imageNamed:@"fus_my_setting_header_jew_icon"];
break;
case FUSMySettingItemTypeBackpack:
itemModel.rightShowText = @"道具、座駕等";
itemModel.rightShowText = @"座駕";
itemModel.rightShowTextFont = [UIFont fus_themeFont:17];
itemModel.rightShowTextColor = [UIColor fus_textColorLight];
itemModel.isShowRedCirclePoint = YES;
break;
default:
break;
......@@ -307,16 +301,17 @@ typedef NS_ENUM(NSInteger, FUSMySettingItemType){
case FUSMySettingItemTypeIntitationReward:{
BOOL isClickInviteItem = [[[NSUserDefaults standardUserDefaults] objectForKey:INVITEITEM_IS_CLICK] boolValue];
itemModel.rightShowText = _zoneModel.invite[@"content"];
if ([_zoneModel.invite[@"isNotice"] boolValue]) {
if ([_zoneModel.invite[@"isNotice"] boolValue] && !isClickInviteItem) {
itemModel.isShowRedCirclePoint = YES;
if (isClickInviteItem == NO) {
[[NSNotificationCenter defaultCenter] postNotificationName:ZONE_SHOW_RED_POINT object:nil];
}
} else {
itemModel.isShowRedCirclePoint = NO;
}
}
break;
case FUSMySettingItemTypeTaskReward:{
itemModel.isShowRedCirclePoint = [_zoneModel.waitReceiveTotal integerValue] > 0;
}
break;
default:
break;
}
......@@ -430,14 +425,15 @@ typedef NS_ENUM(NSInteger, FUSMySettingItemType){
[[NSNotificationCenter defaultCenter] removeObserver:self name:BOUND_AGENT_RESULT object:nil];
}
#pragma mark --- data
- (void)fus_updateDataSourceWithType:(ReadCacheOrder)type{
#pragma mark --- network data
- (void)fus_updateMyZoneDataSourceWithType:(ReadCacheOrder)type{
// 获取自己空间的数据
FUSWeakSelf(weakSelf);
[FUSZoneCacheOperate fus_getMyZoneInfosWithType:type success:^(FUSZoneInfosModel *zoneModel) {
weakSelf.zoneModel = zoneModel;
[weakSelf.headerView fus_setupHeaderViewWithModel:zoneModel];
[weakSelf fus_rebuildItemsUI];
[[NSNotificationCenter defaultCenter] postNotificationName:FUS_NOTIFICATION_MYZONE_ITEM_BADGEVALUE_CHANGE object:nil];
} failure:^(NSString *msg, NSInteger code) {
......@@ -470,6 +466,16 @@ typedef NS_ENUM(NSInteger, FUSMySettingItemType){
FUSFollowViewController *followVC = [[FUSFollowViewController alloc] init];
followVC.uid = self.zoneModel.uid;
[self.parentController.navigationController pushViewController:followVC animated:YES];
NSString *loginUid = [FUSCacheDataShare shareStore].userDetailInfo.uid;
NSMutableDictionary *dict = [[[NSUserDefaults standardUserDefaults] objectForKey:ZONE_FANS_UNREADER_COUNT] mutableCopy];
if ([[dict allKeys] containsObject:loginUid]) {
NSDictionary *saveDic = [dict objectForKey:loginUid];
dict[loginUid] = @{@"uid":saveDic[@"uid"],@"unreaderCount":@(-1)};
}
[[NSUserDefaults standardUserDefaults] setObject:dict forKey:ZONE_FANS_UNREADER_COUNT];
[[NSNotificationCenter defaultCenter] postNotificationName:Tabbar_Unread_Count_Fans object:nil];
}
break;
case FUSMyHeaderButtonTypeDiamond:{
......@@ -507,6 +513,7 @@ typedef NS_ENUM(NSInteger, FUSMySettingItemType){
self.inputInviteCodeItem.rightShowImage = [UIImage imageWithColor:[UIColor clearColor] size:CGSizeMake(8, 8)];
if (isClick) return;
[[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:ZONE_BOUND_AGENT_RED_CLICK];
[[NSNotificationCenter defaultCenter] postNotificationName:FUS_NOTIFICATION_MYZONE_ITEM_BADGEVALUE_CHANGE object:nil];
[self.tableView reloadData];
}
......@@ -515,6 +522,7 @@ typedef NS_ENUM(NSInteger, FUSMySettingItemType){
[FUSTalkingData fus_trackEvent:EVENT_ME_INVITATION_BONUS];
[[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:INVITEITEM_IS_CLICK];
[[NSNotificationCenter defaultCenter] postNotificationName:FUS_NOTIFICATION_MYZONE_ITEM_BADGEVALUE_CHANGE object:nil];
item.isShowRedCirclePoint = NO;
FUSWKWebViewController *wkwVC = [[FUSWKWebViewController alloc] init];
wkwVC.shouldShowShareBtn = NO;
......@@ -535,11 +543,8 @@ typedef NS_ENUM(NSInteger, FUSMySettingItemType){
break;
case FUSMySettingItemTypeTaskReward:{
[FUSTalkingData fus_trackEvent:EVENT_ME_TASKCENTER];
[[NSUserDefaults standardUserDefaults] setObject:@(YES) forKey:TASKCENTER_IS_CLICK];
// if (item.isShowRedCirclePoint) {
[[NSNotificationCenter defaultCenter] postNotificationName:FUS_NOTIFICATION_MYZONE_ITEM_BADGEVALUE_CHANGE object:nil];
// item.isShowRedCirclePoint = NO;
// [weakSelf.tableView reloadData];
// }
FUSZoneTaskCenterViewController *taskCenterVC = [[FUSZoneTaskCenterViewController alloc] init];
[self.parentController.navigationController pushViewController:taskCenterVC animated:YES];
}
......@@ -607,6 +612,11 @@ typedef NS_ENUM(NSInteger, FUSMySettingItemType){
[FUSNewsFeedHelper fus_publishNewsFeedWithType:type complete:^{
btn.enabled = YES;
}];
if (self.zoneCanSendNewsFeedTipView) {
[self.zoneCanSendNewsFeedTipView removeFromSuperview];
self.zoneCanSendNewsFeedTipView = nil;
}
}
#pragma mark getter and setter
......
......@@ -124,7 +124,7 @@
[self.onlyLiveRoomList addObject:tempModel];
}
}
[self fus_sortNormalDataListAutoCall:autoCall];
[self fus_sortDataListAutoCall:autoCall];
} failure:^(NSString *msg, int code) {
[FUSDialogView fus_showDialog:msg];
......@@ -144,12 +144,7 @@
self.followAnchorOriginalList = modelList;
self.recommendModel = recommendModel;
if (autoCall) {
// 为了让下拉刷新可以回调
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeViewViewModelAnchorListDidUpdate:)]) {
[self.delegate fus_homeViewViewModelAnchorListDidUpdate:FUSHomeViewAnchorListTypeFollow];
}
}
[self fus_sortDataListAutoCall:autoCall];
} failure:^(NSString *msg, int code) {
......@@ -183,7 +178,7 @@
return NO;
}else {
self.anchorListType = anchorListType;
[self fus_sortNormalDataListAutoCall:YES];
[self fus_sortDataListAutoCall:YES];
return YES;
}
}else {
......@@ -191,18 +186,16 @@
return NO;
}else {
self.anchorListType = anchorListType;
self.dataList = [[NSMutableArray alloc] initWithArray:self.followAnchorOriginalList];
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeViewViewModelAnchorListDidUpdate:)]) {
[self.delegate fus_homeViewViewModelAnchorListDidUpdate:FUSHomeViewAnchorListTypeFollow];
}
[self fus_sortDataListAutoCall:YES];
return YES;
}
}
}
/// 选择语言后讲数据排序
-(void)fus_sortNormalDataListAutoCall:(BOOL)autoCall{
/// 数据排序,根据当前选的的类型和语言
-(void)fus_sortDataListAutoCall:(BOOL)autoCall{
if (self.anchorListType == FUSHomeViewAnchorListTypeNormal) {
if (self.selectLanguageModel != nil) {
[self.dataList removeAllObjects];
......@@ -218,10 +211,13 @@
[preDataList addObjectsFromArray:subDataList];
self.dataList = preDataList;
}
}else if (self.anchorListType == FUSHomeViewAnchorListTypeFollow) {
self.dataList = [[NSMutableArray alloc] initWithArray:self.followAnchorOriginalList];
}
if (autoCall) {
if (self.delegate && [self.delegate respondsToSelector:@selector(fus_homeViewViewModelAnchorListDidUpdate:)]) {
[self.delegate fus_homeViewViewModelAnchorListDidUpdate:FUSHomeViewAnchorListTypeNormal];
[self.delegate fus_homeViewViewModelAnchorListDidUpdate:self.anchorListType];
}
}
}
......@@ -258,7 +254,7 @@
self.selectLanguageModel = self.showingOtherLanguagelist[index];
[self fus_updateSelectLanguageModel];
if (self.anchorListType == FUSHomeViewAnchorListTypeNormal) {
[self fus_sortNormalDataListAutoCall:YES];
[self fus_sortDataListAutoCall:YES];
}
}
......
......@@ -24,6 +24,9 @@
@property (nonatomic, strong) NSMutableArray *btnList;
@property (nonatomic, assign) NSInteger zhaixinUnreadCount;
@property (nonatomic, assign) NSInteger fansUnreadCount;
@end
@implementation FUSFloatTabbarView
......@@ -34,13 +37,24 @@
if (self) {
[self fus_setupPropeties];
[self fus_createUI];
[self fus_setupNotification];
}
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{
_zhaixinUnreadCount = 0;
_currentIndex = 1;
_fansUnreadCount = 0;
self.shouldBarCenterTransparency = NO;
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"];
......@@ -109,8 +123,6 @@
self.btnList = [[NSMutableArray alloc] initWithArray:@[self.myBtn, self.homeBtn, self.messageBtn]];
[self.myBtn fus_setBadgeValue:0];
[self.messageBtn fus_setBadgeValue:99];
}
-(void)fus_reloadBarUI{
......@@ -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
-(void)fus_setSelect:(NSInteger)index autoCall:(BOOL)autoCall{
......@@ -191,4 +294,9 @@
[self fus_reloadBarUI];
}
#pragma mark --- other
- (void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
@end
......@@ -379,6 +379,9 @@
NSMutableDictionary *zoneInfosDict = [[FUSCacheDataShare shareStore] zoneInfosDict];
FUSZoneInfosModel *zoneModel = [zoneInfosDict objectForKey:uid];
if (![FUSBaseModel fus_isNullWithModel:zoneModel]) {
if (![FUSCacheDataShare shareStore].myZoneInfoModel) {
[FUSCacheDataShare shareStore].myZoneInfoModel = zoneModel;
}
// 回调查询数据
if (success) success(zoneModel);
return;
......@@ -389,6 +392,9 @@
if (type <= 2) {
FUSZoneInfosModel *zoneModel = [FUSZoneDBOperate selectZoneInfosTableWithUid:uid];
if (![FUSBaseModel fus_isNullWithModel:zoneModel]) {
if (![FUSCacheDataShare shareStore].myZoneInfoModel) {
[FUSCacheDataShare shareStore].myZoneInfoModel = zoneModel;
}
// 更新内存数据
[[[FUSCacheDataShare shareStore] zoneInfosDict] setObject:zoneModel forKey:zoneModel.uid];
// 回调查询数据
......@@ -407,6 +413,8 @@
[FUSZoneDBOperate fus_writeDataToZoneInfosTableWithModel:zoneModel];
// 更新内存数据
[[[FUSCacheDataShare shareStore] zoneInfosDict] setObject:zoneModel forKey:zoneModel.uid];
// 记录一下最新的
[FUSCacheDataShare shareStore].myZoneInfoModel = zoneModel;
// 回调查询数据
if (success) success(zoneModel);
}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