12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- const OC_ATSDK_MANAGER_CLASS = "ATSDKManager";
- const OC_BRIDGE_CLASS = "ATJSBridge";
- interface ATiOSJSInterface {
- initSDK(appid: string, appkey: string): void;
- initCustomMap(customMap: string): void;
- setPlacementCustomMap(placementId: string, customMap: string): void;
- setGDPRLevel(level: number): void;
- getGDPRLevel(): number;
- getUserLocation(callbackMethod: string): void;
- showGDPRAuth(): void;
- setLogDebug(debug: boolean): void;
- printJsLog(msg: string): void;
- deniedUploadDeviceInfo(deniedInfo: string): void;
- }
- const ATiOSJS: ATiOSJSInterface = {
- initSDK(appid: string, appkey: string): void {
- this.printJsLog(`ATiOSJS::initSDK(${appid}, ${appkey})`);
- jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "startWithAppID:appKey:", appid, appkey);
- },
- initCustomMap(customMap: string): void {
- this.printJsLog(`ATiOSJS::initCustomMap(${customMap})`);
- jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "setCustomData:", customMap);
- },
- setPlacementCustomMap(placementId: string, customMap: string): void {
- this.printJsLog(`ATiOSJS::setPlacementCustomMap(${placementId}, ${customMap})`);
- jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "setCustomData:forPlacementID:", customMap, placementId);
- },
- setGDPRLevel(level: number): void {
- this.printJsLog(`ATiOSJS::setGDPRLevel(${level})`);
- jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "setDataConsent:", level.toString());
- },
- getGDPRLevel(): number {
- this.printJsLog("ATiOSJS::getGDPRLevel()");
- return jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "dataConsent","");
- },
- getUserLocation(callbackMethod: string): void {
- this.printJsLog(`ATiOSJS::getUserLocation(${callbackMethod})`);
- jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "getUserLocationWithCallback:", callbackMethod);
- },
- showGDPRAuth(): void {
- this.printJsLog("ATiOSJS::showGDPRAuth()");
- jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "presentDataConsentDialog","");
- },
- setLogDebug(debug: boolean): void {
- this.printJsLog(`ATiOSJS::setLogDebug(${debug})`);
- jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "setDebugLog:", debug.toString());
- },
- printJsLog(msg: string): void {
- if (msg !== undefined && msg !== null) {
- jsb.reflection.callStaticMethod(OC_BRIDGE_CLASS, "log:", msg);
- }
- },
- deniedUploadDeviceInfo(deniedInfo: string): void {
- this.printJsLog(`ATiOSJS::deniedUploadDeviceInfo(${deniedInfo})`);
- jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "deniedUploadDeviceInfo:", deniedInfo);
- }
- };
- export default ATiOSJS;
|