| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- //
- // MORefreshViewManage.m
- // MiMoLive
- //
- // Created by SuperC on 2024/1/4.
- //
- #import "MORefreshViewManage.h"
- @interface MORefreshViewManage ()
- @end
- static MORefreshViewManage *_manager;
- @implementation MORefreshViewManage
- ///单例
- + (MORefreshViewManage *)shareManager
- {
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^
- {
- _manager = [[MORefreshViewManage alloc] init];
- });
-
- return _manager;
- }
- - (void)resetAllProperty{
- [self.refreshDict enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL * _Nonnull stop) {
- obj = @(NO);
- }];
- }
- - (void)setNeedRefreshWithCode:(NSString *)codeStr{
- [self.refreshDict setObject:@(YES) forKey:codeStr];
- }
- - (BOOL)getRefreshTagWithCode:(NSString *)codeStr{
- BOOL result = [[MODataManager objectOrNilForKey:codeStr fromDictionary:self.refreshDict] boolValue];
- return result;
- }
- - (void)toUpdataTheUserInfo{
- WEAKSELF
-
- [kHttpManager toGetTheUserCurrentDiamondWithParams:nil andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
- if(kCode_Success){
- NSDictionary *backDict = data[@"data"];
- NSInteger currentDiamond = [[MODataManager objectOrNilForKey:@"result" fromDictionary:backDict] integerValue];
-
- if(currentDiamond < 0){
- return;
- }
-
- MOMeDataInfo *userInfoData = (MOMeDataInfo *)[[MODataCache sharedYYCache] objectForKey:kMineUserInfo];
- userInfoData.userWallet.diamond = currentDiamond;
- [[MODataCache sharedYYCache] setObject:userInfoData forKey:kMineUserInfo];
- }
- }];
-
- return;
-
- [kHttpManager getMeUserInfoWithParams:nil andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
-
- __strong typeof(weakSelf) self = weakSelf;
- if(kCode_Success){
- // MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]);
-
- //更新个人信息偏好缓存
- [MODataManager saveUserInfo:data];
- }
- }];
- }
- - (NSMutableDictionary *)refreshDict{
- if(!_refreshDict){
- _refreshDict = [NSMutableDictionary dictionary];
- }
- return _refreshDict;
- }
- @end
|