ATiOSJS.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. const OC_ATSDK_MANAGER_CLASS = "ATSDKManager";
  2. const OC_BIRDGE_CLASS = "ATJSBridge";
  3. export const ATiOSJS = {
  4. initSDK : function(appid, appkey) {
  5. this.printJsLog("ATiOSJS::initSDK(" + appid + "," + appkey + ")");
  6. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "startWithAppID:appKey:", appid, appkey);
  7. },
  8. initCustomMap : function(customMap) {
  9. this.printJsLog("ATiOSJS::initCustomMap(" + customMap + ")");
  10. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "setCustomData:", customMap);
  11. },
  12. setPlacementCustomMap : function(placmentId, customMap) {
  13. this.printJsLog("ATiOSJS::setPlacementCustomMap(" + placmentId + ", " + customMap + ")");
  14. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "setCustomData:forPlacementID:", customMap, placmentId);
  15. },
  16. setGDPRLevel : function(level) {
  17. this.printJsLog("ATiOSJS::setGDPRLevel(" + level + ")");
  18. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "setDataConsent:", level);
  19. },
  20. getGDPRLevel : function() {
  21. this.printJsLog("ATiOSJS::getGDPRLevel()");
  22. return jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "dataConsent");
  23. },
  24. getUserLocation : function(callbackMethod) {
  25. this.printJsLog("ATiOSJS::getUserLocation(" + callbackMethod + ")");
  26. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "getUserLocationWithCallback:", callbackMethod);
  27. },
  28. showGDPRAuth : function () {
  29. this.printJsLog("ATiOSJS::showGDPRAuth()");
  30. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "presentDataConsentDialog");
  31. },
  32. setLogDebug : function (debug) {
  33. this.printJsLog("ATiOSJS::setLogDebug(" + debug + ")");
  34. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "setDebugLog:", debug);
  35. },
  36. printJsLog : function(msg) {
  37. console.log(msg);
  38. if (undefined != msg && msg != null) {
  39. jsb.reflection.callStaticMethod(OC_BIRDGE_CLASS, "log:", msg);
  40. }
  41. },
  42. deniedUploadDeviceInfo : function (deniedInfo) {
  43. this.printJsLog("ATiOSJS::deniedUploadDeviceInfo(" + deniedInfo + ")");
  44. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "deniedUploadDeviceInfo:", deniedInfo);
  45. },
  46. showDebuggerUI : function (debugKey) {
  47. this.printJsLog("ATiOSJS::showDebuggerUI(" + debugKey + ")");
  48. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "showDebuggerUIWithDebugKey:", debugKey);
  49. }
  50. };