Newer
Older
Productization_H5_IOS / template / Module / package / XFNativeModule.m
@zhangfeng zhangfeng on 8 Aug 2023 1 KB commit first
//
//  XFNativeModule.m
//  xf_native_plugin
//
//  Created by 张丰 on 2023/6/26.
//

#import "XFNativeModule.h"
#import "RCManager.h"
#import "LocationManager.h"

@implementation XFNativeModule

- (void)getLocation:(NSDictionary *)options callback:(UniModuleKeepAliveCallback)callback {
    
    [LocationManager.shareInstance startLocation:options callBack:^(id data) {
        callback(data,true);
    }];
}
/// 停止定位
- (void)stopLocation:(NSDictionary *)options {
    [LocationManager.shareInstance stopLocation:options];
}

- (void)callAction:(NSDictionary *)options {
    
    [XFTool callAction:options];
}
- (NSString *)isBackground {
    return XFTool.isBackground ? @"1":@"0";
}


#pragma mark 融云SDK
// 同步方法
- (void)initRCWithAppKey:(NSString *)appKey option:(NSDictionary *_Nullable)option {
    [RCManager.shareInstance initWithAppKey:appKey option:option];
}
- (void)connectRC:(NSString *)token callback:(UniModuleKeepAliveCallback)callback  {
    [RCManager.shareInstance connectWithToken:token callback:callback];
    
//    [LocationManager.shareInstance startLocation:@{@"type":@"test1"} callBack:^(id data) {
//        NSLog(@"定位数据:%@",data);
//    }];
}
- (void)addRCConnectionListen:(UniModuleKeepAliveCallback)callBack {
    [RCManager.shareInstance addConnectionStatusListen:callBack];
}

- (void)disConnectRC {
    [RCManager.shareInstance disconnect];
}

- (void)testCall:(NSString *)userId mediaType:(NSInteger)mediaType {
    [RCManager.shareInstance testCall:userId mediaType:mediaType];
}
@end