Commit b97c85ce cgx

退出登录、登录成功刷新社区列表

1 个父辈 6e61820e
...@@ -54,6 +54,8 @@ FOUNDATION_EXTERN NSString * const NeedUpdateStartAI; ...@@ -54,6 +54,8 @@ FOUNDATION_EXTERN NSString * const NeedUpdateStartAI;
FOUNDATION_EXTERN NSString * const UnlockAudioSuccess; FOUNDATION_EXTERN NSString * const UnlockAudioSuccess;
// 监听息屏播放页面点击播放、上一首、下一首通知 // 监听息屏播放页面点击播放、上一首、下一首通知
FOUNDATION_EXTERN NSString * const RemoteCommandCenterDidClick; FOUNDATION_EXTERN NSString * const RemoteCommandCenterDidClick;
// 刷新社区动态列表
FOUNDATION_EXTERN NSString * const NeedUpdateComList;
// 用户基础信息 // 用户基础信息
FOUNDATION_EXTERN NSString * const UserBasicInfo; FOUNDATION_EXTERN NSString * const UserBasicInfo;
......
...@@ -34,6 +34,7 @@ NSString * const NeedUpdateAICoach = @"NeedUpdateAICoachNoti"; ...@@ -34,6 +34,7 @@ NSString * const NeedUpdateAICoach = @"NeedUpdateAICoachNoti";
NSString * const NeedUpdateStartAI = @"NeedUpdateStartAINoti"; NSString * const NeedUpdateStartAI = @"NeedUpdateStartAINoti";
NSString * const UnlockAudioSuccess = @"UnlockAudioSuccessNoti"; NSString * const UnlockAudioSuccess = @"UnlockAudioSuccessNoti";
NSString * const RemoteCommandCenterDidClick = @"RemoteCommandCenterDidClickNoti"; NSString * const RemoteCommandCenterDidClick = @"RemoteCommandCenterDidClickNoti";
NSString * const NeedUpdateComList = @"NeedUpdateComListNoti";
NSString * const UserBasicInfo = @"UserBasicInfo"; NSString * const UserBasicInfo = @"UserBasicInfo";
......
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
[self setupUI]; [self setupUI];
} }
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self name:NeedUpdateComList object:nil];
}
#pragma mark - private #pragma mark - private
- (void)setupUI { - (void)setupUI {
self.offset = 1; self.offset = 1;
...@@ -47,6 +51,13 @@ ...@@ -47,6 +51,13 @@
[messageBtn addTarget:self action:@selector(messageAction) forControlEvents:UIControlEventTouchUpInside]; [messageBtn addTarget:self action:@selector(messageAction) forControlEvents:UIControlEventTouchUpInside];
[messageBtn dk_setImage:DKImagePickerWithNames(@"ic_message_shequ", @"dk_ic_message_shequ", @"ic_message_shequ") forState:UIControlStateNormal]; [messageBtn dk_setImage:DKImagePickerWithNames(@"ic_message_shequ", @"dk_ic_message_shequ", @"ic_message_shequ") forState:UIControlStateNormal];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:messageBtn]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:messageBtn];
// 监听社区动态列表需要刷新数据通知
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(needUpdateNoti) name:NeedUpdateComList object:nil];
}
- (void)needUpdateNoti {
[self.communityView notiRefresh];
} }
- (void)messageAction { - (void)messageAction {
......
...@@ -59,6 +59,9 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -59,6 +59,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 更新列表 /// 更新列表
- (void)updateListView; - (void)updateListView;
/// 通知刷新
- (void)notiRefresh;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -71,6 +71,10 @@ ...@@ -71,6 +71,10 @@
[self.listView reloadData]; [self.listView reloadData];
} }
- (void)notiRefresh {
[self.listView.mj_header beginRefreshing];
}
#pragma mark - Action #pragma mark - Action
- (void)tapAction:(UITapGestureRecognizer *)tapGR { - (void)tapAction:(UITapGestureRecognizer *)tapGR {
if (self.delegate && [self.delegate respondsToSelector:@selector(tapCommunityHeaderModule:)]) { if (self.delegate && [self.delegate respondsToSelector:@selector(tapCommunityHeaderModule:)]) {
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
@implementation LoginUtils @implementation LoginUtils
#pragma mark - public
+ (UserModel *)getUserLoginData { + (UserModel *)getUserLoginData {
UserModel *userModel = [NSKeyedUnarchiver unarchiveObjectWithData:kGetUserDefaultsObj(UserBasicInfo)]; UserModel *userModel = [NSKeyedUnarchiver unarchiveObjectWithData:kGetUserDefaultsObj(UserBasicInfo)];
// DSLog(@"获取用户信息:%@", userModel.debugDescription); // DSLog(@"获取用户信息:%@", userModel.debugDescription);
...@@ -93,10 +94,8 @@ ...@@ -93,10 +94,8 @@
// 发送更新用户数据显示UI通知 // 发送更新用户数据显示UI通知
[[NSNotificationCenter defaultCenter] postNotificationName:HasUpdateUserDataNoti object:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:HasUpdateUserDataNoti object:nil];
// 刷新主页数据 // 其他通知
[[NSNotificationCenter defaultCenter] postNotificationName:NeedUpdateHomePage object:nil]; [LoginUtils updateNoti];
// 刷新AI睡眠教练
[[NSNotificationCenter defaultCenter] postNotificationName:NeedUpdateAICoach object:nil];
} }
+ (void)jumpToLoginControllerWithTarget:(UIViewController *)target { + (void)jumpToLoginControllerWithTarget:(UIViewController *)target {
...@@ -132,10 +131,17 @@ ...@@ -132,10 +131,17 @@
} }
+ (void)updateDataNotiAfterLoginSuccess { + (void)updateDataNotiAfterLoginSuccess {
[LoginUtils updateNoti];
}
#pragma mark - private
+ (void)updateNoti {
// 刷新主页数据 // 刷新主页数据
[[NSNotificationCenter defaultCenter] postNotificationName:NeedUpdateHomePage object:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:NeedUpdateHomePage object:nil];
// 刷新AI睡眠教练 // 刷新AI睡眠教练
[[NSNotificationCenter defaultCenter] postNotificationName:NeedUpdateAICoach object:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:NeedUpdateAICoach object:nil];
// 刷新社区动态列表
[[NSNotificationCenter defaultCenter] postNotificationName:NeedUpdateComList object:nil];
} }
+ (void)saveCookie { + (void)saveCookie {
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!