集成httpdns
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// ABSBootingProtection.h
|
||||
// AntilockBrakeSystem
|
||||
//
|
||||
// Created by 地风(ElonChan) on 16/5/16.
|
||||
// Copyright © 2016年 Ali. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef void (^ABSBoolCompletionHandler)(BOOL succeeded, NSError *error);
|
||||
typedef void (^ABSRepairBlock)(ABSBoolCompletionHandler completionHandler);
|
||||
typedef void (^ABSReportBlock)(NSUInteger crashCounts);
|
||||
|
||||
typedef NS_ENUM(NSInteger, ABSBootingProtectionStatus) {
|
||||
ABSBootingProtectionStatusNormal, /**< APP 启动正常 */
|
||||
ABSBootingProtectionStatusNormalChecking, /**< 正在检测是否会在特定时间内是否会 Crash,注意:检测状态下“连续启动崩溃计数”个数小于或等于上限值 */
|
||||
ABSBootingProtectionStatusNeedFix, /**< APP 出现连续启动 Crash,需要采取修复措施 */
|
||||
ABSBootingProtectionStatusFixing, /**< APP 出现连续启动 Crash,正在修复中... */
|
||||
};
|
||||
|
||||
/**
|
||||
* 启动连续 crash 保护。
|
||||
* 启动后 `_crashOnLaunchTimeIntervalThreshold` 秒内 crash,反复超过 `_continuousCrashOnLaunchNeedToReport` 次则上报日志,超过 `_continuousCrashOnLaunchNeedToFix` 则启动修复操作。
|
||||
*/
|
||||
@interface ABSBootingProtection : NSObject
|
||||
|
||||
/**
|
||||
* 启动连续 crash 保护方法。
|
||||
* 前置条件:在 App 启动时注册 crash 处理函数,在 crash 时调用[ABSBootingProtection addCrashCountIfNeeded]。
|
||||
* 启动后一定时间内(`crashOnLaunchTimeIntervalThreshold`秒内)crash,反复超过一定次数(`continuousCrashOnLaunchNeedToReport`次)则上报日志,超过一定次数(`continuousCrashOnLaunchNeedToFix`次)则启动修复程序;在一定时间内(`crashOnLaunchTimeIntervalThreshold`秒) 秒后若没有 crash 将“连续启动崩溃计数”计数置零。
|
||||
`reportBlock` 上报逻辑,
|
||||
`repairtBlock` 修复逻辑,完成后执行 `[self setCrashCount:0]`
|
||||
|
||||
*/
|
||||
- (void)launchContinuousCrashProtect;
|
||||
|
||||
/*!
|
||||
* 当前启动Crash的状态
|
||||
*/
|
||||
@property (nonatomic, assign, readonly) ABSBootingProtectionStatus bootingProtectionStatus;
|
||||
|
||||
/*!
|
||||
* 达到需要执行上报操作的“连续启动崩溃计数”个数。
|
||||
*/
|
||||
@property (nonatomic, assign, readonly) NSUInteger continuousCrashOnLaunchNeedToReport;
|
||||
|
||||
/*!
|
||||
* 达到需要执行修复操作的“连续启动崩溃计数”个数。
|
||||
*/
|
||||
@property (nonatomic, assign, readonly) NSUInteger continuousCrashOnLaunchNeedToFix;
|
||||
|
||||
/*!
|
||||
* APP 启动后经过多少秒,可以将“连续启动崩溃计数”清零
|
||||
*/
|
||||
@property (nonatomic, assign, readonly) NSTimeInterval crashOnLaunchTimeIntervalThreshold;
|
||||
|
||||
/*!
|
||||
* 借助 context 可以让多个模块注册事件,并且事件 block 能独立执行,互不干扰。
|
||||
*/
|
||||
@property (nonatomic, copy, readonly) NSString *context;
|
||||
|
||||
/*!
|
||||
* @details 启动后kCrashOnLaunchTimeIntervalThreshold秒内crash,反复超过continuousCrashOnLaunchNeedToReport次则上报日志,超过continuousCrashOnLaunchNeedToFix则启动修复程序;当所有操作完成后,执行 completion。在 crashOnLaunchTimeIntervalThreshold 秒后若没有 crash 将 kContinuousCrashOnLaunchCounterKey 计数置零。
|
||||
* @param context 借助 context 可以让多个模块注册事件,并且事件 block 能独立执行,互不干扰。
|
||||
*/
|
||||
- (instancetype)initWithContinuousCrashOnLaunchNeedToReport:(NSUInteger)continuousCrashOnLaunchNeedToReport
|
||||
continuousCrashOnLaunchNeedToFix:(NSUInteger)continuousCrashOnLaunchNeedToFix
|
||||
crashOnLaunchTimeIntervalThreshold:(NSTimeInterval)crashOnLaunchTimeIntervalThreshold
|
||||
context:(NSString *)context;
|
||||
/*!
|
||||
* 当前“连续启动崩溃“的状态
|
||||
*/
|
||||
+ (ABSBootingProtectionStatus)bootingProtectionStatusWithContext:(NSString *)context continuousCrashOnLaunchNeedToFix:(NSUInteger)continuousCrashOnLaunchNeedToFix;
|
||||
|
||||
/*!
|
||||
* 设置上报逻辑,参数 crashCounts 为启动连续 crash 次数
|
||||
*/
|
||||
- (void)setReportBlock:(ABSReportBlock)reportBlock;
|
||||
|
||||
/*!
|
||||
* 设置修复逻辑
|
||||
*/
|
||||
- (void)setRepairBlock:(ABSRepairBlock)repairtBlock;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// ABSUncaughtExceptionHandler.h
|
||||
// AntilockBrakeSystem
|
||||
//
|
||||
// Created by 地风(ElonChan) on 16/5/16.
|
||||
// Copyright © 2016年 Ali. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
typedef void (^ABSUncaughtExceptionCallback)(NSException *exception);
|
||||
|
||||
@interface ABSUncaughtExceptionHandler : NSObject
|
||||
|
||||
+ (void)registerExceptionHandlerWithCallback:(ABSUncaughtExceptionCallback)callback;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// ABSUtil.h
|
||||
// AntilockBrakeSystem
|
||||
//
|
||||
// Created by 地风(ElonChan) on 16/5/16.
|
||||
// Copyright © 2016年 Ali. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface ABSUtil : NSObject
|
||||
|
||||
// 设置日志逻辑
|
||||
+ (void)setLogger:(void (^)(NSString *))logger;
|
||||
|
||||
+ (void)Logger:(NSString *)log;
|
||||
|
||||
+ (BOOL)isValidString:(id)notValidString;
|
||||
|
||||
+ (BOOL)isWhiteListClass:(Class)class;
|
||||
|
||||
+ (void)deleteCacheWithfilePathsToRemove:(NSArray *)filePathsToRemove;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// AlicloudHTTPDNSMini.h
|
||||
// AlicloudUtils
|
||||
//
|
||||
// Created by ryan on 3/6/2016.
|
||||
// Copyright © 2016 Ali. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef AlicloudHTTPDNSMini_h
|
||||
#define AlicloudHTTPDNSMini_h
|
||||
|
||||
#define HTTPDNSMINI_RESOLVED_NOTIFY @"HTTPDNSMiniResolvedNotify"
|
||||
|
||||
@interface AlicloudHTTPDNSMini : NSObject
|
||||
|
||||
+ (AlicloudHTTPDNSMini *)sharedInstance;
|
||||
- (NSArray *)getIpsByHostAsync:(NSString *)host;
|
||||
- (void)setPreResolveHosts:(NSArray *)hosts;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* AlicloudHTTPDNSMini_h */
|
||||
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2000-2015 Apple Inc. All rights reserved.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
|
||||
*
|
||||
* This file contains Original Code and/or Modifications of Original Code
|
||||
* as defined in and that are subject to the Apple Public Source License
|
||||
* Version 2.0 (the 'License'). You may not use this file except in
|
||||
* compliance with the License. The rights granted to you under the License
|
||||
* may not be used to create, or enable the creation or redistribution of,
|
||||
* unlawful or unlicensed copies of an Apple operating system, or to
|
||||
* circumvent, violate, or enable the circumvention or violation of, any
|
||||
* terms of an Apple operating system software license agreement.
|
||||
*
|
||||
* Please obtain a copy of the License at
|
||||
* http://www.opensource.apple.com/apsl/ and read it before using this file.
|
||||
*
|
||||
* The Original Code and all software distributed under the License are
|
||||
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
|
||||
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
|
||||
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
|
||||
* Please see the License for the specific language governing rights and
|
||||
* limitations under the License.
|
||||
*
|
||||
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1980, 1986, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)route.h 8.3 (Berkeley) 4/19/94
|
||||
* $FreeBSD: src/sys/net/route.h,v 1.36.2.1 2000/08/16 06:14:23 jayanth Exp $
|
||||
*/
|
||||
|
||||
|
||||
#ifndef AlicloudIPv6Adapter_h
|
||||
#define AlicloudIPv6Adapter_h
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface AlicloudIPv6Adapter : NSObject
|
||||
|
||||
+ (instancetype)getInstance;
|
||||
|
||||
/**
|
||||
* 判断当前是否为IPv6-Only网络
|
||||
*/
|
||||
- (BOOL)isIPv6OnlyNetwork;
|
||||
|
||||
/**
|
||||
* 手动刷新IPv6-Only网络的判定
|
||||
*/
|
||||
- (BOOL)reResolveIPv6OnlyStatus;
|
||||
|
||||
/**
|
||||
IPv4 > IPv6地址转换\n
|
||||
- 输入IPv4地址无效,返回原地址
|
||||
- IPv6-Only网络,返回转换后的IPv6地址
|
||||
- 非IPv6-Only网络,返回原地址
|
||||
|
||||
@param addr IPv4地址
|
||||
@return 转换后的v6地址 或 原地址
|
||||
*/
|
||||
- (NSString *)handleIpv4Address:(NSString *)addr;
|
||||
|
||||
/**
|
||||
* 判断是否为IPv4地址
|
||||
*/
|
||||
- (BOOL)isIPv4Address:(NSString *)addr;
|
||||
|
||||
/**
|
||||
* 判断是否为IPv6地址
|
||||
*/
|
||||
- (BOOL)isIPv6Address:(NSString *)addr;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* AlicloudIPv6Adapter_h */
|
||||
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// AlicloudReachabilityManager.h
|
||||
//
|
||||
// Created by 亿刀 on 14-1-9.
|
||||
// Edited by junmo on 15-5-16
|
||||
// Copyright (c) 2014年 Twitter. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
|
||||
|
||||
#define ALICLOUD_NETWOEK_STATUS_NOTIFY @"AlicloudNetworkStatusChangeNotify"
|
||||
|
||||
typedef enum {
|
||||
AlicloudNotReachable = 0,
|
||||
AlicloudReachableViaWiFi,
|
||||
AlicloudReachableVia2G,
|
||||
AlicloudReachableVia3G,
|
||||
AlicloudReachableVia4G
|
||||
} AlicloudNetworkStatus;
|
||||
|
||||
@interface AlicloudReachabilityManager : NSObject
|
||||
|
||||
/**
|
||||
* 获取Reachability单例对象
|
||||
*/
|
||||
+ (AlicloudReachabilityManager *)shareInstance;
|
||||
|
||||
/**
|
||||
* 获取Reachability单例对象,为保证全局维护一个netInfo实例,可从外部传入netInfo对象的引用
|
||||
* warn: netInfo多次实例化,有一定几率crash
|
||||
*
|
||||
*/
|
||||
+ (AlicloudReachabilityManager *)shareInstanceWithNetInfo:(CTTelephonyNetworkInfo *)netInfo;
|
||||
|
||||
/**
|
||||
* 返回当前网络状态(同步调用,可能会阻塞调用线程)
|
||||
*/
|
||||
- (AlicloudNetworkStatus)currentNetworkStatus;
|
||||
|
||||
/**
|
||||
* 返回之前网络状态
|
||||
*/
|
||||
- (AlicloudNetworkStatus)preNetworkStatus;
|
||||
|
||||
/**
|
||||
* 检测网络是否连通(同步调用,阻塞调用线程)
|
||||
*/
|
||||
- (BOOL)checkInternetConnection;
|
||||
|
||||
/**
|
||||
* 检测Wifi网络是否联通
|
||||
*/
|
||||
- (BOOL)isReachableViaWifi;
|
||||
|
||||
/**
|
||||
* 检测蜂窝网络是否联通
|
||||
*/
|
||||
- (BOOL)isReachableViaWWAN;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// AlicloudReport.h
|
||||
// AlicloudUtils
|
||||
//
|
||||
// Created by ryan on 3/6/2016.
|
||||
// Copyright © 2016 Ali. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef AlicloudReport_h
|
||||
#define AlicloudReport_h
|
||||
|
||||
extern const NSString *EXT_INFO_KEY_VERSION;
|
||||
extern const NSString *EXT_INFO_KEY_PACKAGE;
|
||||
|
||||
// SDK标识
|
||||
typedef NS_ENUM(NSInteger, AMSService) {
|
||||
AMSMAN = 0,
|
||||
AMSHTTPDNS,
|
||||
AMSMPUSH,
|
||||
AMSMAC,
|
||||
AMSAPI,
|
||||
AMSHOTFIX,
|
||||
AMSFEEDBACK,
|
||||
AMSIM
|
||||
};
|
||||
|
||||
// 上报状态
|
||||
typedef NS_ENUM(NSInteger, AMSReportStatus) {
|
||||
AMS_UNREPORTED_STATUS,
|
||||
AMS_REPORTED_STATUS
|
||||
};
|
||||
|
||||
@interface AlicloudReport : NSObject
|
||||
|
||||
/**
|
||||
* 异步上报活跃设备统计
|
||||
*
|
||||
@param tag SDK标识
|
||||
*/
|
||||
+ (void)statAsync:(AMSService)tag;
|
||||
|
||||
/**
|
||||
* 异步上报活跃设备统计并携带附加信息
|
||||
*
|
||||
@param tag SDK标识
|
||||
@param extInfo 附加上报信息 { EXT_INFO_KEY_VERSION :"x.x.x", EXT_INFO_KEY_PACKAGE: "xxx"}
|
||||
*/
|
||||
+ (void)statAsync:(AMSService)tag extInfo:(NSDictionary *)extInfo;
|
||||
|
||||
/**
|
||||
* 获取指定SDK标识上报状态
|
||||
*
|
||||
@param tag SDK标识
|
||||
@return 返回上报状态
|
||||
*/
|
||||
+ (AMSReportStatus)getReportStatus:(AMSService)tag;
|
||||
|
||||
/**
|
||||
* 获取上报状态(兼容老版本接口)
|
||||
*
|
||||
@param tag SDK标识
|
||||
@return YES:已经上报 NO:没有上报
|
||||
*/
|
||||
+ (BOOL)isDeviceReported:(AMSService)tag;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* AlicloudReport_h */
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// AlicloudTracker.h
|
||||
// AlicloudUtils
|
||||
//
|
||||
// Created by junmo on 2017/6/30.
|
||||
// Copyright © 2017年 Ali. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef AlicloudTracker_h
|
||||
#define AlicloudTracker_h
|
||||
|
||||
@interface AlicloudTracker : NSObject
|
||||
|
||||
@property (nonatomic, copy) NSString *sdkId;
|
||||
@property (nonatomic, copy) NSString *sdkVersion;
|
||||
|
||||
/**
|
||||
设置Tracker的通用打点属性,每次上报都携带该参数
|
||||
|
||||
@param key 通用属性Key
|
||||
@param value 通用属性Value
|
||||
*/
|
||||
- (void)setGlobalProperty:(NSString *)key value:(NSString *)value;
|
||||
|
||||
/**
|
||||
删除Tracker通用打点属性
|
||||
|
||||
@param key 通用属性Key
|
||||
*/
|
||||
- (void)removeGlobalProperty:(NSString *)key;
|
||||
|
||||
/**
|
||||
自定义打点上报
|
||||
|
||||
@param eventName 事件名
|
||||
@param duration 时长
|
||||
@param properties 额外参数
|
||||
*/
|
||||
- (void)sendCustomHit:(NSString *)eventName
|
||||
duration:(long long)duration
|
||||
properties:(NSDictionary *)properties;
|
||||
|
||||
@end
|
||||
#endif /* AlicloudTracker_h */
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// AlicloudTrackerManager.h
|
||||
// AlicloudUtils
|
||||
//
|
||||
// Created by junmo on 2017/7/4.
|
||||
// Copyright © 2017年 Ali. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef AlicloudTrackerManager_h
|
||||
#define AlicloudTrackerManager_h
|
||||
|
||||
#import "AlicloudTracker.h"
|
||||
|
||||
@interface AlicloudTrackerManager : NSObject
|
||||
|
||||
/**
|
||||
获取上报通道管理器对象,并初始化UT
|
||||
|
||||
@return 管理器对象
|
||||
*/
|
||||
+ (instancetype)getInstance;
|
||||
|
||||
/**
|
||||
根据SDK标识和版本号获取上报通道
|
||||
|
||||
@param sdkId SDK标识
|
||||
@param version SDK版本号
|
||||
@return 上报通道对象
|
||||
*/
|
||||
- (AlicloudTracker *)getTrackerBySdkId:(NSString *)sdkId version:(NSString *)version;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* AlicloudTrackerManager_h */
|
||||
@@ -0,0 +1,27 @@
|
||||
//
|
||||
// AlicloudUtils.h
|
||||
// AlicloudUtils
|
||||
//
|
||||
// Created by lingkun on 16/5/16.
|
||||
// Copyright © 2016年 Ali. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#define ALICLOUDUTILS_VERSION @"1.3.9-m1"
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <AlicloudUtils/PublicHeader.h>
|
||||
|
||||
#import <AlicloudUtils/AlicloudReachabilityManager.h>
|
||||
#import <AlicloudUtils/EMASSecurityModeManager.h>
|
||||
#import <AlicloudUtils/EMASSecurityModeCommon.h>
|
||||
#import <AlicloudUtils/AlicloudTrackerManager.h>
|
||||
#import <AlicloudUtils/AlicloudIPv6Adapter.h>
|
||||
#import <AlicloudUtils/AlicloudHTTPDNSMini.h>
|
||||
#import <AlicloudUtils/AntilockBrakeSystem.h>
|
||||
#import <AlicloudUtils/EMASBeaconService.h>
|
||||
#import <AlicloudUtils/AlicloudTracker.h>
|
||||
#import <AlicloudUtils/AlicloudReport.h>
|
||||
#import <AlicloudUtils/EMASOptions.h>
|
||||
#import <AlicloudUtils/EMASTools.h>
|
||||
#import <AlicloudUtils/UtilLog.h>
|
||||
@@ -0,0 +1,11 @@
|
||||
//
|
||||
// AntilockBrakeSystem.h
|
||||
// AntilockBrakeSystem
|
||||
//
|
||||
// Created by 地风(ElonChan) on 16/5/16.
|
||||
// Copyright © 2016年 Ali. All rights reserved.
|
||||
//
|
||||
|
||||
#import "ABSUncaughtExceptionHandler.h"
|
||||
#import "ABSBootingProtection.h"
|
||||
#import "ABSUtil.h"
|
||||
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// EMASBeaconService.h
|
||||
// AlicloudBeacon
|
||||
//
|
||||
// Created by junmo on 2017/7/6.
|
||||
// Copyright © 2017年 junmo. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef EMASBeaconService_h
|
||||
#define EMASBeaconService_h
|
||||
|
||||
@interface EMASBeaconConfiguration : NSObject
|
||||
|
||||
- (instancetype)initWithData:(NSData *)data;
|
||||
- (id)getConfigureItemByKey:(NSString *)key;
|
||||
|
||||
@end
|
||||
|
||||
typedef void (^AlicloudBeaconCallbackHandler)(BOOL res, NSError *error);
|
||||
|
||||
@interface EMASBeaconService : NSObject
|
||||
|
||||
- (instancetype)initWithAppKey:(NSString *)appKey
|
||||
appSecret:(NSString *)appSecret
|
||||
SDKVersion:(NSString *)SDKVersion
|
||||
SDKID:(NSString *)SDKID;
|
||||
|
||||
- (instancetype)initWithAppKey:(NSString *)appKey
|
||||
appSecret:(NSString *)appSecret
|
||||
SDKVersion:(NSString *)SDKVersion
|
||||
SDKID:(NSString *)SDKID
|
||||
extension:(NSDictionary *)extension;
|
||||
|
||||
- (void)enableLog:(BOOL)enabled;
|
||||
- (BOOL)isLogEnabled;
|
||||
|
||||
//- (void)getBeaconConfigByKey:(NSString *)key
|
||||
// completionHandler:(void(^)(EMASBeaconConfiguration *configuration, NSError *error))completionHandler;
|
||||
|
||||
- (void)getBeaconConfigStringByKey:(NSString *)key
|
||||
completionHandler:(void(^)(NSString *result, NSError *error))completionHandler;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* EMASBeaconService_h */
|
||||
@@ -0,0 +1,38 @@
|
||||
//
|
||||
// EMASOptions.h
|
||||
// AlicloudUtils
|
||||
//
|
||||
// Created by junmo on 2018/3/16.
|
||||
// Copyright © 2018年 Ali. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef EMASOptions_h
|
||||
#define EMASOptions_h
|
||||
|
||||
@interface EMASOptionSDKServiceItem : NSObject
|
||||
|
||||
@property (nonatomic, copy) NSString *sdkId;
|
||||
@property (nonatomic, copy) NSString *version;
|
||||
@property (nonatomic, assign) NSNumber *status;
|
||||
|
||||
@end
|
||||
|
||||
@interface EMASOptions : NSObject
|
||||
|
||||
@property (nonatomic, copy, readonly) NSString *emasAppKey;
|
||||
@property (nonatomic, copy, readonly) NSString *emasAppSecret;
|
||||
@property (nonatomic, copy, readonly) NSString *emasBundleId;
|
||||
@property (nonatomic, copy, readonly) NSString *hotfixIdSecret;
|
||||
@property (nonatomic, copy, readonly) NSString *hotfixRsaSecret;
|
||||
@property (nonatomic, copy, readonly) NSString *tlogRsaSecret;
|
||||
@property (nonatomic, copy, readonly) NSString *appmonitorRsaSecret;
|
||||
@property (nonatomic, copy, readonly) NSString *httpdnsAccountId;
|
||||
@property (nonatomic, copy, readonly) NSString *httpdnsSecretKey;
|
||||
|
||||
+ (EMASOptions *)defaultOptions;
|
||||
- (NSString *)optionByConfigKey:(NSString *)key;
|
||||
- (EMASOptionSDKServiceItem *)sdkServiceItemForSdkId:(NSString *)sdkId;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* EMASOptions_h */
|
||||
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// EMASSecurityModeCommon.h
|
||||
// AlicloudUtils
|
||||
//
|
||||
// Created by junmo on 2018/3/11.
|
||||
// Copyright © 2018年 Ali. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef EMASSecurityModeCommon_h
|
||||
#define EMASSecurityModeCommon_h
|
||||
|
||||
typedef void (^SDKCheckSuccessHandler)(void);
|
||||
typedef void (^SDKCheckCrashHandler)(NSUInteger crashCount);
|
||||
|
||||
#endif /* EMASSecurityModeCommon_h */
|
||||
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// EMASSecurityModeManager.h
|
||||
// AlicloudUtils
|
||||
//
|
||||
// Created by junmo on 2018/3/10.
|
||||
// Copyright © 2018年 Ali. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef EMASSecurityModeManager_h
|
||||
#define EMASSecurityModeManager_h
|
||||
|
||||
#import "EMASSecurityModeCommon.h"
|
||||
|
||||
@interface EMASSecurityModeManager : NSObject
|
||||
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
- (void)registerSDKComponentAndStartCheck:(NSString *)sdkId
|
||||
sdkVersion:(NSString *)sdkVersion
|
||||
appKey:(NSString *)appKey
|
||||
appSecret:(NSString *)appSecret
|
||||
sdkCrashThreshold:(NSUInteger)crashTimesThreshold
|
||||
onSuccess:(SDKCheckSuccessHandler)successHandler
|
||||
onCrash:(SDKCheckCrashHandler)crashHandler;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* EMASSecurityModeManager_h */
|
||||
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// EMASTools.h
|
||||
// AlicloudUtils
|
||||
//
|
||||
// Created by junmo on 2018/3/14.
|
||||
// Copyright © 2018年 Ali. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef EMASTools_h
|
||||
#define EMASTools_h
|
||||
|
||||
#define EMAS_SYNC_EXECUTE_BY_KEY(key, executor)\
|
||||
[EMASTools syncExecuteBlockByKey:key block:executor];\
|
||||
|
||||
#define EMAS_SYNC_EXECUTE_BY_QUEUE(queue, executor)\
|
||||
[EMASTools syncExecuteBlockByQueue:queue block:executor];\
|
||||
|
||||
@interface EMASTools : NSObject
|
||||
|
||||
+ (BOOL)isValidString:(id)obj;
|
||||
+ (BOOL)isValidDictionary:(id)obj;
|
||||
+ (BOOL)isValidArray:(id)obj;
|
||||
|
||||
+ (NSString *)md5:(NSString *)str;
|
||||
+ (NSString *)sha1:(NSString *)str;
|
||||
+ (NSString *)hmacSha1:(NSString *)str key:(NSString *)key;
|
||||
+ (NSString *)base64EncodedWithString:(NSString *)str;
|
||||
+ (NSString *)base64DecodedWithString:(NSString *)base64Str;
|
||||
+ (NSData *)aes128CBCEncrypt:(NSData *)data key:(NSData *)key iv:(char *)iv;
|
||||
+ (NSString *)URLEncodedString:(NSString *)str;
|
||||
|
||||
+ (NSString *)convertObjectToJsonString:(id)obj;
|
||||
+ (id)convertJsonStringToObject:(NSString *)jsonStr;
|
||||
+ (id)convertJsonDataToObject:(NSData *)jsonData;
|
||||
|
||||
+ (NSString *)convertDateToGMT0String:(NSDate *)date;
|
||||
+ (NSString *)convertDateToGMT8String:(NSDate *)date;
|
||||
|
||||
+ (void)swizzleClassMethod:(Class)cls originSEL:(SEL)originSEL swizzleSEL:(SEL)swizzleSEL;
|
||||
+ (void)swizzleInstanceMethod:(Class)cls originSEL:(SEL)originSEL swizzleSEL:(SEL)swizzleSEL;
|
||||
|
||||
+ (BOOL)isIPv4Address:(NSString *)addr;
|
||||
+ (BOOL)isIPv6Address:(NSString *)addr;
|
||||
|
||||
+ (dispatch_queue_t)createQueueIfNotExists:(NSString *)key;
|
||||
+ (void)syncExecuteBlockByKey:(NSString *)key block:(void(^)(void))block;
|
||||
+ (void)syncExecuteBlockByQueue:(dispatch_queue_t)queue block:(void(^)(void))block;
|
||||
|
||||
+ (NSString *)bundleIdForApp;
|
||||
+ (NSString *)deviceBrand;
|
||||
+ (NSString *)deviceModel;
|
||||
|
||||
+ (void)threadWaitForSec:(double)sec;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* EMASTools_h */
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// UtilLog.h
|
||||
// AlicloudUtils
|
||||
//
|
||||
// Created by junmo on 16/11/24.
|
||||
// Copyright © 2016年 Ali. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef UtilLog_h
|
||||
#define UtilLog_h
|
||||
|
||||
@interface UtilLog : NSObject
|
||||
|
||||
+ (void)enableLog;
|
||||
|
||||
+ (BOOL)isLogEnabled;
|
||||
|
||||
#define UtilLogD(tag, frmt, ...)\
|
||||
if ([UtilLog isLogEnabled]) {\
|
||||
NSLog(@"[%@]-[D]: %@", tag, [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
|
||||
}
|
||||
|
||||
#define UtilLogI(tag, frmt, ...)\
|
||||
if ([UtilLog isLogEnabled]) {\
|
||||
NSLog(@"[%@]-[I]: %@", tag, [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
|
||||
}
|
||||
|
||||
#define UtilLogE(tag, frmt, ...)\
|
||||
if ([UtilLog isLogEnabled]) {\
|
||||
NSLog(@"[%@]-[E]: %@", tag, [NSString stringWithFormat:(frmt), ##__VA_ARGS__]);\
|
||||
}
|
||||
@end
|
||||
|
||||
#endif /* UtilLog_h */
|
||||
Reference in New Issue
Block a user