Skip to content

Commit

Permalink
调整 ios 初始化接口
Browse files Browse the repository at this point in the history
  • Loading branch information
qiuxiang committed Feb 13, 2022
1 parent ddecdf3 commit 302a802
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class SdkModule(val context: ReactApplicationContext) : ReactContextBaseJavaModu
}

@ReactMethod
fun init(apiKey: String?) {
fun initSDK(apiKey: String?) {
apiKey?.let {
MapsInitializer.setApiKey(it)
MapsInitializer.updatePrivacyAgree(context, true)
Expand All @@ -28,4 +28,4 @@ class SdkModule(val context: ReactApplicationContext) : ReactContextBaseJavaModu
fun getVersion(promise: Promise) {
promise.resolve(MapsInitializer.getVersion())
}
}
}
13 changes: 0 additions & 13 deletions lib/ios/Modules/OfflineModule.m

This file was deleted.

10 changes: 0 additions & 10 deletions lib/ios/Modules/OfflineModule.swift

This file was deleted.

2 changes: 1 addition & 1 deletion lib/ios/Modules/SdkModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

@interface RCT_EXTERN_MODULE(AMapSdk, NSObject)

RCT_EXTERN_METHOD(setApiKey: (NSString)apiKey)
RCT_EXTERN_METHOD(initSDK: (NSString)apiKey)
RCT_EXTERN_METHOD(getVersion: (RCTPromiseResolveBlock)resolve reject: (RCTPromiseRejectBlock)_)

@end
2 changes: 1 addition & 1 deletion lib/ios/Modules/SdkModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class AMapSdk: NSObject {
false
}

@objc func setApiKey(_ apiKey: String) {
@objc func initSDK(_ apiKey: String) {
AMapServices.shared().apiKey = apiKey
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NativeModules } from "react-native";
const { AMapSdk } = NativeModules;

export function init(apiKey?: string) {
AMapSdk.init(apiKey);
AMapSdk.initSDK(apiKey);
}

export function getVersion(): Promise<string> {
Expand Down

0 comments on commit 302a802

Please sign in to comment.