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

407 lines
14 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"
#import "FATAppletRequest.h"
#import "FATSearchAppletRequest.h"
#import "FATError.h"
@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;
@property (nonatomic, assign) BOOL enableLog;
@property (nonatomic, weak) id<FATAppletDelegate> delegate;
/** nativeView 控制器*/
@property (nonatomic, strong) id<IFATNativeViewManager> nativeViewManager;
+ (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
URL:${scheme}://applet/appid/${appId}?path=${path}&query=${encode过的queryDict}&apiServer=${apiServer}
fatae55433be2f62915://applet/appid/617bb42f530fb30001509b27?path=/packages/d/index&query=key%3Dvalue%26name%3Dtable&apiServer=https://www.finclip.com/
schemeappIdfatae55433be2f62915://applet/appid/617bb42f530fb30001509b27
schemefat+${appSecret};Appschemetarget->info->URL types
*/
- (BOOL)handleOpenURL:(NSURL *)URL;
/*
Universal Link
@param URL Universal Link URL
URL:${UniversalLink}?appid=${appId}&path=${path}&query=${encodequeryDict}&apiServer=${apiServer}
: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;
#pragma mark - start applet 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;
/**
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;
/**
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;
/**
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;
/**
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;
/// 当前正在使用的小程序
- (FATAppletInfo *)currentApplet;
#pragma mark - close applet
/**
@param animated
*/
- (void)closeCurrentApplet:(BOOL)animated;
/**
@param animated
@param completion
*/
- (void)closeCurrentApplet:(BOOL)animated completion:(dispatch_block_t)completion;
/**
@param animated
*/
- (void)closeApplet:(NSString *)appletId animated:(BOOL)animated;
/**
@param animated
@param completion
*/
- (void)closeApplet:(NSString *)appletId animated:(BOOL)animated completion:(dispatch_block_t)completion;
/**
*/
- (void)closeAllApplets;
/**
@param completion
*/
- (void)closeAllAppletsWithCompletion:(dispatch_block_t)completion;
#pragma mark - recent used applet api
/**
@return <FATAppletInfo>
*/
- (NSArray *)getAppletsFromLocalCache;
#pragma mark - extension api
/**
Api
@param extApiName api
@param handler
@return
*/
- (BOOL)registerExtensionApi:(NSString *)extApiName handle:(void (^)(id param, FATExtensionApiCallback callback))handler;
/**
Api
@param extApiName api
@param target api
@return
*/
- (BOOL)registerSyncExtensionApi:(NSString *)syncExtApiName target:(id)target;
/// 为HTML 注册要调用的原生 api
/// @param webApiName 原生api名字
/// @param handler 回调
- (BOOL)fat_registerWebApi:(NSString *)webApiName handle:(void (^)(id param, FATExtensionApiCallback callback))handler;
/// 原生调用HTML中的JS函数
/// @param eventName 函数名
/// @param paramString 函数的参数字典转成的json
/// @param pageId webView ID可不传默认调用最顶层页面里H5的函数
/// @param hanler 调用结果回调
- (void)fat_callWebApi:(NSString *)eventName paramString:(NSString *)paramString pageId:(NSNumber *)pageId handler:(void (^)(id result, NSError *error))hanler;
#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;
#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;
@end