Commit 5f0bbc5736159f1e92a173ee8659b9ba4352b207
1 parent
f436348e
no message
Showing
8 changed files
with
381 additions
and
2 deletions
CNLiveSettingModule.podspec
| ... | ... | @@ -42,6 +42,7 @@ TODO: 网家家-设置模块. |
| 42 | 42 | ss.dependency 'CNLiveSettingModule/View' |
| 43 | 43 | ss.dependency 'CNLiveSettingModule/Model' |
| 44 | 44 | ss.dependency 'CNLiveSettingModule/Privacy' |
| 45 | + ss.dependency 'CNLiveSettingModule/AboutUs' | |
| 45 | 46 | ss.dependency 'CNLiveSettingModule/Cancellation' |
| 46 | 47 | |
| 47 | 48 | end |
| ... | ... | @@ -63,6 +64,13 @@ TODO: 网家家-设置模块. |
| 63 | 64 | ss.dependency 'CNLiveSettingModule/View' |
| 64 | 65 | |
| 65 | 66 | end |
| 67 | + # 关于网家家 | |
| 68 | + s.subspec 'AboutUs' do |ss| | |
| 69 | + ss.source_files = 'CNLiveSettingModule/Classes/AboutUs/*.{h,m}' | |
| 70 | + ss.dependency 'CNLiveSettingModule/View' | |
| 71 | + ss.dependency 'CNLiveSettingModule/Model' | |
| 72 | + | |
| 73 | + end | |
| 66 | 74 | |
| 67 | 75 | # 注销 |
| 68 | 76 | s.subspec 'Cancellation' do |ss| | ... | ... |
CNLiveSettingModule/Assets/CNLiveSettingModule.xcassets/about_us_icon.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "idiom" : "universal", | |
| 9 | + "filename" : "about_us_icon@2x.png", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "filename" : "about_us_icon@3x.png", | |
| 15 | + "scale" : "3x" | |
| 16 | + } | |
| 17 | + ], | |
| 18 | + "info" : { | |
| 19 | + "version" : 1, | |
| 20 | + "author" : "xcode" | |
| 21 | + } | |
| 22 | +} | |
| 0 | 23 | \ No newline at end of file | ... | ... |
CNLiveSettingModule/Assets/CNLiveSettingModule.xcassets/about_us_icon.imageset/about_us_icon@2x.png
0 → 100644
30.7 KB
CNLiveSettingModule/Assets/CNLiveSettingModule.xcassets/about_us_icon.imageset/about_us_icon@3x.png
0 → 100644
64.2 KB
CNLiveSettingModule/Classes/AboutUs/CNLiveAboutUsController.h
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveAboutUsController.h | |
| 3 | +// CNLiveSettingModule | |
| 4 | +// | |
| 5 | +// Created by 153993236@qq.com on 11/12/2019. | |
| 6 | +// Copyright (c) 2019 153993236@qq.com. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 关于我们 | |
| 11 | + */ | |
| 12 | + | |
| 13 | +#import <UIKit/UIKit.h> | |
| 14 | + | |
| 15 | +NS_ASSUME_NONNULL_BEGIN | |
| 16 | + | |
| 17 | +@interface CNLiveAboutUsController : UIViewController | |
| 18 | + | |
| 19 | +@end | |
| 20 | + | |
| 21 | +NS_ASSUME_NONNULL_END | ... | ... |
CNLiveSettingModule/Classes/AboutUs/CNLiveAboutUsController.m
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveAboutUsController.m | |
| 3 | +// CNLiveSettingModule | |
| 4 | +// | |
| 5 | +// Created by 153993236@qq.com on 11/12/2019. | |
| 6 | +// Copyright (c) 2019 153993236@qq.com. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "CNLiveAboutUsController.h" | |
| 10 | +#import "MJExtension.h" | |
| 11 | +#import "QMUIKit.h" | |
| 12 | + | |
| 13 | +#import "CNLiveServices.h" | |
| 14 | +#import "CNLiveUserAgreementManager.h" | |
| 15 | + | |
| 16 | +#import "CNLiveSettingModel.h" | |
| 17 | +#import "CNLiveSettingCell.h" | |
| 18 | +#import "CNLiveSettingNavigationBar.h" | |
| 19 | + | |
| 20 | +@interface CNLiveAboutUsController () | |
| 21 | +<UITableViewDelegate, UITableViewDataSource, CNLiveSettingNavigationBarDelegate> | |
| 22 | +@property (nonatomic, strong) CNLiveSettingNavigationBar *navigationBar; | |
| 23 | +@property (nonatomic, strong) UITableView *tableView; | |
| 24 | +@property (nonatomic, strong) UIView *headerView; | |
| 25 | +@property (nonatomic, strong) UIView *footerView; | |
| 26 | +@property (nonatomic, strong) NSMutableArray *data; | |
| 27 | + | |
| 28 | +@end | |
| 29 | + | |
| 30 | +@implementation CNLiveAboutUsController | |
| 31 | +static const NSInteger timeValue = 1.5; | |
| 32 | + | |
| 33 | +#pragma mark - 加载数据 | |
| 34 | +- (void)loadData { | |
| 35 | + NSArray *data = @[ | |
| 36 | + @{ | |
| 37 | + @"style":@"1", | |
| 38 | + @"title":@"给软件评分", | |
| 39 | + @"height":@"51", | |
| 40 | + @"lineHeight":@"1" | |
| 41 | + }, | |
| 42 | + @{ | |
| 43 | + @"style":@"1", | |
| 44 | + @"title":@"应用简介", | |
| 45 | + @"height":@"60", | |
| 46 | + @"lineHeight":@"10" | |
| 47 | + }, | |
| 48 | + @{ | |
| 49 | + @"style":@"1", | |
| 50 | + @"title":@"隐私政策协议", | |
| 51 | + @"height":@"51", | |
| 52 | + @"lineHeight":@"1" | |
| 53 | + }, | |
| 54 | + @{ | |
| 55 | + @"style":@"1", | |
| 56 | + @"title":@"软件许可及服务协议", | |
| 57 | + @"height":@"51", | |
| 58 | + @"lineHeight":@"1" | |
| 59 | + }, | |
| 60 | + @{ | |
| 61 | + @"style":@"1", | |
| 62 | + @"title":@"版权信息", | |
| 63 | + @"height":@"51", | |
| 64 | + @"lineHeight":@"1" | |
| 65 | + }, | |
| 66 | + @{ | |
| 67 | + @"style":@"1", | |
| 68 | + @"title":@"资质信息", | |
| 69 | + @"height":@"51", | |
| 70 | + @"lineHeight":@"1" | |
| 71 | + }, | |
| 72 | + @{ | |
| 73 | + @"style":@"2", | |
| 74 | + @"title":@"当前版本", | |
| 75 | + @"content":@"0.0.1", | |
| 76 | + @"height":@"51", | |
| 77 | + @"lineHeight":@"1" | |
| 78 | + }, | |
| 79 | + @{ | |
| 80 | + @"style":@"1", | |
| 81 | + @"title":@"联系我们", | |
| 82 | + @"height":@"51", | |
| 83 | + @"lineHeight":@"1" | |
| 84 | + }, | |
| 85 | + @{ | |
| 86 | + @"style":@"1", | |
| 87 | + @"title":@"投诉", | |
| 88 | + @"height":@"51", | |
| 89 | + @"lineHeight":@"1" | |
| 90 | + } | |
| 91 | + | |
| 92 | + ]; | |
| 93 | + for(NSDictionary *dic in data){ | |
| 94 | + [self.data addObject:[CNLiveSettingModel mj_objectWithKeyValues:dic]]; | |
| 95 | + } | |
| 96 | + [self.tableView reloadData]; | |
| 97 | + | |
| 98 | +} | |
| 99 | + | |
| 100 | +#pragma mark - 生命周期 | |
| 101 | +- (void)viewWillAppear:(BOOL)animated{ | |
| 102 | + [super viewWillAppear:animated]; | |
| 103 | + self.navigationController.navigationBarHidden = YES; | |
| 104 | +} | |
| 105 | + | |
| 106 | +- (void)viewDidLoad { | |
| 107 | + [super viewDidLoad]; | |
| 108 | + self.view.backgroundColor = [UIColor whiteColor]; | |
| 109 | + if (@available(iOS 11, *)) { | |
| 110 | + self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; | |
| 111 | + } | |
| 112 | + else { | |
| 113 | + self.automaticallyAdjustsScrollViewInsets = NO; | |
| 114 | + } | |
| 115 | + | |
| 116 | + [self createSubViews]; | |
| 117 | + [self loadData]; | |
| 118 | + | |
| 119 | +} | |
| 120 | + | |
| 121 | +- (void)dealloc { | |
| 122 | + | |
| 123 | + | |
| 124 | +} | |
| 125 | + | |
| 126 | +- (void)createSubViews { | |
| 127 | + [self.view addSubview:self.navigationBar]; | |
| 128 | + [self.view addSubview:self.tableView]; | |
| 129 | + | |
| 130 | +} | |
| 131 | +#pragma mark - UITableViewDelegate | |
| 132 | +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ | |
| 133 | + CNLiveSettingModel *model = self.data[indexPath.row]; | |
| 134 | + return model.height; | |
| 135 | +} | |
| 136 | + | |
| 137 | +#pragma mark - UITableViewDataSource | |
| 138 | +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |
| 139 | + return self.data.count; | |
| 140 | +} | |
| 141 | + | |
| 142 | +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
| 143 | + CNLiveSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:kCNLiveSettingCell]; | |
| 144 | + cell.selectionStyle = UITableViewCellSelectionStyleNone; | |
| 145 | + CNLiveSettingModel *model = self.data[indexPath.row]; | |
| 146 | + cell.model = model; | |
| 147 | + return cell; | |
| 148 | +} | |
| 149 | + | |
| 150 | +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ | |
| 151 | + if(indexPath.row == 0){ // 给软件评分 | |
| 152 | + NSString *app = [NSString stringWithFormat:@"https://itunes.apple.com/app/apple-store/id%@?ct=web&mt=8",@"1337575478"]; | |
| 153 | + if (@available(iOS 10.0, *)) { | |
| 154 | + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:app] options:@{} completionHandler:nil]; | |
| 155 | + } else { | |
| 156 | + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:app]]; | |
| 157 | + } | |
| 158 | + | |
| 159 | + } | |
| 160 | + else if(indexPath.row == 1){ // 应用简介 | |
| 161 | + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementIntroduction]; | |
| 162 | + | |
| 163 | + } | |
| 164 | + else if(indexPath.row == 2){ // 隐私政策协议 | |
| 165 | + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementPrivacy]; | |
| 166 | + | |
| 167 | + } | |
| 168 | + else if(indexPath.row == 3){ // 软件许可及服务协议 | |
| 169 | + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementPermission]; | |
| 170 | + } | |
| 171 | + else if(indexPath.row == 4){ // 版权信息 | |
| 172 | + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementCopyright]; | |
| 173 | + | |
| 174 | + } | |
| 175 | + else if(indexPath.row == 5){ // 资质信息 | |
| 176 | + [CNLiveUserAgreementManager jumpToAgreementH5WithType:CNLiveUserAgreementEnterpriseQualification]; | |
| 177 | + } | |
| 178 | + else if(indexPath.row == 6){ // 当前版本 | |
| 179 | + | |
| 180 | + } | |
| 181 | + else if(indexPath.row == 7){ // 联系我们 | |
| 182 | + QMUIAlertAction *sure = [QMUIAlertAction actionWithTitle:@"确定" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) { | |
| 183 | + NSMutableString *tel = [[NSMutableString alloc] initWithFormat:@"telprompt://%@",@"010-88824192"]; | |
| 184 | + if (@available(iOS 10.0, *)) { | |
| 185 | + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:tel] options:@{} completionHandler:nil]; | |
| 186 | + } else { | |
| 187 | + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:tel]]; | |
| 188 | + } | |
| 189 | + | |
| 190 | + }]; | |
| 191 | + QMUIAlertAction *cancel = [QMUIAlertAction actionWithTitle:@"取消" style:QMUIAlertActionStyleCancel handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) { | |
| 192 | + }]; | |
| 193 | + | |
| 194 | + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"联系我们" message:@"您确定要拨打010-88824192吗?" preferredStyle:QMUIAlertControllerStyleAlert]; | |
| 195 | + [alertController addAction:sure]; | |
| 196 | + [alertController addAction:cancel]; | |
| 197 | + | |
| 198 | + NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes]; | |
| 199 | + | |
| 200 | + titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0]; | |
| 201 | + | |
| 202 | + NSMutableDictionary *cancelAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes]; | |
| 203 | + cancelAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0]; | |
| 204 | + | |
| 205 | + sure.buttonAttributes = titleAttributs; | |
| 206 | + cancel.buttonAttributes = cancelAttributs; | |
| 207 | + | |
| 208 | + [alertController showWithAnimated:YES]; | |
| 209 | + | |
| 210 | + }else if (indexPath.row == 8){ // 投诉 | |
| 211 | + | |
| 212 | + | |
| 213 | + } | |
| 214 | + | |
| 215 | +} | |
| 216 | + | |
| 217 | +#pragma mark - 懒加载 | |
| 218 | +- (NSMutableArray *)data { | |
| 219 | + if (!_data) { | |
| 220 | + _data = [NSMutableArray array]; | |
| 221 | + } | |
| 222 | + return _data; | |
| 223 | +} | |
| 224 | +#pragma mark - 懒加载 | |
| 225 | +- (CNLiveSettingNavigationBar *)navigationBar { | |
| 226 | + if (!_navigationBar) { | |
| 227 | + _navigationBar = [[CNLiveSettingNavigationBar alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, NavigationContentTop)]; | |
| 228 | + _navigationBar.backgroundColor = [UIColor whiteColor]; | |
| 229 | + _navigationBar.delegate = self; | |
| 230 | + _navigationBar.title.text = @"关于网家家"; | |
| 231 | + _navigationBar.right = nil; | |
| 232 | + } | |
| 233 | + return _navigationBar; | |
| 234 | +} | |
| 235 | + | |
| 236 | +- (UITableView *)tableView{ | |
| 237 | + if(!_tableView){ | |
| 238 | + _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, NavigationContentTop, SCREEN_WIDTH, SCREEN_HEIGHT-NavigationContentTop) style:UITableViewStylePlain]; | |
| 239 | + _tableView.delegate = self; | |
| 240 | + _tableView.dataSource = self; | |
| 241 | + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; | |
| 242 | + _tableView.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0]; | |
| 243 | + _tableView.estimatedRowHeight = 0; | |
| 244 | + _tableView.estimatedSectionHeaderHeight = 0; | |
| 245 | + _tableView.estimatedSectionFooterHeight = 0; | |
| 246 | + [_tableView registerClass:[CNLiveSettingCell class] forCellReuseIdentifier:kCNLiveSettingCell]; | |
| 247 | + _tableView.tableHeaderView = self.headerView; | |
| 248 | + _tableView.tableFooterView = self.footerView; | |
| 249 | + | |
| 250 | + } | |
| 251 | + return _tableView; | |
| 252 | +} | |
| 253 | + | |
| 254 | +- (UIView *)headerView { | |
| 255 | + if (!_headerView) { | |
| 256 | + _headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 156)]; | |
| 257 | + _headerView.clipsToBounds = YES; | |
| 258 | + _headerView.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0]; | |
| 259 | + UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-75)/2.0, 30, 75, 150)]; | |
| 260 | + UIImage *image = [self xw_getImageName:@"about_us_icon" bundleName:@"CNLiveSettingModule" targetClass:[CNLiveSettingNavigationBar class]]; | |
| 261 | + imageView.image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; | |
| 262 | + imageView.contentMode = UIViewContentModeScaleAspectFill; | |
| 263 | + imageView.clipsToBounds = YES; | |
| 264 | + [_headerView addSubview:imageView]; | |
| 265 | + | |
| 266 | + } | |
| 267 | + return _headerView; | |
| 268 | +} | |
| 269 | + | |
| 270 | +- (UIView *)footerView { | |
| 271 | + if (!_footerView) { | |
| 272 | + _footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 100)]; | |
| 273 | + _footerView.backgroundColor = [UIColor colorWithRed:242/255.0 green:242/255.0 blue:242/255.0 alpha:1.0]; | |
| 274 | + UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(0, 25, SCREEN_WIDTH, 25)]; | |
| 275 | + title.textColor = [UIColor colorWithRed:40/255.0 green:40/255.0 blue:40/255.0 alpha:1.0]; | |
| 276 | + title.font = [UIFont systemFontOfSize:12.0f]; | |
| 277 | + title.text = @"版权信息"; | |
| 278 | + title.textAlignment = NSTextAlignmentCenter; | |
| 279 | + [_footerView addSubview:title]; | |
| 280 | + UILabel *subTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, 50, SCREEN_WIDTH, 25)]; | |
| 281 | + subTitle.textColor = [UIColor colorWithRed:40/255.0 green:40/255.0 blue:40/255.0 alpha:1.0]; | |
| 282 | + subTitle.font = [UIFont systemFontOfSize:12.0f]; | |
| 283 | + subTitle.text = @"北京中投视讯文化传媒股份有限公司版权所有"; | |
| 284 | + subTitle.textAlignment = NSTextAlignmentCenter; | |
| 285 | + [_footerView addSubview:subTitle]; | |
| 286 | + } | |
| 287 | + return _footerView; | |
| 288 | +} | |
| 289 | + | |
| 290 | +#pragma mark - 响应方法 | |
| 291 | +- (void)goBack { | |
| 292 | + if (self.presentingViewController != nil) { | |
| 293 | + [self dismissViewControllerAnimated:YES completion:nil]; | |
| 294 | + } | |
| 295 | + else { | |
| 296 | + [self.navigationController popViewControllerAnimated:YES]; | |
| 297 | + } | |
| 298 | +} | |
| 299 | + | |
| 300 | +#pragma mark - 私有方法 | |
| 301 | +/** | |
| 302 | + * 创建图片 | |
| 303 | + * | |
| 304 | + * @param imageName 图片名字 | |
| 305 | + * @param bundleName 图片所在的bundle名字 | |
| 306 | + * @param targetClass 类和bundle的同级目录 | |
| 307 | + * @return 返回UIImage | |
| 308 | + */ | |
| 309 | +- (UIImage *)xw_getImageName:(NSString *)imageName bundleName:(NSString *)bundleName targetClass:(Class)targetClass{ | |
| 310 | + NSBundle *bundle = [NSBundle bundleForClass:targetClass]; | |
| 311 | + NSURL *url = [bundle URLForResource:bundleName withExtension:@"bundle"]; | |
| 312 | + NSBundle *targetBundle = [NSBundle bundleWithURL:url]; | |
| 313 | + UIImage *image = [UIImage imageNamed:imageName inBundle:targetBundle compatibleWithTraitCollection:nil]; | |
| 314 | + return image?image:[UIImage imageNamed:imageName inBundle:[NSBundle mainBundle] compatibleWithTraitCollection:nil]; | |
| 315 | + | |
| 316 | +} | |
| 317 | + | |
| 318 | +#pragma mark - CNLiveSettingNavigationBarDelegate | |
| 319 | +- (void)navigationBar:(CNLiveSettingNavigationBar *)navigationBar actionEvents:(NSString *)actionEvents{ | |
| 320 | + if ([actionEvents isEqualToString:@"1"]) { | |
| 321 | + [self goBack]; | |
| 322 | + }else if ([actionEvents isEqualToString:@"2"]){ | |
| 323 | + | |
| 324 | + } | |
| 325 | +} | |
| 326 | + | |
| 327 | +@end | ... | ... |
CNLiveSettingModule/Classes/Controller/CNLiveSettingController.h
CNLiveSettingModule/Classes/Controller/CNLiveSettingController.m
| ... | ... | @@ -20,6 +20,7 @@ |
| 20 | 20 | |
| 21 | 21 | #import "CNLivePrivacyController.h"//隐私 |
| 22 | 22 | #import "CNLiveCancellationController.h"//注销 |
| 23 | +#import "CNLiveAboutUsController.h"//关于我们 | |
| 23 | 24 | |
| 24 | 25 | @interface CNLiveSettingController () |
| 25 | 26 | <UITableViewDelegate, UITableViewDataSource, CNLiveSettingNavigationBarDelegate> |
| ... | ... | @@ -236,7 +237,7 @@ static const NSInteger timeValue = 1.5; |
| 236 | 237 | [alertController showWithAnimated:YES]; |
| 237 | 238 | |
| 238 | 239 | }else if (indexPath.row == 8){ |
| 239 | - CNLivePrivacyController *vc = [[CNLivePrivacyController alloc]init]; | |
| 240 | + CNLiveAboutUsController *vc = [[CNLiveAboutUsController alloc]init]; | |
| 240 | 241 | [self.navigationController pushViewController:vc animated:YES]; |
| 241 | 242 | } |
| 242 | 243 | else if (indexPath.row == 9) { | ... | ... |