mop-flutter-sdk/ios/Classes/FinAppletExt/ExtensionApi/FATExtBaseApi.h

106 lines
3.4 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

//
// FATExtBaseApi.h
// FinAppletExtension
//
// Created by Haley on 2020/8/11.
// Copyright © 2020 finogeeks. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <FinApplet/FinApplet.h>
@class FATAppletInfo;
@protocol FATApiHanderContextDelegate <NSObject>
//获取当前控制器
- (UIViewController *)getCurrentViewController;
//获取当前的页面id
- (NSString *)getCurrentPageId;
/// API发送回调事件给service层或者page层
/// eventName 事件名
/// eventType 0: service层订阅事件(callSubscribeHandlerWithEvent) 1:page层订阅事件(callSubscribeHandlerWithEvent) int类型方便以后有需要再添加事件类型
/// paramDic 回调事件的参数
/// extDic 扩展参数,预留字段,方便以后扩展 可以包含webId表示发送事件给某个指定页面 service事件可以包含jsContextKey和jsContextValue可以给分包service的JSContext设置值用在数据帧
- (void)sendResultEvent:(NSInteger)eventType eventName:(NSString *)eventName eventParams:(NSDictionary *)param extParams:(NSDictionary *)extDic;
@optional
- (NSString *)insertChildView:(UIView *)childView viewId:(NSString *)viewId parentViewId:(NSString *)parentViewId isFixed:(BOOL)isFixed isHidden:(BOOL)isHidden;
//更新hide属性为NO时使用
/// @param childView 原生视图
/// @param viewId 原生视图id
/// @param parentViewId 原生视图父视图id即WkScrollView的id对应事件的cid
/// @param isFixed 同层渲染这个字段不起作用传NO或YES都可以非同层渲染生效传NO则组件会跟着页面滚动传YES则组件固定在页面上不会随着滚动
- (void)updateChildViewHideProperty:(UIView *)childView viewId:(NSString *)viewId parentViewId:(NSString *)parentViewId isFixed:(BOOL)isFixed isHidden:(BOOL)isHidden complete:(void(^)(BOOL result))complete;
- (UIView *)getChildViewById:(NSString *)viewId;
- (BOOL)removeChildView:(NSString *)viewId;
@end
@protocol FATApiProtocol <NSObject>
@required
@property (nonatomic, strong) FATAppletInfo *appletInfo;
/**
api名称
*/
@property (nonatomic, readonly, copy) NSString *command;
/**
原始参数
*/
@property (nonatomic, readonly, copy) NSDictionary<NSString *, id> *param;
@property (nonatomic, weak) id<FATApiHanderContextDelegate> context;
/**
设置API, 子类重写
@param success 成功回调
@param failure 失败回调
@param cancel 取消回调
*/
- (void)setupApiWithSuccess:(void (^)(NSDictionary<NSString *, id> *successResult))success
failure:(void (^)(NSDictionary *failResult))failure
cancel:(void (^)(NSDictionary *cancelResult))cancel;
@optional
/**
同步api子类重写
*/
- (NSString *)setupSyncApi;
@end
@interface FATExtBaseApi : NSObject<FATApiProtocol>
@property (nonatomic, copy, readonly) NSDictionary *param;
@property (nonatomic, strong) FATAppletInfo *appletInfo;
/**
api名称
*/
@property (nonatomic, readonly, copy) NSString *command;
@property (nonatomic, weak) id<FATApiHanderContextDelegate> context;
//+ (FATExtBaseApi *)apiWithCommand:(NSString *)command param:(NSDictionary *)param;
//- (void)setupApiWithCallback:(FATExtensionApiCallback)callback;
//创建API对象用于地图sdk的API地图的API有点特殊如果用户使用了高德或者百度地图需要创建对应sdk的API对象
+ (id<FATApiProtocol>)fat_apiWithApiClass:(NSString *)apiClassName params:(NSDictionary *)params;
@end