2022-06-08 11:57:35 +08:00
|
|
|
|
//
|
|
|
|
|
// FATWebExtension.h
|
|
|
|
|
// FinApplet
|
|
|
|
|
//
|
|
|
|
|
// Created by Haley on 2019/11/20.
|
|
|
|
|
// Copyright © 2019 finogeeks. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
|
|
|
|
|
#import "FATConstant.h"
|
|
|
|
|
|
2022-10-19 12:51:03 +08:00
|
|
|
|
@class FATAppletInfo;
|
|
|
|
|
|
|
|
|
|
typedef void (^FATWebExtensionApiHandler)(FATAppletInfo *appletInfo, id param, FATExtensionApiCallback callback);
|
|
|
|
|
typedef void (^FATWebExtensionApiDeprecatedHandler)(id param, FATExtensionApiCallback callback);
|
|
|
|
|
|
|
|
|
|
@interface FATWebExtensionApiHandlerModel : NSObject
|
|
|
|
|
|
|
|
|
|
@property (nonatomic, assign) BOOL isOld;
|
|
|
|
|
@property (nonatomic, copy) FATWebExtensionApiHandler handler;
|
|
|
|
|
@property (nonatomic, copy) FATWebExtensionApiDeprecatedHandler deprecatedHandler;
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
2022-06-08 11:57:35 +08:00
|
|
|
|
@interface FATWebExtension : NSObject
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
为JS注册原生API
|
|
|
|
|
宿主注册需要自定义实现的API
|
|
|
|
|
@param api API名
|
|
|
|
|
@param handler 回调
|
|
|
|
|
*/
|
2022-10-19 12:51:03 +08:00
|
|
|
|
+ (BOOL)registerExtensionApi:(NSString *)api handler:(FATWebExtensionApiHandler)handler;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
为JS注册原生API(内部sdk注入,加入到默认白名单)
|
|
|
|
|
宿主注册需要自定义实现的API
|
|
|
|
|
@param api API名
|
|
|
|
|
@param handler 回调
|
|
|
|
|
*/
|
|
|
|
|
+ (BOOL)registerInnerExtensionApi:(NSString *)api handler:(FATWebExtensionApiHandler)handler;
|
|
|
|
|
|
|
|
|
|
+ (BOOL)registerDeprecatedExtensionApi:(NSString *)api handler:(FATWebExtensionApiDeprecatedHandler)handler;
|
|
|
|
|
|
|
|
|
|
+ (NSDictionary<NSString *, FATWebExtensionApiHandlerModel *> *)webExtensionApis;
|
2022-06-08 11:57:35 +08:00
|
|
|
|
|
2022-10-19 12:51:03 +08:00
|
|
|
|
+ (NSMutableArray<NSString *> *)innerApiWhiteList;
|
2022-06-08 11:57:35 +08:00
|
|
|
|
|
|
|
|
|
@end
|