ATiOSJS.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. const OC_ATSDK_MANAGER_CLASS = "ATSDKManager";
  2. const OC_BIRDGE_CLASS = "ATJSBridge";
  3. var ATiOSJS = 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. if (undefined != msg && msg != null) {
  38. jsb.reflection.callStaticMethod(OC_BIRDGE_CLASS, "log:", msg);
  39. }
  40. },
  41. deniedUploadDeviceInfo : function (deniedInfo) {
  42. this.printJsLog("ATiOSJS::deniedUploadDeviceInfo(" + deniedInfo + ")");
  43. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "deniedUploadDeviceInfo:", deniedInfo);
  44. }
  45. };
  46. module.exports = ATiOSJS;