ATiOSJS.ts 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. const OC_ATSDK_MANAGER_CLASS = "ATSDKManager";
  2. const OC_BIRDGE_CLASS = "ATJSBridge";
  3. export const ATiOSJS = {
  4. initSDK : function(appid, appkey) {
  5. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "startWithAppID:appKey:", appid, appkey);
  6. },
  7. initCustomMap : function(customMap) {
  8. this.printJsLog("ATiOSJS::initCustomMap(" + customMap + ")");
  9. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "setCustomData:", customMap);
  10. },
  11. setPlacementCustomMap : function(placmentId, customMap) {
  12. this.printJsLog("ATiOSJS::setPlacementCustomMap(" + placmentId + ", " + customMap + ")");
  13. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "setCustomData:forPlacementID:", customMap, placmentId);
  14. },
  15. setGDPRLevel : function(level) {
  16. this.printJsLog("ATiOSJS::setGDPRLevel(" + level + ")");
  17. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "setDataConsent:", level);
  18. },
  19. getGDPRLevel : function() {
  20. this.printJsLog("ATiOSJS::getGDPRLevel()");
  21. return jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "dataConsent");
  22. },
  23. getUserLocation : function(callbackMethod) {
  24. this.printJsLog("ATiOSJS::getUserLocation(" + callbackMethod + ")");
  25. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "getUserLocationWithCallback:", callbackMethod);
  26. },
  27. showGDPRAuth : function () {
  28. this.printJsLog("ATiOSJS::showGDPRAuth()");
  29. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "presentDataConsentDialog");
  30. },
  31. setLogDebug : function (debug) {
  32. this.printJsLog("ATiOSJS::setLogDebug(" + debug + ")");
  33. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "setDebugLog:", debug);
  34. },
  35. printJsLog : function(msg) {
  36. console.log(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. showDebuggerUI : function (debugKey) {
  46. this.printJsLog("ATiOSJS::showDebuggerUI(" + debugKey + ")");
  47. jsb.reflection.callStaticMethod(OC_ATSDK_MANAGER_CLASS, "showDebuggerUIWithDebugKey:", debugKey);
  48. }
  49. };