This commit is contained in:
lianxiang
2018-10-09 09:02:59 +08:00
parent 431a19b043
commit dc1b1e330f
50 changed files with 880 additions and 255 deletions
@@ -18,6 +18,7 @@
#import "GiGaShareModel.h"
#import "UIImageView+WebCache.h"
#import "UIButton+WebCache.h"
#import "GiGaUserInfoVC.h"
@interface GIGaMaskShareViewController ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate>
@property(nonatomic,strong) GiGaShareModel *model;
@@ -51,7 +52,7 @@
rightBtn.layer.masksToBounds = YES;
rightBtn.layer.cornerRadius = 20;
[rightBtn setImage:[UIImage imageNamed:@"nav_circle_avatar"] forState:UIControlStateNormal];
[rightBtn addTarget:self action:@selector(goUserInfoView) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightBtn];
if ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 11.0) {
@@ -74,6 +75,12 @@
}
}
-(void)goUserInfoView{
GiGaUserInfoVC *userVC= [[GiGaUserInfoVC alloc] init];
[self.navigationController pushViewController:userVC animated:YES];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
@@ -213,19 +220,13 @@
}else{
NSString *errorStr = @"应用相册限受限,请在设置中启用";
NSString *errorStr = @"应用相册限受限,请在设置中启用";
[self jxt_showAlertWithTitle:@"" message:errorStr appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) {
alertMaker.addActionCancelTitle(@"取消");
alertMaker.addActionDefaultTitle(@"去开启");
alertMaker.addActionCancelTitle(@"知道了");
//alertMaker.addActionDefaultTitle(@"去开启");
} actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) {
if (buttonIndex == 1) {
NSURL *url = [NSURL URLWithString:@"prefs:root=Photos"];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
}
}
}];
}
@@ -242,21 +243,12 @@
if(authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied){
NSString *errorStr = @"应用相机权限受限,请在设置中启用";
[self jxt_showAlertWithTitle:@"" message:errorStr appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) {
alertMaker.addActionCancelTitle(@"取消");
alertMaker.addActionDefaultTitle(@"去开启");
alertMaker.addActionCancelTitle(@"知道了");
//alertMaker.addActionDefaultTitle(@"去开启");
} actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) {
if (buttonIndex == 1) {
NSString *urlStr = @"App-Prefs:root=Photos";
if (@available(iOS 10.0, *)) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlStr] options:@{} completionHandler:nil];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlStr]];
// Fallback on earlier versions
}
}
}];
return;
}
+164 -26
View File
@@ -9,77 +9,200 @@
#import "GiGaAppGaurdVC.h"
#import "Masonry.h"
#import "GiGaUserDefault.h"
#import "GiGaPageControl.h"
#import "LXPageControl.h"
@interface GiGaAppGaurdVC ()
@interface GiGaAppGaurdVC ()<UIScrollViewDelegate>
@property(nonatomic,strong) LXPageControl *pagControl;
@property(nonatomic,strong)UIScrollView * scrollView;
@end
@implementation GiGaAppGaurdVC
- (LXPageControl *)pagControl
{
if (!_pagControl) {
_pagControl = [[LXPageControl alloc] initWithFrame:CGRectMake(0, KMainH - 63 - PhoneX_BottomMargin, KMainW, 8)];
_pagControl.numberOfPages = 3;
_pagControl.currentPage = 0;
}
return _pagControl;
}
- (UIScrollView *)scrollView
{
if (!_scrollView) {
_scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
_scrollView.backgroundColor = [UIColor redColor];
_scrollView.pagingEnabled=true;
_scrollView.delegate=self;
_scrollView.showsHorizontalScrollIndicator=false;
_scrollView.showsVerticalScrollIndicator=false;
}
return _scrollView;
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor blueColor];
self.view.backgroundColor = [UIColor blackColor];
[GiGaUserDefault saveAppGaurdflag:YES];
[self creatUI];
[self creatSubs];
}
-(void)creatUI{
//MARK: - scrollView delegate
//结束滚动
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
[self updatePage];
}
-(void)updatePage{
self.pagControl.currentPage = self.scrollView.contentOffset.x / self.scrollView.bounds.size.width;
self.pagControl.hidden = self.scrollView.contentOffset.x / self.scrollView.bounds.size.width == 2 ? YES : NO;
GILog(@"%ld",self.pagControl.currentPage);
}
-(void)creatSubs{
[self.view addSubview:self.scrollView];
[self.view addSubview:self.pagControl];
self.scrollView.contentSize = CGSizeMake(self.scrollView.bounds.size.width*self.pagControl.numberOfPages, self.scrollView.bounds.size.height);
self.scrollView.bounces=NO;
for (int i=0; i<3; i++) {
UIView *pageView = [[UIView alloc] init];
pageView.backgroundColor = [UIColor blueColor];
pageView.frame = CGRectMake(i*self.scrollView.bounds.size.width, 0, self.scrollView.bounds.size.width, self.scrollView.bounds.size.height);
[self.scrollView addSubview:pageView];
if (i==0) {
[self creatFirstPage:pageView];
}else if (i==1){
[self creat2Page:pageView];
}else if (i==2){
[self creat3Page:pageView];
}
}
[self creatcommonView];
}
-(void)creatFirstPage:(UIView *)inView{
UIImageView *backimage = [[UIImageView alloc] init];
backimage.image = [UIImage imageNamed:@"appgaurd_bg"];
backimage.frame = CGRectMake(0, 0, KMainW, KMainH);
//backimage.contentMode = UIViewContentModeScaleToFill;
[self.view addSubview:backimage];
[inView addSubview:backimage];
[backimage mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.view.mas_top);
make.bottom.mas_equalTo(self.view.mas_bottom);
make.left.mas_equalTo(self.view.mas_left);
make.right.mas_equalTo(self.view.mas_right);
make.top.mas_equalTo(inView.mas_top);
make.bottom.mas_equalTo(inView.mas_bottom);
make.left.mas_equalTo(inView.mas_left);
make.right.mas_equalTo(inView.mas_right);
}];
UIImageView *girlimage = [[UIImageView alloc] init];
girlimage.image = [UIImage imageNamed:@"appgaurd_woman"];
[self.view addSubview:girlimage];
[inView addSubview:girlimage];
girlimage.contentMode = UIViewContentModeScaleAspectFit;
[girlimage mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.view.mas_top).offset(104 + PhoneX_TopMargin);
make.centerX.mas_equalTo(self.view.mas_centerX);
make.top.mas_equalTo(inView.mas_top).offset(104 + PhoneX_TopMargin);
make.centerX.mas_equalTo(inView.mas_centerX);
}];
UIImageView *moonimage = [[UIImageView alloc] init];
moonimage.image = [UIImage imageNamed:@"appgaurd_moon"];
[self.view addSubview:moonimage];
[inView addSubview:moonimage];
[moonimage mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.view.mas_top).offset(13 + PhoneX_TopMargin);
make.right.mas_equalTo(self.view.mas_right).offset(-5.5);
make.top.mas_equalTo(inView.mas_top).offset(13 + PhoneX_TopMargin);
make.right.mas_equalTo(inView.mas_right).offset(-24);
}];
}
-(void)creat2Page:(UIView *)inView{
UIImageView *backimage = [[UIImageView alloc] init];
backimage.image = [UIImage imageNamed:@"page2_img"];
backimage.frame = CGRectMake(0, 0, KMainW, KMainH);
//backimage.contentMode = UIViewContentModeScaleToFill;
[inView addSubview:backimage];
UIImageView *girlimage = [[UIImageView alloc] init];
girlimage.image = [UIImage imageNamed:@"page2_women"];
[inView addSubview:girlimage];
girlimage.contentMode = UIViewContentModeScaleAspectFit;
[girlimage mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(inView.mas_top).offset(104 + PhoneX_TopMargin);
make.centerX.mas_equalTo(inView.mas_centerX);
}];
UIImageView *moonimage = [[UIImageView alloc] init];
moonimage.image = [UIImage imageNamed:@"appgaurd_moon"];
[inView addSubview:moonimage];
[moonimage mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(inView.mas_top).offset(13 + PhoneX_TopMargin);
make.right.mas_equalTo(inView.mas_right).offset(-24);
}];
}
-(void)creat3Page:(UIView *)inView{
UIImageView *backimage = [[UIImageView alloc] init];
backimage.image = [UIImage imageNamed:@"page3_img"];
backimage.frame = CGRectMake(0, 0, KMainW, KMainH);
//backimage.contentMode = UIViewContentModeScaleToFill;
[inView addSubview:backimage];
UIImageView *girlimage = [[UIImageView alloc] init];
girlimage.image = [UIImage imageNamed:@"page3_woman"];
[inView addSubview:girlimage];
girlimage.contentMode = UIViewContentModeScaleAspectFit;
[girlimage mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(inView.mas_top).offset(104 + PhoneX_TopMargin);
make.centerX.mas_equalTo(inView.mas_centerX);
}];
UIImageView *logoimage = [[UIImageView alloc] init];
logoimage.image = [UIImage imageNamed:@"page_logo"];
[inView addSubview:logoimage];
[logoimage mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(inView.mas_top).offset(13 + PhoneX_TopMargin);
make.right.mas_equalTo(inView.mas_right).offset(-24);
}];
UIButton *dismisBtn= [UIButton buttonWithType:UIButtonTypeCustom];
[dismisBtn setTitle:@"立即体验" forState:UIControlStateNormal];
//dismisBtn.backgroundColor = [UIColor greenColor];
[dismisBtn addTarget:self action:@selector(dismisBtnAction) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:dismisBtn];
[inView addSubview:dismisBtn];
[dismisBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(160);
make.height.mas_equalTo(40);
make.centerX.mas_equalTo(self.view.mas_centerX);
make.bottom.mas_equalTo(self.view.mas_bottom).offset(-100);
make.top.mas_greaterThanOrEqualTo(girlimage.mas_bottom).offset(20);
make.centerX.mas_equalTo(inView.mas_centerX);
make.bottom.mas_equalTo(inView.mas_bottom).offset(-100);
make.top.mas_greaterThanOrEqualTo(girlimage.mas_bottom).offset(20);
}];
dismisBtn.layer.masksToBounds = YES;
@@ -88,6 +211,21 @@
dismisBtn.layer.borderColor = [UIColor whiteColor].CGColor;
}
-(void)creatcommonView{
// UIImageView *moonimage = [[UIImageView alloc] init];
// moonimage.image = [UIImage imageNamed:@"appgaurd_moon"];
// [self.view addSubview:moonimage];
//
// [moonimage mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.mas_equalTo(self.view.mas_top).offset(13 + PhoneX_TopMargin);
// make.right.mas_equalTo(self.view.mas_right).offset(-24);
//
// }];
UIView *botomlineView = [[UIView alloc] init];
botomlineView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:botomlineView];
@@ -19,6 +19,8 @@
#import "LXCustomSwith.h"
#import "GiGaUserDefault.h"
#import "GiGaServerConfig.h"
#import "GiGaQuestionVC.h"
//弹幕控制器
@interface GiGaFlingCommitVC ()
@@ -28,6 +30,9 @@
//@property (nonatomic,strong) LXCustomSwith *danmuSwitch;
//开启弹幕按钮
@property(nonatomic,strong) UIButton *openDanmuButton;
@property(nonatomic,strong) UIButton *testBtn;
@end
@implementation GiGaFlingCommitVC
@@ -51,6 +56,32 @@
//
//}
- (UIButton *)testBtn
{
if (!_testBtn) {
_testBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_testBtn setTitle:@"" forState:UIControlStateNormal];
[_testBtn addTarget:self action:@selector(testBtnAction) forControlEvents:UIControlEventTouchUpInside];
//_testBtn.backgroundColor = [UIColor redColor];
_testBtn.frame = CGRectMake(30, 476 + PhoneX_TopMargin,KMainW - 30 *2, 50);
}
return _testBtn;
}
-(void)testBtnAction{
//GIGA_ShowToast(@"请先关闭弹幕");
[self dismissViewControllerAnimated:YES completion:^{
[[LXDanMuManager shareInstance] destory];
[self destorySocket];
NC_POST_NAME_OBJECT(@"UserCloseChatRoomAction", nil);
NC_POST_NAME_OBJECT(@"flingcommitViewTestAreaAction", nil);
}];
}
- (UIButton *)openDanmuButton{
if (!_openDanmuButton) {
_openDanmuButton = [UIButton buttonWithType:UIButtonTypeCustom];
@@ -118,13 +149,14 @@
- (void)viewDidLoad {
[super viewDidLoad];
[self.view addSubview:self.testBtn];
// Do any additional setup after loading the view.
[self.view addSubview: self.commitInputView];
// [self.view addSubview:self.danmuSwitch];
// [self.view bringSubviewToFront:self.danmuSwitch];
[self.view addSubview:self.openDanmuButton];
[self.view addSubview:self.testBtn];
weakify(self);
self.commitInputView.SendCommentHandler = ^(NSString *content) {
@@ -35,7 +35,7 @@
#import "GIGaMaskShareViewController.h"
#import "MaskHistryRecord.h"
#import "MaskTimeTopAnimationView.h"
#import <AudioToolbox/AudioToolbox.h>
@interface GiGaMaskTaskViewController ()<MaskCirCularProGressViewDelegate,MaskTimeTextViewDelegate>
{
@@ -177,10 +177,20 @@
if (!_startTestButton) {
_startTestButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_startTestButton setBackgroundImage:[UIImage imageNamed:@"btn_start_test"] forState:UIControlStateNormal];
NSAttributedString *title = [GiGaHelper stringWithText:@"测试肤质" textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTBOLD(18) leterSpace:0];
BOOL istest = [GiGaUserDefault isUserTest];
NSString *text = nil;
if (istest) {
text = @"重新测试";
}else{
text = @"测试肤质";
}
NSAttributedString *title = [GiGaHelper stringWithText:text textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTBOLD(18) leterSpace:0];
[_startTestButton setAttributedTitle:title forState:UIControlStateNormal];
[_startTestButton addTarget:self action:@selector(testBtnAcion:) forControlEvents:UIControlEventTouchUpInside];
}
return _startTestButton;
}
@@ -225,11 +235,12 @@
//  app引导页
BOOL showAppGaurd = [GiGaUserDefault isShowedAppGaurd];
if (showAppGaurd == NO) {
[self showAPPappGaurdView];
}
// BOOL showAppGaurd = [GiGaUserDefault isShowedAppGaurd];
// if (showAppGaurd == NO) {
// [self showAPPappGaurdView];
// }
//[self showAPPappGaurdView];
}
@@ -463,7 +474,7 @@
NSError *payerError;
NSURL *musicUrl = [[NSURL alloc] initWithString:[[NSBundle mainBundle] pathForResource:@"pomodoSound" ofType:@"m4a"]] ;
AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:musicUrl error:&payerError];
player.numberOfLoops = -1;
player.numberOfLoops = 1;//-1 无限
_musicPalyer = player;
[[AVAudioSession sharedInstance] setActive:YES error:nil];
//设置后台模式和锁屏模式下依然能够播放
@@ -483,14 +494,14 @@
}
delegate.isMasking = YES;
[_musicPalyer play];
[self setBackGroundPlayingInfo];//锁屏音频信息
// [self setBackGroundPlayingInfo];//锁屏音频信息
//总时间隔 s
NSTimeInterval timeInterVal = [GiGaUserDefault getUserMaskeTime];
[self.cicleProgressView startWith:timeInterVal];
//底部弹窗
[self showWaringView];
//[self showWaringView];
//app 前台时收到本地通知showAlert 后台时通知提醒
// [[GiGaLocalNotificationManager localNotifiationCenter] sendLocalNotification:@"本地推送" fireTimeInterval:timeInterVal alertAction:@"测试面膜时间" withIdentifier:kLOCALNotifiID_MASKETIMEEND];
@@ -545,8 +556,12 @@
AppDelegate *delegate =(AppDelegate *) [[UIApplication sharedApplication] delegate];
delegate.isMasking = NO;
[_musicPalyer stop];
//震动 需用户手动开启震动模式
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
//复原动画
[self endMaskAnimation];
}
#pragma mark 开始测试
@@ -566,9 +581,13 @@
// [self showAlertGoShareMaskTime];
[self startTest];
}
-(void)startTest{
GiGaQuestionVC *questionVC = [[GiGaQuestionVC alloc] init];
[self.navigationController pushViewController:questionVC animated:YES];
}
-(void)addNotify{
@@ -583,7 +602,21 @@
//用户关闭弹幕聊天
NC_ADD_TARGET_NAME_OBJECT(self, @selector(userCloseChatRoomAction), @"UserCloseChatRoomAction", nil);
//
NC_ADD_TARGET_NAME_OBJECT(self, @selector(flingcommitViewTestAreaAction), @"flingcommitViewTestAreaAction", nil);
//测试肤质flag 状态更新
NC_ADD_TARGET_NAME_OBJECT(self, @selector(testfalgUpdateAction), @"testfalgUpdate", nil);
}
//弹幕界面点击测试按钮区域
-(void)flingcommitViewTestAreaAction{
[self startTest];
}
//测试按钮状态更新通知
-(void)testfalgUpdateAction{
NSAttributedString *title = [GiGaHelper stringWithText:@"重新测试" textColor:[UIColor whiteColor] textFont:GIGA_TEXTFONTBOLD(18) leterSpace:0];
[_startTestButton setAttributedTitle:title forState:UIControlStateNormal];
}
@@ -597,7 +630,7 @@
#pragma mark 新手引导蒙版消失
-(void)guardViewDissmiss{
[self showWaringView];
//[self showWaringView];
}
@@ -620,6 +653,8 @@
NC_REMOVE_NAME(self, kUserLogOutNotify, nil);
NC_REMOVE_NAME(self, kUserLoginSuccessNoti, nil);
NC_REMOVE_NAME(self, @"UserCloseChatRoomAction", nil);
NC_REMOVE_NAME(self, @"flingcommitViewTestAreaAction",nil);
NC_REMOVE_NAME(self,@"testfalgUpdate",nil);
}
#pragma mark 新手引导
@@ -851,4 +886,5 @@
}
@end
@@ -249,19 +249,13 @@
}else{
NSString *errorStr = @"应用相权册限受限,请在设置中启用";
NSString *errorStr = @"应用相受限,请在设置中启用";
[self jxt_showAlertWithTitle:@"" message:errorStr appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) {
alertMaker.addActionCancelTitle(@"取消");
alertMaker.addActionDefaultTitle(@"去开启");
alertMaker.addActionCancelTitle(@"知道了");
//alertMaker.addActionDefaultTitle(@"去开启");
} actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) {
if (buttonIndex == 1) {
NSURL *url = [NSURL URLWithString:@"prefs:root=Photos"];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
}
}
}];
}
@@ -279,21 +273,12 @@
if(authStatus == AVAuthorizationStatusRestricted || authStatus == AVAuthorizationStatusDenied){
NSString *errorStr = @"应用相机权限受限,请在设置中启用";
[self jxt_showAlertWithTitle:@"" message:errorStr appearanceProcess:^(JXTAlertController * _Nonnull alertMaker) {
alertMaker.addActionCancelTitle(@"取消");
alertMaker.addActionDefaultTitle(@"去开启");
alertMaker.addActionCancelTitle(@"知道了");
//alertMaker.addActionDefaultTitle(@"去开启");
} actionsBlock:^(NSInteger buttonIndex, UIAlertAction * _Nonnull action, JXTAlertController * _Nonnull alertSelf) {
if (buttonIndex == 1) {
NSString *urlStr = @"App-Prefs:root=Photos";
if (@available(iOS 10.0, *)) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlStr] options:@{} completionHandler:nil];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlStr]];
// Fallback on earlier versions
}
}
}];
return;
}