Commit b97c85ce cgx

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

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