贵族中心隐身进房开关,糖果树增加中奖消息开关

This commit is contained in:
chenguilong
2022-04-29 15:31:21 +08:00
parent a8bbca8a56
commit 83604204f6
16 changed files with 211 additions and 51 deletions

View File

@@ -196,6 +196,7 @@
9B92A36D2798179B00AD168F /* XPSkillCardTypeCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B92A36C2798179B00AD168F /* XPSkillCardTypeCollectionViewCell.m */; };
9B92A37027981F5B00AD168F /* XPSkillCardEditViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B92A36F27981F5B00AD168F /* XPSkillCardEditViewController.m */; };
9B92C02227E0BD040044C5EA /* XPNobleTrumpetModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B92C02127E0BD040044C5EA /* XPNobleTrumpetModel.m */; };
9B9DD94A281BC17600DBA903 /* XPCandyTreeMoreRuleCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B9DD949281BC17600DBA903 /* XPCandyTreeMoreRuleCell.m */; };
9B9DFD9A27DB2194000F95B3 /* XPSessionMessageHeadView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B9DFD9927DB2194000F95B3 /* XPSessionMessageHeadView.m */; };
9B9EEF4E27C8755C006B0EB3 /* XPSkillCardResourcePropModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B9EEF4D27C8755C006B0EB3 /* XPSkillCardResourcePropModel.m */; };
9B9EEF5427C8AFEA006B0EB3 /* XPSkillCardRecordPropModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B9EEF5327C8AFEA006B0EB3 /* XPSkillCardRecordPropModel.m */; };
@@ -1105,6 +1106,8 @@
9B92A36F27981F5B00AD168F /* XPSkillCardEditViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSkillCardEditViewController.m; sourceTree = "<group>"; };
9B92C02027E0BD040044C5EA /* XPNobleTrumpetModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPNobleTrumpetModel.h; sourceTree = "<group>"; };
9B92C02127E0BD040044C5EA /* XPNobleTrumpetModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPNobleTrumpetModel.m; sourceTree = "<group>"; };
9B9DD948281BC17600DBA903 /* XPCandyTreeMoreRuleCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPCandyTreeMoreRuleCell.h; sourceTree = "<group>"; };
9B9DD949281BC17600DBA903 /* XPCandyTreeMoreRuleCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPCandyTreeMoreRuleCell.m; sourceTree = "<group>"; };
9B9DFD9827DB2194000F95B3 /* XPSessionMessageHeadView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSessionMessageHeadView.h; sourceTree = "<group>"; };
9B9DFD9927DB2194000F95B3 /* XPSessionMessageHeadView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSessionMessageHeadView.m; sourceTree = "<group>"; };
9B9EEF4C27C8755C006B0EB3 /* XPSkillCardResourcePropModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSkillCardResourcePropModel.h; sourceTree = "<group>"; };
@@ -4856,6 +4859,8 @@
E8A03DEF276303D40098D9EA /* XPCandyTreeRankTableViewCell.m */,
E8A03DF42763367F0098D9EA /* XPCandyTreeEmptyableViewCell.h */,
E8A03DF52763367F0098D9EA /* XPCandyTreeEmptyableViewCell.m */,
9B9DD948281BC17600DBA903 /* XPCandyTreeMoreRuleCell.h */,
9B9DD949281BC17600DBA903 /* XPCandyTreeMoreRuleCell.m */,
);
path = Cell;
sourceTree = "<group>";
@@ -6547,6 +6552,7 @@
9BE9F10527FF04CF00667200 /* XPAnchorFansTaskTableViewCell.m in Sources */,
9B92A33C2797E38100AD168F /* XPMineHeadItemTableViewCell.m in Sources */,
189DD56526DE465A00AB55B1 /* LoginViewController.m in Sources */,
9B9DD94A281BC17600DBA903 /* XPCandyTreeMoreRuleCell.m in Sources */,
E824544B26F5BBB800BE8163 /* XPMineModifPayPwdViewController.m in Sources */,
E81C1B2227705F950020D1E4 /* Api+ArrangeMic.m in Sources */,
E800805A27FD34DE0055A8AB /* XPMineClanViewController.m in Sources */,

View File

@@ -90,6 +90,8 @@
- (void)changeEnterHide:(BOOL)enterHide {
[Api changeEnterHidCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] changeEnterHideSuccess];
} fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] changeEnterHideFail];
}] open:[NSString stringWithFormat:@"%d", enterHide]];
}

View File

@@ -32,5 +32,7 @@
///开关隐身进房成功
- (void)changeEnterHideSuccess;
///开关隐身进房失败
- (void)changeEnterHideFail;
@end

View File

@@ -41,6 +41,11 @@
[self initSubViewConstraints];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
}
#pragma mark - Private Method
- (void)initSubViews {
self.view.backgroundColor = [UIColor clearColor];

View File

@@ -23,7 +23,8 @@
///
@property (nonatomic, strong) UILabel *label;
///
@property (nonatomic, strong) UIButton *switchButton;
//@property (nonatomic, strong) UIButton *switchButton;
@property (nonatomic, strong) UISwitch *switchButton;
@end
@@ -68,33 +69,35 @@
[self.switchButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.label);
make.right.mas_equalTo(-15);
make.height.mas_equalTo(16);
make.width.mas_equalTo(32);
}];
}
#pragma mark - XPNobleCenterProtocol
- (void)changeEnterHideSuccess {
self.switchButton.selected = !self.switchButton.selected;
self.enterHide = !self.enterHide;
if (self.didUpdateEnterHideBlock) {
self.didUpdateEnterHideBlock();
}
}
- (void)changeEnterHideFail {
self.switchButton.on = self.enterHide;
}
#pragma mark - XPNobleSettingNavViewDelegate
///
- (void)xPNobleSettingNavView:(XPNobleSettingNavView *)view didClickBackButton:(UIButton *)sender {
[self.navigationController popViewControllerAnimated:YES];
}
- (void)switchButtonAction:(UIButton *)sender {
[self.presenter changeEnterHide:!sender.isSelected];
- (void)switchDidChange:(UISwitch *)switchButton {
[self.presenter changeEnterHide:switchButton.isOn];
}
#pragma mark - getter and setter
- (void)setEnterHide:(BOOL)enterHide {
_enterHide = enterHide;
self.switchButton.selected = enterHide;
self.switchButton.on = enterHide;
}
- (XPNobleSettingNavView *)navView {
@@ -115,13 +118,12 @@
return _label;
}
- (UIButton *)switchButton {
- (UISwitch *)switchButton {
if (!_switchButton) {
_switchButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_switchButton setImage:[UIImage imageNamed:@"noble_setting_visible_close"] forState:UIControlStateNormal];
[_switchButton setImage:[UIImage imageNamed:@"noble_setting_visible_open"] forState:UIControlStateSelected];
[_switchButton addTarget:self action:@selector(switchButtonAction:) forControlEvents:UIControlEventTouchUpInside];
[_switchButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
_switchButton = [[UISwitch alloc] init];
_switchButton.tintColor = UIColorRGBAlpha(0xFFE3AF, 0.4);
_switchButton.onTintColor = UIColorFromRGB(0xFFE3AF);
[_switchButton addTarget:self action:@selector(switchDidChange:) forControlEvents:UIControlEventValueChanged];
}
return _switchButton;
}

View File

@@ -1163,23 +1163,6 @@
}
#pragma mark - Getters And Setters
//- (UIButton *)contributionButton {
// if (!_contributionButton) {
// _contributionButton = [[UIButton alloc]init];
// [_contributionButton addTarget:self action:@selector(contributionButtonAction:) forControlEvents:UIControlEventTouchUpInside];
// _contributionButton.backgroundColor = [UIColor colorWithWhite:0 alpha:0.2];
// [_contributionButton setTitle:@"房间榜" forState:UIControlStateNormal];
// [_contributionButton setImage:[UIImage imageNamed:@"room_rank_enter_icon"] forState:UIControlStateNormal];
// [_contributionButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
// _contributionButton.titleLabel.font = [UIFont systemFontOfSize:12];
// _contributionButton.layer.cornerRadius = 13;
// _contributionButton.layer.masksToBounds = YES;
// _contributionButton.imageEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
// _contributionButton.titleEdgeInsets = UIEdgeInsetsMake(0, 20, 0, 0);
// }
// return _contributionButton;
//}
- (XPRoomRankEntranceView *)contributeEnterView {
if (!_contributeEnterView) {
_contributeEnterView = [[XPRoomRankEntranceView alloc] init];

View File

@@ -8,7 +8,6 @@
#import "XPRoomRankEntranceView.h"
///Third
#import <Masonry/Masonry.h>
#import "UIImage+Utils.h"
#import "ThemeColor.h"
///Tool
#import "NetImageView.h"
@@ -36,6 +35,16 @@
return self;
}
- (void)layoutSubviews {
[super layoutSubviews];
CAGradientLayer *layer = [CAGradientLayer new];
layer.colors=@[(__bridge id)UIColorRGBAlpha(0xFFB300, 0.5).CGColor,(__bridge id)UIColorRGBAlpha(0xFFCA45, 0).CGColor];
layer.startPoint = CGPointMake(0, 0);
layer.endPoint = CGPointMake(1, 0);
layer.frame = self.bounds;
[self.bgImageView.layer addSublayer:layer];
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.bgImageView];
@@ -55,12 +64,12 @@
make.left.mas_equalTo(1);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.bgImageView);
make.centerY.mas_equalTo(self);
make.left.mas_equalTo(self.rankContentView.mas_right).mas_offset(4);
}];
[self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(9);
make.centerY.mas_equalTo(self.bgImageView);
make.centerY.mas_equalTo(self);
make.left.mas_equalTo(self.titleLabel.mas_right).mas_offset(5);
}];
@@ -100,7 +109,6 @@
- (UIImageView *)bgImageView {
if (_bgImageView == nil) {
_bgImageView = [[UIImageView alloc] init];
_bgImageView.image = [UIImage gradientColorImageFromColors:@[UIColorRGBAlpha(0xFFB300, 0.5), UIColorRGBAlpha(0xFFCA45, 0)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(116, 22)];
}
return _bgImageView;
}

View File

@@ -19,7 +19,7 @@
///
/// @param complection
/// @param sendMessage
/// @param sendMessage 1: 0
/// @param keyNum
/// @param boxType
/// @param roomUid uid

View File

@@ -12,6 +12,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface CandyTreeInfoModel : NSObject
///糖果的数量
@property (nonatomic, assign) NSInteger keyNum;
///糖果树展示消息开关需要的等级
@property (nonatomic, assign) NSInteger sendMessageSwitchLevel;
@end
NS_ASSUME_NONNULL_END

View File

@@ -30,12 +30,14 @@
/// @param roomUid uid
- (void)pickCandy:(NSString *)keyNum roomUid:(NSString *)roomUid {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString *showSwitch = [[NSUserDefaults standardUserDefaults] objectForKey:@"kCandyTreeHideMessage"];
NSString *sendMessage = showSwitch.length ? @"0" : @"1";
[Api pickCandyComplection:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
CandyTreeResultModel * resultModel = [CandyTreeResultModel modelWithJSON:data.data];
[[self getView] pickCandySuccess:resultModel];
}fail:^(NSInteger code, NSString * _Nullable msg) {
[[self getView] pickCandyFail];
}] sendMessage:@"1" keyNum:keyNum boxType:@"1" roomUid:roomUid uid:uid];
}] sendMessage:sendMessage keyNum:keyNum boxType:@"1" roomUid:roomUid uid:uid];
}
@end

View File

@@ -0,0 +1,28 @@
//
// XPCandyTreeMoreRuleCell.h
// xplan-ios
//
// Created by GreenLand on 2022/4/29.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class XPCandyTreeMoreRuleCell;
@protocol XPCandyTreeMoreRuleCellDelegate <NSObject>
- (void)xPCandyTreeMoreRuleCell:(XPCandyTreeMoreRuleCell *)cell switchChange:(BOOL)change;
@end
@interface XPCandyTreeMoreRuleCell : UITableViewCell
@property (nonatomic, copy) NSString *title;
@property (nonatomic, assign) BOOL isShow;
@property (nonatomic, weak) id<XPCandyTreeMoreRuleCellDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,82 @@
//
// XPCandyTreeMoreRuleCell.m
// xplan-ios
//
// Created by GreenLand on 2022/4/29.
//
#import "XPCandyTreeMoreRuleCell.h"
///Third
#import <Masonry/Masonry.h>
#import "ThemeColor.h"
@interface XPCandyTreeMoreRuleCell ()
@property (nonatomic,strong) UILabel *titleLabel;
@property (nonatomic, strong) UISwitch *switchButton;
@end
@implementation XPCandyTreeMoreRuleCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor whiteColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.switchButton];
}
- (void)initSubViewConstraints {
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.contentView);
make.left.mas_equalTo(16);
}];
[self.switchButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.contentView);
make.right.mas_equalTo(-16);
}];
}
- (void)setTitle:(NSString *)title {
self.titleLabel.text = title;
}
- (void)setIsShow:(BOOL)isShow {
self.switchButton.on = isShow;
}
- (void)switchDidChange:(UISwitch *)switchButton {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPCandyTreeMoreRuleCell:switchChange:)]) {
[self.delegate xPCandyTreeMoreRuleCell:self switchChange:switchButton.isOn];
}
}
#pragma mark - Getters And Setters
- (UISwitch *)switchButton {
if (!_switchButton) {
_switchButton = [[UISwitch alloc] init];
[_switchButton addTarget:self action:@selector(switchDidChange:) forControlEvents:UIControlEventValueChanged];
}
return _switchButton;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:15];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.textColor = [ThemeColor alertTitleColor];
}
return _titleLabel;
}
@end

View File

@@ -10,7 +10,8 @@
NS_ASSUME_NONNULL_BEGIN
@interface XPCandyTreeMoreView : UIView
///展示中奖消息的开关
@property (nonatomic, assign) BOOL showMessageSwitch;
@end
NS_ASSUME_NONNULL_END

View File

@@ -15,13 +15,18 @@
#import "TTPopup.h"
///View
#import "XPRoomHalfWebView.h"
@interface XPCandyTreeMoreView ()<UITableViewDelegate, UITableViewDataSource>
#import "XPCandyTreeMoreRuleCell.h"
///
NSString * const kCandyTreeHideMessage = @"kCandyTreeHideMessage";
@interface XPCandyTreeMoreView ()<UITableViewDelegate, UITableViewDataSource, XPCandyTreeMoreRuleCellDelegate>
///
@property (nonatomic,strong) UILabel *titleLabel;
///
@property (nonatomic,strong) UITableView *tableView;
///
@property (nonatomic,strong) NSArray *datasource;
@property (nonatomic,strong) NSMutableArray *datasource;
@end
@implementation XPCandyTreeMoreView
@@ -74,15 +79,23 @@
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([UITableViewCell class])];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([UITableViewCell class])];
}
cell.backgroundColor = [UIColor whiteColor];
cell.textLabel.text = [self.datasource objectAtIndex:indexPath.row];
cell.textLabel.textColor = [ThemeColor alertTitleColor];
cell.textLabel.font = [UIFont systemFontOfSize:15];
return cell;
if (indexPath.row != 3) {
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([UITableViewCell class])];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([UITableViewCell class])];
}
cell.backgroundColor = [UIColor whiteColor];
cell.textLabel.text = [self.datasource objectAtIndex:indexPath.row];
cell.textLabel.textColor = [ThemeColor alertTitleColor];
cell.textLabel.font = [UIFont systemFontOfSize:15];
return cell;
}
XPCandyTreeMoreRuleCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPCandyTreeMoreRuleCell class])];
cell.title = self.datasource[indexPath.row];
cell.delegate = self;
NSString *showSwitch = [[NSUserDefaults standardUserDefaults] objectForKey:kCandyTreeHideMessage];
cell.isShow = !showSwitch.length;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
@@ -116,7 +129,28 @@
}
}
#pragma mark - XPCandyTreeMoreRuleCellDelegate
- (void)xPCandyTreeMoreRuleCell:(XPCandyTreeMoreRuleCell *)cell switchChange:(BOOL)change {
if (change) {
[[NSUserDefaults standardUserDefaults] setObject:nil forKey:kCandyTreeHideMessage];
} else {
[[NSUserDefaults standardUserDefaults] setObject:@"1" forKey:kCandyTreeHideMessage];
}
[[NSUserDefaults standardUserDefaults] synchronize];
}
#pragma mark - Getters And Setters
- (void)setShowMessageSwitch:(BOOL)showMessageSwitch {
_showMessageSwitch = showMessageSwitch;
if (showMessageSwitch) {
[self.datasource addObject:@"允许将中奖消息对外展示"];
[self.tableView reloadData];
} else {
[[NSUserDefaults standardUserDefaults] setObject:nil forKey:kCandyTreeHideMessage];
[[NSUserDefaults standardUserDefaults] synchronize];
}
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
@@ -139,13 +173,14 @@
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
[_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:NSStringFromClass([UITableViewCell class])];
[_tableView registerClass:[XPCandyTreeMoreRuleCell class] forCellReuseIdentifier:NSStringFromClass([XPCandyTreeMoreRuleCell class])];
}
return _tableView;
}
- (NSArray *)datasource {
- (NSMutableArray *)datasource {
if (!_datasource) {
_datasource = @[@"参与活动获得糖果", @"获奖记录", @"玩法规则"];
_datasource = [NSMutableArray arrayWithObjects:@"参与活动获得糖果", @"获奖记录", @"玩法规则", nil];
}
return _datasource;
}

View File

@@ -20,6 +20,7 @@
#import "AttachmentModel.h"
#import "CandyTreeInfoModel.h"
#import "CandyTreeResultModel.h"
#import "UserInfoModel.h"
///View
#import "XPRoomHalfWebView.h"
#import "XPCandyTreeMoreView.h"
@@ -341,6 +342,7 @@
#pragma mark - Event Response
- (void)moreTapRecognizer:(UITapGestureRecognizer *)tap {
XPCandyTreeMoreView * moreView = [[XPCandyTreeMoreView alloc] init];
moreView.showMessageSwitch = self.hostDelegate.getUserInfo.userLevelVo.experLevelSeq >= self.candyInfo.sendMessageSwitchLevel;
[TTPopup popupView:moreView style:TTPopupStyleActionSheet];
}

View File

@@ -165,7 +165,7 @@ UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
}
#pragma mark - Private Method