187 lines
4.1 KiB
Objective-C
187 lines
4.1 KiB
Objective-C
//
|
||
// DDUtility.h
|
||
// DingDangApp
|
||
//
|
||
// Created by 触海 on 2023/12/11.
|
||
//
|
||
|
||
#import <Foundation/Foundation.h>
|
||
|
||
@class CTCarrier;
|
||
|
||
NS_ASSUME_NONNULL_BEGIN
|
||
|
||
@interface DDUtility : NSObject
|
||
|
||
|
||
@end
|
||
|
||
|
||
/*==============================*/
|
||
/* App Utilities */
|
||
/*==============================*/
|
||
@interface DDUtility (App)
|
||
/**
|
||
* 从YYMobile-Info.plist中读取字段
|
||
* @param key 键
|
||
* @return 值
|
||
*/
|
||
+ (id)DD_ValueInPlistForKey:(NSString *)key;
|
||
|
||
/*** 获取App版本号, 从plist从读取CFBundleShortVersion */
|
||
+ (NSString *)DD_AppVersion;
|
||
|
||
/*** 获取AppBuild号, 从plist中读取CFBundleVersion */
|
||
+ (NSString *)DD_AppBuild;
|
||
|
||
/*** 当前构建出的版本在svn中的版本号 */
|
||
+ (NSString *)DD_SvnVersion;
|
||
|
||
/**
|
||
获取appName
|
||
@return app的名称
|
||
*/
|
||
+ (NSString *)DD_AppName;
|
||
|
||
/**
|
||
* 获取bundle id
|
||
* @return bundle id
|
||
*/
|
||
+ (NSString *)DD_AppBundleId;
|
||
|
||
/*** 获取YYMobileFrameworkRes.bundle的URL */
|
||
+ (NSURL *)DD_URLForMobileFrameworkResourceBundle;
|
||
|
||
/*** 获取YYMobileFrameworkRes.bundle的路径 */
|
||
+ (NSString *)DD_PathForMobileFrameworkResourceBundle;
|
||
|
||
+ (BOOL)DD_AddSkipBackupAttributeToItemAtURL:(NSURL *)fileURL;
|
||
|
||
/**
|
||
* 获取当前的构建类型(DEBUG/RELEASE)
|
||
* @return 构建类型
|
||
*/
|
||
+ (NSString *)DD_BuildType;
|
||
|
||
/*** 获取平台渠道 */
|
||
+ (NSString *)DD_GetAppSource;
|
||
|
||
/*** 是否来自appstore */
|
||
+ (BOOL)DD_IsFromAppStore;
|
||
|
||
|
||
@end
|
||
|
||
|
||
/*==============================*/
|
||
/* Carrier Utilities */
|
||
/*==============================*/
|
||
@interface DDUtility (Carrier)
|
||
|
||
/**
|
||
获取设备唯一标识
|
||
@return 唯一标识
|
||
*/
|
||
+ (NSString *)DD_DeviceUniqueIdentification;
|
||
|
||
/*** 获取运营商 */
|
||
+ (CTCarrier *)DD_Carrier;
|
||
|
||
/*** 获取运营商类型 */
|
||
+ (NSInteger)DD_CarrierIdentifier;
|
||
|
||
/*** 获取运营商名称 */
|
||
+ (NSString *)DD_CarrierName;
|
||
|
||
/**
|
||
* 从CTCarrier对象获取网络类型
|
||
* @param carrier - CTCarrier对象
|
||
* @return CarrierType
|
||
*/
|
||
+ (NSInteger)DD_IdentifierOfCarrier:(CTCarrier *)carrier;
|
||
|
||
@end
|
||
|
||
|
||
/*==============================*/
|
||
/* Device Utilities */
|
||
/*==============================*/
|
||
@interface DDUtility (Device)
|
||
|
||
/*** 获取modelName, 如iPhone5,2 */
|
||
+ (NSString *)DD_ModelName;
|
||
|
||
/**
|
||
获取设备类型
|
||
@return 设备类型
|
||
*/
|
||
+ (NSString*)DD_ModelType;
|
||
|
||
/*** 获取系统版本 */
|
||
+ (NSString *)DD_SystemVersion;
|
||
|
||
/*** 获取当前设备的 IDFV,IDFV 在某些情况下会变,不建议将其作为设备标识 */
|
||
+ (NSString *)DD_IdentifierForVendor NS_AVAILABLE_IOS(6_0);
|
||
|
||
/**
|
||
* 获取当前的设备标识,会使用海度 SDK 中的 OpenUDID
|
||
* @return 海度 SDK 缓存的 OpenUDID
|
||
*/
|
||
+ (NSString *)DD_DeviceID;
|
||
|
||
/*** 获取当前网络状态 */
|
||
+ (NSInteger)DD_NetworkStatus;
|
||
|
||
/*** 获取当前IP地址 */
|
||
+ (NSString *)DD_IPAddress;
|
||
|
||
/**
|
||
* 获取当前IP地址
|
||
* @param preferIPv4 优先取IPv4的地址
|
||
*/
|
||
+ (NSString *)DD_IPAddress:(BOOL)preferIPv4;
|
||
|
||
/**
|
||
* 检查Camera是否可用, 可用则调用available; 若隐私设置中禁用了本app对相机
|
||
* 的访问, 则调用denied; 否则视为被限制, 调用restriction
|
||
* @param available 可用
|
||
* @param denied 不可用
|
||
* @param restriction 受限制
|
||
*/
|
||
+ (void)DD_CheckCameraAvailable:(void (^)(void))available denied:(void(^)(void))denied restriction:(void(^)(void))restriction;
|
||
|
||
/**
|
||
* 检查相册是否可用, 可用则调用available; 若隐私设置中禁用了本app对相册
|
||
* 的访问, 则调用denied; 否则视为被限制, 调用restriction
|
||
* @param available 可用
|
||
* @param denied 不可用
|
||
* @param restriction 受限制
|
||
*/
|
||
+ (void)DD_CheckAssetsLibrayAvailable:(void (^)(void))available denied:(void(^)(void))denied restriction:(void(^)(void))restriction;
|
||
|
||
/**
|
||
检查麦克风权限
|
||
@param resultBlock 结果处理block
|
||
*/
|
||
+ (void)DD_CheckMicPrivacy:(void(^)(BOOL succeed))resultBlock;
|
||
|
||
+ (NSString *)DD_MACAddresss;
|
||
+ (NSString *)DD_IDFA;
|
||
|
||
/**
|
||
* 初始化信令sdk,imsdk所用到的appName
|
||
* @return app name
|
||
*/
|
||
+ (NSString *)DD_AppName;
|
||
|
||
|
||
/**
|
||
当前设备是否低于, 等于 iPhone6
|
||
@return 当前设备是否低于, 等于 iPhone6
|
||
*/
|
||
+ (BOOL)DD_ISIphone6AndLow;
|
||
|
||
@end
|
||
|
||
NS_ASSUME_NONNULL_END
|