add jpush 启动广告页
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// GiGaFileNanager.h
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/8/22.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
@interface GiGaFileNanager : NSObject
|
||||
|
||||
+(GiGaFileNanager*)shareInstance;
|
||||
- (BOOL)isFileExistWithFilePath:(NSString *)filePath;
|
||||
-(NSString *)getFilePathWithImageName:(NSString *)imageName;
|
||||
-(void)removeItemAtPath:(NSString *)filePath;
|
||||
- (void)saveAdImageWithUrl:(NSString *)imageUrl imageName:(NSString *)imageName success:(void (^)(void))success
|
||||
failure:(void (^)(NSError *err))failure;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// GiGaFileNanager.m
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/8/22.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import "GiGaFileNanager.h"
|
||||
|
||||
@implementation GiGaFileNanager
|
||||
|
||||
+ (GiGaFileNanager *)shareInstance
|
||||
{
|
||||
static GiGaFileNanager *manager = nil;
|
||||
static dispatch_once_t once;
|
||||
dispatch_once(&once, ^{
|
||||
manager = [[self alloc] init];
|
||||
});
|
||||
|
||||
return manager;
|
||||
}
|
||||
|
||||
- (BOOL)isFileExistWithFilePath:(NSString *)filePath
|
||||
{
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
BOOL isDirectory = FALSE;
|
||||
return [fileManager fileExistsAtPath:filePath isDirectory:&isDirectory];
|
||||
}
|
||||
|
||||
-(NSString *)getFilePathWithImageName:(NSString *)imageName{
|
||||
|
||||
if (imageName) {
|
||||
|
||||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory,NSUserDomainMask, YES);
|
||||
NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:imageName];
|
||||
return filePath;
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
-(void)removeItemAtPath:(NSString *)filePath{
|
||||
NSFileManager *filManager = [NSFileManager defaultManager];
|
||||
[filManager removeItemAtPath:filePath error:nil];
|
||||
}
|
||||
|
||||
- (void)saveAdImageWithUrl:(NSString *)imageUrl imageName:(NSString *)imageName success:(void (^)(void))success
|
||||
failure:(void (^)(NSError *err))failure{
|
||||
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
|
||||
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:imageUrl]];
|
||||
|
||||
UIImage *image = [UIImage imageWithData:data];
|
||||
NSString *filePath = [self getFilePathWithImageName:imageName]; // 保存文件的名称
|
||||
if ([UIImagePNGRepresentation(image) writeToFile:filePath atomically:YES]) {
|
||||
//NSLog(@"保存成功");
|
||||
|
||||
success();
|
||||
|
||||
}else{
|
||||
//NSLog(@"保存失败");
|
||||
NSError *err;
|
||||
failure(err);
|
||||
} });
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -15,8 +15,9 @@
|
||||
|
||||
+(void)saveUserId:(NSString *)userId;
|
||||
+(NSString *)getCurentUserId;
|
||||
+(void)removeUserId;
|
||||
+(void)removeUserId;//退出登录
|
||||
+(BOOL)isUserLogin;
|
||||
|
||||
/**
|
||||
保存用户表版本号
|
||||
*/
|
||||
|
||||
@@ -30,6 +30,7 @@ NSString *const kShowAppGuard = @"ShowAppGuard";
|
||||
+(void)removeUserId{
|
||||
|
||||
UD_REMOVE_KEY(GIGADEFAULTKEY_USERID);
|
||||
|
||||
}
|
||||
|
||||
+(BOOL)isUserLogin{
|
||||
|
||||
Reference in New Issue
Block a user