phizclip-uniapp-demo/finclip-uniapp-test/nativeplugins/MopSdk/ios/FinApplet.framework/Headers/FATClient.h

488 lines
18 KiB
C
Raw Normal View History

2022-06-08 11:57:35 +08:00
//
// FATClient.h
// FinApplet
//
// Created by Haley on 2019/3/27.
// Copyright © 2019 finogeeks. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "FATConfig.h"
#import "FATUIConfig.h"
#import "FATConstant.h"
#import "FATAppletInfo.h"
#import "FATAppletDelegate.h"
#import "IFATNativeViewManager.h"
2022-10-19 12:51:03 +08:00
#import "IFATXLogManager.h"
2022-06-08 11:57:35 +08:00
#import "FATAppletRequest.h"
#import "FATSearchAppletRequest.h"
#import "FATError.h"
2022-10-19 12:51:03 +08:00
#import "FATAppletConfig.h"
#import "FATAppletButtonOpenTypeDelegate.h"
#import "FATAppletLifeCycleDelegate.h"
#import "FATAppletMoreMenuDelegate.h"
#import "FATLocalAppletDelegate.h"
#import "FATAppletConfigurationDelegate.h"
#import "FATAppletWaterMaskAndScreenCaptureDelegate.h"
2022-06-08 11:57:35 +08:00
@interface FATClient : NSObject
@property (nonatomic, strong, readonly) FATConfig *config;
/// UI控件的样式配置
@property (nonatomic, strong, readonly) FATUIConfig *uiConfig;
@property (nonatomic, copy, readonly) NSString *version;
@property (nonatomic, assign, readonly) BOOL inited;
2022-10-19 12:51:03 +08:00
/// 日志记录快捷开关未配置记录等级时默认等级为FATLogLevelDebug
@property (nonatomic, assign, getter=isEnableLog) BOOL enableLog;
2022-06-08 11:57:35 +08:00
2022-10-19 12:51:03 +08:00
@property (nonatomic, weak) id<FATAppletDelegate> delegate __attribute__((deprecated("该属性(自2.37.13起)废弃请使用buttonOpenTypeDelegatelifeCycleDelegatemoreMenuDelegatelocalAppletDelegateconfigurationDelegatewaterMaskAndScreenCaptureDelegate等属性的能力")));
/**
buttonopen-type
*/
@property (nonatomic, weak) id<FATAppletButtonOpenTypeDelegate> buttonOpenTypeDelegate;
/**
*/
@property (nonatomic, weak) id<FATAppletLifeCycleDelegate> lifeCycleDelegate;
/**
*/
@property (nonatomic, weak) id<FATAppletMoreMenuDelegate> moreMenuDelegate;
/**
*/
@property (nonatomic, weak) id<FATLocalAppletDelegate> localAppletDelegate;
/**
,,H5 hook
*/
@property (nonatomic, weak) id<FATAppletConfigurationDelegate> configurationDelegate;
/**
*/
@property (nonatomic, weak) id<FATAppletWaterMaskAndScreenCaptureDelegate> waterMaskAndScreenCaptureDelegate;
2022-06-08 11:57:35 +08:00
/** nativeView 控制器*/
@property (nonatomic, strong) id<IFATNativeViewManager> nativeViewManager;
2022-10-19 12:51:03 +08:00
/** 日志管理器*/
@property (nonatomic, strong) id<IFATXLogManager> logManager;
2022-06-08 11:57:35 +08:00
+ (instancetype)sharedClient;
/// 初始化SDK
/// @param config 配置对象
/// @param error 初始化失败时返回的error
- (BOOL)initWithConfig:(FATConfig *)config error:(NSError **)error;
/// 初始化SDK
/// @param config 配置对象
/// @param uiConfig UI配置对象
/// @param error 初始化失败时返回的error
- (BOOL)initWithConfig:(FATConfig *)config uiConfig:(FATUIConfig *)uiConfig error:(NSError **)error;
/**
*/
- (void)clearMemoryCache;
/**
*/
- (void)clearMemeryApplet:(NSString *)appletId;
/**
*/
- (void)clearLocalApplets;
/**
@param appletId id
@return BOOL
*/
- (BOOL)removeAppletFromLocalCache:(NSString *)appletId;
/*
URL
@param URL URL
2022-10-19 12:51:03 +08:00
URL:${scheme}://applet/appid/${appId}?path=${path}&query=${encode过的query}&apiServer=${encode过的apiServer}
fatae55433be2f62915://applet/appid/617bb42f530fb30001509b27?path=/packages/d/index&query=key%3Dvalue%26name%3Dtable&apiServer=https%3A%2F%2Fwww.finclip.com
2022-06-08 11:57:35 +08:00
schemeappIdfatae55433be2f62915://applet/appid/617bb42f530fb30001509b27
2022-10-19 12:51:03 +08:00
schemefat+${SDKKey16md5};Appschemetarget->info->URL types
2022-06-08 11:57:35 +08:00
*/
- (BOOL)handleOpenURL:(NSURL *)URL;
/*
Universal Link
@param URL Universal Link URL
2022-10-19 12:51:03 +08:00
URL:${UniversalLink}?appid=${appId}&path=${path}&query=${encodequery}&apiServer=${encodeapiServer}
2022-06-08 11:57:35 +08:00
:https://www.finclip.com/mop/scattered-page/#/mop-download?appid=xx&query=xxx&path=xxx
UniversalLinkappIdhttps://www.finclip.com/mop/scattered-page/#/mop-download?appid=xx
*/
- (BOOL)handleOpenUniversalLinkURL:(NSURL *)URL;
2022-10-19 12:51:03 +08:00
/// 打开个人信息与权限管理页面
/// @param parentViewController 父控制器,打开的个人信息与权限管理页面会在父控制器上模态弹出
- (void)openPrivacyManage:(UIViewController *)parentViewController;
2022-06-08 11:57:35 +08:00
/// 当前正在使用的小程序
- (FATAppletInfo *)currentApplet;
#pragma mark - close applet
/**
@param animated
@param completion
*/
- (void)closeCurrentApplet:(BOOL)animated completion:(dispatch_block_t)completion;
/**
@param animated
@param completion
*/
- (void)closeApplet:(NSString *)appletId animated:(BOOL)animated completion:(dispatch_block_t)completion;
/**
@param completion
*/
- (void)closeAllAppletsWithCompletion:(dispatch_block_t)completion;
2022-10-19 12:51:03 +08:00
#pragma mark - update & download applets api
/**
@brief
@param appIds id
@param apiServer
@param complete
*/
- (void)downloadApplets:(NSArray *)appIds apiServer:(NSString *)apiServer complete:(void (^)(NSArray *results, FATError *error))complete;
2022-06-08 11:57:35 +08:00
#pragma mark - recent used applet api
/**
@return <FATAppletInfo>
*/
- (NSArray *)getAppletsFromLocalCache;
#pragma mark - extension api
/**
Api
@param extApiName api
@param handler
@return
*/
2022-10-19 12:51:03 +08:00
- (BOOL)registerExtensionApi:(NSString *)extApiName handler:(void (^)(FATAppletInfo *appletInfo, id param, FATExtensionApiCallback callback))handler;
2022-06-08 11:57:35 +08:00
/**
Api
2022-10-19 12:51:03 +08:00
@param syncExtApiName api
@param handler
2022-06-08 11:57:35 +08:00
@return
*/
2022-10-19 12:51:03 +08:00
- (BOOL)registerSyncExtensionApi:(NSString *)syncExtApiName handler:(NSDictionary * (^)(FATAppletInfo *appletInfo, id param))handler;
2022-06-08 11:57:35 +08:00
2022-10-19 12:51:03 +08:00
/**
HTML api
@param webApiName api
@param handler
*/
- (BOOL)fat_registerWebApi:(NSString *)webApiName handler:(void (^)(FATAppletInfo *appletInfo, id param, FATExtensionApiCallback callback))handler;
2022-06-08 11:57:35 +08:00
2022-10-19 12:51:03 +08:00
/**
HTMLJS
@param eventName
@param paramString json
@param pageId webView IDH5
@param handler error codeFATErrorCodeAppletNotFound
*/
- (void)fat_callWebApi:(NSString *)eventName paramString:(NSString *)paramString pageId:(NSNumber *)pageId handler:(void (^)(id result, NSError *error))handler;
/**
HTMLJSappletId
@param eventName
@param appletId id
@param paramString json
@param pageId webView IDH5
@param handler error codeFATErrorCodeForegroundAppletNotFoundappletId
*/
- (void)fat_callWebApi:(NSString *)eventName applet:(NSString *)appletId paramString:(NSString *)paramString pageId:(NSNumber *)pageId handler:(void (^)(id result, NSError *error))handler;
2022-06-08 11:57:35 +08:00
#pragma mark - tool api
/**
@param fileData
@param fileName
@return :finfile://tmp_b118e2e5e2618d4d8bbbb7b0a3ad806a.jpg
*/
- (NSString *)saveFile:(NSData *)fileData fileName:(NSString *)fileName;
/**
finfile://tmp_b118e2e5e2618d4d8bbbb7b0a3ad806a.jpg ,则会转为本地绝对路径
image/xxx.jpg
@param path
@return
*/
- (NSString *)fat_absolutePathWithPath:(NSString *)path;
/**
@param fileName
@return
*/
- (NSString *)getFileAddressWithfileName:(NSString *)fileName;
/**
5:4
*/
- (UIImage *)getCurrentAppletImage;
/**
H5URL
H5nil
*/
- (NSURL *)getCurrentWebViewURL;
/**
userAgent
*/
- (void)getCurrentWebViewUserAgentWithCompletion:(void (^)(NSString *userAgent, NSError *error))completionHandler;
/**
SM3
@param plainText
@return
*/
- (NSString *)getSM3String:(NSString *)plainText;
2022-10-19 12:51:03 +08:00
/**
appletId
@param appletId id
@return
*/
- (FATAppletInfo *)getAppletInfo:(NSString *)appletId;
2022-06-08 11:57:35 +08:00
#pragma mark - new apis
/// 启动小程序
/// @param request 启动的request
/// @param parentVC 父页面
/// @param completion 完成回调
/// @param closeCompletion 关闭小程序时的回调
- (void)startAppletWithRequest:(FATAppletRequest *)request
InParentViewController:(UIViewController *)parentVC
completion:(void (^)(BOOL result, FATError *error))completion
closeCompletion:(dispatch_block_t)closeCompletion;
/// 解密信息,并启动小程序
/// @param request 加密信息的request
/// @param parentVC 父页面
/// @param completion 完成回调
/// @param closeCompletion 关闭小程序时的回调
- (void)startAppletWithDecryptRequest:(FATAppletDecryptRequest *)request
InParentViewController:(UIViewController *)parentVC
completion:(void (^)(BOOL result, FATError *error))completion
closeCompletion:(dispatch_block_t)closeCompletion;
/// 二维码信息启动小程序
/// @param request 请求对象
/// @param parentVC 父页面
/// @param requestBlock 校验二维码的请求完成的回调
/// @param completion 完成的回调
/// @param closeCompletion 关闭小程序时的回调
- (void)startAppletWithQrCodeRequest:(FATAppletQrCodeRequest *)request
inParentViewController:(UIViewController *)parentVC
requestBlock:(void (^)(BOOL result, FATError *error))requestBlock
completion:(void (^)(BOOL result, FATError *error))completion
closeCompletion:(dispatch_block_t)closeCompletion;
/// 启动本地离线小程序
/// @param request 请求对象
/// @param parentVC 父页面
/// @param completion 完成回调
/// @param closeCompletion 关闭小程序时的回调
- (void)startLocalAppletWithRequest:(FATLocalAppletRequest *)request
inParentViewController:(UIViewController *)parentVC
completion:(void (^)(BOOL result, FATError *error))completion
closeCompletion:(dispatch_block_t)closeCompletion;
#pragma mark - search applet
/// 搜索小程序
/// @param request 搜索的request
/// @param completion 搜索结果
- (void)searchAppletsWithRequest:(FATSearchAppletRequest *)request
completion:(void (^)(NSDictionary *result, FATError *aError))completion;
/// 解析微信小程序二维码,得到凡泰小程序信息
/// @param qrCode 微信二维码
/// @param apiServer 解析服务器url
/// @param completion 结果回调
- (void)parseAppletInfoFromWXQrCode:(NSString *)qrCode apiServer:(NSString *)apiServer completion:(void (^)(FATAppletSimpleInfo *appInfo, FATError *aError))completion;
2022-10-19 12:51:03 +08:00
#pragma mark - deprecate api
/**
使FATTranstionStyleUp
SDK
@param appletId appId,
@param startParams nilkeypathqueryscene
:
@{
@"path":@"/pages/index/index",
@"query":@"key1=value1&key2=value2",
@"scene" : @"1001"
};
@param parentVC
@param completion error
*/
- (void)startRemoteApplet:(NSString *)appletId
startParams:(NSDictionary *)startParams
InParentViewController:(UIViewController *)parentVC
completion:(void (^)(BOOL result, NSError *error))completion __attribute__((deprecated("该api(自2.23.5起)废弃请使用startAppletWithRequest:InParentViewController:completion:closeCompletioncloseCompletion")));
/**
SDK
@param appletId appId,
@param startParams nilkeypathqueryscene
:
@{
@"path":@"/pages/index/index",
@"query":@"key1=value1&key2=value2",
@"scene" : @"1001"
};
@param parentVC
@param transitionStyle
@param completion error
*/
- (void)startRemoteApplet:(NSString *)appletId
startParams:(NSDictionary *)startParams
InParentViewController:(UIViewController *)parentVC
transitionStyle:(FATTranstionStyle)transitionStyle
completion:(void (^)(BOOL result, NSError *error))completion __attribute__((deprecated("该api(自2.23.5起)废弃请使用startAppletWithRequest:InParentViewController:completion:closeCompletioncloseCompletion")));
/**
SDK
@param appletId appId,
@param startParams nilkeypathqueryscene
:
@{
@"path":@"/pages/index/index",
@"query":@"key1=value1&key2=value2",
@"scene" : @"1001"
};
@param parentVC
@param transitionStyle
@param animated
@param completion error
@param closeCompletion
*/
- (void)startRemoteApplet:(NSString *)appletId
startParams:(NSDictionary *)startParams
InParentViewController:(UIViewController *)parentVC
transitionStyle:(FATTranstionStyle)transitionStyle
animated:(BOOL)animated
completion:(void (^)(BOOL result, NSError *error))completion
closeCompletion:(dispatch_block_t)closeCompletion __attribute__((deprecated("该api(自2.23.5起)废弃请使用startAppletWithRequest:InParentViewController:completion:closeCompletioncloseCompletion")));
/**
SDK
@param appletId appId,
@param sequence
@param startParams nilkeypathqueryscene
:
@{
@"path":@"/pages/index/index",
@"query":@"key1=value1&key2=value2",
@"scene" : @"1001"
};
@param parentVC
@param animated
@param completion error
*/
- (void)startRemoteApplet:(NSString *)appletId
sequence:(NSNumber *)sequence
startParams:(NSDictionary *)startParams
InParentViewController:(UIViewController *)parentVC
animated:(BOOL)animated
completion:(void (^)(BOOL result, NSError *error))completion __attribute__((deprecated("该api(自2.23.5起)废弃请使用startAppletWithRequest:InParentViewController:completion:closeCompletioncloseCompletion")));
/**
SDK
@param appletId appId,
@param sequence
@param startParams nilkeypathqueryscene
:
@{
@"path":@"/pages/index/index",
@"query":@"key1=value1&key2=value2",
@"scene" : @"1001"
};
@param parentVC
@param transitionStyle
@param animated
@param completion error
*/
- (void)startRemoteApplet:(NSString *)appletId
sequence:(NSNumber *)sequence
startParams:(NSDictionary *)startParams
InParentViewController:(UIViewController *)parentVC
transitionStyle:(FATTranstionStyle)transitionStyle
animated:(BOOL)animated
completion:(void (^)(BOOL result, NSError *error))completion __attribute__((deprecated("该api(自2.23.5起)废弃请使用startAppletWithRequest:InParentViewController:completion:closeCompletioncloseCompletion")));
/**
@param animated
*/
- (void)closeCurrentApplet:(BOOL)animated __attribute__((deprecated("该api(自2.27.1起)废弃请使用closeCurrentApplet:completion:")));
/**
@param animated
*/
- (void)closeApplet:(NSString *)appletId animated:(BOOL)animated __attribute__((deprecated("该api(自2.27.1起)废弃请使用closeApplet:animated:completion:")));
/**
*/
- (void)closeAllApplets __attribute__((deprecated("该api(自2.27.1起)废弃请使用closeAllApplets:completion:")));
- (BOOL)registerExtensionApi:(NSString *)extApiName handle:(void (^)(id param, FATExtensionApiCallback callback))handler __attribute__((deprecated("该api(自2.36.7起)废弃,请使用 -registerExtensionApi:handler:")));
- (BOOL)fat_registerWebApi:(NSString *)webApiName handle:(void (^)(id param, FATExtensionApiCallback callback))handler __attribute__((deprecated("该api(自2.36.7起)废弃,请使用 -fat_registerWebApi:handler:")));
2022-06-08 11:57:35 +08:00
@end