This commit is contained in:
lianxiang 2018-10-19 20:23:26 +08:00
parent e06dc32099
commit d845ed2cb0
12 changed files with 255 additions and 49 deletions

View File

@ -28,7 +28,6 @@
8338F6B12142182200B4780B /* MaskTime.png in Resources */ = {isa = PBXBuildFile; fileRef = 8338F6B02142182100B4780B /* MaskTime.png */; };
8338F6B92142504E00B4780B /* LXCustomSwith.m in Sources */ = {isa = PBXBuildFile; fileRef = 8338F6B82142504E00B4780B /* LXCustomSwith.m */; };
833DA7762122A62000A5C614 /* GiGaMaskTaskViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 833DA7752122A62000A5C614 /* GiGaMaskTaskViewController.m */; };
833DE8E52150169F009D4329 /* JYAddressPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 833DE8E32150169F009D4329 /* JYAddressPicker.m */; };
8340BF9E213E3846008F22E4 /* SHineLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 8340BF9D213E3846008F22E4 /* SHineLabel.m */; };
8340BFA2213E60DD008F22E4 /* GIGAMBHUDHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8340BFA1213E60DD008F22E4 /* GIGAMBHUDHelper.m */; };
8340BFA6213E6514008F22E4 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8340BFA5213E6514008F22E4 /* Localizable.strings */; };
@ -106,7 +105,6 @@
836EE5D7213645E300F0ABB2 /* GiGaBaseAPiRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 836EE5D6213645E300F0ABB2 /* GiGaBaseAPiRequest.m */; };
836EE5DA2136716100F0ABB2 /* NSTimer+Convenience.m in Sources */ = {isa = PBXBuildFile; fileRef = 836EE5D82136716000F0ABB2 /* NSTimer+Convenience.m */; };
8376B81E2154897700AB79F8 /* GIGaUserFileHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8376B81D2154897700AB79F8 /* GIGaUserFileHelper.m */; };
8376B8202154913E00AB79F8 /* city.json in Resources */ = {isa = PBXBuildFile; fileRef = 8376B81F2154913E00AB79F8 /* city.json */; };
8376B8232154927300AB79F8 /* GIGaMaskShareViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8376B8222154927300AB79F8 /* GIGaMaskShareViewController.m */; };
8376B8282154A0A200AB79F8 /* MaskTimeEndViewImgaeCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 8376B8262154A0A200AB79F8 /* MaskTimeEndViewImgaeCell.m */; };
8376B8292154A0A200AB79F8 /* MaskTimeEndViewImgaeCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8376B8272154A0A200AB79F8 /* MaskTimeEndViewImgaeCell.xib */; };
@ -192,6 +190,9 @@
838762E3214B9F580039D241 /* GiGaUserSexViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 838762E1214B9F580039D241 /* GiGaUserSexViewCell.xib */; };
838762E7214B9FA60039D241 /* GIGaUserCityViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 838762E5214B9FA60039D241 /* GIGaUserCityViewCell.m */; };
838762E8214B9FA60039D241 /* GIGaUserCityViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 838762E6214B9FA60039D241 /* GIGaUserCityViewCell.xib */; };
838CD5972179E11E000CBEA6 /* GIGaDateHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 838CD5962179E11E000CBEA6 /* GIGaDateHelper.m */; };
838CD5A22179E79C000CBEA6 /* city.json in Resources */ = {isa = PBXBuildFile; fileRef = 838CD5A02179E79C000CBEA6 /* city.json */; };
838CD5A32179E79C000CBEA6 /* JYAddressPicker.m in Sources */ = {isa = PBXBuildFile; fileRef = 838CD5A12179E79C000CBEA6 /* JYAddressPicker.m */; };
8390116B214E20B2004CA790 /* LYSDateContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 83901145214E20B1004CA790 /* LYSDateContentView.m */; };
8390116C214E20B2004CA790 /* LYSDatePopViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83901149214E20B1004CA790 /* LYSDatePopViewController.m */; };
8390116D214E20B2004CA790 /* LYSDateBaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83901151214E20B1004CA790 /* LYSDateBaseViewController.m */; };
@ -302,8 +303,6 @@
8338F6B82142504E00B4780B /* LXCustomSwith.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LXCustomSwith.m; sourceTree = "<group>"; };
833DA7742122A62000A5C614 /* GiGaMaskTaskViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiGaMaskTaskViewController.h; sourceTree = "<group>"; };
833DA7752122A62000A5C614 /* GiGaMaskTaskViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiGaMaskTaskViewController.m; sourceTree = "<group>"; };
833DE8E12150169F009D4329 /* JYAddressPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JYAddressPicker.h; sourceTree = "<group>"; };
833DE8E32150169F009D4329 /* JYAddressPicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JYAddressPicker.m; sourceTree = "<group>"; };
8340BF9C213E3846008F22E4 /* SHineLabel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SHineLabel.h; sourceTree = "<group>"; };
8340BF9D213E3846008F22E4 /* SHineLabel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SHineLabel.m; sourceTree = "<group>"; };
8340BFA0213E60DD008F22E4 /* GIGAMBHUDHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GIGAMBHUDHelper.h; sourceTree = "<group>"; };
@ -439,7 +438,6 @@
836EE5D92136716000F0ABB2 /* NSTimer+Convenience.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSTimer+Convenience.h"; sourceTree = "<group>"; };
8376B81C2154897700AB79F8 /* GIGaUserFileHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GIGaUserFileHelper.h; sourceTree = "<group>"; };
8376B81D2154897700AB79F8 /* GIGaUserFileHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GIGaUserFileHelper.m; sourceTree = "<group>"; };
8376B81F2154913E00AB79F8 /* city.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = city.json; sourceTree = "<group>"; };
8376B8212154927300AB79F8 /* GIGaMaskShareViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GIGaMaskShareViewController.h; sourceTree = "<group>"; };
8376B8222154927300AB79F8 /* GIGaMaskShareViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GIGaMaskShareViewController.m; sourceTree = "<group>"; };
8376B8252154A0A200AB79F8 /* MaskTimeEndViewImgaeCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MaskTimeEndViewImgaeCell.h; path = GIGA/Modules/Mask/View/MaskTimeEndViewImgaeCell.h; sourceTree = SOURCE_ROOT; };
@ -589,6 +587,11 @@
838762E4214B9FA60039D241 /* GIGaUserCityViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GIGaUserCityViewCell.h; sourceTree = "<group>"; };
838762E5214B9FA60039D241 /* GIGaUserCityViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GIGaUserCityViewCell.m; sourceTree = "<group>"; };
838762E6214B9FA60039D241 /* GIGaUserCityViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GIGaUserCityViewCell.xib; sourceTree = "<group>"; };
838CD5952179E11D000CBEA6 /* GIGaDateHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GIGaDateHelper.h; sourceTree = "<group>"; };
838CD5962179E11E000CBEA6 /* GIGaDateHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GIGaDateHelper.m; sourceTree = "<group>"; };
838CD59F2179E79C000CBEA6 /* JYAddressPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JYAddressPicker.h; sourceTree = "<group>"; };
838CD5A02179E79C000CBEA6 /* city.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = city.json; sourceTree = "<group>"; };
838CD5A12179E79C000CBEA6 /* JYAddressPicker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JYAddressPicker.m; sourceTree = "<group>"; };
83901142214E04D1004CA790 /* ApiRequestConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ApiRequestConfig.h; sourceTree = "<group>"; };
83901144214E20B1004CA790 /* LYSDatePickerTypeDayAndTimeDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LYSDatePickerTypeDayAndTimeDelegate.h; sourceTree = "<group>"; };
83901145214E20B1004CA790 /* LYSDateContentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LYSDateContentView.m; sourceTree = "<group>"; };
@ -774,17 +777,6 @@
path = CustomSwitch;
sourceTree = "<group>";
};
833DE8E02150169F009D4329 /* JYAddressPicker */ = {
isa = PBXGroup;
children = (
8376B81F2154913E00AB79F8 /* city.json */,
833DE8E12150169F009D4329 /* JYAddressPicker.h */,
833DE8E32150169F009D4329 /* JYAddressPicker.m */,
);
name = JYAddressPicker;
path = ../../../../JYAddressPicker;
sourceTree = "<group>";
};
8340BF9F213E6080008F22E4 /* GIGAMBHUDHelper */ = {
isa = PBXGroup;
children = (
@ -807,9 +799,9 @@
8340BFAC213E7374008F22E4 /* Views */ = {
isa = PBXGroup;
children = (
838CD59E2179E79C000CBEA6 /* JYAddressPicker */,
83276184216F29A800C6216C /* LXCustomActionsheet */,
8382DFC021564A1F00BBA5A5 /* SJPhotoPicker */,
833DE8E02150169F009D4329 /* JYAddressPicker */,
83901143214E20B1004CA790 /* LYSDatePickerController */,
8338F6B62142504E00B4780B /* CustomSwitch */,
8340BFAD213E739D008F22E4 /* GiGaNoNetWorkView.h */,
@ -1027,6 +1019,8 @@
8361B3FC21215C7400238FEB /* Common */ = {
isa = PBXGroup;
children = (
838CD5952179E11D000CBEA6 /* GIGaDateHelper.h */,
838CD5962179E11E000CBEA6 /* GIGaDateHelper.m */,
8340BFAC213E7374008F22E4 /* Views */,
8340BF9F213E6080008F22E4 /* GIGAMBHUDHelper */,
83928FFF2134F4230077D2E8 /* LXDanMuManager */,
@ -1553,6 +1547,17 @@
path = userInfoView;
sourceTree = "<group>";
};
838CD59E2179E79C000CBEA6 /* JYAddressPicker */ = {
isa = PBXGroup;
children = (
838CD59F2179E79C000CBEA6 /* JYAddressPicker.h */,
838CD5A02179E79C000CBEA6 /* city.json */,
838CD5A12179E79C000CBEA6 /* JYAddressPicker.m */,
);
name = JYAddressPicker;
path = "../../../../../MaskTime素材新/JYAddressPicker";
sourceTree = "<group>";
};
83901143214E20B1004CA790 /* LYSDatePickerController */ = {
isa = PBXGroup;
children = (
@ -1863,13 +1868,13 @@
834BDA48215C7D10001E1DB7 /* InfoPlist.strings in Resources */,
8382DFEF21564A1F00BBA5A5 /* photopicker_back.png in Resources */,
83BFAE68213CCF10004EF801 /* GiGaMineUserViewCell.xib in Resources */,
8376B8202154913E00AB79F8 /* city.json in Resources */,
8351474221521C2A00B25A88 /* GIGaChangePassVC.xib in Resources */,
8382DFAD215626CE00BBA5A5 /* GiGaFeedContentViewCell.xib in Resources */,
8340BFA9213E65CA008F22E4 /* GIGACommonLocalizabe.strings in Resources */,
83835BA8212E4748001480F2 /* MAssaageCenterCell.xib in Resources */,
8361B3D3212155C300238FEB /* Assets.xcassets in Resources */,
8340BFA6213E6514008F22E4 /* Localizable.strings in Resources */,
838CD5A22179E79C000CBEA6 /* city.json in Resources */,
8361B3D1212155C200238FEB /* Main.storyboard in Resources */,
8376B8412154CEB200AB79F8 /* MaskShareTimeMidViewCell.xib in Resources */,
8340BFAB213E665D008F22E4 /* GIGAUserLocalizable.strings in Resources */,
@ -2006,6 +2011,7 @@
8361B4382121847600238FEB /* UINavigationBar+Custom.m in Sources */,
83BFAE6C213CD0E3004EF801 /* GiGaMineInfoViewCell.m in Sources */,
834DA5A8215F5FE0003FC4C6 /* ShareCustomIamgeModel.m in Sources */,
838CD5A32179E79C000CBEA6 /* JYAddressPicker.m in Sources */,
8376B8402154CEB200AB79F8 /* MaskShareTimeMidViewCell.m in Sources */,
8390116B214E20B2004CA790 /* LYSDateContentView.m in Sources */,
83BC8A872148BE8A00820437 /* NYPopover.m in Sources */,
@ -2095,6 +2101,7 @@
8357ADD32123C7C6000816F2 /* GiGaAPIResult.m in Sources */,
8340BF9E213E3846008F22E4 /* SHineLabel.m in Sources */,
8342FD862150FD5200D141F4 /* VersionModel.m in Sources */,
838CD5972179E11E000CBEA6 /* GIGaDateHelper.m in Sources */,
838762D3214B9D120039D241 /* GIGaUserInfoAvatorCell.m in Sources */,
8361B4352121836700238FEB /* GiGaBaseNavViewController.m in Sources */,
835060B3212D54C2007E6220 /* GiGaAdDetailViewController.m in Sources */,
@ -2109,7 +2116,6 @@
8382DFEB21564A1F00BBA5A5 /* SJPreviewPhotoController.m in Sources */,
8376B81E2154897700AB79F8 /* GIGaUserFileHelper.m in Sources */,
8376B8362154C74300AB79F8 /* ShareViewController.m in Sources */,
833DE8E52150169F009D4329 /* JYAddressPicker.m in Sources */,
834127212152AEFB001DDB36 /* GIGaMaskTimeUseRecordVC.m in Sources */,
83901171214E20B2004CA790 /* LYSDatePickerLabel.m in Sources */,
83C78A14215873170083DDD9 /* MaskHistoryListViewCell.m in Sources */,

View File

@ -27,8 +27,8 @@
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
//[NSThread sleepForTimeInterval:1];//
_isMasking = NO;
self.isMasking = [GiGaUserDefault isMasking];
//_isMasking = NO;
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self registLocalNotification];
[self configThridPartyWithOptions:launchOptions];
@ -138,7 +138,7 @@
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
[GiGaUserDefault saveisMaskingflag:_isMasking];
//app
if (_isMasking) {
@ -147,6 +147,7 @@
// [[GiGaLocalNotificationManager localNotifiationCenter] cancelAllLocalNoitification];
}
[[GiGaLocalNotificationManager localNotifiationCenter] cancelAllLocalNoitification];
}
-(void)remoteControlReceivedWithEvent:(UIEvent *)event

View File

@ -0,0 +1,25 @@
//
// GIGaDateHelper.h
// MasKTimeCountTime
//
// Created by lianxiang on 2018/10/19.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface GIGaDateHelper : NSObject
+(NSString *)getNowTimeTimestamp2;
+(NSDate *)getStartDate;
+(void)saveSatrtDate;
+(int)getTimebySubtracting:(NSDate*)Date1 andDate2:(NSDate*)Date2;
+(void)saveisMaskingflag:(BOOL)masking;
+(BOOL)isMasking;
+(void)removeStartDate;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,73 @@
//
// GIGaDateHelper.m
// MasKTimeCountTime
//
// Created by lianxiang on 2018/10/19.
// Copyright © 2018 com.giga.ios. All rights reserved.
//
#import "GIGaDateHelper.h"
@implementation GIGaDateHelper
//
+(NSString *)getNowTimeTimestamp2{
NSDate* dat = [NSDate dateWithTimeIntervalSinceNow:0];
NSLog(@"date :%@",dat);
NSTimeInterval a=[dat timeIntervalSince1970];
NSString*timeString = [NSString stringWithFormat:@"%0.f", a];
// ;
return timeString;
}
+(NSDate *)getStartDate{
NSDate *start = [[NSUserDefaults standardUserDefaults] objectForKey:@"start"];
return start;
}
+(void )saveSatrtDate{
NSDate* dat = [NSDate dateWithTimeIntervalSinceNow:0];
[[NSUserDefaults standardUserDefaults] setObject:dat forKey:@"start"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
+(void)removeStartDate{
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"start"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
+(int)getTimebySubtracting:(NSDate*)Date1 andDate2:(NSDate*)Date2
{
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
unsigned int unitFlags = NSCalendarUnitSecond;
NSDateComponents *comps = [gregorian components: unitFlags fromDate:Date1 toDate:Date2 options:0];
int seconds = (int)[comps second];
return seconds;
}
+(void)saveisMaskingflag:(BOOL)masking{
[[NSUserDefaults standardUserDefaults] setBool:masking forKey:@"isMasking"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
+(BOOL)isMasking{
BOOL ismasking = [[NSUserDefaults standardUserDefaults] boolForKey:@"isMasking"];
return ismasking;
}
@end

View File

@ -75,4 +75,8 @@
+(void)saveUserTestFlag:(BOOL)tested;
+(BOOL)isUserTest;
+(void)saveisMaskingflag:(BOOL)masking;
+(BOOL)isMasking;
@end

View File

@ -166,4 +166,16 @@ NSString *const kShowUserTested = @"kShowUserTested";
return showedGaurd;
}
+(void)saveisMaskingflag:(BOOL)masking{
[[NSUserDefaults standardUserDefaults] setBool:masking forKey:@"isMasking"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
+(BOOL)isMasking{
BOOL ismasking = [[NSUserDefaults standardUserDefaults] boolForKey:@"isMasking"];
return ismasking;
}
@end

View File

@ -15,7 +15,7 @@
* finishTimeStamp
*/
-(void)countDownWithStratTimeStamp:(long)starTimeStamp finishTimeStamp:(long)finishTimeStamp completeBlock:(void (^)(NSInteger day,NSInteger hour,NSInteger minute,NSInteger second))completeBlock;
-(void)countDownWithtimerInterval:(NSTimeInterval)timerInterval completeBlock:(void (^)(NSInteger day, NSInteger hour, NSInteger minute, NSInteger second))completeBlock;
/**
* block

View File

@ -54,6 +54,42 @@
}
}
-(void)countDownWithtimerInterval:(NSTimeInterval)timerInterval completeBlock:(void (^)(NSInteger, NSInteger, NSInteger, NSInteger))completeBlock{
if (_timer == nil) {
__block int timeout = timerInterval;
if (timeout !=0) {
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
_timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
dispatch_source_set_timer(_timer, dispatch_walltime(NULL, 0), 1.0*NSEC_PER_SEC, 0);//
dispatch_source_set_event_handler(_timer, ^{
if (timeout<=0) {
//
dispatch_source_cancel(self->_timer);
self->_timer = nil;
dispatch_async(dispatch_get_main_queue(), ^{
completeBlock(0,0,0,0);
});
}else{
int days = (int)(timeout/(3600*24));
int hours = (int)((timeout-days*24*3600)/3600);
int minute = (int)(timeout-days*24*3600-hours*3600)/60;
int second = timeout-days*24*3600-hours*3600-minute*60;
dispatch_async(dispatch_get_main_queue(), ^{
completeBlock(days,hours,minute,second);
});
timeout--;
}
});
dispatch_resume(_timer);
}
}
}
-(void)countDownWithPER_SECBlock:(void (^)(void))PER_SECBlock{
if (_timer==nil) {
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);

View File

@ -19,10 +19,10 @@
case 0://
{
// [[NSUserDefaults standardUserDefaults] setValue:@"http://apiyts.s1.natapp.cc/v1/" forKey:@"MainUrl"];
// [[NSUserDefaults standardUserDefaults] setValue:@"http://wsyts.s1.natapp.cc" forKey:@"gigasocketUrl"];
[[NSUserDefaults standardUserDefaults] setValue:@"https://api.mianmoshijian.com/v1/" forKey:@"MainUrl"];
[[NSUserDefaults standardUserDefaults] setValue:@"https://ws.mianmoshijian.com" forKey:@"gigasocketUrl"];
[[NSUserDefaults standardUserDefaults] setValue:@"http://apiyts.s1.natapp.cc/v1/" forKey:@"MainUrl"];
[[NSUserDefaults standardUserDefaults] setValue:@"http://wsyts.s1.natapp.cc" forKey:@"gigasocketUrl"];
// [[NSUserDefaults standardUserDefaults] setValue:@"https://api.mianmoshijian.com/v1/" forKey:@"MainUrl"];
// [[NSUserDefaults standardUserDefaults] setValue:@"https://ws.mianmoshijian.com" forKey:@"gigasocketUrl"];
}
break;

View File

@ -54,7 +54,6 @@
<string>是否允许此App使用您的相册</string>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>

View File

@ -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];
}

View File

@ -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];