Commit a9b75049999aef68352fed80cf5956b484117850
1 parent
e601e862
消息通知开发
Showing
9 changed files
with
235 additions
and
4 deletions
CNLiveCMineModule/Classes/CNCSubMine/Model/CNMySettingListModel.h
| ... | ... | @@ -38,3 +38,9 @@ typedef enum { |
| 38 | 38 | @property (nonatomic, copy) NSString *isHidden; |
| 39 | 39 | |
| 40 | 40 | @end |
| 41 | + | |
| 42 | +@interface CNMessageNoteModel : NSObject | |
| 43 | +@property (nonatomic, copy)NSString *title; | |
| 44 | +@property (nonatomic, copy)NSString *sys_type; | |
| 45 | +@property (nonatomic, assign)BOOL state; | |
| 46 | +@end | ... | ... |
CNLiveCMineModule/Classes/CNCSubMine/Model/CNMySettingListModel.m
CNLiveCMineModule/Classes/CNCSubMine/Present/CNCSubMinePresent.h
| ... | ... | @@ -57,7 +57,8 @@ typedef void (^CNLoginResponseBlock)(NSURLSessionTask *requestTask, id responseO |
| 57 | 57 | /// @param statue 状态 |
| 58 | 58 | +(void)showWithScoreViewForScoreIntergal:(NSString *)scoreIntergal Statue:(BOOL)statue SuperView:(UIViewController *)superView; |
| 59 | 59 | |
| 60 | - | |
| 60 | +/// 获取消息提醒列表 | |
| 61 | ++ (NSArray *)getMessageNotificationList; | |
| 61 | 62 | @end |
| 62 | 63 | |
| 63 | 64 | NS_ASSUME_NONNULL_END | ... | ... |
CNLiveCMineModule/Classes/CNCSubMine/Present/CNCSubMinePresent.m
| ... | ... | @@ -92,6 +92,13 @@ |
| 92 | 92 | @"cellType":@30 |
| 93 | 93 | }, |
| 94 | 94 | @{ |
| 95 | + @"title":@"消息通知", | |
| 96 | + @"image":@"", | |
| 97 | + @"rowHeight":@56, | |
| 98 | + @"lineHeight":@1, | |
| 99 | + @"cellType":@30 | |
| 100 | + }, | |
| 101 | + @{ | |
| 95 | 102 | @"title":@"金币音量开关", |
| 96 | 103 | @"image":@"", |
| 97 | 104 | @"rowHeight":rowHeight, |
| ... | ... | @@ -484,4 +491,26 @@ |
| 484 | 491 | [mainView removeFromSuperview]; |
| 485 | 492 | }); |
| 486 | 493 | } |
| 494 | + | |
| 495 | +/// 获取消息提醒列表 | |
| 496 | ++ (NSArray *)getMessageNotificationList{ | |
| 497 | + NSArray *array = @[ | |
| 498 | + @{ | |
| 499 | + @"title":@"新闻号", | |
| 500 | + @"sys_type":@"sys_news", | |
| 501 | + @"state":[[NSUserDefaults standardUserDefaults] objectForKey:@"CNWithNewsReceiveMessageOpt"]?@([[NSUserDefaults standardUserDefaults] stringForKey:@"CNWithNewsReceiveMessageOpt"].integerValue):@(1) | |
| 502 | + }, | |
| 503 | + @{ | |
| 504 | + @"title":@"视频号", | |
| 505 | + @"sys_type":@"sys_video", | |
| 506 | + @"state":[[NSUserDefaults standardUserDefaults] objectForKey:@"CNWithVideoReceiveMessageOpt"]?@([[NSUserDefaults standardUserDefaults] stringForKey:@"CNWithVideoReceiveMessageOpt"].integerValue):@(1) | |
| 507 | + }, | |
| 508 | + @{ | |
| 509 | + @"title":@"直播号", | |
| 510 | + @"sys_type":@"sys_live", | |
| 511 | + @"state":[[NSUserDefaults standardUserDefaults] objectForKey:@"CNWithLiveReceiveMessageOpt"]?@([[NSUserDefaults standardUserDefaults] stringForKey:@"CNWithLiveReceiveMessageOpt"].integerValue):@(1) | |
| 512 | + }, | |
| 513 | + ]; | |
| 514 | + return [CNMessageNoteModel mj_objectArrayWithKeyValuesArray:array]; | |
| 515 | +} | |
| 487 | 516 | @end | ... | ... |
CNLiveCMineModule/Classes/CNCSubMine/View/CNMessgeNoteCell.h
0 → 100644
| 1 | +// | |
| 2 | +// CNMeaageNoteCell.h | |
| 3 | +// CNLiveCMineModule | |
| 4 | +// | |
| 5 | +// Created by iOS on 2022/12/7. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#import <UIKit/UIKit.h> | |
| 9 | + | |
| 10 | +NS_ASSUME_NONNULL_BEGIN | |
| 11 | + | |
| 12 | +@interface CNMessgeNoteCell : UITableViewCell | |
| 13 | +@property (nonatomic, copy)void(^changeSwitchBlock)(CNMessageNoteModel *model); | |
| 14 | +@property (nonatomic, strong)CNMessageNoteModel *model; | |
| 15 | +@end | |
| 16 | + | |
| 17 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveCMineModule/Classes/CNCSubMine/View/CNMessgeNoteCell.m
0 → 100644
| 1 | +// | |
| 2 | +// CNMeaageNoteCell.m | |
| 3 | +// CNLiveCMineModule | |
| 4 | +// | |
| 5 | +// Created by iOS on 2022/12/7. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#import "CNMessgeNoteCell.h" | |
| 9 | +@interface CNMessgeNoteCell () | |
| 10 | +@property (nonatomic, strong)UIView *bgView; | |
| 11 | +@property (nonatomic, strong)UILabel *titleLabel; | |
| 12 | +@property (nonatomic, strong)UISwitch *switchBtn; | |
| 13 | + | |
| 14 | +@end | |
| 15 | + | |
| 16 | +@implementation CNMessgeNoteCell | |
| 17 | +- (instancetype)initWithFrame:(CGRect)frame{ | |
| 18 | + if (self = [super initWithFrame:frame]) { | |
| 19 | + self.contentView.backgroundColor = [UIColor clearColor]; | |
| 20 | + self.backgroundColor = UIColorClear; | |
| 21 | + [self.contentView addSubview:self.bgView]; | |
| 22 | + [self.bgView addSubview:self.titleLabel]; | |
| 23 | + [self.bgView addSubview:self.switchBtn]; | |
| 24 | + [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 25 | + make.left.right.bottom.equalTo(self); | |
| 26 | + make.top.equalTo(self).offset(10); | |
| 27 | + }]; | |
| 28 | + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 29 | + | |
| 30 | + }]; | |
| 31 | + } | |
| 32 | + return self; | |
| 33 | +} | |
| 34 | +- (void)switchValueChanged:(UISwitch *)sender{ | |
| 35 | + if (self.changeSwitchBlock) { | |
| 36 | + self.changeSwitchBlock(self.model); | |
| 37 | + } | |
| 38 | +} | |
| 39 | +#pragma mark - Setting | |
| 40 | +- (void)setModel:(CNMessageNoteModel *)model{ | |
| 41 | + _model = model; | |
| 42 | + self.titleLabel.text = model.title; | |
| 43 | + [self.switchBtn setOn:model.state]; | |
| 44 | +} | |
| 45 | +#pragma mark - Getting | |
| 46 | +- (UIView *)bgView{ | |
| 47 | + if (!_bgView) { | |
| 48 | + _bgView = [[UIView alloc] init]; | |
| 49 | + _bgView.backgroundColor = UIColorWhite; | |
| 50 | + } | |
| 51 | + return _bgView; | |
| 52 | +} | |
| 53 | +- (UILabel *)titleLabel{ | |
| 54 | + if (!_titleLabel) { | |
| 55 | + _titleLabel = [[UILabel alloc] init]; | |
| 56 | + _titleLabel.textColor = UIColorHex(#282828); | |
| 57 | + _titleLabel.font = UIFontMake(16); | |
| 58 | + } | |
| 59 | + return _titleLabel; | |
| 60 | +} | |
| 61 | +- (UISwitch *)switchBtn{ | |
| 62 | + if (!_switchBtn) { | |
| 63 | + _switchBtn = [[UISwitch alloc] init]; | |
| 64 | + [_switchBtn addTarget:self action:@selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged]; | |
| 65 | + } | |
| 66 | + return _switchBtn; | |
| 67 | +} | |
| 68 | +@end | ... | ... |
CNLiveCMineModule/Classes/CNCSubMine/ViewController/CNMessageNotesController.h
0 → 100644
| 1 | +// | |
| 2 | +// CNMessageNotesController.h | |
| 3 | +// CNLiveCMineModule | |
| 4 | +// | |
| 5 | +// Created by iOS on 2022/12/7. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#import <CNLiveBusinessBaseModule/CNLiveBusinessBaseModule.h> | |
| 9 | + | |
| 10 | +NS_ASSUME_NONNULL_BEGIN | |
| 11 | + | |
| 12 | +@interface CNMessageNotesController : CNCommonViewController | |
| 13 | + | |
| 14 | +@end | |
| 15 | + | |
| 16 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveCMineModule/Classes/CNCSubMine/ViewController/CNMessageNotesController.m
0 → 100644
| 1 | +// | |
| 2 | +// CNMessageNotesController.m | |
| 3 | +// CNLiveCMineModule | |
| 4 | +// | |
| 5 | +// Created by iOS on 2022/12/7. | |
| 6 | +// | |
| 7 | + | |
| 8 | +#import "CNMessageNotesController.h" | |
| 9 | +#import "CNMessgeNoteCell.h" | |
| 10 | +#import "CNCSubMinePresent.h" | |
| 11 | + | |
| 12 | +static NSString const*kCNMessgeNoteCellID = @"CNMessgeNoteCellID"; | |
| 13 | +@interface CNMessageNotesController ()<UITableViewDelegate, UITableViewDataSource> | |
| 14 | +@property (nonatomic, strong)CNLiveNavigationBar *navigationBar; | |
| 15 | +@property (nonatomic, strong)UITableView *tableView; | |
| 16 | +@property (nonatomic, strong)NSArray *dataSource; | |
| 17 | +@end | |
| 18 | + | |
| 19 | +@implementation CNMessageNotesController | |
| 20 | +- (void)dealloc{ | |
| 21 | + NSLog(@"%s",__func__); | |
| 22 | +} | |
| 23 | +- (void)viewDidLoad { | |
| 24 | + [super viewDidLoad]; | |
| 25 | + self.view.backgroundColor = UIColorWhite; | |
| 26 | + self.dataSource = [CNCSubMinePresent getMessageNotificationList]; | |
| 27 | + [self.view addSubview:self.navigationBar]; | |
| 28 | + [self.view addSubview:self.tableView]; | |
| 29 | + [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { | |
| 30 | + make.left.right.bottom.equalTo(self.view); | |
| 31 | + make.top.equalTo(self.navigationBar.mas_bottom); | |
| 32 | + }]; | |
| 33 | +} | |
| 34 | +- (BOOL)preferredNavigationBarHidden{ | |
| 35 | + return YES; | |
| 36 | +} | |
| 37 | +#pragma mark - UITableViewDelegate | |
| 38 | +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; | |
| 39 | +{ | |
| 40 | + return 59; | |
| 41 | +} | |
| 42 | +- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ | |
| 43 | + return 50; | |
| 44 | +} | |
| 45 | +- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ | |
| 46 | + UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(18, 10, kScreenWidth - 36, 40)]; | |
| 47 | + label.font = UIFontMake(14); | |
| 48 | + label.textColor = UIColorHex(#999999); | |
| 49 | + label.numberOfLines = 2; | |
| 50 | + label.text = @"关闭后你将不会在下拉通知看到该类型的消息,但在网家家内会显示红点。"; | |
| 51 | + return label; | |
| 52 | +} | |
| 53 | +#pragma mark - UITableViewDataSource | |
| 54 | +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ | |
| 55 | + return self.dataSource.count; | |
| 56 | +} | |
| 57 | +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ | |
| 58 | + CNMessgeNoteCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNMessgeNoteCellID]; | |
| 59 | + return cell; | |
| 60 | +} | |
| 61 | +#pragma mark - Getting | |
| 62 | +- (CNLiveNavigationBar *)navigationBar{ | |
| 63 | + if (!_navigationBar) { | |
| 64 | + _navigationBar = [CNLiveNavigationBar navigationBar]; | |
| 65 | + _navigationBar.title.text = @"消息通知"; | |
| 66 | + weakself | |
| 67 | + _navigationBar.onClickLeftButton = ^{ | |
| 68 | + [weakSelf.navigationController popViewControllerAnimated:YES]; | |
| 69 | + }; | |
| 70 | + } | |
| 71 | + return _navigationBar; | |
| 72 | +} | |
| 73 | +- (UITableView *)tableView{ | |
| 74 | + if (!_tableView) { | |
| 75 | + _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; | |
| 76 | + _tableView.backgroundColor = UIColorHex(#F2F2F2); | |
| 77 | + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; | |
| 78 | + _tableView.delegate = self; | |
| 79 | + _tableView.dataSource = self; | |
| 80 | + [_tableView registerClass:[CNMessgeNoteCell class] forCellReuseIdentifier:kCNMessgeNoteCellID]; | |
| 81 | + } | |
| 82 | + return _tableView; | |
| 83 | +} | |
| 84 | +@end | ... | ... |
CNLiveCMineModule/Classes/CNCSubMine/ViewController/CNMineSettingVC.m
| ... | ... | @@ -13,6 +13,7 @@ |
| 13 | 13 | #import "CNPrivacyViewController.h" |
| 14 | 14 | #import "CNMineAccountManageController.h" |
| 15 | 15 | #import "CNCancellationViewController.h" |
| 16 | +#import "CNMessageNotesController.h" | |
| 16 | 17 | |
| 17 | 18 | @interface CNMineSettingVC ()<UITableViewDelegate,UITableViewDataSource> |
| 18 | 19 | @property (nonatomic, strong) UITableView *tableView; |
| ... | ... | @@ -184,7 +185,12 @@ static NSString *settingListCellId = @"settingListCellId"; |
| 184 | 185 | //隐私 |
| 185 | 186 | CNPrivacyViewController *vc = [[CNPrivacyViewController alloc] init]; |
| 186 | 187 | [[BaseAppDelegate sharedAppDelegate] pushViewController:vc withBackTitle:@" "]; |
| 187 | - }else if (indexPath.row == 6+i) | |
| 188 | + }else if (indexPath.row == 6){ | |
| 189 | + //消息通知 | |
| 190 | + CNMessageNotesController *vc = [[CNMessageNotesController alloc] init]; | |
| 191 | + [[BaseAppDelegate sharedAppDelegate] pushViewController:vc]; | |
| 192 | + } | |
| 193 | + else if (indexPath.row == 7+i) | |
| 188 | 194 | //清除缓存 |
| 189 | 195 | { |
| 190 | 196 | UIAlertController *actionAlert = [UIAlertController alertControllerWithTitle:@"清除缓存" message:@"您确定要清除本地缓存吗?" preferredStyle:UIAlertControllerStyleAlert]; |
| ... | ... | @@ -212,11 +218,11 @@ static NSString *settingListCellId = @"settingListCellId"; |
| 212 | 218 | [action1 setValue:UIColorHex(23D41E) forKey:@"_titleTextColor"]; |
| 213 | 219 | [action2 setValue:UIColorHex(23D41E) forKey:@"_titleTextColor"]; |
| 214 | 220 | [self presentViewController:actionAlert animated:YES completion:nil]; |
| 215 | - }else if (indexPath.row == 7+ i){ | |
| 221 | + }else if (indexPath.row == 8+ i){ | |
| 216 | 222 | //关于我们 |
| 217 | 223 | CNMineAccountManageController *aboutVC = [[CNMineAccountManageController alloc] initWithType:SettingTypeAbout]; |
| 218 | 224 | [[BaseAppDelegate sharedAppDelegate] pushViewController:aboutVC withBackTitle:@" "]; |
| 219 | - }else if (indexPath.row == 8+ i){ | |
| 225 | + }else if (indexPath.row == 9+ i){ | |
| 220 | 226 | //注销账号 |
| 221 | 227 | CNCancellationViewController *vc = [[CNCancellationViewController alloc] init]; |
| 222 | 228 | [[BaseAppDelegate sharedAppDelegate] pushViewController:vc withBackTitle:@" "]; | ... | ... |