Commit 648692f494ae956a6f98c9255aead97e540a3080

Authored by zhangxiaowen
1 parent 0661acba

no message

CNLiveSettingModule/Classes/Controller/CNLiveSettingController.m
@@ -145,6 +145,8 @@ static const NSInteger timeValue = 1.5; @@ -145,6 +145,8 @@ static const NSInteger timeValue = 1.5;
145 [super viewWillAppear:animated]; 145 [super viewWillAppear:animated];
146 self.navigationController.navigationBarHidden = YES; 146 self.navigationController.navigationBarHidden = YES;
147 [self.tableView reloadData]; 147 [self.tableView reloadData];
  148 + self.logout.titleLabel.font = UIFontBoldCNMake(17.0);
  149 +
148 } 150 }
149 151
150 - (void)viewDidLoad { 152 - (void)viewDidLoad {
CNLiveSettingModule/Classes/Model/CNLiveSettingRequest.h 0 → 100644
  1 +//
  2 +// CNLiveSettingRequest.h
  3 +// CNLiveSettingModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +@interface CNLiveSettingRequest : NSObject
  14 +
  15 +
  16 +@end
  17 +
  18 +NS_ASSUME_NONNULL_END
CNLiveSettingModule/Classes/Model/CNLiveSettingRequest.m 0 → 100644
  1 +//
  2 +// CNLiveSettingRequest.m
  3 +// CNLiveSettingModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveSettingRequest.h"
  10 +
  11 +@implementation CNLiveSettingRequest
  12 +
  13 +
  14 +@end
CNLiveSettingModule/Classes/Model/CNLiveUserDefaultsModel.h 0 → 100644
  1 +//
  2 +// CNLiveUserDefaultsModel.h
  3 +// CNLiveSettingModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "NSUserDefaultsModel.h"
  10 +
  11 +#define UserDefaultsModel [CNLiveUserDefaultsModel userDefaultsModel]
  12 +
  13 +NS_ASSUME_NONNULL_BEGIN
  14 +
  15 +@interface CNLiveUserDefaultsModel : NSUserDefaultsModel
  16 +
  17 +//@property (nonatomic, copy) NSString *name;
  18 +//@property (nonatomic, assign) NSInteger gender;
  19 +//@property (nonatomic, assign) long age;
  20 +//@property (nonatomic, assign) float floatNumber;
  21 +//@property (nonatomic, assign) double doubleNumber;
  22 +
  23 +
  24 +// 允许陌生人查看生活圈
  25 +@property (nonatomic, copy) NSString *findStrangerSwitch;
  26 +
  27 +// 金币音量开关
  28 +@property (nonatomic, assign) BOOL goldCoinSound;
  29 +
  30 +@end
  31 +
  32 +NS_ASSUME_NONNULL_END
  33 +
CNLiveSettingModule/Classes/Model/CNLiveUserDefaultsModel.m 0 → 100644
  1 +//
  2 +// CNLiveUserDefaultsModel.m
  3 +// CNLiveSettingModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveUserDefaultsModel.h"
  10 +
  11 +@implementation CNLiveUserDefaultsModel
  12 +
  13 +//@dynamic name;
  14 +//@dynamic gender;
  15 +//@dynamic age;
  16 +//@dynamic floatNumber;
  17 +//@dynamic doubleNumber;
  18 +
  19 +@dynamic goldCoinSound;
  20 +@dynamic findStrangerSwitch;
  21 +
  22 +#pragma mark - Init
  23 +
  24 +- (NSDictionary *)setupDefaultValues {
  25 + return @{
  26 +// @"name": @"lc",
  27 +// @"gender": @1,
  28 +// @"age": @20,
  29 +// @"floatNumber": @11.1,
  30 +// @"doubleNumber": @22.2,
  31 + @"goldCoinSound": @YES,
  32 + @"findStrangerSwitch": @"access"
  33 + };
  34 +}
  35 +
  36 +@end
CNLiveSettingModule/Classes/Model/NSUserDefaultsModel.h 0 → 100644
  1 +//
  2 +// NSUserDefaultsModel.h
  3 +// CNLiveSettingModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +@interface NSUserDefaultsModel : NSObject
  12 +
  13 +// Value types
  14 +typedef NS_ENUM(NSInteger, NSUserDefaultsValueType) {
  15 + NSUserDefaultsValueTypeInteger, // NSInteger
  16 + NSUserDefaultsValueTypeLong, // Include:long,long long,short and unsigned
  17 + NSUserDefaultsValueTypeFloat,
  18 + NSUserDefaultsValueTypeDouble,
  19 + NSUserDefaultsValueTypeBool,
  20 + NSUserDefaultsValueTypeObject,
  21 + NSUserDefaultsValueTypeUnknown
  22 +};
  23 +
  24 +// Init
  25 ++ (instancetype)userDefaultsModel;
  26 +
  27 +// Set default values
  28 +/**
  29 + * Override this method,you can setup default values
  30 + * Description: If the object has two properties such as 'name' and 'gender',you should return @{@"name": @"defaultName", @"gender": @defaultGender}
  31 + */
  32 +- (NSDictionary *)setupDefaultValues;
  33 +
  34 +@end
CNLiveSettingModule/Classes/Model/NSUserDefaultsModel.m 0 → 100644
  1 +//
  2 +// NSUserDefaultsModel.m
  3 +// CNLiveSettingModule
  4 +//
  5 +// Created by 153993236@qq.com on 11/12/2019.
  6 +// Copyright © 2019 153993236@qq.com. All rights reserved.
  7 +//
  8 +
  9 +#import "NSUserDefaultsModel.h"
  10 +#import <objc/runtime.h>
  11 +
  12 +@interface NSUserDefaultsModel ()
  13 +@property (nonatomic, strong) NSMutableDictionary *properties;
  14 +
  15 +@end
  16 +
  17 +@implementation NSUserDefaultsModel
  18 +
  19 +#pragma mark - Init
  20 ++ (instancetype)userDefaultsModel {
  21 + static id model = nil;
  22 + static dispatch_once_t onceToken;
  23 + dispatch_once(&onceToken, ^{
  24 + model = [[[self class] alloc] init];
  25 + });
  26 +
  27 + return model;
  28 +}
  29 +
  30 +- (instancetype)init {
  31 + if (self = [super init]) {
  32 + if ([self respondsToSelector:@selector(setupDefaultValues)]) {
  33 + NSDictionary *defaults = [self setupDefaultValues];
  34 + if (defaults) {
  35 + [[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
  36 + [self exchangeAccessMethods];
  37 + }
  38 + }
  39 + }
  40 +
  41 + return self;
  42 +}
  43 +
  44 +- (NSDictionary *)setupDefaultValues {
  45 + return nil;
  46 +}
  47 +
  48 +#pragma mark - Processing Data
  49 +- (void)exchangeAccessMethods {
  50 + unsigned int count = 0;
  51 +
  52 + objc_property_t *propertyList = class_copyPropertyList([self class], &count);
  53 + for (int index = 0; index < count; index++) {
  54 + objc_property_t property = propertyList[index];
  55 + const char *propertyName = property_getName(property);
  56 + const char *propertyAttributes = property_getAttributes(property);
  57 +
  58 + NSString *getterKey = [NSString stringWithFormat:@"%s", propertyName];
  59 + NSString *setterKey = [NSString stringWithFormat:@"set%@%@:", [[getterKey substringToIndex:1] uppercaseString], [getterKey substringFromIndex:1]];
  60 + if (getterKey && getterKey.length > 0) {
  61 + SEL getterSelector = NSSelectorFromString(getterKey);
  62 + SEL setterSelector = NSSelectorFromString(setterKey);
  63 + self.properties[getterKey] = getterKey;
  64 + self.properties[setterKey] = getterKey;
  65 +
  66 + IMP getterImp = NULL;
  67 + IMP setterImp = NULL;
  68 + // Data type
  69 + char type = propertyAttributes[1];
  70 + if (type == '@') {
  71 + getterImp = (IMP)getObjectValue;
  72 + setterImp = (IMP)setObjectValue;
  73 + }else if (type == 'B') {
  74 + getterImp = (IMP)getBoolValue;
  75 + setterImp = (IMP)setBoolValue;
  76 + } else if (type == 'i') {
  77 + getterImp = (IMP)getIntegerValue;
  78 + setterImp = (IMP)setIntegerValue;
  79 + } else if (type == 'd') {
  80 + getterImp = (IMP)getDoubleValue;
  81 + setterImp = (IMP)setDoubleValue;
  82 + } else if (type == 'f') {
  83 + getterImp = (IMP)getFloatValue;
  84 + setterImp = (IMP)setFloatValue;
  85 + } else if (type == 's' || type == 'l' || type == 'q' || type == 'S' || type == 'I' || type == 'L' || type == 'Q') {
  86 + getterImp = (IMP)getLongValue;
  87 + setterImp = (IMP)setLongValue;
  88 + } else {
  89 + NSLog(@"Warning:Unsupported type ,property = '%@'", getterKey);
  90 + break;
  91 + }
  92 +
  93 + char getterYypes[3] = "v@:";
  94 + getterYypes[0] = type;
  95 + class_addMethod([self class], getterSelector, getterImp, getterYypes);
  96 +
  97 + char setterTypes[4] = "v@:";
  98 + setterTypes[3] = type;
  99 + class_addMethod([self class], setterSelector, setterImp, setterTypes);
  100 + }
  101 + }
  102 + free(propertyList); // release
  103 +}
  104 +
  105 +#pragma mark - Override Methods
  106 +- (NSMutableDictionary *)properties {
  107 + if (!_properties) {
  108 + _properties = [NSMutableDictionary dictionary];
  109 + }
  110 + return _properties;
  111 +}
  112 +
  113 +#pragma mark - Private Methods
  114 +/**
  115 + * Setter And Getter Methods
  116 + */
  117 +
  118 +// Bbject
  119 +static id getObjectValue(NSUserDefaultsModel *model, SEL sel) {
  120 + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
  121 + return [userDefaults objectForKey:model.properties[NSStringFromSelector(sel)]];
  122 +}
  123 +
  124 +static void setObjectValue(NSUserDefaultsModel *model, SEL sel, id value) {
  125 + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
  126 + if (value) {
  127 + [userDefaults setObject:value forKey:model.properties[NSStringFromSelector(sel)]];
  128 + } else {
  129 + [userDefaults removeObjectForKey:model.properties[NSStringFromSelector(sel)]];
  130 + }
  131 + [userDefaults synchronize];
  132 +}
  133 +
  134 +// Bool
  135 +static BOOL getBoolValue(NSUserDefaultsModel *model, SEL sel) {
  136 + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
  137 + return [userDefaults boolForKey:model.properties[NSStringFromSelector(sel)]];
  138 +}
  139 +
  140 +static void setBoolValue(NSUserDefaultsModel *model, SEL sel, BOOL value) {
  141 + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
  142 + [userDefaults setBool:value forKey:model.properties[NSStringFromSelector(sel)]];
  143 + [userDefaults synchronize];
  144 +}
  145 +
  146 +// Integer
  147 +static NSInteger getIntegerValue(NSUserDefaultsModel *model, SEL sel) {
  148 + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
  149 + return [userDefaults integerForKey:model.properties[NSStringFromSelector(sel)]];
  150 +}
  151 +
  152 +static void setIntegerValue(NSUserDefaultsModel *model, SEL sel, NSInteger value) {
  153 + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
  154 + [userDefaults setInteger:value forKey:model.properties[NSStringFromSelector(sel)]];
  155 + [userDefaults synchronize];
  156 +}
  157 +
  158 +// Double
  159 +static double getDoubleValue(NSUserDefaultsModel *model, SEL sel) {
  160 + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
  161 + return [userDefaults doubleForKey:model.properties[NSStringFromSelector(sel)]];
  162 +}
  163 +
  164 +static void setDoubleValue(NSUserDefaultsModel *model, SEL sel, double value) {
  165 + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
  166 + [userDefaults setDouble:value forKey:model.properties[NSStringFromSelector(sel)]];
  167 + [userDefaults synchronize];
  168 +}
  169 +
  170 +// Float
  171 +static float getFloatValue(NSUserDefaultsModel *model, SEL sel) {
  172 + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
  173 + return [userDefaults doubleForKey:model.properties[NSStringFromSelector(sel)]];
  174 +}
  175 +
  176 +static void setFloatValue(NSUserDefaultsModel *model, SEL sel, float value) {
  177 + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
  178 + [userDefaults setFloat:value forKey:model.properties[NSStringFromSelector(sel)]];
  179 + [userDefaults synchronize];
  180 +}
  181 +
  182 +// Long
  183 +static long long getLongValue(NSUserDefaultsModel *model, SEL sel) {
  184 + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
  185 + return [[userDefaults objectForKey:model.properties[NSStringFromSelector(sel)]] longLongValue];
  186 +}
  187 +
  188 +static void setLongValue(NSUserDefaultsModel *model, SEL sel, long long value) {
  189 + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
  190 + [userDefaults setObject:@(value) forKey:model.properties[NSStringFromSelector(sel)]];
  191 + [userDefaults synchronize];
  192 +}
  193 +
  194 +@end
CNLiveSettingModule/Classes/Privacy/CNLivePrivacyTableViewCell.h renamed to CNLiveSettingModule/Classes/Privacy/CNLivePrivacyCell.h
1 // 1 //
2 -// CNPrivacyTableViewCell.h 2 +// CNPrivacyCell.h
3 // CNLiveSettingModule 3 // CNLiveSettingModule
4 // 4 //
5 // Created by CNLive-zxw on 2019/4/23. 5 // Created by CNLive-zxw on 2019/4/23.
@@ -9,10 +9,10 @@ @@ -9,10 +9,10 @@
9 #import <UIKit/UIKit.h> 9 #import <UIKit/UIKit.h>
10 10
11 NS_ASSUME_NONNULL_BEGIN 11 NS_ASSUME_NONNULL_BEGIN
12 -#define kCNLivePrivacyTableViewCell @"CNLivePrivacyTableViewCell" 12 +#define kCNLivePrivacyCell @"CNLivePrivacyCell"
13 @class CNLivePrivacyModel; 13 @class CNLivePrivacyModel;
14 14
15 -@interface CNLivePrivacyTableViewCell : UITableViewCell 15 +@interface CNLivePrivacyCell : UITableViewCell
16 @property (nonatomic, strong) CNLivePrivacyModel *model; 16 @property (nonatomic, strong) CNLivePrivacyModel *model;
17 17
18 @end 18 @end
CNLiveSettingModule/Classes/Privacy/CNLivePrivacyTableViewCell.m renamed to CNLiveSettingModule/Classes/Privacy/CNLivePrivacyCell.m
1 // 1 //
2 -// CNLivePrivacyTableViewCell.m 2 +// CNLivePrivacyCell.m
3 // CNLiveSettingModule 3 // CNLiveSettingModule
4 // 4 //
5 // Created by CNLive-zxw on 2019/4/23. 5 // Created by CNLive-zxw on 2019/4/23.
6 // Copyright © 2019 cnlive. All rights reserved. 6 // Copyright © 2019 cnlive. All rights reserved.
7 // 7 //
8 8
9 -#import "CNLivePrivacyTableViewCell.h" 9 +#import "CNLivePrivacyCell.h"
10 #import <SDWebImage/SDWebImage.h> 10 #import <SDWebImage/SDWebImage.h>
11 #import "QMUIKit.h" 11 #import "QMUIKit.h"
12 #import <Masonry/Masonry.h> 12 #import <Masonry/Masonry.h>
@@ -18,15 +18,17 @@ @@ -18,15 +18,17 @@
18 #import "CNLiveBaseKit.h" 18 #import "CNLiveBaseKit.h"
19 19
20 #import "CNLivePrivacyModel.h" 20 #import "CNLivePrivacyModel.h"
  21 +#import "CNLiveUserDefaultsModel.h"
  22 +#import "CNLivePrivacyRequest.h"
21 23
22 -@interface CNLivePrivacyTableViewCell () 24 +@interface CNLivePrivacyCell ()
23 @property (nonatomic, strong) UILabel *titleLabel; 25 @property (nonatomic, strong) UILabel *titleLabel;
24 -@property (nonatomic, strong) UISwitch *notifiSwitch; 26 +@property (nonatomic, strong) UISwitch *allowSwitch;
25 @property (nonatomic, strong) UIImageView *arrowImage; 27 @property (nonatomic, strong) UIImageView *arrowImage;
26 28
27 @end 29 @end
28 30
29 -@implementation CNLivePrivacyTableViewCell 31 +@implementation CNLivePrivacyCell
30 static const NSInteger margin = 12; 32 static const NSInteger margin = 12;
31 33
32 #pragma mark - Init 34 #pragma mark - Init
@@ -41,7 +43,7 @@ static const NSInteger margin = 12; @@ -41,7 +43,7 @@ static const NSInteger margin = 12;
41 - (void)initSubView { 43 - (void)initSubView {
42 [self.contentView addSubview:self.titleLabel]; 44 [self.contentView addSubview:self.titleLabel];
43 [self.contentView addSubview:self.arrowImage]; 45 [self.contentView addSubview:self.arrowImage];
44 - [self.contentView addSubview:self.notifiSwitch]; 46 + [self.contentView addSubview:self.allowSwitch];
45 47
46 } 48 }
47 49
@@ -55,7 +57,7 @@ static const NSInteger margin = 12; @@ -55,7 +57,7 @@ static const NSInteger margin = 12;
55 make.centerY.mas_equalTo(self.contentView); 57 make.centerY.mas_equalTo(self.contentView);
56 make.right.equalTo(self.contentView).offset(-margin); 58 make.right.equalTo(self.contentView).offset(-margin);
57 }]; 59 }];
58 - [self.notifiSwitch mas_makeConstraints:^(MASConstraintMaker *make) { 60 + [self.allowSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
59 // UISwithch的大小无效.默认大小 51.0f 31.0f) 61 // UISwithch的大小无效.默认大小 51.0f 31.0f)
60 make.centerY.mas_equalTo(self.contentView); 62 make.centerY.mas_equalTo(self.contentView);
61 make.right.equalTo(self.contentView).offset(-margin); 63 make.right.equalTo(self.contentView).offset(-margin);
@@ -73,48 +75,34 @@ static const NSInteger margin = 12; @@ -73,48 +75,34 @@ static const NSInteger margin = 12;
73 - (void)setModel:(CNLivePrivacyModel *)model { 75 - (void)setModel:(CNLivePrivacyModel *)model {
74 _model = model; 76 _model = model;
75 _titleLabel.text = model.title; 77 _titleLabel.text = model.title;
76 - if (model.cellType == CNLivePrivacyCellTypeList) { //0 隐私的列表 78 + if (model.cellType == CNLivePrivacyCellTypeDefault) { //0 隐私的列表
77 _arrowImage.hidden = NO; 79 _arrowImage.hidden = NO;
78 - _notifiSwitch.hidden = YES; 80 + _allowSwitch.hidden = YES;
79 81
80 } 82 }
81 if (model.cellType == CNLivePrivacyCellTypeSee) { //1 是否允许陌生人看生活圈 83 if (model.cellType == CNLivePrivacyCellTypeSee) { //1 是否允许陌生人看生活圈
82 _arrowImage.hidden = YES; 84 _arrowImage.hidden = YES;
83 - _notifiSwitch.hidden = NO;  
84 -  
85 -// _notifiSwitch.enabled = [[KSYReachability reachabilityForInternetConnection] currentReachabilityStatus];//交互性  
86 - [_notifiSwitch setOn:[model.status isEqualToString:@"access"]];  
87 - 85 + _allowSwitch.hidden = NO;
  86 + [_allowSwitch setOn:[model.status isEqualToString:@"access"]];
88 } 87 }
89 88
90 } 89 }
91 90
92 #pragma mark - Action 91 #pragma mark - Action
93 -- (void)switchAction:(UISwitch *)sender { 92 +- (void)allowDidClicked:(UISwitch *)sender {
94 if (_model.cellType == CNLivePrivacyCellTypeSee) { //1 是否允许陌生人看生活圈 93 if (_model.cellType == CNLivePrivacyCellTypeSee) { //1 是否允许陌生人看生活圈
95 sender.userInteractionEnabled = NO; 94 sender.userInteractionEnabled = NO;
96 - if (![[[NSUserDefaults standardUserDefaults] objectForKey:@"CNLiveConnectSuccNotification"] boolValue]) {  
97 - [sender setOn:[_model.status isEqualToString:@"access"]];  
98 - sender.userInteractionEnabled = YES;  
99 - return;  
100 - };  
101 __weak typeof(self) weakSelf = self; 95 __weak typeof(self) weakSelf = self;
102 - NSDictionary *params = @{@"appId":AppId,  
103 - @"type":[_model.status isEqualToString:@"access"]?@"reject":@"access",  
104 - @"sid":CNUserShareModel.uid};  
105 - [CNLiveNetworking setAllowRequestDefaultArgument:YES];  
106 - [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNSwitchAllowStrangerUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {  
107 - if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) {  
108 - weakSelf.model.status = [weakSelf.model.status isEqualToString:@"access"]?@"reject":@"access";  
109 - [[NSUserDefaults standardUserDefaults] setValue:weakSelf.model.status forKey:@"findStrangerSwitch"];  
110 - 96 + [CNLivePrivacyRequest changeAllowStrangersToSeeState:[UserDefaultsModel.findStrangerSwitch isEqualToString:@"access"]?@"reject":@"access" block:^(BOOL isSuccess) {
  97 + if(isSuccess){
  98 + UserDefaultsModel.findStrangerSwitch = [UserDefaultsModel.findStrangerSwitch isEqualToString:@"access"]?@"reject":@"access";
111 }else{ 99 }else{
112 [sender setOn:[weakSelf.model.status isEqualToString:@"access"]]; 100 [sender setOn:[weakSelf.model.status isEqualToString:@"access"]];
113 101
114 } 102 }
115 sender.userInteractionEnabled = YES; 103 sender.userInteractionEnabled = YES;
116 -  
117 }]; 104 }];
  105 +
118 } 106 }
119 107
120 } 108 }
@@ -142,18 +130,18 @@ static const NSInteger margin = 12; @@ -142,18 +130,18 @@ static const NSInteger margin = 12;
142 - (UIImageView *)arrowImage { 130 - (UIImageView *)arrowImage {
143 if (!_arrowImage) { 131 if (!_arrowImage) {
144 _arrowImage = [[UIImageView alloc] init]; 132 _arrowImage = [[UIImageView alloc] init];
145 - UIImage *xw_image = [self getImageWithImageName:@"mine_info_front" bundleName:@"CNLiveSettingModule" targetClass:[CNLivePrivacyTableViewCell class]]; 133 + UIImage *xw_image = [self getImageWithImageName:@"mine_info_front" bundleName:@"CNLiveSettingModule" targetClass:[self class]];
146 _arrowImage.image = xw_image; 134 _arrowImage.image = xw_image;
147 } 135 }
148 return _arrowImage; 136 return _arrowImage;
149 } 137 }
150 138
151 -- (UISwitch *)notifiSwitch {  
152 - if (!_notifiSwitch) {  
153 - _notifiSwitch = [[UISwitch alloc] init];  
154 - [_notifiSwitch addTarget:self action:@selector(switchAction:) forControlEvents:UIControlEventValueChanged]; 139 +- (UISwitch *)allowSwitch {
  140 + if (!_allowSwitch) {
  141 + _allowSwitch = [[UISwitch alloc] init];
  142 + [_allowSwitch addTarget:self action:@selector(allowDidClicked:) forControlEvents:UIControlEventValueChanged];
155 } 143 }
156 - return _notifiSwitch; 144 + return _allowSwitch;
157 } 145 }
158 146
159 @end 147 @end
CNLiveSettingModule/Classes/Privacy/CNLivePrivacyContactTableViewCell.h renamed to CNLiveSettingModule/Classes/Privacy/CNLivePrivacyContactCell.h
1 // 1 //
2 -// CNLivePrivacyContactTableViewCell.h 2 +// CNLivePrivacyContactCell.h
3 // CNLiveSettingModule 3 // CNLiveSettingModule
4 // 4 //
5 // Created by CNLive-zxw on 2019/4/24. 5 // Created by CNLive-zxw on 2019/4/24.
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN @@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
16 16
17 @end 17 @end
18 18
19 -@interface CNLivePrivacyContactTableViewCell : UITableViewCell 19 +@interface CNLivePrivacyContactCell : UITableViewCell
20 @property (nonatomic, strong) UIButton *selectBtn; 20 @property (nonatomic, strong) UIButton *selectBtn;
21 @property (nonatomic, strong) IMAUser *user; 21 @property (nonatomic, strong) IMAUser *user;
22 @property (nonatomic, assign) id<CNLivePrivacyContactCellDelegate> delegate; 22 @property (nonatomic, assign) id<CNLivePrivacyContactCellDelegate> delegate;
CNLiveSettingModule/Classes/Privacy/CNLivePrivacyContactTableViewCell.m renamed to CNLiveSettingModule/Classes/Privacy/CNLivePrivacyContactCell.m
1 // 1 //
2 -// CNLivePrivacyContactTableViewCell.m 2 +// CNLivePrivacyContactCell.m
3 // CNLiveSettingModule 3 // CNLiveSettingModule
4 // 4 //
5 // Created by CNLive-zxw on 2019/4/24. 5 // Created by CNLive-zxw on 2019/4/24.
6 // Copyright © 2019 cnlive. All rights reserved. 6 // Copyright © 2019 cnlive. All rights reserved.
7 // 7 //
8 8
9 -#import "CNLivePrivacyContactTableViewCell.h" 9 +#import "CNLivePrivacyContactCell.h"
10 #import <Masonry/Masonry.h> 10 #import <Masonry/Masonry.h>
11 #import "QMUIKit.h" 11 #import "QMUIKit.h"
12 #import "CNLiveCategory.h" 12 #import "CNLiveCategory.h"
13 13
14 -@interface CNLivePrivacyContactTableViewCell () 14 +@interface CNLivePrivacyContactCell ()
15 @property (nonatomic, strong) UIImageView *iconImage; 15 @property (nonatomic, strong) UIImageView *iconImage;
16 @property (nonatomic, strong) UILabel *nickLabel; 16 @property (nonatomic, strong) UILabel *nickLabel;
17 17
18 @end 18 @end
19 19
20 -@implementation CNLivePrivacyContactTableViewCell 20 +@implementation CNLivePrivacyContactCell
21 #pragma mark - Init 21 #pragma mark - Init
22 + (instancetype)cellWithTableView:(UITableView *)tableView { 22 + (instancetype)cellWithTableView:(UITableView *)tableView {
23 - static NSString *indentify = @"CNLivePrivacyContactTableViewCell";  
24 - CNLivePrivacyContactTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indentify]; 23 + static NSString *indentify = @"CNLivePrivacyContactCell";
  24 + CNLivePrivacyContactCell *cell = [tableView dequeueReusableCellWithIdentifier:indentify];
25 if (!cell) { 25 if (!cell) {
26 - cell = [[CNLivePrivacyContactTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indentify]; 26 + cell = [[CNLivePrivacyContactCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indentify];
27 } 27 }
28 return cell; 28 return cell;
29 29
@@ -194,7 +194,7 @@ @@ -194,7 +194,7 @@
194 194
195 - (UIImageView *)moreImage { 195 - (UIImageView *)moreImage {
196 if (!_moreImage) { 196 if (!_moreImage) {
197 - UIImage *xw_image = [self getImageWithImageName:@"mine_info_front" bundleName:@"CNLiveSettingModule" targetClass:[CNLivePrivacyContactTableViewCell class]]; 197 + UIImage *xw_image = [self getImageWithImageName:@"mine_info_front" bundleName:@"CNLiveSettingModule" targetClass:[CNLivePrivacyContactCell class]];
198 _moreImage = [[UIImageView alloc] initWithImage:xw_image]; 198 _moreImage = [[UIImageView alloc] initWithImage:xw_image];
199 } 199 }
200 return _moreImage; 200 return _moreImage;
CNLiveSettingModule/Classes/Privacy/CNLivePrivacyController.m
@@ -17,17 +17,20 @@ @@ -17,17 +17,20 @@
17 #import "CNUserInfoManager.h" 17 #import "CNUserInfoManager.h"
18 18
19 #import "CNLiveSettingNavigationBar.h" 19 #import "CNLiveSettingNavigationBar.h"
20 -#import "CNLivePrivacyTableViewCell.h" 20 +#import "CNLivePrivacyCell.h"
21 #import "CNLivePrivacyHeaderView.h" 21 #import "CNLivePrivacyHeaderView.h"
22 #import "CNLivePrivacyModel.h" 22 #import "CNLivePrivacyModel.h"
23 #import "CNLiveNotSeeController.h"//不让看/不看 23 #import "CNLiveNotSeeController.h"//不让看/不看
24 //#import "CNLiveBlackListController.h"//通讯录黑名单 24 //#import "CNLiveBlackListController.h"//通讯录黑名单
  25 +#import "CNLiveUserDefaultsModel.h"
  26 +#import "CNLivePrivacyRequest.h"
25 27
26 @interface CNLivePrivacyController ()<UITableViewDelegate,UITableViewDataSource,CNLiveSettingNavigationBarDelegate> 28 @interface CNLivePrivacyController ()<UITableViewDelegate,UITableViewDataSource,CNLiveSettingNavigationBarDelegate>
27 @property (nonatomic, strong) CNLiveSettingNavigationBar *navigationBar; 29 @property (nonatomic, strong) CNLiveSettingNavigationBar *navigationBar;
28 @property (nonatomic, strong) UITableView *tableView; 30 @property (nonatomic, strong) UITableView *tableView;
29 -@property (nonatomic, strong) NSMutableArray <CNLivePrivacyModel*>*data; 31 +
30 @property (nonatomic, strong) CNLivePrivacyModel *model; 32 @property (nonatomic, strong) CNLivePrivacyModel *model;
  33 +@property (nonatomic, strong) NSMutableArray <CNLivePrivacyModel*>*data;
31 34
32 @end 35 @end
33 36
@@ -70,26 +73,14 @@ @@ -70,26 +73,14 @@
70 73
71 //允许陌生人查看生活圈 74 //允许陌生人查看生活圈
72 - (void)getData { 75 - (void)getData {
73 - NSDictionary *params = @{@"appId":AppId,  
74 - @"sid":CNUserShareModel.uid};  
75 - [CNLiveNetworking setAllowRequestDefaultArgument:YES];  
76 - [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNIsAllowFindStrangerSwitchUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {  
77 - if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) {  
78 - if(responseObject[@"data"] && [responseObject[@"data"] isKindOfClass:[NSDictionary class]]){  
79 - NSMutableArray <CNLivePrivacyModel *>*arr = [CNLivePrivacyModel mj_objectArrayWithKeyValuesArray:responseObject[@"data"][@"findStrangerSwitch"]];  
80 - CNLivePrivacyModel *model = [arr firstObject];  
81 - [[NSUserDefaults standardUserDefaults] setValue:model.status forKey:@"findStrangerSwitch"];  
82 - for (CNLivePrivacyModel *model in self.data) {  
83 - if([model.title isEqualToString:@"允许陌生人查看生活圈"]){  
84 - model.status = model.status;  
85 - }  
86 - } 76 + [CNLivePrivacyRequest getAllowStrangersToSeeState:^(NSString * _Nonnull status) {
  77 + for (CNLivePrivacyModel *model in self.data) {
  78 + if([model.title isEqualToString:@"允许陌生人查看生活圈"]){
  79 + model.status = status;
87 } 80 }
88 } 81 }
89 [self.tableView reloadData]; 82 [self.tableView reloadData];
90 -  
91 }]; 83 }];
92 -  
93 } 84 }
94 85
95 - (void)viewWillAppear:(BOOL)animated { 86 - (void)viewWillAppear:(BOOL)animated {
@@ -97,31 +88,30 @@ @@ -97,31 +88,30 @@
97 [self.tableView reloadData]; 88 [self.tableView reloadData];
98 89
99 } 90 }
  91 +
100 - (void)viewDidLoad { 92 - (void)viewDidLoad {
101 [super viewDidLoad]; 93 [super viewDidLoad];
102 // Do any additional setup after loading the view. 94 // Do any additional setup after loading the view.
103 - self.title = @"隐私";  
104 self.view.backgroundColor = [UIColor whiteColor]; 95 self.view.backgroundColor = [UIColor whiteColor];
  96 + [self loadData:UserDefaultsModel.findStrangerSwitch];
105 [self getData]; 97 [self getData];
106 - NSString *status = [[NSUserDefaults standardUserDefaults] valueForKey:@"findStrangerSwitch"];  
107 - [self loadData:status?status:@"access"];  
108 [self createUI]; 98 [self createUI];
109 99
110 } 100 }
  101 +
111 //网络监听 102 //网络监听
112 - (void)cn_noNetworking { 103 - (void)cn_noNetworking {
113 [self.tableView reloadData]; 104 [self.tableView reloadData];
114 -  
115 } 105 }
116 106
117 - (void)cn_wifiOrWWANNetworking { 107 - (void)cn_wifiOrWWANNetworking {
118 [self.tableView reloadData]; 108 [self.tableView reloadData];
119 } 109 }
  110 +
120 #pragma mark - UI 111 #pragma mark - UI
121 - (void)createUI { 112 - (void)createUI {
122 [self.view addSubview:self.navigationBar]; 113 [self.view addSubview:self.navigationBar];
123 [self.view addSubview:self.tableView]; 114 [self.view addSubview:self.tableView];
124 -  
125 } 115 }
126 116
127 #pragma mark - UITableViewDataSource 117 #pragma mark - UITableViewDataSource
@@ -131,28 +121,27 @@ @@ -131,28 +121,27 @@
131 121
132 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 122 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
133 return section == 0?1:self.data.count; 123 return section == 0?1:self.data.count;
134 -  
135 } 124 }
136 125
137 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 126 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
138 - CNLivePrivacyTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNLivePrivacyTableViewCell forIndexPath:indexPath]; 127 + CNLivePrivacyCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNLivePrivacyCell forIndexPath:indexPath];
139 cell.model = indexPath.section == 0?self.model:self.data[indexPath.row]; 128 cell.model = indexPath.section == 0?self.model:self.data[indexPath.row];
140 cell.selectionStyle = UITableViewCellSelectionStyleNone; 129 cell.selectionStyle = UITableViewCellSelectionStyleNone;
141 return cell; 130 return cell;
142 -  
143 } 131 }
144 132
145 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 133 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
146 return self.data[indexPath.row].rowHeight; 134 return self.data[indexPath.row].rowHeight;
147 -  
148 } 135 }
  136 +
149 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ 137 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
150 return section == 0?10:30; 138 return section == 0?10:30;
151 } 139 }
  140 +
152 - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ 141 - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
153 return 0.000001f; 142 return 0.000001f;
154 -  
155 } 143 }
  144 +
156 - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ 145 - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
157 CNLivePrivacyHeaderView *view = [tableView dequeueReusableHeaderFooterViewWithIdentifier:kCNLivePrivacyHeaderView]; 146 CNLivePrivacyHeaderView *view = [tableView dequeueReusableHeaderFooterViewWithIdentifier:kCNLivePrivacyHeaderView];
158 view.text = section == 0?@"":@"生活圈和视频动态"; 147 view.text = section == 0?@"":@"生活圈和视频动态";
@@ -185,7 +174,6 @@ @@ -185,7 +174,6 @@
185 vc.name = model.title; 174 vc.name = model.title;
186 vc.type = CNTypeNoSeeHim; 175 vc.type = CNTypeNoSeeHim;
187 [self.navigationController pushViewController:vc animated:YES]; 176 [self.navigationController pushViewController:vc animated:YES];
188 -  
189 } 177 }
190 break; 178 break;
191 case 2: //允许陌生人查看生活圈 179 case 2: //允许陌生人查看生活圈
@@ -205,8 +193,6 @@ @@ -205,8 +193,6 @@
205 - (void)navigationBar:(CNLiveSettingNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{ 193 - (void)navigationBar:(CNLiveSettingNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{
206 if ([actionEvents isEqualToString:@"1"]) { 194 if ([actionEvents isEqualToString:@"1"]) {
207 [self goBack]; 195 [self goBack];
208 - }else if ([actionEvents isEqualToString:@"2"]){  
209 -  
210 } 196 }
211 } 197 }
212 198
@@ -240,11 +226,10 @@ @@ -240,11 +226,10 @@
240 _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 226 _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
241 _tableView.showsVerticalScrollIndicator = NO; 227 _tableView.showsVerticalScrollIndicator = NO;
242 _tableView.showsHorizontalScrollIndicator = NO; 228 _tableView.showsHorizontalScrollIndicator = NO;
243 - [_tableView registerClass:[CNLivePrivacyTableViewCell class] forCellReuseIdentifier:kCNLivePrivacyTableViewCell]; 229 + [_tableView registerClass:[CNLivePrivacyCell class] forCellReuseIdentifier:kCNLivePrivacyCell];
244 [_tableView registerClass:[CNLivePrivacyHeaderView class] forHeaderFooterViewReuseIdentifier:kCNLivePrivacyHeaderView]; 230 [_tableView registerClass:[CNLivePrivacyHeaderView class] forHeaderFooterViewReuseIdentifier:kCNLivePrivacyHeaderView];
245 } 231 }
246 return _tableView; 232 return _tableView;
247 -  
248 } 233 }
249 234
250 - (NSMutableArray *)data{ 235 - (NSMutableArray *)data{
CNLiveSettingModule/Classes/Privacy/CNLivePrivacyModel.h
@@ -10,7 +10,7 @@ @@ -10,7 +10,7 @@
10 10
11 NS_ASSUME_NONNULL_BEGIN 11 NS_ASSUME_NONNULL_BEGIN
12 typedef enum { 12 typedef enum {
13 - CNLivePrivacyCellTypeList = 0,//隐私列表 13 + CNLivePrivacyCellTypeDefault = 0,//隐私列表
14 CNLivePrivacyCellTypeSee = 1,//是否允许陌生人查看生活圈 14 CNLivePrivacyCellTypeSee = 1,//是否允许陌生人查看生活圈
15 15
16 } CNLivePrivacyCellType; 16 } CNLivePrivacyCellType;
CNLiveSettingModule/Classes/Privacy/CNLivePrivacyRequest.h 0 → 100644
  1 +//
  2 +// CNLivePrivacyRequest.h
  3 +// CNLiveSettingModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/4/23.
  6 +// Copyright © 2019 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +NS_ASSUME_NONNULL_BEGIN
  12 +
  13 +typedef void(^GetStatusBlock)(NSString *status);
  14 +typedef void(^ChangeStatusBlock)(BOOL isSuccess);
  15 +
  16 +@interface CNLivePrivacyRequest : NSObject
  17 +
  18 +// 获取是否允许默认人查看生活区状态
  19 ++ (void)getAllowStrangersToSeeState:(GetStatusBlock)block;
  20 +
  21 +// 改变是否允许默认人查看生活区状态
  22 ++ (void)changeAllowStrangersToSeeState:(NSString *)state block:(ChangeStatusBlock)block;
  23 +
  24 +@end
  25 +
  26 +NS_ASSUME_NONNULL_END
CNLiveSettingModule/Classes/Privacy/CNLivePrivacyRequest.m 0 → 100644
  1 +//
  2 +// CNLivePrivacyRequest.m
  3 +// CNLiveSettingModule
  4 +//
  5 +// Created by CNLive-zxw on 2019/4/23.
  6 +// Copyright © 2019 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLivePrivacyRequest.h"
  10 +
  11 +#import "MJExtension.h"
  12 +
  13 +#import "CNLiveNetworking.h"
  14 +#import "CNLiveEnvironment.h"
  15 +#import "CNUserInfoManager.h"
  16 +#import "CNLivePrivacyModel.h"
  17 +#import "CNLiveUserDefaultsModel.h"
  18 +
  19 +@implementation CNLivePrivacyRequest
  20 +
  21 +// 获取是否允许默认人查看生活区状态
  22 ++ (void)getAllowStrangersToSeeState:(GetStatusBlock)block{
  23 + NSDictionary *params = @{@"appId":AppId,
  24 + @"sid":CNUserShareModel.uid};
  25 + [CNLiveNetworking setAllowRequestDefaultArgument:YES];
  26 + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNIsAllowFindStrangerSwitchUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
  27 + if ([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"]) {
  28 + if(responseObject[@"data"] && [responseObject[@"data"] isKindOfClass:[NSDictionary class]]){
  29 + NSMutableArray <CNLivePrivacyModel *>*arr = [CNLivePrivacyModel mj_objectArrayWithKeyValuesArray:responseObject[@"data"][@"findStrangerSwitch"]];
  30 + CNLivePrivacyModel *model = [arr firstObject];
  31 + if(model.status&&(![model.status isEqualToString:@""])&&(![UserDefaultsModel.findStrangerSwitch isEqualToString:model.status])){
  32 + UserDefaultsModel.findStrangerSwitch = model.status;
  33 + block?block(model.status):@"";
  34 + }
  35 + }
  36 +
  37 + }
  38 +
  39 + }];
  40 +}
  41 +
  42 +// 改变是否允许默认人查看生活区状态
  43 ++ (void)changeAllowStrangersToSeeState:(NSString *)state block:(ChangeStatusBlock)block{
  44 + NSDictionary *params = @{@"appId":AppId,
  45 + @"type":state,
  46 + @"sid":CNUserShareModel.uid};
  47 + [CNLiveNetworking setAllowRequestDefaultArgument:YES];
  48 + [CNLiveNetworking requestNetworkWithMethod:CNLiveRequestMethodPOST URLString:CNSwitchAllowStrangerUrl Param:params CacheType:CNLiveNetworkCacheTypeNetworkOnly CompletionBlock:^(NSURLSessionTask *requestTask, id responseObject, NSError *error) {
  49 + block?block(([responseObject isKindOfClass:[NSDictionary class]] && [responseObject[@"errorCode"] isEqualToString:@"0"])):@"";
  50 + }];
  51 +}
  52 +
  53 +@end
CNLiveSettingModule/Classes/View/CNLiveSettingCell.m
@@ -13,6 +13,9 @@ @@ -13,6 +13,9 @@
13 13
14 #import "CNLiveSettingModel.h" 14 #import "CNLiveSettingModel.h"
15 15
  16 +// 本地化数据
  17 +#import "CNLiveUserDefaultsModel.h"
  18 +
16 @interface CNLiveSettingCell() 19 @interface CNLiveSettingCell()
17 @property (nonatomic, strong) UIView *line; 20 @property (nonatomic, strong) UIView *line;
18 @property (nonatomic, strong) UILabel *title; 21 @property (nonatomic, strong) UILabel *title;
@@ -113,6 +116,7 @@ static const NSInteger margin = 12; @@ -113,6 +116,7 @@ static const NSInteger margin = 12;
113 make.right.equalTo(self.line.mas_right).with.offset(-margin); 116 make.right.equalTo(self.line.mas_right).with.offset(-margin);
114 117
115 }]; 118 }];
  119 + [_switchOn setOn:UserDefaultsModel.goldCoinSound];
116 120
117 } 121 }
118 break; 122 break;
@@ -145,6 +149,7 @@ static const NSInteger margin = 12; @@ -145,6 +149,7 @@ static const NSInteger margin = 12;
145 149
146 #pragma mark - 响应方法 150 #pragma mark - 响应方法
147 - (void)switchChanged:(UISwitch *)sw{ 151 - (void)switchChanged:(UISwitch *)sw{
  152 + UserDefaultsModel.goldCoinSound = !UserDefaultsModel.goldCoinSound;
148 153
149 } 154 }
150 155
@@ -184,7 +189,6 @@ static const NSInteger margin = 12; @@ -184,7 +189,6 @@ static const NSInteger margin = 12;
184 UIImage *xw_image = [self getImageWithImageName:@"mine_info_front" bundleName:@"CNLiveSettingModule" targetClass:[CNLiveSettingCell class]]; 189 UIImage *xw_image = [self getImageWithImageName:@"mine_info_front" bundleName:@"CNLiveSettingModule" targetClass:[CNLiveSettingCell class]];
185 _front.image = xw_image; 190 _front.image = xw_image;
186 _front.contentMode = UIViewContentModeCenter; 191 _front.contentMode = UIViewContentModeCenter;
187 -  
188 } 192 }
189 return _front; 193 return _front;
190 } 194 }
Example/CNLiveSettingModule.xcodeproj/project.pbxproj
@@ -207,8 +207,8 @@ @@ -207,8 +207,8 @@
207 6003F586195388D20070C39A /* Sources */, 207 6003F586195388D20070C39A /* Sources */,
208 6003F587195388D20070C39A /* Frameworks */, 208 6003F587195388D20070C39A /* Frameworks */,
209 6003F588195388D20070C39A /* Resources */, 209 6003F588195388D20070C39A /* Resources */,
210 - 6A7F75A7B7E637A2752F7EE5 /* [CP] Embed Pods Frameworks */,  
211 - 17743842CB67A72F2519D76B /* [CP] Copy Pods Resources */, 210 + C2DFB5708D727D1EC7140381 /* [CP] Embed Pods Frameworks */,
  211 + D4B4D009160ADF9CDF29107C /* [CP] Copy Pods Resources */,
212 ); 212 );
213 buildRules = ( 213 buildRules = (
214 ); 214 );
@@ -299,25 +299,29 @@ @@ -299,25 +299,29 @@
299 /* End PBXResourcesBuildPhase section */ 299 /* End PBXResourcesBuildPhase section */
300 300
301 /* Begin PBXShellScriptBuildPhase section */ 301 /* Begin PBXShellScriptBuildPhase section */
302 - 17743842CB67A72F2519D76B /* [CP] Copy Pods Resources */ = { 302 + 653FED99FAD33AD7306D3799 /* [CP] Check Pods Manifest.lock */ = {
303 isa = PBXShellScriptBuildPhase; 303 isa = PBXShellScriptBuildPhase;
304 buildActionMask = 2147483647; 304 buildActionMask = 2147483647;
305 files = ( 305 files = (
306 ); 306 );
  307 + inputFileListPaths = (
  308 + );
307 inputPaths = ( 309 inputPaths = (
308 - "${PODS_ROOT}/Target Support Files/Pods-CNLiveSettingModule_Example/Pods-CNLiveSettingModule_Example-resources.sh",  
309 - "${PODS_CONFIGURATION_BUILD_DIR}/CNLiveSettingModule/CNLiveSettingModule.bundle", 310 + "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
  311 + "${PODS_ROOT}/Manifest.lock",
  312 + );
  313 + name = "[CP] Check Pods Manifest.lock";
  314 + outputFileListPaths = (
310 ); 315 );
311 - name = "[CP] Copy Pods Resources";  
312 outputPaths = ( 316 outputPaths = (
313 - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CNLiveSettingModule.bundle", 317 + "$(DERIVED_FILE_DIR)/Pods-CNLiveSettingModule_Tests-checkManifestLockResult.txt",
314 ); 318 );
315 runOnlyForDeploymentPostprocessing = 0; 319 runOnlyForDeploymentPostprocessing = 0;
316 shellPath = /bin/sh; 320 shellPath = /bin/sh;
317 - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveSettingModule_Example/Pods-CNLiveSettingModule_Example-resources.sh\"\n"; 321 + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
318 showEnvVarsInLog = 0; 322 showEnvVarsInLog = 0;
319 }; 323 };
320 - 653FED99FAD33AD7306D3799 /* [CP] Check Pods Manifest.lock */ = { 324 + B63C2143E7B1CC8A1F17474A /* [CP] Check Pods Manifest.lock */ = {
321 isa = PBXShellScriptBuildPhase; 325 isa = PBXShellScriptBuildPhase;
322 buildActionMask = 2147483647; 326 buildActionMask = 2147483647;
323 files = ( 327 files = (
@@ -332,14 +336,14 @@ @@ -332,14 +336,14 @@
332 outputFileListPaths = ( 336 outputFileListPaths = (
333 ); 337 );
334 outputPaths = ( 338 outputPaths = (
335 - "$(DERIVED_FILE_DIR)/Pods-CNLiveSettingModule_Tests-checkManifestLockResult.txt", 339 + "$(DERIVED_FILE_DIR)/Pods-CNLiveSettingModule_Example-checkManifestLockResult.txt",
336 ); 340 );
337 runOnlyForDeploymentPostprocessing = 0; 341 runOnlyForDeploymentPostprocessing = 0;
338 shellPath = /bin/sh; 342 shellPath = /bin/sh;
339 shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 343 shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
340 showEnvVarsInLog = 0; 344 showEnvVarsInLog = 0;
341 }; 345 };
342 - 6A7F75A7B7E637A2752F7EE5 /* [CP] Embed Pods Frameworks */ = { 346 + C2DFB5708D727D1EC7140381 /* [CP] Embed Pods Frameworks */ = {
343 isa = PBXShellScriptBuildPhase; 347 isa = PBXShellScriptBuildPhase;
344 buildActionMask = 2147483647; 348 buildActionMask = 2147483647;
345 files = ( 349 files = (
@@ -407,26 +411,22 @@ @@ -407,26 +411,22 @@
407 shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveSettingModule_Example/Pods-CNLiveSettingModule_Example-frameworks.sh\"\n"; 411 shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveSettingModule_Example/Pods-CNLiveSettingModule_Example-frameworks.sh\"\n";
408 showEnvVarsInLog = 0; 412 showEnvVarsInLog = 0;
409 }; 413 };
410 - B63C2143E7B1CC8A1F17474A /* [CP] Check Pods Manifest.lock */ = { 414 + D4B4D009160ADF9CDF29107C /* [CP] Copy Pods Resources */ = {
411 isa = PBXShellScriptBuildPhase; 415 isa = PBXShellScriptBuildPhase;
412 buildActionMask = 2147483647; 416 buildActionMask = 2147483647;
413 files = ( 417 files = (
414 ); 418 );
415 - inputFileListPaths = (  
416 - );  
417 inputPaths = ( 419 inputPaths = (
418 - "${PODS_PODFILE_DIR_PATH}/Podfile.lock",  
419 - "${PODS_ROOT}/Manifest.lock",  
420 - );  
421 - name = "[CP] Check Pods Manifest.lock";  
422 - outputFileListPaths = ( 420 + "${PODS_ROOT}/Target Support Files/Pods-CNLiveSettingModule_Example/Pods-CNLiveSettingModule_Example-resources.sh",
  421 + "${PODS_CONFIGURATION_BUILD_DIR}/CNLiveSettingModule/CNLiveSettingModule.bundle",
423 ); 422 );
  423 + name = "[CP] Copy Pods Resources";
424 outputPaths = ( 424 outputPaths = (
425 - "$(DERIVED_FILE_DIR)/Pods-CNLiveSettingModule_Example-checkManifestLockResult.txt", 425 + "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/CNLiveSettingModule.bundle",
426 ); 426 );
427 runOnlyForDeploymentPostprocessing = 0; 427 runOnlyForDeploymentPostprocessing = 0;
428 shellPath = /bin/sh; 428 shellPath = /bin/sh;
429 - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 429 + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-CNLiveSettingModule_Example/Pods-CNLiveSettingModule_Example-resources.sh\"\n";
430 showEnvVarsInLog = 0; 430 showEnvVarsInLog = 0;
431 }; 431 };
432 /* End PBXShellScriptBuildPhase section */ 432 /* End PBXShellScriptBuildPhase section */
Example/CNLiveSettingModule/CNLIVEAppDelegate.m
@@ -10,13 +10,32 @@ @@ -10,13 +10,32 @@
10 #import "CNLiveSettingController.h" 10 #import "CNLiveSettingController.h"
11 #import "CNLiveEnvironment.h" 11 #import "CNLiveEnvironment.h"
12 #import "CNUserInfoManager.h" 12 #import "CNUserInfoManager.h"
  13 +#import <CNLiveRequestBastKit/CNLiveNetworking.h>
13 14
14 @implementation CNLIVEAppDelegate 15 @implementation CNLIVEAppDelegate
  16 +- (void)networkParamAction{
  17 + NSMutableDictionary * mDict = [[NSMutableDictionary alloc] init];
  18 + [mDict setValue:@"10514405" forKey:@"loginSid"];
15 19
  20 + [mDict setValue:BundleId forKey:@"platform_id"];
  21 +
  22 + [mDict setValue:[[[[UIDevice currentDevice] identifierForVendor] UUIDString] stringByReplacingOccurrencesOfString:@"-" withString:@""] forKey:@"uuid"];
  23 + [mDict setValue:@"i" forKey:@"plat"];
  24 + [mDict setValue:@"1.7.8.19.10.30.15"forKey:@"ver"];
  25 + [mDict setObject:AppId forKey:@"appId"];
  26 + [CNLiveNetworking setupDefaultParam:mDict];
  27 + [CNLiveNetworking setupShowResult:NO];
  28 + [CNLiveNetworking setupSignKey:APPKey];
  29 + [CNLiveNetworking setAllowRequestDefaultArgument:YES];
  30 + [CNLiveNetworking setResponseSerializerType:CNLiveResponseSerializerJSON];
  31 +
  32 +}
16 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 33 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
17 { 34 {
18 // Override point for customization after application launch. 35 // Override point for customization after application launch.
19 [CNLiveEnvironmentManager setEnvironment:CNLiveProductionAppStore]; 36 [CNLiveEnvironmentManager setEnvironment:CNLiveProductionAppStore];
  37 + [self networkParamAction];
  38 +
20 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];//UIScreen mainScreen].bounds个人理解获取屏幕的硬件信息然后设置尺寸大小 39 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];//UIScreen mainScreen].bounds个人理解获取屏幕的硬件信息然后设置尺寸大小
21 CNLiveSettingController *vc = [[CNLiveSettingController alloc] init]; 40 CNLiveSettingController *vc = [[CNLiveSettingController alloc] init];
22 UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc]; 41 UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];