70 lines
2.3 KiB
Objective-C
70 lines
2.3 KiB
Objective-C
//
|
|
// YMMineNotificaPresenter.m
|
|
// YUMI
|
|
//
|
|
// Created by YUMI on 2021/9/17.
|
|
//
|
|
|
|
#import "XPMineNotificaPresenter.h"
|
|
///Api
|
|
#import "Api+Mine.h"
|
|
///P
|
|
#import "XPMineNotificaProtocol.h"
|
|
///Tool
|
|
#import "AccountInfoStorage.h"
|
|
///Model
|
|
#import "XPMineNotifyStatus.h"
|
|
#import "XPMineNotificationItemModel.h"
|
|
|
|
@interface XPMineNotificaPresenter ()
|
|
///系统消息
|
|
@property (nonatomic,strong) XPMineNotificationItemModel *systemModel;
|
|
@end
|
|
|
|
@implementation XPMineNotificaPresenter
|
|
|
|
- (id<XPMineNotificaProtocol>)getView {
|
|
return (id<XPMineNotificaProtocol>)[super getView];
|
|
}
|
|
|
|
|
|
/// 请求当前开关的状态
|
|
- (void)requestUserInfoNotifyStatus {
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
[Api requestUserInfoNotifyStatus:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
XPMineNotifyStatus * model = [XPMineNotifyStatus modelWithDictionary:data.data];
|
|
if (self.systemModel == nil) {
|
|
XPMineNotificationItemModel * systemItem = [[XPMineNotificationItemModel alloc] init];
|
|
systemItem.title = YMLocalizedString(@"XPMineNotificaPresenter0");
|
|
systemItem.desc = YMLocalizedString(@"XPMineNotificaPresenter1");
|
|
self.systemModel = systemItem;
|
|
}
|
|
self.systemModel.notification = model.sysMsgNotify;
|
|
XPMineNotificationItemModel * broadcastItem = [[XPMineNotificationItemModel alloc] init];
|
|
broadcastItem.title = YMLocalizedString(@"XPMineNotificaPresenter2");
|
|
broadcastItem.desc = YMLocalizedString(@"XPMineNotificaPresenter3");
|
|
broadcastItem.notification = model.singleBroadcastMsgNotify;
|
|
NSArray * array = @[self.systemModel, broadcastItem];
|
|
[[self getView] requestUserInfoNotifyStatusSuccess:array];
|
|
}] uid:uid];
|
|
}
|
|
|
|
/// 更新系统消息状态
|
|
- (void)updateUserInfoSystemNotify:(BOOL)notify {
|
|
NSString * notifyStr = [NSString stringWithFormat:@"%d", notify];
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
[Api updateUserInfoSystemNotifyWith:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
|
|
}] sysMsgNotify:notifyStr uid:uid];
|
|
}
|
|
|
|
/// 更新开播消息状态
|
|
- (void)updateBroadCastNotify:(BOOL)notify {
|
|
NSString * notifyStr = [NSString stringWithFormat:@"%d", notify];
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
[Api updateAnchorBroadCastNotifyWith:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
|
|
}] msgNotify:notifyStr uid:uid];
|
|
}
|
|
@end
|