add
This commit is contained in:
@@ -36,10 +36,11 @@
|
||||
#import "MaskHistryRecord.h"
|
||||
#import "MaskTimeTopAnimationView.h"
|
||||
#import <AudioToolbox/AudioToolbox.h>
|
||||
#import "GIGaDateHelper.h"
|
||||
|
||||
@interface GiGaMaskTaskViewController ()<MaskCirCularProGressViewDelegate,MaskTimeTextViewDelegate>
|
||||
{
|
||||
AVAudioPlayer *_musicPalyer;
|
||||
|
||||
AVAudioPlayer *_startMaskMusic;
|
||||
|
||||
}
|
||||
@@ -258,8 +259,25 @@
|
||||
[self setUpNav];
|
||||
[self initUI];
|
||||
[self addNotify];
|
||||
[self creatBackGroundMusic];
|
||||
//[self creatBackGroundMusic];
|
||||
[self creatMaskTimeSatrtMusic];
|
||||
//判断是否有倒数计时
|
||||
[self digIsMasking];
|
||||
|
||||
}
|
||||
|
||||
-(void)digIsMasking{
|
||||
AppDelegate *delegate =(AppDelegate *) [[UIApplication sharedApplication] delegate];
|
||||
NSString *st = nil;
|
||||
if (delegate.isMasking) {
|
||||
NSLog(@"倒计时中");
|
||||
st = @"YES";
|
||||
[self animaMask];
|
||||
|
||||
}else{
|
||||
st = @"NO";
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -288,6 +306,8 @@
|
||||
[self.cicleProgressView stop];
|
||||
//手动结束时结束peding通知
|
||||
[[GiGaLocalNotificationManager localNotifiationCenter] cancelAllLocalNoitification];
|
||||
[GIGaDateHelper removeStartDate];
|
||||
[GIGaDateHelper saveisMaskingflag:NO];
|
||||
[self maskTimeEnd];
|
||||
}
|
||||
}];
|
||||
@@ -473,7 +493,7 @@
|
||||
AVAudioPlayer *player = [[AVAudioPlayer alloc] initWithContentsOfURL:musicUrl error:&payerError];
|
||||
player.numberOfLoops = -1;//-1 无限
|
||||
player.volume = 0;
|
||||
_musicPalyer = player;
|
||||
//_musicPalyer = player;
|
||||
[[AVAudioSession sharedInstance] setActive:YES error:nil];
|
||||
//设置后台模式和锁屏模式下依然能够播放
|
||||
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:AVAudioSessionCategoryOptionMixWithOthers error:nil];
|
||||
@@ -502,18 +522,14 @@
|
||||
[self sendBengainMaskTime];
|
||||
[self createInputView]; //出现弹幕
|
||||
AppDelegate *delegate =(AppDelegate *) [[UIApplication sharedApplication] delegate];
|
||||
if (delegate.isMasking) {
|
||||
return;
|
||||
}
|
||||
NSTimeInterval timeInterVal = [GiGaUserDefault getUserMaskeTime];
|
||||
[self.cicleProgressView startWith:timeInterVal];
|
||||
|
||||
delegate.isMasking = YES;
|
||||
[_startMaskMusic play];
|
||||
[_musicPalyer play];
|
||||
//[_musicPalyer play];
|
||||
// [self setBackGroundPlayingInfo];//锁屏音频信息
|
||||
|
||||
//总时间隔 s
|
||||
NSTimeInterval timeInterVal = [GiGaUserDefault getUserMaskeTime];
|
||||
|
||||
[self.cicleProgressView startWith:timeInterVal];
|
||||
|
||||
//底部弹窗
|
||||
//[self showWaringView];
|
||||
|
||||
@@ -563,13 +579,15 @@
|
||||
|
||||
#pragma mark 面膜时间结束
|
||||
-(void)maskTimeEnd{
|
||||
|
||||
self.openDanmuButton.hidden = YES;
|
||||
[self sendEndMaskTime];
|
||||
NC_POST_NAME_OBJECT(kUserNoti_MASKEND, nil);
|
||||
//面膜时间结束时设置 全局变量 不再发送本地通知 提醒
|
||||
AppDelegate *delegate =(AppDelegate *) [[UIApplication sharedApplication] delegate];
|
||||
delegate.isMasking = NO;
|
||||
[_musicPalyer stop];
|
||||
|
||||
//[_musicPalyer stop];
|
||||
|
||||
//震动 需用户手动开启震动模式
|
||||
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
|
||||
@@ -792,6 +810,7 @@
|
||||
[UIView animateWithDuration:0.4 animations:^{
|
||||
self.waringView.frame = CGRectMake(0,CGRectGetMaxY(self.view.frame) - 44 - PhoneX_BottomMargin, self.view.frame.size.width, 44);
|
||||
}];
|
||||
|
||||
[self.waringView showView];
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#import "MaskTimeCircularProgressView.h"
|
||||
#import "LXCountTimer.h"
|
||||
#import "SHineLabel.h"
|
||||
#import "GIGaDateHelper.h"
|
||||
#import "AppDelegate.h"
|
||||
|
||||
@interface MaskTimeCircularProgressView()
|
||||
@property (nonatomic) CADisplayLink *displayLink;
|
||||
@@ -20,7 +22,6 @@
|
||||
@property (nonatomic,strong) NSTimer *playTimer;
|
||||
@property (nonatomic,strong) UIImageView *holderImageView;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation MaskTimeCircularProgressView
|
||||
@@ -145,8 +146,8 @@
|
||||
slice.lineCap = kCALineJoinRound;
|
||||
slice.lineJoin = kCALineJoinBevel;
|
||||
slice.path = smoothedPath.CGPath;
|
||||
|
||||
return slice;
|
||||
|
||||
}
|
||||
|
||||
- (void)setProgress:(float)progress{
|
||||
@@ -180,7 +181,10 @@
|
||||
- (void)startWith:(NSTimeInterval)time{
|
||||
|
||||
self.timeinterval = time;
|
||||
|
||||
[self countDown:time];
|
||||
|
||||
//进度圆环
|
||||
[self start];
|
||||
}
|
||||
|
||||
@@ -200,13 +204,37 @@
|
||||
|
||||
-(void)countDown:(NSTimeInterval)timeInterVal{
|
||||
|
||||
NSString *timeformat = [GiGaHelper stringWithNSTimerinterval:timeInterVal];
|
||||
NSArray *timesArr = [timeformat componentsSeparatedByString:@":"];
|
||||
NSString *hour = timesArr[0];
|
||||
NSString *min = timesArr[1];
|
||||
NSString *sec = timesArr[2];
|
||||
[self countTimeBegain:hour.integerValue minute:min.integerValue second:sec.integerValue];
|
||||
AppDelegate *delegate =(AppDelegate *) [[UIApplication sharedApplication] delegate];
|
||||
|
||||
if (delegate.isMasking) {
|
||||
|
||||
}else{
|
||||
|
||||
[GIGaDateHelper saveSatrtDate];
|
||||
}
|
||||
|
||||
NSDate *startDate = [GIGaDateHelper getStartDate];
|
||||
NSDate* dat = [NSDate dateWithTimeIntervalSinceNow:0];
|
||||
if (startDate == nil) {
|
||||
startDate = dat;
|
||||
}
|
||||
|
||||
NSTimeInterval passt = [GIGaDateHelper getTimebySubtracting:startDate andDate2:dat];
|
||||
NSLog(@"passT %0.f",passt);
|
||||
|
||||
NSTimeInterval cunrenShowTimCount = timeInterVal > passt ? timeInterVal - passt: timeInterVal;
|
||||
delegate.isMasking= YES;
|
||||
weakify(self);
|
||||
[self.timer countDownWithtimerInterval:cunrenShowTimCount completeBlock:^(NSInteger day, NSInteger hour, NSInteger minute, NSInteger second) {
|
||||
[weakSelf refreshTimeCount:hour minute:minute second:second];
|
||||
if (minute==0 && second == 0) {
|
||||
delegate.isMasking = NO;
|
||||
[GIGaDateHelper removeStartDate];
|
||||
[GIGaDateHelper saveisMaskingflag:NO];
|
||||
|
||||
}
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark 开始计时
|
||||
@@ -218,8 +246,11 @@
|
||||
[self.timer countDownWithStratTimeStamp:nowTimestamp finishTimeStamp:futrueTimestamp completeBlock:^(NSInteger day, NSInteger hour, NSInteger minute, NSInteger second) {
|
||||
[weakSelf refreshTimeCount:hour minute:minute second:second];
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
-(void)refreshTimeCount:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second{
|
||||
|
||||
self.countLabel.text = [NSString stringWithFormat:@"%02ld:%02ld",minute,second];
|
||||
|
||||
Reference in New Issue
Block a user