Commit 29b2334a by pierce

通知页面

parent 07fc83dd
......@@ -28,6 +28,11 @@ typedef NS_ENUM(NSInteger, CustomSettingItemType) {
*/
@property (nonatomic, copy) NSString *icon;
/**
* 图标
*/
@property (nonatomic, copy) NSString *webIcon;
// 图标的偏移量
@property (nonatomic, assign) CGPoint iconOffset;
......@@ -179,4 +184,10 @@ typedef NS_ENUM(NSInteger, CustomSettingItemType) {
*/
+ (instancetype)fus_itemWithIcon:(NSString *)icon title:(NSString *)title type:(CustomSettingItemType)type;
@property (nonatomic, copy) UITableViewCell *(^getCustomCellBlock)(UITableView *tableView, NSIndexPath *indexPath, FUSCustomSettingItem *item);
@end
......@@ -85,6 +85,11 @@
FUSCustomSettingGroup *itemsGroup = self.allGroups[indexPath.section];
FUSCustomSettingItem *item = itemsGroup.items[indexPath.row];
if (item.getCustomCellBlock) {
UITableViewCell *cell = item.getCustomCellBlock(tableView, indexPath, item);
return cell;
}
FUSCustomSettingCell *settingCell = [FUSCustomSettingCell settingCellWithTableView:tableView style:item.cellStyle bgColor:itemsGroup.itemsBgColor];
settingCell.selectedBackgroundView = [[UIView alloc] initWithFrame:settingCell.frame];
settingCell.selectedBackgroundView.backgroundColor = itemsGroup.itemsPressBgColor;
......
......@@ -158,6 +158,8 @@
BE2A4B982CF86CF6008B4796 /* FUSLiveAudienceSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BE2A4B962CF86CF6008B4796 /* FUSLiveAudienceSettingViewController.m */; };
BE2A4B9E2CF87E5C008B4796 /* FUSZhaixinChatSettingViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = BE2A4B9C2CF87E5C008B4796 /* FUSZhaixinChatSettingViewController.h */; };
BE2A4B9F2CF87E5C008B4796 /* FUSZhaixinChatSettingViewController.h.m in Sources */ = {isa = PBXBuildFile; fileRef = BE2A4B9D2CF87E5C008B4796 /* FUSZhaixinChatSettingViewController.h.m */; };
BE2A4BA22CF9B893008B4796 /* FUSNoticeLiveUserCell.h in Headers */ = {isa = PBXBuildFile; fileRef = BE2A4BA02CF9B893008B4796 /* FUSNoticeLiveUserCell.h */; };
BE2A4BA32CF9B893008B4796 /* FUSNoticeLiveUserCell.m in Sources */ = {isa = PBXBuildFile; fileRef = BE2A4BA12CF9B893008B4796 /* FUSNoticeLiveUserCell.m */; };
BE3625822C6B32130004606D /* 1_zone_details_animation_1@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = BE3625062C6B32130004606D /* 1_zone_details_animation_1@3x.png */; };
BE3625832C6B32130004606D /* 1_zone_details_animation_2@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = BE3625072C6B32130004606D /* 1_zone_details_animation_2@3x.png */; };
BE3625842C6B32130004606D /* 1_zone_details_animation_3@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = BE3625082C6B32130004606D /* 1_zone_details_animation_3@3x.png */; };
......@@ -1010,6 +1012,8 @@
BE2A4B962CF86CF6008B4796 /* FUSLiveAudienceSettingViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSLiveAudienceSettingViewController.m; sourceTree = "<group>"; };
BE2A4B9C2CF87E5C008B4796 /* FUSZhaixinChatSettingViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSZhaixinChatSettingViewController.h; sourceTree = "<group>"; };
BE2A4B9D2CF87E5C008B4796 /* FUSZhaixinChatSettingViewController.h.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSZhaixinChatSettingViewController.h.m; sourceTree = "<group>"; };
BE2A4BA02CF9B893008B4796 /* FUSNoticeLiveUserCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSNoticeLiveUserCell.h; sourceTree = "<group>"; };
BE2A4BA12CF9B893008B4796 /* FUSNoticeLiveUserCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSNoticeLiveUserCell.m; sourceTree = "<group>"; };
BE3625062C6B32130004606D /* 1_zone_details_animation_1@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "1_zone_details_animation_1@3x.png"; sourceTree = "<group>"; };
BE3625072C6B32130004606D /* 1_zone_details_animation_2@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "1_zone_details_animation_2@3x.png"; sourceTree = "<group>"; };
BE3625082C6B32130004606D /* 1_zone_details_animation_3@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "1_zone_details_animation_3@3x.png"; sourceTree = "<group>"; };
......@@ -2727,6 +2731,8 @@
BE78CA0F2C538D7D00F38855 /* FUSSettingNetworkCherkAlert.h */,
BE78CA102C538D7D00F38855 /* FUSSettingNetworkCherkAlert.m */,
BE78CA112C538D7D00F38855 /* FUSSettingNetworkCherkAlert.xib */,
BE2A4BA02CF9B893008B4796 /* FUSNoticeLiveUserCell.h */,
BE2A4BA12CF9B893008B4796 /* FUSNoticeLiveUserCell.m */,
);
path = View;
sourceTree = "<group>";
......@@ -3508,6 +3514,7 @@
BE189A952C7323FE0008418B /* FSRMinedictMotorMissionView.h in Headers */,
BE78CC302C538D7F00F38855 /* FUSSettingChatInviteCell.h in Headers */,
BE78CBFA2C538D7F00F38855 /* FUSChatSettingViewController.h in Headers */,
BE2A4BA22CF9B893008B4796 /* FUSNoticeLiveUserCell.h in Headers */,
BE78CC9D2C538D8000F38855 /* FUSNewsFeedReplyInputView.h in Headers */,
BE189AA92C7323FE0008418B /* FSRVoicedictMinePrivacySearchView.h in Headers */,
BE78CCEF2C538D8000F38855 /* NEW_FUSFullImageViewController.h in Headers */,
......@@ -4152,6 +4159,7 @@
BEDEDC292C66029D00B4B0B0 /* FUSBaoFangHomeFocusCollectionViewSmallCell.m in Sources */,
BE189A742C7323FE0008418B /* FSRPrivacyCollectionViewCell.m in Sources */,
BE189A782C7323FE0008418B /* FSRPrivacyVoiceCollectionViewCell.m in Sources */,
BE2A4BA32CF9B893008B4796 /* FUSNoticeLiveUserCell.m in Sources */,
BE78CC4F2C538D7F00F38855 /* FUSNewsFeedHttpHelper.m in Sources */,
BE78CB6E2C538D7E00F38855 /* FUSZoneCacheOperate.m in Sources */,
BE78CBF62C538D7F00F38855 /* FUSBlackListViewController.m in Sources */,
......
......@@ -8,18 +8,26 @@
#import "FUSNoticeSettingViewController.h"
#import "FUSNoticeLiveUserCell.h"
#import "FUSSettingHttpRequest.h"
@interface FUSNoticeSettingViewController ()
@interface FUSLiveUserSettingItem : FUSCustomSettingItem
// 开播通知
@property (nonatomic, strong) FUSCustomSettingItem *liveNoticeItem;
@property (nonatomic, copy) NSString *roomId;
//// 消息通知
//@property (nonatomic, strong) FUSCustomSettingItem *messageNoticeItem;
//
//// 视讯/声讯通知
//@property (nonatomic, strong) FUSCustomSettingItem *dateNoticeItem;
@end
@implementation FUSLiveUserSettingItem
@end
@interface FUSNoticeSettingViewController ()
// 亲密私信消息通知
@property (nonatomic, strong) FUSCustomSettingItem *intimateItem;
// 其他私信消息通知
@property (nonatomic, strong) FUSCustomSettingItem *messageNoticeItem;
// 动态通知
@property (nonatomic, strong) FUSCustomSettingItem *newsFeedNoticeItem;
......@@ -27,6 +35,20 @@
// 活动通知
@property (nonatomic, strong) FUSCustomSettingItem *activeNoticeItem;
// 签到通知
@property (nonatomic, strong) FUSCustomSettingItem *dailySignNoticeItem;
// 开播通知
@property (nonatomic, strong) FUSCustomSettingItem *liveNoticeItem;
/// 用户头像
@property (nonatomic, strong) NSMutableArray<FUSCustomSettingItem *> *userItems;
@property (nonatomic, strong) FUSCustomSettingGroup *liveUserGroup;
/// 页码
@property (nonatomic, assign) NSInteger page;
@end
@implementation FUSNoticeSettingViewController
......@@ -37,6 +59,9 @@
self.navigationItem.title = [NSString fus_localString:@"通知"];
[self fus_enableNavigationBackWithPopFunction:popViewController withAnimated:YES];
[self.tableView registerClass:[FUSNoticeLiveUserCell class] forCellReuseIdentifier:[FUSNoticeLiveUserCell cellIdentifer]];
[self setGroups];
[self fus_requestPushConfig];
[self fus_refreshTableHeader];
......@@ -52,22 +77,29 @@
BOOL live = [dataDict[@"live"] boolValue];
// 动态分享(0:不接收、1:接收)
BOOL share = [dataDict[@"share"] boolValue];
// 私信消息(0:不接收、1:接收)
// BOOL im = [dataDict[@"im"] boolValue];
// // 声视讯(0:不接收、1:接收)
// BOOL unicast = [dataDict[@"unicast"] boolValue];
// 活动(0:不接收、1:接收)
BOOL activity = [dataDict[@"activity"] boolValue];
BOOL intimatePrivateMsgSwitch = [dataDict[@"intimatePrivateMsgSwitch"] boolValue];
BOOL otherPrivateMsgSwitch = [dataDict[@"otherPrivateMsgSwitch"] boolValue];
BOOL checkIn = [dataDict[@"checkIn"] boolValue];
self.intimateItem.switchState = intimatePrivateMsgSwitch;
self.messageNoticeItem.switchState = otherPrivateMsgSwitch;
self.dailySignNoticeItem.switchState = checkIn;
self.liveNoticeItem.switchState = live;
// self.messageNoticeItem.switchState = im;
// self.dateNoticeItem.switchState = unicast;
self.newsFeedNoticeItem.switchState = share;
self.activeNoticeItem.switchState = activity;
[self.tableView reloadData];
[FUSLoadingView fus_dismissProgressView];
if (live) {
self.page = 1;
[self fus_loadLiveRooms:self.page];
[self fus_setupFooters];
}
} failure:^(NSString *msg, int code) {
[self.navigationController popViewControllerAnimated:YES];
[FUSDialogView fus_showDialog:msg];
......@@ -75,22 +107,137 @@
}];
}
- (void)fus_loadLiveRooms:(NSInteger)page {
[FUSSettingHttpRequest fus_getUserLikePushListWithPage:self.page success:^(NSDictionary *dataDict) {
NSArray *pageList = dataDict[@"pageList"];
if (self.page == 1) {
[self.userItems removeAllObjects];
self.userItems = [NSMutableArray array];
}
__weak typeof(self) weakSelf = self;
for (NSDictionary *user in pageList) {
FUSLiveUserSettingItem *userItem = [[FUSLiveUserSettingItem alloc] init];
userItem.getCustomCellBlock = ^UITableViewCell *(UITableView *tableView, NSIndexPath *indexPath, FUSCustomSettingItem *item) {
FUSNoticeLiveUserCell *cell = [tableView dequeueReusableCellWithIdentifier:[FUSNoticeLiveUserCell cellIdentifer] forIndexPath:indexPath];
cell.item = item;
cell.selectedBackgroundView.backgroundColor = weakSelf.liveUserGroup.itemsPressBgColor;
return cell;
};
userItem.title = user[@"roomName"];
userItem.cellStyle = UITableViewCellStyleValue1;
userItem.type = CustomSettingItemTypeSwitch;
userItem.font = [UIFont systemFontOfSize:16 weight:UIFontWeightLight];
userItem.titleColor = [UIColor fus_textColorRich];
userItem.webIcon = user[@"roomFace"];
userItem.roomId = [user[@"roomId"] description];
userItem.switchState = [user[@"liveSwitch"] boolValue];
userItem.switchClick = ^(FUSCustomSettingItem *item) {
[FUSSettingHttpRequest fus_setUserLikePushListWithRoomId:((FUSLiveUserSettingItem *)item).roomId selected:item.switchState success:^(NSDictionary *dataDict) {
} failure:^(NSString *msg, int code) {
item.switchState = !item.switchState;
[weakSelf.tableView reloadData];
}];
};
[self.userItems addObject:userItem];
}
self.liveUserGroup.items = self.userItems;
if (self.liveUserGroup
&& ![self.allGroups containsObject:self.liveUserGroup]) {
[self.allGroups addObject:self.liveUserGroup];
}
if (pageList.count == 0) {
[self.tableView.mj_footer endRefreshingWithNoMoreData];
} else {
[self.tableView.mj_footer endRefreshing];
}
[self.tableView reloadData];
} failure:^(NSString *msg, int code) {
}];
}
- (void)fus_setupFooters {
if (self.liveUserGroup == nil) {
self.liveUserGroup = [FUSCustomSettingGroup fus_settingGroup];
self.liveUserGroup.groupFooterBgColor = [UIColor clearColor];
self.liveUserGroup.groupFooterTextBgColor = [UIColor clearColor];
self.liveUserGroup.itemsHeight = kCenterShowTextSettingItemHeight;
self.liveUserGroup.groupHeaderHeight = 22;
self.liveUserGroup.groupHeaderBgColor = [UIColor clearColor];
self.liveUserGroup.groupHeaderTextBgColor = [UIColor clearColor];
self.liveUserGroup.groupHeaderText = [NSString fus_versionLocalString:@"你关注的主播"];
self.liveUserGroup.groupHeaderTextFont = [UIFont fus_themeMediumFont:14];
self.liveUserGroup.groupHeaderTextColor = [UIColor fus_textColorRich];
self.liveUserGroup.groupFooterOriginY = 0;
self.liveUserGroup.groupFooterHeight = 0;
self.liveUserGroup.groupFooterOriginX = 0;
self.liveUserGroup.itemsBgColor = [UIColor fus_appBGColor];
self.liveUserGroup.itemsPressBgColor = [UIColor fus_appBGPressColor];
[self.allGroups appendObject:self.liveUserGroup];
}
__weak typeof(self) weakSelf = self;
self.tableView.mj_footer = [FUSRefreshAutoFooter footerWithRefreshingBlock:^{
weakSelf.page ++;
[weakSelf fus_loadLiveRooms:weakSelf.page];
}];
}
#pragma mark - 设置分组
- (void)setGroups
{
__weak typeof(self) weakSelf = self;
self.liveNoticeItem = [FUSCustomSettingItem fus_itemWithTitle:[NSString fus_localString:@"开播消息提醒"] type:CustomSettingItemTypeSwitch];
self.liveNoticeItem.showSeparatorLine = YES;
self.liveNoticeItem.switchClick = ^(FUSCustomSettingItem *item){
[FUSSettingHttpRequest fus_setPushConfigSwitch:item.switchState type:1 success:^{
FUSCustomSettingGroup *msgGroup = [self fus_createGroups];
self.intimateItem = [FUSCustomSettingItem fus_itemWithTitle:[NSString fus_versionLocalString:@"亲密私信"] type:CustomSettingItemTypeSwitch];
self.intimateItem.cellStyle = UITableViewCellStyleSubtitle;
self.intimateItem.rightShowText = [NSString fus_versionLocalString:@"亲密好友发送私信给您的通知"];
self.intimateItem.rightShowTextFont = [UIFont fus_themeFont:11];
self.intimateItem.rightShowTextColor = [UIColor fus_textColorLight2];
self.intimateItem.showSeparatorLine = YES;
self.intimateItem.switchClick = ^(FUSCustomSettingItem *item){
[FUSSettingHttpRequest fus_setPushConfigSwitch:item.switchState type:2 success:^{
} failure:^(NSString *msg, int code) {
item.switchState = !item.switchState;
[weakSelf.tableView reloadData];
}];
};
self.messageNoticeItem = [FUSCustomSettingItem fus_itemWithTitle:[NSString fus_versionLocalString:@"其他私信"] type:CustomSettingItemTypeSwitch];
self.messageNoticeItem.cellStyle = UITableViewCellStyleSubtitle;
self.messageNoticeItem.rightShowText = [NSString fus_versionLocalString:@"屏蔽非亲密私信"];
self.messageNoticeItem.rightShowTextFont = [UIFont fus_themeFont:11];
self.messageNoticeItem.rightShowTextColor = [UIColor fus_textColorLight2];
self.messageNoticeItem.showSeparatorLine = YES;
self.messageNoticeItem.switchClick = ^(FUSCustomSettingItem *item){
[FUSSettingHttpRequest fus_setPushConfigSwitch:item.switchState type:3 success:^{
} failure:^(NSString *msg, int code) {
item.switchState = !item.switchState;
[weakSelf.tableView reloadData];
}];
};
msgGroup.items = @[self.intimateItem,self.messageNoticeItem];
[self.allGroups addObject:msgGroup];
FUSCustomSettingGroup *otherGroup = [self fus_createGroups];
self.newsFeedNoticeItem = [FUSCustomSettingItem fus_itemWithTitle:[NSString fus_localString:@"分享内容提醒"] type:CustomSettingItemTypeSwitch];
self.newsFeedNoticeItem = [FUSCustomSettingItem fus_itemWithTitle:[NSString fus_versionLocalString:@"分享内容通知"] type:CustomSettingItemTypeSwitch];
self.newsFeedNoticeItem.cellStyle = UITableViewCellStyleSubtitle;
self.newsFeedNoticeItem.rightShowText = [NSString fus_versionLocalString:@"分享内容的点赞、评论的通知"];
self.newsFeedNoticeItem.rightShowTextFont = [UIFont fus_themeFont:11];
self.newsFeedNoticeItem.rightShowTextColor = [UIColor fus_textColorLight2];
self.newsFeedNoticeItem.showSeparatorLine = YES;
self.newsFeedNoticeItem.switchClick = ^(FUSCustomSettingItem *item){
[FUSSettingHttpRequest fus_setPushConfigSwitch:item.switchState type:4 success:^{
......@@ -100,7 +247,12 @@
}];
};
self.activeNoticeItem = [FUSCustomSettingItem fus_itemWithTitle:[NSString fus_localString:@"活动提醒"] type:CustomSettingItemTypeSwitch];
self.activeNoticeItem = [FUSCustomSettingItem fus_itemWithTitle:[NSString fus_versionLocalString:@"活动通知"] type:CustomSettingItemTypeSwitch];
self.activeNoticeItem.cellStyle = UITableViewCellStyleSubtitle;
self.activeNoticeItem.rightShowText = [NSString fus_versionLocalString:@"活动最新资讯的通知"];
self.activeNoticeItem.rightShowTextFont = [UIFont fus_themeFont:11];
self.activeNoticeItem.rightShowTextColor = [UIColor fus_textColorLight2];
self.activeNoticeItem.showSeparatorLine = YES;
self.activeNoticeItem.switchClick = ^(FUSCustomSettingItem *item){
[FUSSettingHttpRequest fus_setPushConfigSwitch:item.switchState type:5 success:^{
} failure:^(NSString *msg, int code) {
......@@ -109,11 +261,77 @@
}];
};
self.dailySignNoticeItem = [FUSCustomSettingItem fus_itemWithTitle:[NSString fus_versionLocalString:@"签到提醒通知"] type:CustomSettingItemTypeSwitch];
self.dailySignNoticeItem.cellStyle = UITableViewCellStyleSubtitle;
self.dailySignNoticeItem.rightShowText = [NSString fus_versionLocalString:@"每天固定时间提醒您完成进入签到"];
self.dailySignNoticeItem.rightShowTextFont = [UIFont fus_themeFont:11];
self.dailySignNoticeItem.rightShowTextColor = [UIColor fus_textColorLight2];
self.dailySignNoticeItem.showSeparatorLine = YES;
self.dailySignNoticeItem.switchClick = ^(FUSCustomSettingItem *item){
[FUSSettingHttpRequest fus_setPushConfigSwitch:item.switchState type:7 success:^{
} failure:^(NSString *msg, int code) {
item.switchState = !item.switchState;
[weakSelf.tableView reloadData];
}];
};
otherGroup.items = @[self.newsFeedNoticeItem,self.activeNoticeItem,self.dailySignNoticeItem];
[self.allGroups addObject:otherGroup];
self.liveNoticeItem = [FUSCustomSettingItem fus_itemWithTitle:[NSString fus_localString:@"开播消息提醒"] type:CustomSettingItemTypeSwitch];
self.liveNoticeItem.cellStyle = UITableViewCellStyleSubtitle;
self.liveNoticeItem.rightShowTextFont = [UIFont fus_themeFont:11];
self.liveNoticeItem.rightShowTextColor = [UIColor fus_textColorLight2];
self.liveNoticeItem.rightShowText = [NSString fus_versionLocalString:@"已关注的主播开播时的通知"];
self.liveNoticeItem.showSeparatorLine = YES;
self.liveNoticeItem.switchClick = ^(FUSCustomSettingItem *item){
[FUSSettingHttpRequest fus_setPushConfigSwitch:item.switchState type:1 success:^{
if (item.switchState) {
[weakSelf fus_setupFooters];
if (weakSelf.liveUserGroup
&& ![weakSelf.allGroups containsObject:weakSelf.liveUserGroup]) {
[weakSelf.allGroups addObject:weakSelf.liveUserGroup];
}
} else {
weakSelf.tableView.mj_footer = nil;
if (weakSelf.liveUserGroup
&& [weakSelf.allGroups containsObject:weakSelf.liveUserGroup]) {
[weakSelf.allGroups removeObject:weakSelf.liveUserGroup];
}
}
[weakSelf.tableView reloadData];
} failure:^(NSString *msg, int code) {
item.switchState = !item.switchState;
[weakSelf.tableView reloadData];
}];
};
FUSCustomSettingGroup *group1 = [FUSCustomSettingGroup fus_settingGroup];
group1.items = @[self.liveNoticeItem,self.newsFeedNoticeItem,self.activeNoticeItem];
group1.items = @[self.liveNoticeItem];
[self.allGroups addObject:group1];
[self fus_refreshTableFooter];
}
- (FUSCustomSettingGroup *)fus_createGroups {
FUSCustomSettingGroup *group = [FUSCustomSettingGroup fus_settingGroup];
group.groupHeaderHeight = 12;
group.groupHeaderBgColor = [UIColor fus_appBGPressColor];
group.groupFooterBgColor = [UIColor clearColor];
group.groupFooterTextBgColor = [UIColor clearColor];
group.groupHeaderTextBgColor = [UIColor fus_appBGPressColor];
group.itemsHeight = kCenterShowTextSettingItemHeight;
group.groupCornerRadius = 11;
group.groupFooterOriginY = 0;
group.groupFooterHeight = 0;
group.groupFooterOriginX = 0;
group.itemsBgColor = [UIColor fus_appBGColor];
group.itemsPressBgColor = [UIColor fus_appBGPressColor];
return group;
}
- (void)fus_refreshTableHeader {
......@@ -123,7 +341,7 @@
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.text = [NSString fus_localString:@"通知权限已关闭,无法接收通知"];
titleLabel.font = [UIFont fus_themeFont:15];
titleLabel.textColor = [UIColor colorWithHex:@"FEFEFE"];
titleLabel.textColor = [UIColor fus_textColorMedium];
titleLabel.numberOfLines = 0;
[titleLabel sizeToFit];
[headerView addSubview:titleLabel];
......@@ -131,7 +349,7 @@
UIButton *settingBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[settingBtn setTitle:[NSString fus_localString:@"去开启"] forState:UIControlStateNormal];
settingBtn.titleLabel.font = [UIFont fus_themeFont:15];
[settingBtn setTitleColor:[UIColor colorWithHex:@"#2BE1B0"] forState:UIControlStateNormal];
[settingBtn setTitleColor:[UIColor fus_themeColor] forState:UIControlStateNormal];
[settingBtn sizeToFit];
[settingBtn addTarget:self action:@selector(clickSettingNoticeBtnAction:) forControlEvents:UIControlEventTouchUpInside];
[headerView addSubview:settingBtn];
......@@ -150,7 +368,7 @@
titleLabel.centerY = headerView.height / 2.0f;
UIView *line = [[UIView alloc] initWithFrame:CGRectMake(16, headerView.height - 0.5, headerView.width - 32, 0.5)];
line.backgroundColor = [UIColor colorWithHex:@"#2B3138" alpha:0.5];
line.backgroundColor = [UIColor fus_lineColor];
[headerView addSubview:line];
self.tableView.tableHeaderView = headerView;
} else {
......@@ -158,28 +376,6 @@
}
}
- (void)fus_refreshTableFooter {
UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIView.fus_screenW, 46)];
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.text = [NSString fus_localString:@"私信、声讯和视讯通知默认开启"];
titleLabel.font = [UIFont fus_themeFont:13];
titleLabel.textColor = [UIColor colorWithHex:@"4D4D4D"];
titleLabel.numberOfLines = 0;
[titleLabel sizeToFit];
[footerView addSubview:titleLabel];
titleLabel.x = 16;
if (titleLabel.right > UIView.fus_screenW - 16) {
titleLabel.width = UIView.fus_screenW - 16 - titleLabel.x;
footerView.height = 70;
titleLabel.height = footerView.height;
}
self.tableView.tableFooterView = footerView;
}
- (void)clickSettingNoticeBtnAction:(UIButton *)button {
NSURL *pushSettingUrl = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
if ([[UIApplication sharedApplication] canOpenURL:pushSettingUrl]) {
......
......@@ -267,4 +267,26 @@
success:(void (^)(NSDictionary *dataDict))success
failure:(void (^)(NSString * msg, int code))failure;
/**
获取用户关注主播-设置通知开关
@param success 成功回调
@param failure 失败回调
*/
+ (void)fus_getUserLikePushListWithPage:(NSInteger)page
success:(void(^)(NSDictionary *dataDict))success
failure:(void(^)(NSString *msg, int code))failure;
/**
用户设置接收/不接收某个主播开播通知
@param success 成功回调
@param failure 失败回调
*/
+ (void)fus_setUserLikePushListWithRoomId:(NSString *)roomId
selected:(BOOL)selected
success:(void(^)(NSDictionary *dataDict))success
failure:(void(^)(NSString *msg, int code))failure;
@end
......@@ -517,7 +517,7 @@
/**
设置推送配置
@param type 消息类型(1:开播消息、2:私信消息、3:声视讯消息、4:动态分享消息、5:活动消息
@param type 消息类型(0:系统通知、 1:开播消息、2:亲密私信消息、3:其他私信消息、4:动态分享消息、5:活动消息、6:好友私信通知、7:签到通知
@param switchState 状态(0:开启,1:关闭)
@param success 成功回调
@param failure 失败回调
......@@ -539,6 +539,54 @@
}];
}
/**
获取用户关注主播-设置通知开关
@param success 成功回调
@param failure 失败回调
*/
+ (void)fus_getUserLikePushListWithPage:(NSInteger)page
success:(void(^)(NSDictionary *dataDict))success
failure:(void(^)(NSString *msg, int code))failure
{
[FUSHttpHelper postRequestBinaryWithUrl:FUSUserCenterURLs.fus_URL_GetUserLikePushList
params:@{@"page":@(page), @"pageSize":@(20)} success:^(NSDictionary *dataDict, int code) {
if (success) {
success(dataDict);
}
} failure:^(NSDictionary *dataDict, int code) {
if (failure) failure(dataDict[@"msg"],code);
}];
}
/**
用户设置接收/不接收某个主播开播通知
@param success 成功回调
@param failure 失败回调
*/
+ (void)fus_setUserLikePushListWithRoomId:(NSString *)roomId
selected:(BOOL)selected
success:(void(^)(NSDictionary *dataDict))success
failure:(void(^)(NSString *msg, int code))failure
{
[FUSHttpHelper postRequestBinaryWithUrl:FUSUserCenterURLs.fus_URL_setUserLikePushList
params:@{@"roomId":roomId, @"value":@(selected), @"type":@(1)}
success:^(NSDictionary *dataDict, int code) {
if (success) {
success(dataDict);
}
} failure:^(NSDictionary *dataDict, int code) {
if (failure) failure(dataDict[@"msg"],code);
}];
}
/// 校验是否已更新账号资料
+ (void)fus_oneToOneCheckQualificationSuccess:(void (^)(FUSOnetoOneCheckQualificationModel *))success failure:(void (^)(NSString *, int))failure{
[FUSHttpHelper postRequestBinaryWithUrl:FUSUserCenterURLs.fus_URL_OneToOneCheckQualification params:nil success:^(NSDictionary * _Nullable dataDict, int code) {
......
//
// FUSNoticeLiveUserCell.h
// FUSUserCenterModule
//
// Created by pierce on 2024/11/29.
//
#import <UIKit/UIKit.h>
#import "FUSCustomSettingItem.h"
NS_ASSUME_NONNULL_BEGIN
@interface FUSNoticeLiveUserCell : UITableViewCell
/**
* 通过CustomSettingItem确定自己显示什么样式
*/
@property (nonatomic,strong) FUSCustomSettingItem *item;
/**
cell 的reuse id
*/
+ (NSString *)cellIdentifer;
@end
NS_ASSUME_NONNULL_END
//
// FUSNoticeLiveUserCell.m
// FUSUserCenterModule
//
// Created by pierce on 2024/11/29.
//
#import "FUSNoticeLiveUserCell.h"
#import <Masonry/Masonry.h>
@interface FUSNoticeLiveUserCell ()
@property (nonatomic, strong) UIImageView *faceImageView;
@property (nonatomic, strong) UILabel *nicknameLabel;
@property (nonatomic, strong) UISwitch *theSwitch;
@property (nonatomic, strong) UIView *separatorLineView;
@end
@implementation FUSNoticeLiveUserCell
/**
cell 的reuse id
*/
+ (NSString *)cellIdentifer {
return NSStringFromClass([self class]);
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.backgroundColor = [UIColor whiteColor];
self.selectedBackgroundView = [[UIView alloc] initWithFrame:self.frame];
self.faceImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
self.faceImageView.contentMode = UIViewContentModeScaleAspectFill;
self.faceImageView.layer.cornerRadius = 20;
self.faceImageView.layer.masksToBounds = YES;
[self.contentView addSubview:self.faceImageView];
self.nicknameLabel = [[UILabel alloc] init];
[self.contentView addSubview:self.nicknameLabel];
self.accessoryView = self.theSwitch;
self.separatorLineView = [[UIView alloc] init];
self.separatorLineView.backgroundColor = [UIColor fus_lineColor];
[self.contentView addSubview:self.separatorLineView];
[self.separatorLineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.inset(16);
make.bottom.offset(0);
make.height.offset(0.5);
}];
[self.faceImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(40);
make.left.mas_equalTo(16);
make.centerY.equalTo(self.contentView);
}];
[self.nicknameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.faceImageView.mas_right).offset(8);
make.centerY.equalTo(self.contentView);
}];
}
return self;
}
- (void)setItem:(FUSCustomSettingItem *)item {
_item = item;
//设置图标
if (_item.icon) {
self.faceImageView.image = [UIImage com_ImageNamed:_item.icon];
} else if (_item.webIcon) {
[self.faceImageView setWebImageWithSubURLString:_item.webIcon];
}
//设置标题字体
if (_item.font) {
self.nicknameLabel.font = _item.font;
}
//设置标题颜色
if (_item.titleColor) {
self.nicknameLabel.textColor = _item.titleColor;
}
if (_item.title){ //设置标题
self.nicknameLabel.text = _item.title;
} else if (_item.titleAttributedText) { //设置标题富文本
self.nicknameLabel.attributedText = _item.titleAttributedText;
}
self.separatorLineView.hidden = !item.showSeparatorLine;
self.accessoryView = self.theSwitch;
}
#pragma mark - 右侧开关
- (UISwitch *)theSwitch
{
if (_theSwitch == nil) {
_theSwitch = [[UISwitch alloc]init];
[_theSwitch setOnTintColor:[UIColor colorWithHex:@"02F2F2"]];
[_theSwitch addTarget:self action:@selector(switchClick:) forControlEvents:UIControlEventValueChanged];
}
_theSwitch.on = _item.currentSwitchState;
return _theSwitch;
}
#pragma mark 开关点击事件
- (void)switchClick:(UISwitch *)theSwith
{
_item.switchState = theSwith.isOn;
if (_item.switchClick) {
_item.switchClick(_item);
}
}
@end
......@@ -38,6 +38,12 @@ NS_ASSUME_NONNULL_BEGIN
// 绑定手机
+ (NSString *)fus_URL_PHONE_AUTH;
/// 获取用户关注主播-设置通知开关
+ (NSString *)fus_URL_GetUserLikePushList;
/// 用户设置接收/不接收某个主播开播通知
+ (NSString *)fus_URL_setUserLikePushList;
#pragma mark -- 登录注册相关
// 登录
......
......@@ -265,6 +265,16 @@
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/userManager/changePush"];
}
/// 获取用户关注主播-设置通知开关
+ (NSString *)fus_URL_GetUserLikePushList {
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/userManager/getUserLikePushList"];
}
/// 用户设置接收/不接收某个主播开播通知
+ (NSString *)fus_URL_setUserLikePushList {
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/userManager/setUserLikePush"];
}
// 举报
+ (NSString *)fus_URL_ZONE_REPORT_USER {
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/user/userexpose.html"];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment