chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// TLAboutViewController.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/2/22.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface TLAboutViewController : ZZFlexibleLayoutViewController
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// TLAboutViewController.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/2/22.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLAboutViewController.h"
|
||||
#import "TLWebViewController.h"
|
||||
#import "TLAppConfig.h"
|
||||
#import "TLSettingItem.h"
|
||||
|
||||
typedef NS_ENUM(NSInteger, TLAboutVCSectionType) {
|
||||
TLAboutVCSectionTypeItems,
|
||||
};
|
||||
|
||||
@interface TLAboutViewController ()
|
||||
|
||||
@property (nonatomic, strong) UILabel *cmpLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TLAboutViewController
|
||||
|
||||
- (void)loadView
|
||||
{
|
||||
[super loadView];
|
||||
[self.navigationItem setTitle:LOCSTR(@"关于微信")];
|
||||
[self.collectionView setBackgroundColor:[UIColor colorGrayBG]];
|
||||
|
||||
self.addSection(TLAboutVCSectionTypeItems);
|
||||
|
||||
[self loadAboutUI];
|
||||
}
|
||||
|
||||
- (void)viewWillLayoutSubviews
|
||||
{
|
||||
[super viewWillLayoutSubviews];
|
||||
|
||||
self.setFooter(@"TLAboutFooterView").toSection(TLAboutVCSectionTypeItems).withDataModel(@([self p_footerHeight]));
|
||||
}
|
||||
|
||||
#pragma mark - # UI
|
||||
- (void)loadAboutUI
|
||||
{
|
||||
@weakify(self);
|
||||
{
|
||||
NSInteger sectionTag = TLAboutVCSectionTypeItems;
|
||||
|
||||
// header
|
||||
NSString *versionInfo = [NSString stringWithFormat:@"TLChat %@", [TLAppConfig sharedConfig].version];
|
||||
self.setHeader(@"TLAboutHeaderView").toSection(sectionTag).withDataModel(versionInfo);
|
||||
|
||||
// 评分
|
||||
self.addCell(CELL_ST_ITEM_NORMAL).toSection(sectionTag).withDataModel(TLCreateSettingItem(@"去评分")).selectedAction(^ (id data) {
|
||||
@strongify(self);
|
||||
TLWebViewController *webVC = [[TLWebViewController alloc] initWithUrl:@"https://github.com/tbl00c/TLChat"];
|
||||
PushVC(webVC);
|
||||
});
|
||||
|
||||
// 欢迎页
|
||||
self.addCell(CELL_ST_ITEM_NORMAL).toSection(sectionTag).withDataModel(TLCreateSettingItem(@"欢迎页"));
|
||||
|
||||
// 功能介绍
|
||||
self.addCell(CELL_ST_ITEM_NORMAL).toSection(sectionTag).withDataModel(TLCreateSettingItem(@"功能介绍")).selectedAction(^ (id data) {
|
||||
@strongify(self);
|
||||
TLWebViewController *webVC = [[TLWebViewController alloc] initWithUrl:@"https://github.com/tbl00c/TLChat/blob/master/README.md"];
|
||||
PushVC(webVC);
|
||||
});
|
||||
|
||||
// footer
|
||||
self.setFooter(@"TLAboutFooterView").toSection(sectionTag).withDataModel(@([self p_footerHeight]));
|
||||
}
|
||||
|
||||
[self reloadView];
|
||||
}
|
||||
|
||||
#pragma mark - # Private
|
||||
- (CGFloat)p_footerHeight
|
||||
{
|
||||
CGFloat statusHeight = [UIApplication sharedApplication].statusBarFrame.size.height;
|
||||
CGFloat navHeight = self.navigationController.navigationBar.height;
|
||||
CGFloat headerHeight = 120.0f;
|
||||
CGFloat cellsHeight = self.sectionForTag(TLAboutVCSectionTypeItems).dataModelArray.count * 44.0f;
|
||||
CGFloat footerHeight = SCREEN_HEIGHT - statusHeight - navHeight - headerHeight - cellsHeight;
|
||||
return footerHeight;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// TLAboutFooterView.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/3/5.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface TLAboutFooterView : UICollectionReusableView <ZZFlexibleLayoutViewProtocol>
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// TLAboutFooterView.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 2018/3/5.
|
||||
// Copyright © 2018年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLAboutFooterView.h"
|
||||
|
||||
@implementation TLAboutFooterView
|
||||
|
||||
+ (CGFloat)viewHeightByDataModel:(NSNumber *)dataModel
|
||||
{
|
||||
return dataModel.doubleValue;
|
||||
}
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
self.addLabel(1).numberOfLines(0).textAlignment(NSTextAlignmentCenter)
|
||||
.text(@"高仿微信 仅供学习\nhttps://github.com/tbl00c/TLChat")
|
||||
.font([UIFont systemFontOfSize:12.0f]).textColor([UIColor grayColor])
|
||||
.masonry(^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(0);
|
||||
make.bottom.mas_equalTo(-10);
|
||||
make.width.mas_lessThanOrEqualTo(self).mas_offset(-30);
|
||||
});
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// TLAboutHeaderView.h
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/2/22.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface TLAboutHeaderView : UICollectionReusableView <ZZFlexibleLayoutViewProtocol>
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// TLAboutHeaderView.m
|
||||
// TLChat
|
||||
//
|
||||
// Created by 李伯坤 on 16/2/22.
|
||||
// Copyright © 2016年 李伯坤. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TLAboutHeaderView.h"
|
||||
|
||||
@interface TLAboutHeaderView ()
|
||||
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation TLAboutHeaderView
|
||||
|
||||
#pragma mark - # Protocol
|
||||
+ (CGFloat)viewHeightByDataModel:(id)dataModel
|
||||
{
|
||||
return 120.0f;
|
||||
}
|
||||
|
||||
- (void)setViewDataModel:(id)dataModel
|
||||
{
|
||||
[self.titleLabel setText:dataModel];
|
||||
}
|
||||
|
||||
#pragma mark - # View
|
||||
- (id)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
self.titleLabel = self.addLabel(1000)
|
||||
.font([UIFont systemFontOfSize:17.0f]).textColor([UIColor grayColor])
|
||||
.masonry(^ (MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(0);
|
||||
make.width.mas_lessThanOrEqualTo(self).mas_offset(-30);
|
||||
make.bottom.mas_equalTo(-13);
|
||||
})
|
||||
.view;
|
||||
|
||||
self.addImageView(1001).image(TLImage(@"AppLogo"))
|
||||
.masonry(^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(20);
|
||||
make.centerX.mas_equalTo(0);
|
||||
make.size.mas_equalTo(CGSizeMake(73, 64));
|
||||
});
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user