@tyrads.com/tyrads-sdk 3.3.4 → 4.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/tyradssdk/TyradsSdkModule.kt +161 -19
- package/ios/Tyrads/AcmoConfig.swift +1 -1
- package/ios/Tyrads/InitModel.swift +29 -15
- package/ios/Tyrads/Tyrads.swift +332 -274
- package/ios/Tyrads/WebViewController.swift +10 -17
- package/ios/Tyrads/core/models/TyradsUserInfo.swift +2 -0
- package/ios/Tyrads/core/utils/AcmoKeyNames.swift +1 -0
- package/ios/Tyrads/helpers/device_details.swift +122 -2
- package/ios/Tyrads/pushNotifications/APNsAppDelegateProxy.swift +37 -0
- package/ios/Tyrads/pushNotifications/APNsNotificationListener.swift +14 -0
- package/ios/Tyrads/pushNotifications/APNsNotificationManager.swift +68 -0
- package/ios/Tyrads/pushNotifications/APNsNotificationReceiver.swift +77 -0
- package/ios/Tyrads/pushNotifications/TyradsAPNsSwizzler.mm +179 -0
- package/ios/TyradsSdk-Bridging-Header.h +3 -0
- package/ios/TyradsSdk.mm +12 -1
- package/ios/TyradsSdk.swift +121 -4
- package/lib/commonjs/acmo/core/components/countdown-timer.js +48 -0
- package/lib/commonjs/acmo/core/components/countdown-timer.js.map +1 -0
- package/lib/commonjs/acmo/core/components/snap-carousel.js +86 -0
- package/lib/commonjs/acmo/core/components/snap-carousel.js.map +1 -0
- package/lib/commonjs/acmo/core/constants/api-endpoints.js +18 -0
- package/lib/commonjs/acmo/core/constants/api-endpoints.js.map +1 -0
- package/lib/commonjs/acmo/core/helpers/colors.js +20 -0
- package/lib/commonjs/acmo/core/helpers/colors.js.map +1 -0
- package/lib/commonjs/acmo/core/helpers/logger.js +18 -0
- package/lib/commonjs/acmo/core/helpers/logger.js.map +1 -0
- package/lib/commonjs/acmo/core/helpers/patches.js +7 -0
- package/lib/commonjs/acmo/core/helpers/patches.js.map +1 -0
- package/lib/commonjs/acmo/core/network/http-client.js +91 -0
- package/lib/commonjs/acmo/core/network/http-client.js.map +1 -0
- package/lib/commonjs/acmo/core/network/network-common.js +111 -0
- package/lib/commonjs/acmo/core/network/network-common.js.map +1 -0
- package/lib/commonjs/acmo/core/services/localization_service.js +7 -13
- package/lib/commonjs/acmo/core/services/localization_service.js.map +1 -1
- package/lib/commonjs/acmo/core/types/activated-campaings.d.js +2 -0
- package/lib/commonjs/acmo/core/types/activated-campaings.d.js.map +1 -0
- package/lib/commonjs/acmo/core/tyrads-sdk-core.js +203 -0
- package/lib/commonjs/acmo/core/tyrads-sdk-core.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/components/gradient_card.js +98 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/components/gradient_card.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/components/modal-wrapper.js +55 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/components/modal-wrapper.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/controller.js +141 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/controller.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.js +183 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/inapp-notification-host.js +37 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/inapp-notification-host.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/inapp-notification-manager.js +39 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/inapp-notification-manager.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.js +206 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.js +155 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/repository.js +52 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/repository.js.map +1 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/tyrads-global-host.js +37 -0
- package/lib/commonjs/acmo/modules/inapp-notifications/tyrads-global-host.js.map +1 -0
- package/lib/commonjs/acmo/modules/premium-widgets/components/active_offers_button.js.map +1 -0
- package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/custom_card.js +1 -2
- package/lib/commonjs/acmo/modules/premium-widgets/components/custom_card.js.map +1 -0
- package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/custom_scroller.js +20 -11
- package/lib/commonjs/acmo/modules/premium-widgets/components/custom_scroller.js.map +1 -0
- package/lib/commonjs/acmo/modules/premium-widgets/components/custom_shimmer.js.map +1 -0
- package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/offer_card.js +12 -12
- package/lib/commonjs/acmo/modules/premium-widgets/components/offer_card.js.map +1 -0
- package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/offer_list_item.js +3 -3
- package/lib/commonjs/acmo/modules/premium-widgets/components/offer_list_item.js.map +1 -0
- package/lib/commonjs/acmo/modules/premium-widgets/components/premium_empty_widget.js.map +1 -0
- package/lib/commonjs/acmo/modules/premium-widgets/components/premium_header.js.map +1 -0
- package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/premium_loading.js +3 -3
- package/lib/commonjs/acmo/modules/premium-widgets/components/premium_loading.js.map +1 -0
- package/lib/commonjs/acmo/modules/premium-widgets/controller.js +30 -0
- package/lib/commonjs/acmo/modules/premium-widgets/controller.js.map +1 -0
- package/lib/commonjs/acmo/modules/{dashboard/top_offers.js → premium-widgets/premium_offers_widget.js} +67 -30
- package/lib/commonjs/acmo/modules/premium-widgets/premium_offers_widget.js.map +1 -0
- package/lib/commonjs/acmo/modules/premium-widgets/premium_offers_widget_wrapper.js +49 -0
- package/lib/commonjs/acmo/modules/premium-widgets/premium_offers_widget_wrapper.js.map +1 -0
- package/lib/commonjs/acmo/modules/premium-widgets/repository.js +103 -0
- package/lib/commonjs/acmo/modules/premium-widgets/repository.js.map +1 -0
- package/lib/commonjs/acmo/modules/push-notifications/apns-manager.js +227 -0
- package/lib/commonjs/acmo/modules/push-notifications/apns-manager.js.map +1 -0
- package/lib/commonjs/acmo/modules/push-notifications/fcm-manager.js +148 -0
- package/lib/commonjs/acmo/modules/push-notifications/fcm-manager.js.map +1 -0
- package/lib/commonjs/acmo_config.js +6 -5
- package/lib/commonjs/acmo_config.js.map +1 -1
- package/lib/commonjs/assets/images/alarm-clock.png +0 -0
- package/lib/commonjs/assets/images/circle-x.png +0 -0
- package/lib/commonjs/assets/images/coin.png +0 -0
- package/lib/commonjs/index.js +33 -106
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/acmo/core/components/countdown-timer.js +42 -0
- package/lib/module/acmo/core/components/countdown-timer.js.map +1 -0
- package/lib/module/acmo/core/components/snap-carousel.js +81 -0
- package/lib/module/acmo/core/components/snap-carousel.js.map +1 -0
- package/lib/module/acmo/core/constants/api-endpoints.js +14 -0
- package/lib/module/acmo/core/constants/api-endpoints.js.map +1 -0
- package/lib/module/acmo/core/helpers/colors.js +15 -0
- package/lib/module/acmo/core/helpers/colors.js.map +1 -0
- package/lib/module/acmo/core/helpers/logger.js +14 -0
- package/lib/module/acmo/core/helpers/logger.js.map +1 -0
- package/lib/module/acmo/core/helpers/patches.js +7 -0
- package/lib/module/acmo/core/helpers/patches.js.map +1 -0
- package/lib/module/acmo/core/network/http-client.js +86 -0
- package/lib/module/acmo/core/network/http-client.js.map +1 -0
- package/lib/module/acmo/core/network/network-common.js +106 -0
- package/lib/module/acmo/core/network/network-common.js.map +1 -0
- package/lib/module/acmo/core/services/localization_service.js +7 -13
- package/lib/module/acmo/core/services/localization_service.js.map +1 -1
- package/lib/module/acmo/core/types/activated-campaings.d.js +2 -0
- package/lib/module/acmo/core/types/activated-campaings.d.js.map +1 -0
- package/lib/module/acmo/core/tyrads-sdk-core.js +197 -0
- package/lib/module/acmo/core/tyrads-sdk-core.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/components/gradient_card.js +92 -0
- package/lib/module/acmo/modules/inapp-notifications/components/gradient_card.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/components/modal-wrapper.js +49 -0
- package/lib/module/acmo/modules/inapp-notifications/components/modal-wrapper.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/controller.js +136 -0
- package/lib/module/acmo/modules/inapp-notifications/controller.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.js +176 -0
- package/lib/module/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/inapp-notification-host.js +32 -0
- package/lib/module/acmo/modules/inapp-notifications/inapp-notification-host.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/inapp-notification-manager.js +35 -0
- package/lib/module/acmo/modules/inapp-notifications/inapp-notification-manager.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.js +200 -0
- package/lib/module/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.js +149 -0
- package/lib/module/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/repository.js +47 -0
- package/lib/module/acmo/modules/inapp-notifications/repository.js.map +1 -0
- package/lib/module/acmo/modules/inapp-notifications/tyrads-global-host.js +32 -0
- package/lib/module/acmo/modules/inapp-notifications/tyrads-global-host.js.map +1 -0
- package/lib/module/acmo/modules/premium-widgets/components/active_offers_button.js.map +1 -0
- package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/custom_card.js +1 -2
- package/lib/module/acmo/modules/premium-widgets/components/custom_card.js.map +1 -0
- package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/custom_scroller.js +20 -11
- package/lib/module/acmo/modules/premium-widgets/components/custom_scroller.js.map +1 -0
- package/lib/module/acmo/modules/premium-widgets/components/custom_shimmer.js.map +1 -0
- package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/offer_card.js +12 -12
- package/lib/module/acmo/modules/premium-widgets/components/offer_card.js.map +1 -0
- package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/offer_list_item.js +3 -3
- package/lib/module/acmo/modules/premium-widgets/components/offer_list_item.js.map +1 -0
- package/lib/module/acmo/modules/premium-widgets/components/premium_empty_widget.js.map +1 -0
- package/lib/module/acmo/modules/premium-widgets/components/premium_header.js.map +1 -0
- package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/premium_loading.js +1 -1
- package/lib/module/acmo/modules/premium-widgets/components/premium_loading.js.map +1 -0
- package/lib/module/acmo/modules/premium-widgets/controller.js +25 -0
- package/lib/module/acmo/modules/premium-widgets/controller.js.map +1 -0
- package/lib/module/acmo/modules/{dashboard/top_offers.js → premium-widgets/premium_offers_widget.js} +69 -32
- package/lib/module/acmo/modules/premium-widgets/premium_offers_widget.js.map +1 -0
- package/lib/module/acmo/modules/premium-widgets/premium_offers_widget_wrapper.js +41 -0
- package/lib/module/acmo/modules/premium-widgets/premium_offers_widget_wrapper.js.map +1 -0
- package/lib/module/acmo/modules/premium-widgets/repository.js +98 -0
- package/lib/module/acmo/modules/premium-widgets/repository.js.map +1 -0
- package/lib/module/acmo/modules/push-notifications/apns-manager.js +222 -0
- package/lib/module/acmo/modules/push-notifications/apns-manager.js.map +1 -0
- package/lib/module/acmo/modules/push-notifications/fcm-manager.js +143 -0
- package/lib/module/acmo/modules/push-notifications/fcm-manager.js.map +1 -0
- package/lib/module/acmo_config.js +6 -5
- package/lib/module/acmo_config.js.map +1 -1
- package/lib/module/assets/images/alarm-clock.png +0 -0
- package/lib/module/assets/images/circle-x.png +0 -0
- package/lib/module/assets/images/coin.png +0 -0
- package/lib/module/index.js +16 -106
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/acmo/core/components/countdown-timer.d.ts +8 -0
- package/lib/typescript/commonjs/src/acmo/core/components/countdown-timer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/components/snap-carousel.d.ts +26 -0
- package/lib/typescript/commonjs/src/acmo/core/components/snap-carousel.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/constants/api-endpoints.d.ts +12 -0
- package/lib/typescript/commonjs/src/acmo/core/constants/api-endpoints.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/helpers/colors.d.ts +2 -0
- package/lib/typescript/commonjs/src/acmo/core/helpers/colors.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/helpers/logger.d.ts +6 -0
- package/lib/typescript/commonjs/src/acmo/core/helpers/logger.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/network/http-client.d.ts +28 -0
- package/lib/typescript/commonjs/src/acmo/core/network/http-client.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/network/network-common.d.ts +13 -0
- package/lib/typescript/commonjs/src/acmo/core/network/network-common.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/services/localization_service.d.ts +0 -1
- package/lib/typescript/commonjs/src/acmo/core/services/localization_service.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/core/types/external_types.d.ts +5 -0
- package/lib/typescript/commonjs/src/acmo/core/types/external_types.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/core/tyrads-sdk-core.d.ts +46 -0
- package/lib/typescript/commonjs/src/acmo/core/tyrads-sdk-core.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/components/gradient_card.d.ts +17 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/components/gradient_card.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/components/modal-wrapper.d.ts +10 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/components/modal-wrapper.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/controller.d.ts +22 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/controller.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.d.ts +6 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/inapp-notification-host.d.ts +7 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/inapp-notification-host.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/inapp-notification-manager.d.ts +14 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/inapp-notification-manager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.d.ts +4 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.d.ts +7 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/repository.d.ts +8 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/repository.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/tyrads-global-host.d.ts +6 -0
- package/lib/typescript/commonjs/src/acmo/modules/inapp-notifications/tyrads-global-host.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/active_offers_button.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/custom_card.d.ts.map +1 -0
- package/lib/typescript/{module/src/acmo/modules/dashboard → commonjs/src/acmo/modules/premium-widgets}/components/custom_scroller.d.ts +3 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/custom_scroller.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/custom_shimmer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/offer_card.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/offer_list_item.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/premium_empty_widget.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/premium_header.d.ts.map +1 -0
- package/lib/typescript/{module/src/acmo/modules/dashboard → commonjs/src/acmo/modules/premium-widgets}/components/premium_loading.d.ts +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/components/premium_loading.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/controller.d.ts +14 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/controller.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/{dashboard/top_offers.d.ts → premium-widgets/premium_offers_widget.d.ts} +3 -3
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/premium_offers_widget.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/premium_offers_widget_wrapper.d.ts +9 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/premium_offers_widget_wrapper.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/repository.d.ts +13 -0
- package/lib/typescript/commonjs/src/acmo/modules/premium-widgets/repository.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/push-notifications/apns-manager.d.ts +40 -0
- package/lib/typescript/commonjs/src/acmo/modules/push-notifications/apns-manager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/push-notifications/fcm-manager.d.ts +32 -0
- package/lib/typescript/commonjs/src/acmo/modules/push-notifications/fcm-manager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo_config.d.ts +1 -0
- package/lib/typescript/commonjs/src/acmo_config.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +5 -11
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/core/components/countdown-timer.d.ts +8 -0
- package/lib/typescript/module/src/acmo/core/components/countdown-timer.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/components/snap-carousel.d.ts +26 -0
- package/lib/typescript/module/src/acmo/core/components/snap-carousel.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/constants/api-endpoints.d.ts +12 -0
- package/lib/typescript/module/src/acmo/core/constants/api-endpoints.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/helpers/colors.d.ts +2 -0
- package/lib/typescript/module/src/acmo/core/helpers/colors.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/helpers/logger.d.ts +6 -0
- package/lib/typescript/module/src/acmo/core/helpers/logger.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/network/http-client.d.ts +28 -0
- package/lib/typescript/module/src/acmo/core/network/http-client.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/network/network-common.d.ts +13 -0
- package/lib/typescript/module/src/acmo/core/network/network-common.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/services/localization_service.d.ts +0 -1
- package/lib/typescript/module/src/acmo/core/services/localization_service.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/core/types/external_types.d.ts +5 -0
- package/lib/typescript/module/src/acmo/core/types/external_types.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/core/tyrads-sdk-core.d.ts +46 -0
- package/lib/typescript/module/src/acmo/core/tyrads-sdk-core.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/components/gradient_card.d.ts +17 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/components/gradient_card.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/components/modal-wrapper.d.ts +10 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/components/modal-wrapper.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/controller.d.ts +22 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/controller.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.d.ts +6 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/inapp-notification-host.d.ts +7 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/inapp-notification-host.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/inapp-notification-manager.d.ts +14 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/inapp-notification-manager.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.d.ts +4 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.d.ts +7 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/repository.d.ts +8 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/repository.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/tyrads-global-host.d.ts +6 -0
- package/lib/typescript/module/src/acmo/modules/inapp-notifications/tyrads-global-host.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/active_offers_button.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/custom_card.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src/acmo/modules/dashboard → module/src/acmo/modules/premium-widgets}/components/custom_scroller.d.ts +3 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/custom_scroller.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/custom_shimmer.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/offer_card.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/offer_list_item.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/premium_empty_widget.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/premium_header.d.ts.map +1 -0
- package/lib/typescript/{commonjs/src/acmo/modules/dashboard → module/src/acmo/modules/premium-widgets}/components/premium_loading.d.ts +1 -1
- package/lib/typescript/module/src/acmo/modules/premium-widgets/components/premium_loading.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/controller.d.ts +14 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/controller.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/{dashboard/top_offers.d.ts → premium-widgets/premium_offers_widget.d.ts} +3 -3
- package/lib/typescript/module/src/acmo/modules/premium-widgets/premium_offers_widget.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/premium_offers_widget_wrapper.d.ts +9 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/premium_offers_widget_wrapper.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/repository.d.ts +13 -0
- package/lib/typescript/module/src/acmo/modules/premium-widgets/repository.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/push-notifications/apns-manager.d.ts +40 -0
- package/lib/typescript/module/src/acmo/modules/push-notifications/apns-manager.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/push-notifications/fcm-manager.d.ts +32 -0
- package/lib/typescript/module/src/acmo/modules/push-notifications/fcm-manager.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo_config.d.ts +1 -0
- package/lib/typescript/module/src/acmo_config.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +5 -11
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +5 -3
- package/readme.md +27 -14
- package/src/acmo/core/components/countdown-timer.tsx +52 -0
- package/src/acmo/core/components/snap-carousel.tsx +106 -0
- package/src/acmo/core/constants/api-endpoints.ts +12 -0
- package/src/acmo/core/helpers/colors.ts +16 -0
- package/src/acmo/core/helpers/logger.ts +11 -0
- package/src/acmo/core/helpers/patches.js +6 -0
- package/src/acmo/core/network/http-client.ts +89 -0
- package/src/acmo/core/network/network-common.ts +128 -0
- package/src/acmo/core/services/localization_service.ts +7 -14
- package/src/acmo/core/types/activated-campaings.d.ts +101 -0
- package/src/acmo/core/types/external_types.ts +7 -1
- package/src/acmo/core/types/types.d.ts +112 -76
- package/src/acmo/core/tyrads-sdk-core.tsx +256 -0
- package/src/acmo/modules/inapp-notifications/components/gradient_card.tsx +87 -0
- package/src/acmo/modules/inapp-notifications/components/modal-wrapper.tsx +59 -0
- package/src/acmo/modules/inapp-notifications/controller.ts +183 -0
- package/src/acmo/modules/inapp-notifications/currency-sales/currency-sales-notif.tsx +164 -0
- package/src/acmo/modules/inapp-notifications/inapp-notification-host.tsx +32 -0
- package/src/acmo/modules/inapp-notifications/inapp-notification-manager.ts +40 -0
- package/src/acmo/modules/inapp-notifications/limited-time-offer/components/limited-time-offer-card.tsx +188 -0
- package/src/acmo/modules/inapp-notifications/limited-time-offer/limited-time-notif.tsx +149 -0
- package/src/acmo/modules/inapp-notifications/repository.ts +49 -0
- package/src/acmo/modules/inapp-notifications/tyrads-global-host.tsx +25 -0
- package/src/acmo/modules/{dashboard → premium-widgets}/components/custom_card.tsx +1 -2
- package/src/acmo/modules/{dashboard → premium-widgets}/components/custom_scroller.tsx +24 -10
- package/src/acmo/modules/{dashboard → premium-widgets}/components/offer_card.tsx +11 -11
- package/src/acmo/modules/{dashboard → premium-widgets}/components/offer_list_item.tsx +3 -3
- package/src/acmo/modules/{dashboard → premium-widgets}/components/premium_loading.tsx +1 -1
- package/src/acmo/modules/premium-widgets/controller.ts +39 -0
- package/src/acmo/modules/{dashboard/top_offers.tsx → premium-widgets/premium_offers_widget.tsx} +67 -45
- package/src/acmo/modules/premium-widgets/premium_offers_widget_wrapper.tsx +39 -0
- package/src/acmo/modules/premium-widgets/repository.ts +107 -0
- package/src/acmo/modules/push-notifications/apns-manager.ts +254 -0
- package/src/acmo/modules/push-notifications/fcm-manager.ts +162 -0
- package/src/acmo_config.ts +6 -5
- package/src/assets/images/alarm-clock.png +0 -0
- package/src/assets/images/circle-x.png +0 -0
- package/src/assets/images/coin.png +0 -0
- package/src/index.tsx +19 -127
- package/ios/Tyrads/user/AcmoUserUpdatePage.swift +0 -302
- package/ios/Tyrads/user/AcmoUsersUpdateController.swift +0 -26
- package/ios/Tyrads/user/Repository.swift +0 -89
- package/lib/commonjs/acmo/core/helpers/native_methods.js +0 -48
- package/lib/commonjs/acmo/core/helpers/native_methods.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/active_offers_button.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/custom_card.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/custom_scroller.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/custom_shimmer.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/offer_card.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/offer_list_item.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_empty_widget.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_header.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_loading.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/repository.js +0 -147
- package/lib/commonjs/acmo/modules/dashboard/repository.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/top_offers.js.map +0 -1
- package/lib/module/acmo/core/helpers/native_methods.js +0 -44
- package/lib/module/acmo/core/helpers/native_methods.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/active_offers_button.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/custom_card.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/custom_scroller.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/custom_shimmer.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/offer_card.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/offer_list_item.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/premium_empty_widget.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/premium_header.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/premium_loading.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/repository.js +0 -140
- package/lib/module/acmo/modules/dashboard/repository.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/top_offers.js.map +0 -1
- package/lib/typescript/commonjs/src/acmo/core/helpers/native_methods.d.ts +0 -10
- package/lib/typescript/commonjs/src/acmo/core/helpers/native_methods.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/active_offers_button.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_card.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_scroller.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_shimmer.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_card.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_list_item.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_header.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_loading.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/repository.d.ts +0 -3
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/repository.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/top_offers.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/core/helpers/native_methods.d.ts +0 -10
- package/lib/typescript/module/src/acmo/core/helpers/native_methods.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/active_offers_button.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_card.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_scroller.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_shimmer.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_card.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_list_item.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_header.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_loading.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/repository.d.ts +0 -3
- package/lib/typescript/module/src/acmo/modules/dashboard/repository.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/top_offers.d.ts.map +0 -1
- package/src/acmo/core/helpers/native_methods.ts +0 -59
- package/src/acmo/modules/dashboard/repository.ts +0 -170
- /package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/active_offers_button.js +0 -0
- /package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/custom_shimmer.js +0 -0
- /package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/premium_empty_widget.js +0 -0
- /package/lib/commonjs/acmo/modules/{dashboard → premium-widgets}/components/premium_header.js +0 -0
- /package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/active_offers_button.js +0 -0
- /package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/custom_shimmer.js +0 -0
- /package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/premium_empty_widget.js +0 -0
- /package/lib/module/acmo/modules/{dashboard → premium-widgets}/components/premium_header.js +0 -0
- /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/active_offers_button.d.ts +0 -0
- /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/custom_card.d.ts +0 -0
- /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/custom_shimmer.d.ts +0 -0
- /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/offer_card.d.ts +0 -0
- /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/offer_list_item.d.ts +0 -0
- /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/premium_empty_widget.d.ts +0 -0
- /package/lib/typescript/commonjs/src/acmo/modules/{dashboard → premium-widgets}/components/premium_header.d.ts +0 -0
- /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/active_offers_button.d.ts +0 -0
- /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/custom_card.d.ts +0 -0
- /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/custom_shimmer.d.ts +0 -0
- /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/offer_card.d.ts +0 -0
- /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/offer_list_item.d.ts +0 -0
- /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/premium_empty_widget.d.ts +0 -0
- /package/lib/typescript/module/src/acmo/modules/{dashboard → premium-widgets}/components/premium_header.d.ts +0 -0
- /package/src/acmo/modules/{dashboard → premium-widgets}/components/active_offers_button.tsx +0 -0
- /package/src/acmo/modules/{dashboard → premium-widgets}/components/custom_shimmer.tsx +0 -0
- /package/src/acmo/modules/{dashboard → premium-widgets}/components/premium_empty_widget.tsx +0 -0
- /package/src/acmo/modules/{dashboard → premium-widgets}/components/premium_header.tsx +0 -0
package/ios/Tyrads/Tyrads.swift
CHANGED
|
@@ -8,279 +8,362 @@ import Combine
|
|
|
8
8
|
|
|
9
9
|
/// The TyradsSdk class provides methods for configuring the SDK and displaying offers.
|
|
10
10
|
public class Tyrads : NSObject {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
11
|
+
/// Shared instance of the TyradsSdk.
|
|
12
|
+
public static let instance = Tyrads()
|
|
13
|
+
|
|
14
|
+
internal var apiKey: String = ""
|
|
15
|
+
internal var apiSecret: String = ""
|
|
16
|
+
internal var encKey: String?
|
|
17
|
+
internal var engagementId: String?
|
|
18
|
+
internal var placementId: String?
|
|
19
|
+
internal var publisherUserID: String = ""
|
|
20
|
+
internal var mainColor: String?
|
|
21
|
+
private var token: String = ""
|
|
22
|
+
internal var currentLanguage: String = "en" {
|
|
23
|
+
didSet {
|
|
24
|
+
if oldValue != currentLanguage {
|
|
25
|
+
languagePublisher.send(currentLanguage)
|
|
27
26
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
internal var newUser: Bool = false
|
|
31
|
-
private var loginData: AcmoInitModel?
|
|
32
|
-
var initializationWait = DispatchSemaphore(value: 0)
|
|
33
|
-
private var initializationContinuation: CheckedContinuation<Void, Never>?
|
|
34
|
-
private var debugMode: Bool = false
|
|
27
|
+
}
|
|
28
|
+
}
|
|
35
29
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
public let languagePublisher = PassthroughSubject<String, Never>()
|
|
31
|
+
internal var newUser: Bool = false
|
|
32
|
+
private var loginData: AcmoInitModel?
|
|
33
|
+
var initializationWait = DispatchSemaphore(value: 0)
|
|
34
|
+
private var initializationContinuation: CheckedContinuation<Void, Never>?
|
|
35
|
+
private var debugMode: Bool = false
|
|
36
|
+
|
|
37
|
+
private var _isSecure: Bool = false
|
|
38
|
+
public var isSecure: Bool {
|
|
39
|
+
get {
|
|
40
|
+
return _isSecure
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
private var preloadedWebVC: AcmoWebViewController?
|
|
45
|
+
|
|
46
|
+
internal func log(_ message: String) {
|
|
47
|
+
if debugMode {
|
|
48
|
+
NSLog(message)
|
|
47
49
|
}
|
|
50
|
+
}
|
|
48
51
|
|
|
49
52
|
private func ensureInitialized() async {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
guard self.token.isEmpty else { return }
|
|
54
|
+
|
|
55
|
+
await withCheckedContinuation { continuation in
|
|
56
|
+
self.initializationContinuation = continuation
|
|
57
|
+
}
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
private var mediaSourceInfo: TyradsMediaSourceInfo?
|
|
58
61
|
private var userInfo: TyradsUserInfo?
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
@objc public func configure( apiKey: String, secretKey: String, encKey: String? = nil, engagementId: String? = nil, debugMode: Bool = false) async -> String {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
62
|
+
|
|
63
|
+
/// Configures the Tyrads SDK with the provided API key and secret key.
|
|
64
|
+
///
|
|
65
|
+
/// - Parameters:
|
|
66
|
+
/// - apiKey: The API key provided by Tyrads.
|
|
67
|
+
/// - secretKey: The secret key provided by Tyrads.
|
|
68
|
+
@objc public func configure( apiKey: String, secretKey: String, encKey: String? = nil, engagementId: String? = nil, placementId: String? = nil, debugMode: Bool = false) async -> String {
|
|
69
|
+
self.apiKey = apiKey
|
|
70
|
+
self.apiSecret = secretKey
|
|
71
|
+
self.encKey = encKey
|
|
72
|
+
self.engagementId = engagementId
|
|
73
|
+
self.placementId = placementId
|
|
74
|
+
self._isSecure = (encKey != nil)
|
|
75
|
+
self.debugMode = debugMode
|
|
72
76
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
let savedLocale = UserDefaults.standard.string(forKey: "locale")
|
|
78
|
+
let deviceLocale = Locale.current.languageCode ?? "en"
|
|
79
|
+
self.currentLanguage = savedLocale ?? deviceLocale
|
|
80
|
+
await LocalizationService.shared.initialize(locale: self.currentLanguage)
|
|
81
|
+
return self.currentLanguage
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/// Logs in the user with the provided user ID or retrieves the user ID from UserDefaults.
|
|
85
|
+
///
|
|
86
|
+
/// - Parameter userID: Optional. The user ID to log in with. If nil, the SDK will attempt to retrieve the user ID from UserDefaults.
|
|
87
|
+
public func loginUser(_ userID: String? = nil) async throws -> ApiHeaders? {
|
|
88
|
+
let userId = userID ?? UserDefaults.standard.string(forKey: "acmo-tyrads-sdk-user-id") ?? ""
|
|
89
|
+
var identifierType = "IDFA"
|
|
90
|
+
var advertisingId = ""
|
|
91
|
+
let deviceDetails = getDeviceDetails()
|
|
92
|
+
|
|
93
|
+
if #available(iOS 14, *) {
|
|
94
|
+
self.log("Requesting tracking authorization for iOS 14+")
|
|
95
|
+
let status = await ATTrackingManager.requestTrackingAuthorization()
|
|
96
|
+
switch status {
|
|
97
|
+
case .authorized:
|
|
98
|
+
advertisingId = ASIdentifierManager.shared().advertisingIdentifier.uuidString
|
|
99
|
+
self.log("Tracking authorized. Advertising ID: \(advertisingId)")
|
|
100
|
+
case .denied, .restricted, .notDetermined:
|
|
101
|
+
advertisingId = "\(deviceDetails["deviceId"] ?? UUID().uuidString)"
|
|
102
|
+
identifierType = "OTHER"
|
|
103
|
+
self.log("Tracking not authorized or restricted")
|
|
104
|
+
@unknown default:
|
|
105
|
+
self.log("Unknown tracking status")
|
|
106
|
+
}
|
|
107
|
+
} else {
|
|
108
|
+
advertisingId = ASIdentifierManager.shared().advertisingIdentifier.uuidString
|
|
109
|
+
self.log("iOS version < 14. Advertising ID: \(advertisingId)")
|
|
78
110
|
}
|
|
111
|
+
|
|
112
|
+
let engagementIDInt: Int? = {
|
|
113
|
+
guard let engagementId = self.engagementId, !engagementId.isEmpty else { return nil }
|
|
114
|
+
return Int(engagementId)
|
|
115
|
+
}()
|
|
79
116
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
var fd: [String: Any?] = [
|
|
114
|
-
"publisherUserId": userId,
|
|
115
|
-
"platform": "iOS",
|
|
116
|
-
"identifierType": identifierType,
|
|
117
|
-
"engagementId": engagementIDInt,
|
|
118
|
-
"identifier": advertisingId,
|
|
119
|
-
"deviceData": deviceDetails
|
|
120
|
-
]
|
|
121
|
-
|
|
122
|
-
if let info = mediaSourceInfo {
|
|
123
|
-
if let sub1 = info.sub1 { fd["sub1"] = sub1 }
|
|
124
|
-
if let sub2 = info.sub2 { fd["sub2"] = sub2 }
|
|
125
|
-
if let sub3 = info.sub3 { fd["sub3"] = sub3 }
|
|
126
|
-
if let sub4 = info.sub4 { fd["sub4"] = sub4 }
|
|
127
|
-
if let sub5 = info.sub5 { fd["sub5"] = sub5 }
|
|
128
|
-
if let mediaSourceName = info.mediaSourceName { fd["mediaSourceName"] = mediaSourceName }
|
|
129
|
-
if let mediaSourceId = info.mediaSourceId { fd["mediaSourceId"] = mediaSourceId }
|
|
130
|
-
if let mediaSubSourceId = info.mediaSubSourceId { fd["mediaSubSourceId"] = mediaSubSourceId }
|
|
131
|
-
if let incentivized = info.incentivized { fd["incentivized"] = incentivized }
|
|
132
|
-
if let mediaAdsetName = info.mediaAdsetName { fd["mediaAdsetName"] = mediaAdsetName }
|
|
133
|
-
if let mediaAdsetId = info.mediaAdsetId { fd["mediaAdsetId"] = mediaAdsetId }
|
|
134
|
-
if let mediaCreativeName = info.mediaCreativeName { fd["mediaCreativeName"] = mediaCreativeName }
|
|
135
|
-
if let mediaCreativeId = info.mediaCreativeId { fd["mediaCreativeId"] = mediaCreativeId }
|
|
136
|
-
if let mediaCampaignName = info.mediaCampaignName { fd["mediaCampaignName"] = mediaCampaignName }
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if let info = userInfo {
|
|
141
|
-
if let email = info.email { fd["email"] = email }
|
|
142
|
-
if let phoneNumber = info.phoneNumber { fd["phoneNumber"] = phoneNumber }
|
|
143
|
-
if let userGroup = info.userGroup { fd["userGroup"] = userGroup }
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
self.log("Initializing with data: \(fd)")
|
|
147
|
-
guard let url = URL(string: AcmoConfig.BASE_URL + "initialize") else {
|
|
148
|
-
self.log("Failed to create URL")
|
|
149
|
-
throw NSError(domain: "TyradsSdk", code: 1, userInfo: [NSLocalizedDescriptionKey: "Invalid URL"])
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
var request = URLRequest(url: url)
|
|
153
|
-
request.httpMethod = "POST"
|
|
154
|
-
request.setValue(AcmoConfig.SDK_PLATFORM, forHTTPHeaderField: "X-SDK-Platform")
|
|
155
|
-
request.setValue(AcmoConfig.SDK_VERSION, forHTTPHeaderField: "X-SDK-Version")
|
|
156
|
-
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
|
|
157
|
-
request.setValue(self.apiKey, forHTTPHeaderField: "X-API-Key")
|
|
158
|
-
request.setValue(self.apiSecret, forHTTPHeaderField: "X-API-Secret")
|
|
159
|
-
request.setValue(_isSecure ? "BASIC" : "PLAIN", forHTTPHeaderField: "X-Secure-Mode")
|
|
160
|
-
|
|
161
|
-
do {
|
|
162
|
-
let requestBody = _isSecure && !(encKey ?? "").isEmpty ? try AcmoEncrypt(encKey!).encryptDataAESGCM(data: fd) : fd
|
|
163
|
-
request.httpBody = try JSONSerialization.data(withJSONObject: requestBody)
|
|
164
|
-
} catch {
|
|
165
|
-
self.log("Failed to serialize request body: \(error)")
|
|
166
|
-
throw error
|
|
167
|
-
}
|
|
168
|
-
let hasAccepted = UserDefaults.standard.bool(forKey: "\(AcmoKeyNames.PRIVACY_ACCEPTED_FOR_USER_ID)\(Tyrads.instance.publisherUserID)")
|
|
169
|
-
// Use the async URLSession API to get data
|
|
170
|
-
let (data, _) = try await URLSession.shared.data(for: request)
|
|
171
|
-
|
|
172
|
-
let responseString = String(data: data, encoding: .utf8)
|
|
173
|
-
self.log("Received response: \(responseString ?? "nil")")
|
|
174
|
-
|
|
175
|
-
guard let acmoInitModel = try? JSONDecoder().decode(AcmoInitModel.self, from: data) else {
|
|
176
|
-
self.log("Failed to decode response")
|
|
177
|
-
throw NSError(domain: "TyradsSdk", code: 2, userInfo: [NSLocalizedDescriptionKey: "Failed to decode response"])
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
self.loginData = acmoInitModel
|
|
181
|
-
self.publisherUserID = acmoInitModel.data.user.publisherUserId
|
|
182
|
-
self.newUser = acmoInitModel.data.newRegisteredUser
|
|
183
|
-
self.token = acmoInitModel.data.token
|
|
184
|
-
self.log("Login successful. Publisher User ID: \(self.publisherUserID), New User: \(self.newUser)")
|
|
185
|
-
self.mainColor = acmoInitModel.data.publisherApp.mainColor
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
let headers = await ApiHeaders(
|
|
189
|
-
xApiKey: self.apiKey,
|
|
190
|
-
xApiSecret: self.apiSecret,
|
|
191
|
-
xUserId: self.publisherUserID,
|
|
192
|
-
xSdkPlatform: AcmoConfig.SDK_PLATFORM,
|
|
193
|
-
xSdkVersion: AcmoConfig.SDK_VERSION,
|
|
194
|
-
userAgent: UIDevice.current.systemName + "/" + UIDevice.current.systemVersion,
|
|
195
|
-
languageCode: self.currentLanguage,
|
|
196
|
-
premiumColor: acmoInitModel.data.publisherApp.premiumColor,
|
|
197
|
-
headerColor: acmoInitModel.data.publisherApp.headerColor,
|
|
198
|
-
mainColor: acmoInitModel.data.publisherApp.mainColor,
|
|
199
|
-
privacyAccepted: hasAccepted
|
|
200
|
-
)
|
|
201
|
-
return headers
|
|
117
|
+
let placementIDInt: Int? = {
|
|
118
|
+
guard let placementId = self.placementId, !placementId.isEmpty else { return nil }
|
|
119
|
+
return Int(placementId)
|
|
120
|
+
}()
|
|
121
|
+
|
|
122
|
+
let storedToken = UserDefaults.standard.string(forKey: AcmoKeyNames.APNS_TOKEN)
|
|
123
|
+
|
|
124
|
+
var fd: [String: Any?] = [
|
|
125
|
+
"publisherUserId": userId,
|
|
126
|
+
"platform": "iOS",
|
|
127
|
+
"devicePushToken": storedToken,
|
|
128
|
+
"identifierType": identifierType,
|
|
129
|
+
"engagementId": engagementIDInt,
|
|
130
|
+
"placementId": placementIDInt,
|
|
131
|
+
"identifier": advertisingId,
|
|
132
|
+
"deviceData": deviceDetails
|
|
133
|
+
]
|
|
134
|
+
|
|
135
|
+
if let info = mediaSourceInfo {
|
|
136
|
+
if let sub1 = info.sub1 { fd["sub1"] = sub1 }
|
|
137
|
+
if let sub2 = info.sub2 { fd["sub2"] = sub2 }
|
|
138
|
+
if let sub3 = info.sub3 { fd["sub3"] = sub3 }
|
|
139
|
+
if let sub4 = info.sub4 { fd["sub4"] = sub4 }
|
|
140
|
+
if let sub5 = info.sub5 { fd["sub5"] = sub5 }
|
|
141
|
+
if let mediaSourceName = info.mediaSourceName { fd["mediaSourceName"] = mediaSourceName }
|
|
142
|
+
if let mediaSourceId = info.mediaSourceId { fd["mediaSourceId"] = mediaSourceId }
|
|
143
|
+
if let mediaSubSourceId = info.mediaSubSourceId { fd["mediaSubSourceId"] = mediaSubSourceId }
|
|
144
|
+
if let incentivized = info.incentivized { fd["incentivized"] = incentivized }
|
|
145
|
+
if let mediaAdsetName = info.mediaAdsetName { fd["mediaAdsetName"] = mediaAdsetName }
|
|
146
|
+
if let mediaAdsetId = info.mediaAdsetId { fd["mediaAdsetId"] = mediaAdsetId }
|
|
147
|
+
if let mediaCreativeName = info.mediaCreativeName { fd["mediaCreativeName"] = mediaCreativeName }
|
|
148
|
+
if let mediaCreativeId = info.mediaCreativeId { fd["mediaCreativeId"] = mediaCreativeId }
|
|
149
|
+
if let mediaCampaignName = info.mediaCampaignName { fd["mediaCampaignName"] = mediaCampaignName }
|
|
202
150
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
151
|
+
|
|
152
|
+
if let info = userInfo {
|
|
153
|
+
if let email = info.email { fd["email"] = email }
|
|
154
|
+
if let phoneNumber = info.phoneNumber { fd["phoneNumber"] = phoneNumber }
|
|
155
|
+
if let userGroup = info.userGroup { fd["userGroup"] = userGroup }
|
|
156
|
+
if let age = info.age { fd["age"] = age }
|
|
157
|
+
if let gender = info.gender { fd["gender"] = gender }
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
self.log("Initializing with data: \(fd)")
|
|
161
|
+
guard let url = URL(string: AcmoConfig.BASE_URL + "initialize") else {
|
|
162
|
+
self.log("Failed to create URL")
|
|
163
|
+
throw NSError(domain: "TyradsSdk", code: 1, userInfo: [NSLocalizedDescriptionKey: "Invalid URL"])
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
var request = URLRequest(url: url)
|
|
167
|
+
request.httpMethod = "POST"
|
|
168
|
+
request.setValue(AcmoConfig.SDK_PLATFORM, forHTTPHeaderField: "X-SDK-Platform")
|
|
169
|
+
request.setValue(AcmoConfig.SDK_VERSION, forHTTPHeaderField: "X-SDK-Version")
|
|
170
|
+
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
|
|
171
|
+
request.setValue(self.apiKey, forHTTPHeaderField: "X-API-Key")
|
|
172
|
+
request.setValue(self.apiSecret, forHTTPHeaderField: "X-API-Secret")
|
|
173
|
+
request.setValue(_isSecure ? "BASIC" : "PLAIN", forHTTPHeaderField: "X-Secure-Mode")
|
|
174
|
+
|
|
175
|
+
do {
|
|
176
|
+
let requestBody = _isSecure && !(encKey ?? "").isEmpty ? try AcmoEncrypt(encKey!).encryptDataAESGCM(data: fd) : fd
|
|
177
|
+
request.httpBody = try JSONSerialization.data(withJSONObject: requestBody)
|
|
178
|
+
} catch {
|
|
179
|
+
self.log("Failed to serialize request body: \(error)")
|
|
180
|
+
throw error
|
|
181
|
+
}
|
|
182
|
+
let hasAccepted = UserDefaults.standard.bool(forKey: "\(AcmoKeyNames.PRIVACY_ACCEPTED_FOR_USER_ID)\(Tyrads.instance.publisherUserID)")
|
|
183
|
+
let (data, _) = try await URLSession.shared.data(for: request)
|
|
184
|
+
|
|
185
|
+
let responseString = String(data: data, encoding: .utf8)
|
|
186
|
+
self.log("Received response: \(responseString ?? "nil")")
|
|
187
|
+
|
|
188
|
+
let acmoInitModel: AcmoInitModel
|
|
189
|
+
do {
|
|
190
|
+
acmoInitModel = try JSONDecoder().decode(AcmoInitModel.self, from: data)
|
|
191
|
+
} catch {
|
|
192
|
+
self.log("Failed to decode response: \(error)")
|
|
193
|
+
throw NSError(domain: "TyradsSdk", code: 2, userInfo: [NSLocalizedDescriptionKey: "Failed to decode response: \(error) \nResponse: \(responseString)\nRequestHeaders: \(request.allHTTPHeaderFields ?? [:])"])
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
self.loginData = acmoInitModel
|
|
197
|
+
self.publisherUserID = acmoInitModel.data.accountInfo.publisherUserId
|
|
198
|
+
self.newUser = acmoInitModel.data.newRegisteredUser
|
|
199
|
+
self.token = acmoInitModel.data.token
|
|
200
|
+
self.log("Login successful. Publisher User ID: \(self.publisherUserID), New User: \(self.newUser)")
|
|
201
|
+
self.mainColor = acmoInitModel.data.appInfo.mainColor
|
|
202
|
+
|
|
203
|
+
let headers = await ApiHeaders(
|
|
204
|
+
xApiKey: self.apiKey,
|
|
205
|
+
xApiSecret: self.apiSecret,
|
|
206
|
+
xUserId: self.publisherUserID,
|
|
207
|
+
xSdkPlatform: AcmoConfig.SDK_PLATFORM,
|
|
208
|
+
xSdkVersion: AcmoConfig.SDK_VERSION,
|
|
209
|
+
userAgent: UIDevice.current.systemName + "/" + UIDevice.current.systemVersion,
|
|
210
|
+
languageCode: self.currentLanguage,
|
|
211
|
+
premiumColor: acmoInitModel.data.appInfo.premiumColor,
|
|
212
|
+
headerColor: acmoInitModel.data.appInfo.headerColor,
|
|
213
|
+
mainColor: acmoInitModel.data.appInfo.mainColor,
|
|
214
|
+
privacyAccepted: hasAccepted
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
Task { @MainActor in
|
|
218
|
+
self.preloadOffers()
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return headers
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
public func getOffersURL(route: String? = nil, campaignID: Int? = nil) -> URL? {
|
|
228
|
+
|
|
229
|
+
let normalizedRoute = (route?.isEmpty ?? true) ? nil : route
|
|
230
|
+
|
|
211
231
|
var components = URLComponents()
|
|
212
232
|
components.scheme = "https"
|
|
213
|
-
components.host = "sdk.tyrads.com"
|
|
214
|
-
// components.path = "/\(route ?? "")"
|
|
233
|
+
components.host = "v4.sdk.tyrads.com"
|
|
215
234
|
components.queryItems = [
|
|
216
235
|
URLQueryItem(name: "token", value: self.token),
|
|
217
|
-
URLQueryItem(name: "to", value: campaignID != nil ? "\(
|
|
218
|
-
URLQueryItem(name: "lang", value: self.currentLanguage)
|
|
219
|
-
URLQueryItem(name: "skipUserInfo", value: "\(skipUserUpdate)")
|
|
236
|
+
URLQueryItem(name: "to", value: campaignID != nil ? "\(normalizedRoute ?? "")/\(campaignID!)" : normalizedRoute),
|
|
237
|
+
URLQueryItem(name: "lang", value: self.currentLanguage)
|
|
220
238
|
]
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
urlString = url.absoluteString
|
|
224
|
-
print(urlString)
|
|
225
|
-
} else {
|
|
226
|
-
print("Failed to create URL with components: \(components)")
|
|
239
|
+
if let placementId = self.placementId {
|
|
240
|
+
components.queryItems?.append(URLQueryItem(name: "placementId", value: placementId))
|
|
227
241
|
}
|
|
242
|
+
return components.url
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
@MainActor
|
|
246
|
+
public func preloadOffers(route: String? = nil) {
|
|
247
|
+
let normalizedRoute = (route?.isEmpty ?? true) ? nil : route
|
|
228
248
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
249
|
+
// only preload the default offerwall (no specific route)
|
|
250
|
+
if normalizedRoute != nil {
|
|
251
|
+
self.log("Preload: Skipping specific route \(normalizedRoute!)")
|
|
252
|
+
return
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
guard !self.token.isEmpty else {
|
|
256
|
+
self.log("Preload failed: token is empty")
|
|
257
|
+
return
|
|
258
|
+
}
|
|
259
|
+
guard let url = getOffersURL(route: nil) else {
|
|
260
|
+
self.log("Preload failed: failed to generate URL")
|
|
261
|
+
return
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
self.log("Preloading default webview for URL: \(url.absoluteString)")
|
|
265
|
+
|
|
266
|
+
if let existing = self.preloadedWebVC, existing.initialURL.absoluteString == url.absoluteString {
|
|
267
|
+
self.log("Preload: Already have a matching preloaded VC, skipping recreation.")
|
|
268
|
+
return
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
let webVC = AcmoWebViewController(url: url)
|
|
272
|
+
_ = webVC.view
|
|
273
|
+
self.preloadedWebVC = webVC
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
public func showOffers(_ launchMode: Int = 2, route: String? = nil, campaignID: Int? = nil) async {
|
|
277
|
+
await ensureInitialized()
|
|
278
|
+
|
|
279
|
+
guard let url = getOffersURL(route: route, campaignID: campaignID) else {
|
|
280
|
+
self.log("Failed to create URL for showOffers")
|
|
281
|
+
return
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
switch launchMode {
|
|
285
|
+
case 1, 2:
|
|
286
|
+
DispatchQueue.main.async {
|
|
287
|
+
guard let rootVC = UIApplication.shared.windows.first?.rootViewController else { return }
|
|
288
|
+
|
|
289
|
+
let showWebView: () -> Void = {
|
|
290
|
+
let webVC: AcmoWebViewController
|
|
238
291
|
|
|
239
|
-
let
|
|
240
|
-
let webVC = AcmoWebViewController(url: url)
|
|
241
|
-
webVC.modalPresentationStyle = .fullScreen
|
|
242
|
-
rootVC.present(webVC, animated: true)
|
|
243
|
-
}
|
|
292
|
+
let isDefault = (route?.isEmpty ?? true) && campaignID == nil
|
|
244
293
|
|
|
245
|
-
let
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
rootVC.present(userUpdateVC, animated: true)
|
|
252
|
-
} else {
|
|
253
|
-
showWebView()
|
|
294
|
+
let isMatch: Bool = {
|
|
295
|
+
guard isDefault else { return false }
|
|
296
|
+
|
|
297
|
+
guard let preloaded = self.preloadedWebVC else {
|
|
298
|
+
self.log("Preload Check: No preloaded webview found.")
|
|
299
|
+
return false
|
|
254
300
|
}
|
|
301
|
+
let preloadedURL = preloaded.initialURL
|
|
302
|
+
|
|
303
|
+
if preloadedURL.absoluteString == url.absoluteString { return true }
|
|
304
|
+
|
|
305
|
+
guard let comp1 = URLComponents(url: preloadedURL, resolvingAgainstBaseURL: false),
|
|
306
|
+
let comp2 = URLComponents(url: url, resolvingAgainstBaseURL: false) else { return false }
|
|
307
|
+
|
|
308
|
+
let q1 = comp1.queryItems ?? []
|
|
309
|
+
let q2 = comp2.queryItems ?? []
|
|
310
|
+
|
|
311
|
+
if q1.count != q2.count {
|
|
312
|
+
return false
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
let matchesAll = q1.allSatisfy { item1 in
|
|
316
|
+
q2.contains { item2 in item1.name == item2.name && item1.value == item2.value }
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
return matchesAll && comp1.host == comp2.host && comp1.path == comp2.path
|
|
320
|
+
}()
|
|
321
|
+
|
|
322
|
+
if isMatch, let preloaded = self.preloadedWebVC {
|
|
323
|
+
self.log("Preload Check: MATCH FOUND. Using shared default webview.")
|
|
324
|
+
webVC = preloaded
|
|
325
|
+
} else {
|
|
326
|
+
self.log("Preload Check: Loading normally. (Req: \(isDefault ? "default" : "specific route"), Preload Available: \(self.preloadedWebVC != nil))")
|
|
327
|
+
webVC = AcmoWebViewController(url: url)
|
|
255
328
|
}
|
|
256
329
|
|
|
257
|
-
|
|
330
|
+
webVC.onDismiss = {
|
|
331
|
+
webVC.onDismiss = nil
|
|
332
|
+
}
|
|
258
333
|
|
|
259
|
-
if
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
showUserUpdateOrWeb()
|
|
263
|
-
})
|
|
264
|
-
privacyController.modalPresentationStyle = .fullScreen
|
|
265
|
-
rootVC.present(privacyController, animated: true)
|
|
266
|
-
} else {
|
|
267
|
-
showUserUpdateOrWeb()
|
|
268
|
-
}
|
|
269
|
-
} else {
|
|
270
|
-
UIApplication.shared.open(url, options: [:], completionHandler: nil)
|
|
334
|
+
if webVC.presentingViewController != nil || webVC.isBeingPresented || webVC.isBeingDismissed {
|
|
335
|
+
self.log("Preload Check: WebView is already busy/showing. Ignoring tap.")
|
|
336
|
+
return
|
|
271
337
|
}
|
|
338
|
+
|
|
339
|
+
webVC.modalPresentationStyle = .fullScreen
|
|
340
|
+
rootVC.present(webVC, animated: true)
|
|
272
341
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
342
|
+
|
|
343
|
+
let hasAccepted = Tyrads.instance.isPrivacyAccepted()
|
|
344
|
+
|
|
345
|
+
if launchMode == 1 || launchMode == 2 {
|
|
346
|
+
if !hasAccepted {
|
|
347
|
+
let privacyController = AcmoPrivacyPolicyController(onAccept: {
|
|
348
|
+
showWebView()
|
|
349
|
+
})
|
|
350
|
+
privacyController.modalPresentationStyle = .fullScreen
|
|
351
|
+
rootVC.present(privacyController, animated: true)
|
|
352
|
+
} else {
|
|
353
|
+
showWebView()
|
|
354
|
+
}
|
|
355
|
+
} else {
|
|
279
356
|
UIApplication.shared.open(url, options: [:], completionHandler: nil)
|
|
280
357
|
}
|
|
281
358
|
}
|
|
282
|
-
|
|
283
|
-
|
|
359
|
+
case 3:
|
|
360
|
+
DispatchQueue.main.async {
|
|
361
|
+
UIApplication.shared.open(url, options: [:], completionHandler: nil)
|
|
362
|
+
}
|
|
363
|
+
default:
|
|
364
|
+
DispatchQueue.main.async {
|
|
365
|
+
UIApplication.shared.open(url, options: [:], completionHandler: nil)
|
|
366
|
+
}
|
|
284
367
|
}
|
|
285
368
|
}
|
|
286
369
|
|
|
@@ -288,15 +371,6 @@ public class Tyrads : NSObject {
|
|
|
288
371
|
self.newUser = newValue
|
|
289
372
|
}
|
|
290
373
|
|
|
291
|
-
public func setSkipUserUpdate(_ newValue: Bool){
|
|
292
|
-
let key = "\(AcmoKeyNames.SKIP_FOR_USER_ID)\(self.publisherUserID)"
|
|
293
|
-
UserDefaults.standard.set(newValue, forKey: key)
|
|
294
|
-
}
|
|
295
|
-
public func getSkipUserUpdate() -> Bool{
|
|
296
|
-
let key = "\(AcmoKeyNames.SKIP_FOR_USER_ID)\(self.publisherUserID)"
|
|
297
|
-
return (UserDefaults.standard.bool(forKey: key) || newUser == false)
|
|
298
|
-
}
|
|
299
|
-
|
|
300
374
|
public func setSDKVersion(_ sdkVersion: String) {
|
|
301
375
|
AcmoConfig.SDK_VERSION = sdkVersion
|
|
302
376
|
}
|
|
@@ -308,11 +382,13 @@ public class Tyrads : NSObject {
|
|
|
308
382
|
public func setUserInfo(_ userInfo: TyradsUserInfo){
|
|
309
383
|
self.userInfo = userInfo
|
|
310
384
|
}
|
|
311
|
-
|
|
385
|
+
|
|
312
386
|
public func changeLanguage(_ lang: String) async {
|
|
313
387
|
self.currentLanguage = lang
|
|
314
388
|
UserDefaults.standard.set(lang, forKey: "locale")
|
|
315
389
|
await LocalizationService.shared.changeLanguage(locale: lang)
|
|
390
|
+
|
|
391
|
+
self.preloadedWebVC = nil
|
|
316
392
|
}
|
|
317
393
|
|
|
318
394
|
public func isPrivacyAccepted() -> Bool {
|
|
@@ -334,39 +410,21 @@ public class Tyrads : NSObject {
|
|
|
334
410
|
continuation.resume(returning: true)
|
|
335
411
|
}
|
|
336
412
|
|
|
337
|
-
let showUserUpdate: () -> Void = {
|
|
338
|
-
let userUpdateVC = AcmoUsersUpdateController(onSubmit: {
|
|
339
|
-
rootVC.dismiss(animated: true) {
|
|
340
|
-
print("User Update submitted, view dismissed.")
|
|
341
|
-
finishFlow()
|
|
342
|
-
}
|
|
343
|
-
})
|
|
344
|
-
userUpdateVC.isModalInPresentation = false
|
|
345
|
-
rootVC.present(userUpdateVC, animated: true)
|
|
346
|
-
}
|
|
347
|
-
|
|
348
413
|
let hasAcceptedPrivacy = self.isPrivacyAccepted()
|
|
349
|
-
let isNewUser = Tyrads.instance.newUser
|
|
350
414
|
|
|
351
|
-
print("showPrivacyFlowAndDismissOnComplete: Privacy Accepted: \(hasAcceptedPrivacy)
|
|
415
|
+
print("showPrivacyFlowAndDismissOnComplete: Privacy Accepted: \(hasAcceptedPrivacy)")
|
|
352
416
|
|
|
353
417
|
if !hasAcceptedPrivacy {
|
|
354
418
|
let privacyController = AcmoPrivacyPolicyController(onAccept: {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
rootVC.dismiss(animated: true) {
|
|
359
|
-
print("Privacy accepted, user is not new, view dismissed.")
|
|
360
|
-
finishFlow()
|
|
361
|
-
}
|
|
419
|
+
rootVC.dismiss(animated: true) {
|
|
420
|
+
print("Privacy accepted, view dismissed.")
|
|
421
|
+
finishFlow()
|
|
362
422
|
}
|
|
363
423
|
})
|
|
364
424
|
privacyController.modalPresentationStyle = .fullScreen
|
|
365
425
|
rootVC.present(privacyController, animated: true)
|
|
366
|
-
} else if isNewUser {
|
|
367
|
-
showUserUpdate()
|
|
368
426
|
} else {
|
|
369
|
-
print("Privacy accepted
|
|
427
|
+
print("Privacy accepted. No flow presented.")
|
|
370
428
|
finishFlow()
|
|
371
429
|
}
|
|
372
430
|
}
|