@tyrads.com/tyrads-sdk 3.0.0-beta.0 → 3.2.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 +130 -29
- package/ios/Tyrads/AcmoAssets.swift +14 -0
- package/ios/Tyrads/ApiHeaders.swift +1 -0
- package/ios/Tyrads/InitModel.swift +3 -0
- package/ios/Tyrads/Tyrads.swift +255 -213
- package/ios/Tyrads/WebViewController.swift +195 -0
- package/ios/Tyrads/core/utils/AcmoKeyNames.swift +29 -0
- package/ios/Tyrads/core/utils/ColorExtension.swift +55 -0
- package/ios/Tyrads/core/utils/Services/LocalizationService.swift +175 -0
- package/ios/Tyrads/helpers/device_details.swift +160 -0
- package/ios/Tyrads/legal/AcmoPrivacyPage.swift +353 -0
- package/ios/Tyrads/legal/PrivacyPageController.swift +31 -0
- package/ios/Tyrads/user/AcmoUserUpdatePage.swift +302 -0
- package/ios/Tyrads/user/AcmoUsersUpdateController.swift +26 -0
- package/ios/Tyrads/user/Repository.swift +89 -0
- package/ios/TyradsSdk.mm +22 -4
- package/ios/TyradsSdk.swift +101 -31
- package/lib/commonjs/acmo/core/helpers/launcher.js +20 -0
- package/lib/commonjs/acmo/core/helpers/launcher.js.map +1 -0
- package/lib/commonjs/acmo/core/helpers/native_methods.js +37 -0
- package/lib/commonjs/acmo/core/helpers/native_methods.js.map +1 -0
- package/lib/commonjs/acmo/core/helpers/numeral.js +19 -0
- package/lib/commonjs/acmo/core/helpers/numeral.js.map +1 -0
- package/lib/commonjs/acmo/core/services/localization_service.js +164 -0
- package/lib/commonjs/acmo/core/services/localization_service.js.map +1 -0
- package/lib/commonjs/acmo/core/storage/storage.js +15 -1
- package/lib/commonjs/acmo/core/storage/storage.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/active_offers_button.js +79 -0
- package/lib/commonjs/acmo/modules/dashboard/components/active_offers_button.js.map +1 -0
- package/lib/commonjs/acmo/modules/dashboard/components/custom_card.js +7 -10
- package/lib/commonjs/acmo/modules/dashboard/components/custom_card.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/custom_scroller.js +141 -0
- package/lib/commonjs/acmo/modules/dashboard/components/custom_scroller.js.map +1 -0
- package/lib/commonjs/acmo/{core/marquee.js → modules/dashboard/components/custom_shimmer.js} +46 -34
- package/lib/commonjs/acmo/modules/dashboard/components/custom_shimmer.js.map +1 -0
- package/lib/commonjs/acmo/modules/dashboard/components/offer_card.js +263 -0
- package/lib/commonjs/acmo/modules/dashboard/components/offer_card.js.map +1 -0
- package/lib/commonjs/acmo/modules/dashboard/components/offer_list_item.js +203 -0
- package/lib/commonjs/acmo/modules/dashboard/components/offer_list_item.js.map +1 -0
- package/lib/commonjs/acmo/modules/dashboard/components/premium_empty_widget.js +87 -0
- package/lib/commonjs/acmo/modules/dashboard/components/premium_empty_widget.js.map +1 -0
- package/lib/commonjs/acmo/modules/dashboard/components/premium_header.js +16 -14
- package/lib/commonjs/acmo/modules/dashboard/components/premium_header.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_loading.js +111 -0
- package/lib/commonjs/acmo/modules/dashboard/components/premium_loading.js.map +1 -0
- package/lib/commonjs/acmo/modules/dashboard/repository.js +108 -32
- package/lib/commonjs/acmo/modules/dashboard/repository.js.map +1 -1
- package/lib/commonjs/acmo/modules/dashboard/top_offers.js +85 -63
- package/lib/commonjs/acmo/modules/dashboard/top_offers.js.map +1 -1
- package/lib/commonjs/acmo/modules/localization/localization_context.js +56 -0
- package/lib/commonjs/acmo/modules/localization/localization_context.js.map +1 -0
- package/lib/commonjs/assets/images/angle_up.png +0 -0
- package/lib/commonjs/assets/images/diamond.png +0 -0
- package/lib/commonjs/assets/images/info.png +0 -0
- package/lib/commonjs/assets/images/info_icon.png +0 -0
- package/lib/commonjs/assets/images/premium-emptybg.jpeg +0 -0
- package/lib/commonjs/assets/images/rank_1.png +0 -0
- package/lib/commonjs/assets/images/rank_2.png +0 -0
- package/lib/commonjs/assets/images/rank_3.png +0 -0
- package/lib/commonjs/assets/images/rank_4.png +0 -0
- package/lib/commonjs/assets/images/rank_5.png +0 -0
- package/lib/commonjs/index.js +50 -16
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/acmo/core/helpers/launcher.js +15 -0
- package/lib/module/acmo/core/helpers/launcher.js.map +1 -0
- package/lib/module/acmo/core/helpers/native_methods.js +33 -0
- package/lib/module/acmo/core/helpers/native_methods.js.map +1 -0
- package/lib/module/acmo/core/helpers/numeral.js +14 -0
- package/lib/module/acmo/core/helpers/numeral.js.map +1 -0
- package/lib/module/acmo/core/services/localization_service.js +159 -0
- package/lib/module/acmo/core/services/localization_service.js.map +1 -0
- package/lib/module/acmo/core/storage/storage.js +13 -0
- package/lib/module/acmo/core/storage/storage.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/active_offers_button.js +73 -0
- package/lib/module/acmo/modules/dashboard/components/active_offers_button.js.map +1 -0
- package/lib/module/acmo/modules/dashboard/components/custom_card.js +7 -10
- package/lib/module/acmo/modules/dashboard/components/custom_card.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/custom_scroller.js +135 -0
- package/lib/module/acmo/modules/dashboard/components/custom_scroller.js.map +1 -0
- package/lib/module/acmo/modules/dashboard/components/custom_shimmer.js +66 -0
- package/lib/module/acmo/modules/dashboard/components/custom_shimmer.js.map +1 -0
- package/lib/module/acmo/modules/dashboard/components/offer_card.js +257 -0
- package/lib/module/acmo/modules/dashboard/components/offer_card.js.map +1 -0
- package/lib/module/acmo/modules/dashboard/components/offer_list_item.js +197 -0
- package/lib/module/acmo/modules/dashboard/components/offer_list_item.js.map +1 -0
- package/lib/module/acmo/modules/dashboard/components/premium_empty_widget.js +82 -0
- package/lib/module/acmo/modules/dashboard/components/premium_empty_widget.js.map +1 -0
- package/lib/module/acmo/modules/dashboard/components/premium_header.js +16 -14
- package/lib/module/acmo/modules/dashboard/components/premium_header.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/components/premium_loading.js +106 -0
- package/lib/module/acmo/modules/dashboard/components/premium_loading.js.map +1 -0
- package/lib/module/acmo/modules/dashboard/repository.js +105 -30
- package/lib/module/acmo/modules/dashboard/repository.js.map +1 -1
- package/lib/module/acmo/modules/dashboard/top_offers.js +86 -64
- package/lib/module/acmo/modules/dashboard/top_offers.js.map +1 -1
- package/lib/module/acmo/modules/localization/localization_context.js +45 -0
- package/lib/module/acmo/modules/localization/localization_context.js.map +1 -0
- package/lib/module/assets/images/angle_up.png +0 -0
- package/lib/module/assets/images/diamond.png +0 -0
- package/lib/module/assets/images/info.png +0 -0
- package/lib/module/assets/images/info_icon.png +0 -0
- package/lib/module/assets/images/premium-emptybg.jpeg +0 -0
- package/lib/module/assets/images/rank_1.png +0 -0
- package/lib/module/assets/images/rank_2.png +0 -0
- package/lib/module/assets/images/rank_3.png +0 -0
- package/lib/module/assets/images/rank_4.png +0 -0
- package/lib/module/assets/images/rank_5.png +0 -0
- package/lib/module/index.js +49 -17
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/acmo/core/helpers/launcher.d.ts +3 -0
- package/lib/typescript/commonjs/src/acmo/core/helpers/launcher.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/helpers/native_methods.d.ts +6 -0
- package/lib/typescript/commonjs/src/acmo/core/helpers/native_methods.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/helpers/numeral.d.ts +2 -0
- package/lib/typescript/commonjs/src/acmo/core/helpers/numeral.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/services/localization_service.d.ts +18 -0
- package/lib/typescript/commonjs/src/acmo/core/services/localization_service.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/core/storage/storage.d.ts +1 -0
- package/lib/typescript/commonjs/src/acmo/core/storage/storage.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/active_offers_button.d.ts +9 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/active_offers_button.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_card.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_scroller.d.ts +17 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_scroller.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_shimmer.d.ts +11 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/custom_shimmer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_card.d.ts +12 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_card.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_list_item.d.ts +15 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_list_item.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts +7 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_header.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_loading.d.ts +8 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_loading.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/repository.d.ts +2 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/repository.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/top_offers.d.ts +8 -7
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/top_offers.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/acmo/modules/localization/localization_context.d.ts +14 -0
- package/lib/typescript/commonjs/src/acmo/modules/localization/localization_context.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +8 -6
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/core/helpers/launcher.d.ts +3 -0
- package/lib/typescript/module/src/acmo/core/helpers/launcher.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/helpers/native_methods.d.ts +6 -0
- package/lib/typescript/module/src/acmo/core/helpers/native_methods.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/helpers/numeral.d.ts +2 -0
- package/lib/typescript/module/src/acmo/core/helpers/numeral.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/services/localization_service.d.ts +18 -0
- package/lib/typescript/module/src/acmo/core/services/localization_service.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/core/storage/storage.d.ts +1 -0
- package/lib/typescript/module/src/acmo/core/storage/storage.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/active_offers_button.d.ts +9 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/active_offers_button.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_card.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_scroller.d.ts +17 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_scroller.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_shimmer.d.ts +11 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/custom_shimmer.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_card.d.ts +12 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_card.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_list_item.d.ts +15 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_list_item.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts +7 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_empty_widget.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_header.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_loading.d.ts +8 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_loading.d.ts.map +1 -0
- package/lib/typescript/module/src/acmo/modules/dashboard/repository.d.ts +2 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/repository.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/top_offers.d.ts +8 -7
- package/lib/typescript/module/src/acmo/modules/dashboard/top_offers.d.ts.map +1 -1
- package/lib/typescript/module/src/acmo/modules/localization/localization_context.d.ts +14 -0
- package/lib/typescript/module/src/acmo/modules/localization/localization_context.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +8 -6
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +3 -6
- package/readme.md +8 -8
- package/src/acmo/core/helpers/launcher.ts +14 -0
- package/src/acmo/core/helpers/native_methods.ts +43 -0
- package/src/acmo/core/helpers/numeral.ts +14 -0
- package/src/acmo/core/services/localization_service.ts +200 -0
- package/src/acmo/core/storage/storage.ts +14 -0
- package/src/acmo/core/types/types.d.ts +11 -13
- package/src/acmo/modules/dashboard/components/active_offers_button.tsx +62 -0
- package/src/acmo/modules/dashboard/components/custom_card.tsx +5 -8
- package/src/acmo/modules/dashboard/components/custom_scroller.tsx +164 -0
- package/src/acmo/modules/dashboard/components/custom_shimmer.tsx +75 -0
- package/src/acmo/modules/dashboard/components/offer_card.tsx +248 -0
- package/src/acmo/modules/dashboard/components/offer_list_item.tsx +228 -0
- package/src/acmo/modules/dashboard/components/premium_empty_widget.tsx +79 -0
- package/src/acmo/modules/dashboard/components/premium_header.tsx +14 -13
- package/src/acmo/modules/dashboard/components/premium_loading.tsx +72 -0
- package/src/acmo/modules/dashboard/repository.ts +121 -46
- package/src/acmo/modules/dashboard/top_offers.tsx +105 -53
- package/src/acmo/modules/localization/localization_context.tsx +52 -0
- package/src/assets/images/angle_up.png +0 -0
- package/src/assets/images/diamond.png +0 -0
- package/src/assets/images/info.png +0 -0
- package/src/assets/images/info_icon.png +0 -0
- package/src/assets/images/premium-emptybg.jpeg +0 -0
- package/src/assets/images/rank_1.png +0 -0
- package/src/assets/images/rank_2.png +0 -0
- package/src/assets/images/rank_3.png +0 -0
- package/src/assets/images/rank_4.png +0 -0
- package/src/assets/images/rank_5.png +0 -0
- package/src/index.tsx +76 -34
- package/lib/commonjs/acmo/core/marquee.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/auto_scroller.js +0 -87
- package/lib/commonjs/acmo/modules/dashboard/components/auto_scroller.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/my_games_button.js +0 -48
- package/lib/commonjs/acmo/modules/dashboard/components/my_games_button.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/offer_info_section.js +0 -158
- package/lib/commonjs/acmo/modules/dashboard/components/offer_info_section.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_option_1.js +0 -180
- package/lib/commonjs/acmo/modules/dashboard/components/premium_option_1.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_option_2.js +0 -102
- package/lib/commonjs/acmo/modules/dashboard/components/premium_option_2.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_option_3.js +0 -41
- package/lib/commonjs/acmo/modules/dashboard/components/premium_option_3.js.map +0 -1
- package/lib/commonjs/acmo/modules/dashboard/components/premium_option_4.js +0 -214
- package/lib/commonjs/acmo/modules/dashboard/components/premium_option_4.js.map +0 -1
- package/lib/commonjs/i18n.js +0 -112
- package/lib/commonjs/i18n.js.map +0 -1
- package/lib/module/acmo/core/marquee.js +0 -54
- package/lib/module/acmo/core/marquee.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/auto_scroller.js +0 -81
- package/lib/module/acmo/modules/dashboard/components/auto_scroller.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/my_games_button.js +0 -43
- package/lib/module/acmo/modules/dashboard/components/my_games_button.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/offer_info_section.js +0 -153
- package/lib/module/acmo/modules/dashboard/components/offer_info_section.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/premium_option_1.js +0 -174
- package/lib/module/acmo/modules/dashboard/components/premium_option_1.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/premium_option_2.js +0 -97
- package/lib/module/acmo/modules/dashboard/components/premium_option_2.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/premium_option_3.js +0 -36
- package/lib/module/acmo/modules/dashboard/components/premium_option_3.js.map +0 -1
- package/lib/module/acmo/modules/dashboard/components/premium_option_4.js +0 -209
- package/lib/module/acmo/modules/dashboard/components/premium_option_4.js.map +0 -1
- package/lib/module/i18n.js +0 -107
- package/lib/module/i18n.js.map +0 -1
- package/lib/typescript/commonjs/src/acmo/core/marquee.d.ts +0 -11
- package/lib/typescript/commonjs/src/acmo/core/marquee.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/auto_scroller.d.ts +0 -10
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/auto_scroller.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/my_games_button.d.ts +0 -8
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/my_games_button.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_info_section.d.ts +0 -11
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_info_section.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_1.d.ts +0 -9
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_1.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_2.d.ts +0 -9
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_2.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_3.d.ts +0 -9
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_3.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_4.d.ts +0 -9
- package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_4.d.ts.map +0 -1
- package/lib/typescript/commonjs/src/i18n.d.ts +0 -3
- package/lib/typescript/commonjs/src/i18n.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/core/marquee.d.ts +0 -11
- package/lib/typescript/module/src/acmo/core/marquee.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/auto_scroller.d.ts +0 -10
- package/lib/typescript/module/src/acmo/modules/dashboard/components/auto_scroller.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/my_games_button.d.ts +0 -8
- package/lib/typescript/module/src/acmo/modules/dashboard/components/my_games_button.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_info_section.d.ts +0 -11
- package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_info_section.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_1.d.ts +0 -9
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_1.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_2.d.ts +0 -9
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_2.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_3.d.ts +0 -9
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_3.d.ts.map +0 -1
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_4.d.ts +0 -9
- package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_4.d.ts.map +0 -1
- package/lib/typescript/module/src/i18n.d.ts +0 -3
- package/lib/typescript/module/src/i18n.d.ts.map +0 -1
- package/src/acmo/core/marquee.tsx +0 -62
- package/src/acmo/modules/dashboard/components/auto_scroller.tsx +0 -85
- package/src/acmo/modules/dashboard/components/my_games_button.tsx +0 -40
- package/src/acmo/modules/dashboard/components/offer_info_section.tsx +0 -139
- package/src/acmo/modules/dashboard/components/premium_option_1.tsx +0 -163
- package/src/acmo/modules/dashboard/components/premium_option_2.tsx +0 -100
- package/src/acmo/modules/dashboard/components/premium_option_3.tsx +0 -42
- package/src/acmo/modules/dashboard/components/premium_option_4.tsx +0 -185
- package/src/i18n.ts +0 -115
@@ -1,5 +1,6 @@
|
|
1
|
-
import axios
|
1
|
+
import axios from 'axios';
|
2
2
|
import { getData } from '../../core/storage/storage';
|
3
|
+
import { acmoLaunchURLForce } from '../../core/helpers/launcher';
|
3
4
|
|
4
5
|
interface ApiHeaders {
|
5
6
|
languageCode: string;
|
@@ -12,28 +13,11 @@ interface ApiHeaders {
|
|
12
13
|
userAgent: string;
|
13
14
|
}
|
14
15
|
|
15
|
-
const
|
16
|
-
return campaigns.map((campaign) => ({
|
17
|
-
campaignId: campaign.campaignId || 0,
|
18
|
-
appId: campaign.app?.id || 0,
|
19
|
-
title: campaign.app?.title || 'Unknown Title',
|
20
|
-
creativePackName:
|
21
|
-
campaign.creative?.creativePacks?.[0]?.creativePackName || '',
|
22
|
-
fileUrl:
|
23
|
-
campaign.creative?.creativePacks?.[0]?.creatives?.[0]?.fileUrl || '',
|
24
|
-
points: campaign.campaignPayout?.totalPayoutConverted || 0,
|
25
|
-
rewards: campaign.campaignPayout?.totalEvents || 0,
|
26
|
-
currency: campaign.currency || {},
|
27
|
-
thumbnail: campaign.app?.thumbnail || '',
|
28
|
-
premium: campaign.premium || false,
|
29
|
-
sortingScore: campaign.sortingScore || 0,
|
30
|
-
}));
|
31
|
-
};
|
32
|
-
|
33
|
-
export const fetchCampaignsData = async (
|
34
|
-
// setLanguage: (language: string) => void,
|
16
|
+
export const fetchPremiumOfferDetails = async (
|
35
17
|
setPremiumColor: (color: string) => void,
|
36
|
-
setCampaigns: (campaigns:
|
18
|
+
setCampaigns: (campaigns: Campaign[]) => void,
|
19
|
+
setCurrencySale: (currencySale: CurrencySales) => void,
|
20
|
+
setActiveCount: (activeCount: number) => void,
|
37
21
|
setError: (error: string) => void,
|
38
22
|
setIsLoading: (loading: boolean) => void
|
39
23
|
): Promise<void> => {
|
@@ -41,11 +25,9 @@ export const fetchCampaignsData = async (
|
|
41
25
|
|
42
26
|
try {
|
43
27
|
const data: any = await getData('apiHeaders');
|
44
|
-
if (!data)
|
45
|
-
|
46
|
-
}
|
28
|
+
if (!data) throw new Error('apiHeaders data not found.');
|
29
|
+
|
47
30
|
const parsedHeaderData: ApiHeaders = JSON.parse(data);
|
48
|
-
// setLanguage(parsedHeaderData.languageCode);
|
49
31
|
setPremiumColor(parsedHeaderData.premiumColor);
|
50
32
|
|
51
33
|
const headers = {
|
@@ -59,37 +41,130 @@ export const fetchCampaignsData = async (
|
|
59
41
|
'User-Agent': parsedHeaderData.userAgent,
|
60
42
|
};
|
61
43
|
|
62
|
-
const
|
63
|
-
`https://api.tyrads.com/v3.0/campaigns?lang=${parsedHeaderData.languageCode}`,
|
64
|
-
{
|
65
|
-
headers: headers,
|
66
|
-
}
|
67
|
-
);
|
44
|
+
const langParam = `?lang=${parsedHeaderData.languageCode}`;
|
68
45
|
|
69
|
-
const
|
46
|
+
const [campaignsRes, currencyRes, summaryRes] = await Promise.all([
|
47
|
+
axios.get<{ data: Campaign[] }>(`https://api.tyrads.com/v3.0/campaigns${langParam}`, { headers }),
|
48
|
+
axios.get<{ data: { CurrencySales: CurrencySales } }>(`https://api.tyrads.com/v3.0/engagement${langParam}`, { headers }),
|
49
|
+
axios.get<{ data: { activeCampaignCount: number } }>(`https://api.tyrads.com/v3.0/activated-campaigns/summary${langParam}`, { headers })
|
50
|
+
]);
|
70
51
|
|
71
|
-
const hotOffers =
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
52
|
+
const hotOffers = campaignsRes.data.data
|
53
|
+
.sort((a, b) => {
|
54
|
+
if (a.premium && !b.premium) return -1;
|
55
|
+
if (!a.premium && b.premium) return 1;
|
56
|
+
return b.sortingScore - a.sortingScore;
|
57
|
+
})
|
58
|
+
.filter(item => item.campaignPayout.totalPlayablePayoutConverted > 0)
|
59
|
+
.slice(0, 5);
|
60
|
+
// const currency: CurrencySales = {
|
61
|
+
// "name": "Ramadhan Karem",
|
62
|
+
// "multiplier": 1.5,
|
63
|
+
// "bannerUrl": "",
|
64
|
+
// "dateStart": "2025-03-10T00:00:00.000Z",
|
65
|
+
// "dateEnd": "2025-03-10T23:59:59.000Z",
|
66
|
+
// remainingTimeSeconds: 3090
|
67
|
+
// };
|
79
68
|
|
80
69
|
setCampaigns(hotOffers);
|
70
|
+
|
71
|
+
setCurrencySale(currencyRes.data.data.CurrencySales);
|
72
|
+
|
73
|
+
setActiveCount(summaryRes.data.data.activeCampaignCount);
|
81
74
|
} catch (error: any) {
|
82
75
|
if (axios.isAxiosError(error) && error.response) {
|
83
76
|
console.log('Response Error:', error.response.data);
|
84
|
-
console.log('Status Code:', error.response.status);
|
85
|
-
console.log('Response Headers:', error.response.headers);
|
86
77
|
} else if (axios.isAxiosError(error) && error.request) {
|
87
78
|
console.log('No Response from API:', error.request);
|
88
79
|
} else {
|
89
|
-
console.log('
|
80
|
+
console.log('Request Setup Error:', error.message);
|
90
81
|
}
|
91
|
-
setError('Something went wrong, please try again');
|
82
|
+
setError('Something went wrong, please try again.');
|
92
83
|
} finally {
|
93
84
|
setIsLoading(false);
|
94
85
|
}
|
95
|
-
};
|
86
|
+
};
|
87
|
+
|
88
|
+
const track = async (activity: string) => {
|
89
|
+
const data: any = await getData('apiHeaders');
|
90
|
+
if (!data) throw new Error('apiHeaders data not found.');
|
91
|
+
|
92
|
+
const parsedHeaderData: ApiHeaders = JSON.parse(data);
|
93
|
+
|
94
|
+
const headers = {
|
95
|
+
'Content-Type': 'application/json',
|
96
|
+
Accept: 'application/json',
|
97
|
+
'X-User-ID': parsedHeaderData.xUserId,
|
98
|
+
'X-API-Key': parsedHeaderData.xApiKey,
|
99
|
+
'X-API-Secret': parsedHeaderData.xApiSecret,
|
100
|
+
'X-SDK-Platform': parsedHeaderData.xSdkPlatform,
|
101
|
+
'X-SDK-Version': parsedHeaderData.xSdkVersion,
|
102
|
+
'User-Agent': parsedHeaderData.userAgent,
|
103
|
+
};
|
104
|
+
try {
|
105
|
+
const fd = {
|
106
|
+
"activity": activity
|
107
|
+
};
|
108
|
+
await axios.post('https://api.tyrads.com/v3.0/user-activities', fd, { headers });
|
109
|
+
} catch (error) {
|
110
|
+
if (axios.isAxiosError(error) && error.response) {
|
111
|
+
console.log('Response Error:', error.response.data);
|
112
|
+
} else if (axios.isAxiosError(error) && error.request) {
|
113
|
+
console.log('No Response from API:', error.request);
|
114
|
+
} else {
|
115
|
+
console.log('Request Setup Error:', error);
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
export const openOffer = async (campaign: Campaign) => {
|
121
|
+
const campaignId = campaign.campaignId;
|
122
|
+
const clickUrl = campaign.tracking.clickUrl;
|
123
|
+
const isRetryDownload = campaign.isRetryDownload;
|
124
|
+
const isInstalled = campaign.isInstalled;
|
125
|
+
const previewUrl = campaign.app.previewUrl;
|
126
|
+
const s2sClickUrl = campaign.tracking.s2sClickUrl;
|
127
|
+
|
128
|
+
const data: any = await getData('apiHeaders');
|
129
|
+
if (!data) throw new Error('apiHeaders data not found.');
|
130
|
+
|
131
|
+
const parsedHeaderData: ApiHeaders = JSON.parse(data);
|
132
|
+
|
133
|
+
const headers = {
|
134
|
+
'Content-Type': 'application/json',
|
135
|
+
Accept: 'application/json',
|
136
|
+
'X-User-ID': parsedHeaderData.xUserId,
|
137
|
+
'X-API-Key': parsedHeaderData.xApiKey,
|
138
|
+
'X-API-Secret': parsedHeaderData.xApiSecret,
|
139
|
+
'X-SDK-Platform': parsedHeaderData.xSdkPlatform,
|
140
|
+
'X-SDK-Version': parsedHeaderData.xSdkVersion,
|
141
|
+
'User-Agent': parsedHeaderData.userAgent,
|
142
|
+
};
|
143
|
+
|
144
|
+
try {
|
145
|
+
var url = clickUrl;
|
146
|
+
if (isInstalled) {
|
147
|
+
url = previewUrl;
|
148
|
+
} else {
|
149
|
+
if (isRetryDownload) {
|
150
|
+
await track("CampaignActivatedRetry");
|
151
|
+
} else {
|
152
|
+
await track("CampaignActivated");
|
153
|
+
}
|
154
|
+
await axios.post(`https://api.tyrads.com/v3.0/campaigns/active/${campaignId}`, {}, { headers });
|
155
|
+
}
|
156
|
+
if (s2sClickUrl != null) {
|
157
|
+
const res = await axios.get(s2sClickUrl);
|
158
|
+
if (res.status == 200) {
|
159
|
+
// url = res.data.url;
|
160
|
+
return;
|
161
|
+
}
|
162
|
+
}
|
163
|
+
await acmoLaunchURLForce(url);
|
164
|
+
} catch (error) {
|
165
|
+
console.log('=============Error=============');
|
166
|
+
console.log(error);
|
167
|
+
console.log('====================================');
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
@@ -2,65 +2,95 @@ import React, { useState, useEffect } from 'react';
|
|
2
2
|
import {
|
3
3
|
View,
|
4
4
|
Text,
|
5
|
-
ActivityIndicator,
|
6
5
|
StyleSheet,
|
7
6
|
} from 'react-native';
|
8
|
-
import {
|
7
|
+
import { fetchPremiumOfferDetails, openOffer } from './repository';
|
9
8
|
import PremiumHeaderSection from './components/premium_header';
|
10
9
|
import CustomCard from './components/custom_card';
|
11
|
-
import
|
12
|
-
import
|
13
|
-
import
|
14
|
-
import
|
15
|
-
import
|
10
|
+
import ActiveOffersButton from './components/active_offers_button';
|
11
|
+
import { AcmoOfferListItem } from './components/offer_list_item';
|
12
|
+
import AcmoOfferCard from './components/offer_card';
|
13
|
+
import AcmoScrollPager from './components/custom_scroller';
|
14
|
+
import PremiumEmptyView from './components/premium_empty_widget';
|
15
|
+
import PremiumWidgetsLoading from './components/premium_loading';
|
16
|
+
import TyradsNativeMethods from '../../core/helpers/native_methods';
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
export const enum PremiumWidgetStyles {
|
19
|
+
list,
|
20
|
+
sliderCards,
|
21
|
+
}
|
22
|
+
|
23
|
+
interface PremiumWidgetProps {
|
24
|
+
widgetStyle?: PremiumWidgetStyles;
|
22
25
|
onNavigate: (route?: string, campaignID?: number) => void;
|
23
26
|
}
|
24
27
|
|
25
|
-
const
|
26
|
-
|
27
|
-
showMyOffers = false,
|
28
|
-
showMyOffersEmptyView = false,
|
29
|
-
style = 1,
|
28
|
+
const PremiumWidgets: React.FC<PremiumWidgetProps> = ({
|
29
|
+
widgetStyle = PremiumWidgetStyles.list,
|
30
30
|
onNavigate
|
31
31
|
}) => {
|
32
|
-
const [campaigns, setCampaigns] = useState<
|
32
|
+
const [campaigns, setCampaigns] = useState<Campaign[]>([]);
|
33
33
|
const [isLoading, setIsLoading] = useState<boolean>(true);
|
34
34
|
const [error, setError] = useState<string | null>(null);
|
35
35
|
const [premiumColor, setPremiumColor] = useState<string>('#1C90DF');
|
36
|
-
|
36
|
+
const [currencySale, setCurrencySale] = useState<CurrencySales>();
|
37
|
+
const [activeCount, setActiveCount] = useState<number>(0);
|
38
|
+
const [loadingIndex, setLoadingIndex] = useState<number | null>(null);
|
37
39
|
|
38
40
|
useEffect(() => {
|
39
|
-
|
40
|
-
// setLanguage,
|
41
|
+
fetchPremiumOfferDetails(
|
41
42
|
setPremiumColor,
|
42
43
|
setCampaigns,
|
44
|
+
setCurrencySale,
|
45
|
+
setActiveCount,
|
43
46
|
setError,
|
44
|
-
setIsLoading
|
47
|
+
setIsLoading,
|
45
48
|
);
|
49
|
+
|
46
50
|
}, []);
|
47
51
|
|
48
52
|
const handleShowOffers = () => {
|
49
53
|
onNavigate();
|
50
54
|
};
|
51
55
|
const handleCampaignPress = (campaignId: number) => {
|
52
|
-
onNavigate(
|
56
|
+
onNavigate("offers", campaignId);
|
53
57
|
};
|
54
58
|
|
55
|
-
const
|
59
|
+
const handleActiveOffersPress = (route: string) => {
|
56
60
|
onNavigate(route);
|
57
61
|
};
|
58
62
|
|
63
|
+
const handleButtonPress = async (campaign: Campaign) => {
|
64
|
+
let isReady = await TyradsNativeMethods.isPrivacyAccepted()
|
65
|
+
if (!isReady) {
|
66
|
+
try {
|
67
|
+
const result = await TyradsNativeMethods.checkOnboardingProcess();
|
68
|
+
console.log("Privacy flow result:", result);
|
69
|
+
isReady = result === true;
|
70
|
+
} catch (err) {
|
71
|
+
console.error("Privacy flow error:", err);
|
72
|
+
isReady = false;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
if (!isReady) {
|
76
|
+
return
|
77
|
+
}
|
78
|
+
await openOffer(campaign);
|
79
|
+
await fetchPremiumOfferDetails(
|
80
|
+
setPremiumColor,
|
81
|
+
setCampaigns,
|
82
|
+
setCurrencySale,
|
83
|
+
setActiveCount,
|
84
|
+
setError,
|
85
|
+
setIsLoading,
|
86
|
+
);
|
87
|
+
}
|
88
|
+
|
59
89
|
if (isLoading) {
|
60
90
|
return (
|
61
|
-
<
|
62
|
-
|
63
|
-
|
91
|
+
<PremiumWidgetsLoading
|
92
|
+
widgetStyle={widgetStyle}
|
93
|
+
/>
|
64
94
|
);
|
65
95
|
}
|
66
96
|
|
@@ -72,53 +102,75 @@ const TopOffers: React.FC<TopOffersProps> = ({
|
|
72
102
|
);
|
73
103
|
}
|
74
104
|
|
105
|
+
|
75
106
|
if (campaigns.length === 0) {
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
</View>
|
81
|
-
);
|
82
|
-
} else {
|
83
|
-
return <View />;
|
84
|
-
}
|
107
|
+
return <PremiumEmptyView
|
108
|
+
colorPremium={premiumColor}
|
109
|
+
onContinue={handleShowOffers}
|
110
|
+
/>
|
85
111
|
}
|
86
112
|
|
87
113
|
return (
|
88
|
-
<CustomCard style={{}}>
|
114
|
+
<CustomCard style={{ flexDirection: 'row' }}>
|
89
115
|
<View style={{ flex: 1 }}>
|
90
|
-
<PremiumHeaderSection
|
116
|
+
<PremiumHeaderSection premiumColor={premiumColor} onShowOffers={handleShowOffers} />
|
91
117
|
<View style={styles.headerSpacer} />
|
92
118
|
{(() => {
|
93
|
-
switch (
|
94
|
-
case
|
95
|
-
return (
|
96
|
-
<PremiumOption1 data={campaigns} premiumColor={premiumColor} onCampaignPress={handleCampaignPress} />
|
97
|
-
);
|
98
|
-
case 2:
|
119
|
+
switch (widgetStyle) {
|
120
|
+
case PremiumWidgetStyles.list:
|
99
121
|
return (
|
100
|
-
|
122
|
+
campaigns.map((item, index) => (
|
123
|
+
<AcmoOfferListItem
|
124
|
+
key={index}
|
125
|
+
onPress={async () => handleCampaignPress && handleCampaignPress(item.campaignId)}
|
126
|
+
offer={item}
|
127
|
+
currencySales={currencySale}
|
128
|
+
index={index}
|
129
|
+
loadingIndex={loadingIndex}
|
130
|
+
setLoadingIndex={setLoadingIndex}
|
131
|
+
colorPremium={premiumColor}
|
132
|
+
onButtonTap={async () => handleButtonPress(item)}
|
133
|
+
/>
|
134
|
+
))
|
101
135
|
);
|
102
|
-
case
|
136
|
+
case PremiumWidgetStyles.sliderCards:
|
103
137
|
return (
|
104
|
-
<
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
138
|
+
<AcmoScrollPager
|
139
|
+
totalPages={campaigns.length}
|
140
|
+
activeIndicatorColor={premiumColor}
|
141
|
+
content={(index) => (
|
142
|
+
<AcmoOfferCard
|
143
|
+
item={campaigns[index]!}
|
144
|
+
onButtonClick={async () => handleButtonPress(campaigns[index]!)}
|
145
|
+
currencySaleModel={currencySale}
|
146
|
+
premiumColor={premiumColor}
|
147
|
+
isLoading={false}
|
148
|
+
onTap={async () => handleCampaignPress && handleCampaignPress(campaigns[index]!.campaignId)}
|
149
|
+
/>
|
150
|
+
)}
|
151
|
+
/>
|
109
152
|
);
|
110
153
|
default:
|
111
154
|
return <Text>Please specify a correct style</Text>;
|
112
155
|
}
|
113
156
|
})()}
|
114
157
|
<View style={styles.gameListSpacer} />
|
115
|
-
{
|
158
|
+
<ActiveOffersButton activeCount={activeCount} premiumColor={premiumColor} onPress={handleActiveOffersPress} />
|
116
159
|
</View>
|
117
160
|
</CustomCard>
|
118
161
|
);
|
119
162
|
};
|
120
163
|
|
121
164
|
const styles = StyleSheet.create({
|
165
|
+
itemContainer: {
|
166
|
+
flexDirection: 'row',
|
167
|
+
flex: 1,
|
168
|
+
width: '100%',
|
169
|
+
justifyContent: 'space-between',
|
170
|
+
alignItems: 'center',
|
171
|
+
paddingHorizontal: 16,
|
172
|
+
paddingVertical: 8,
|
173
|
+
},
|
122
174
|
loadingContainer: {
|
123
175
|
flex: 1,
|
124
176
|
justifyContent: 'center',
|
@@ -141,4 +193,4 @@ const styles = StyleSheet.create({
|
|
141
193
|
},
|
142
194
|
});
|
143
195
|
|
144
|
-
export default
|
196
|
+
export default PremiumWidgets;
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import React, { createContext, useContext, useState, useEffect } from 'react';
|
2
|
+
import LocalizationService from '../../core/services/localization_service';
|
3
|
+
|
4
|
+
interface LocalizationContextProps {
|
5
|
+
t: (key: string, args?: Record<string, string | number>) => string;
|
6
|
+
changeLanguage: (lang: string) => Promise<void>;
|
7
|
+
currentLanguage: string;
|
8
|
+
}
|
9
|
+
|
10
|
+
const LocalizationContext = createContext<LocalizationContextProps>({
|
11
|
+
t: (key) => key,
|
12
|
+
changeLanguage: async () => {},
|
13
|
+
currentLanguage: 'en',
|
14
|
+
});
|
15
|
+
|
16
|
+
let _updateLanguage: ((lang: string) => void) | null = null;
|
17
|
+
|
18
|
+
export const LocalizationProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
19
|
+
const [currentLanguage, setCurrentLanguage] = useState('en');
|
20
|
+
const service = LocalizationService.getInstance();
|
21
|
+
|
22
|
+
useEffect(() => {
|
23
|
+
_updateLanguage = setCurrentLanguage;
|
24
|
+
}, []);
|
25
|
+
|
26
|
+
const changeLanguage = async (lang: string) => {
|
27
|
+
await service.changeLanguage(lang);
|
28
|
+
setCurrentLanguage(lang);
|
29
|
+
};
|
30
|
+
|
31
|
+
const t = (key: string, args?: Record<string, string | number>) => service.translate(key, args);
|
32
|
+
|
33
|
+
return (
|
34
|
+
<LocalizationContext.Provider value={{ t, changeLanguage, currentLanguage }}>
|
35
|
+
{children}
|
36
|
+
</LocalizationContext.Provider>
|
37
|
+
);
|
38
|
+
};
|
39
|
+
|
40
|
+
export const useLocalization = () => useContext(LocalizationContext);
|
41
|
+
|
42
|
+
export const updateProviderLanguage = async (lang: string) => {
|
43
|
+
const service = LocalizationService.getInstance();
|
44
|
+
await service.init(lang);
|
45
|
+
_updateLanguage?.(lang);
|
46
|
+
};
|
47
|
+
|
48
|
+
export const changeProviderLanguage = async (lang: string) => {
|
49
|
+
const service = LocalizationService.getInstance();
|
50
|
+
await service.changeLanguage(lang);
|
51
|
+
_updateLanguage?.(lang);
|
52
|
+
};
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
package/src/index.tsx
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
import { NativeModules, Platform, View,} from 'react-native';
|
1
|
+
import { NativeEventEmitter, NativeModules, Platform, View, } from 'react-native';
|
2
2
|
|
3
|
-
import TopOffers from './acmo/modules/dashboard/top_offers';
|
3
|
+
import TopOffers, { PremiumWidgetStyles } from './acmo/modules/dashboard/top_offers';
|
4
4
|
import { saveData } from './acmo/core/storage/storage';
|
5
|
-
import
|
6
|
-
import
|
5
|
+
import Localization from './acmo/core/services/localization_service';
|
6
|
+
import { changeProviderLanguage, LocalizationProvider, updateProviderLanguage } from './acmo/modules/localization/localization_context';
|
7
|
+
import PremiumWidgetsLoading from './acmo/modules/dashboard/components/premium_loading';
|
7
8
|
|
8
9
|
// const TyradsSdkComposeView = requireNativeComponent('TyradsSdkComposeView');
|
9
10
|
|
@@ -17,23 +18,54 @@ const LINKING_ERROR =
|
|
17
18
|
const TyradsSdk = NativeModules.TyradsSdk
|
18
19
|
? NativeModules.TyradsSdk
|
19
20
|
: new Proxy(
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
{},
|
22
|
+
{
|
23
|
+
get() {
|
24
|
+
throw new Error(LINKING_ERROR);
|
25
|
+
},
|
26
|
+
}
|
27
|
+
);
|
28
|
+
|
29
|
+
const tyradsEmitter = new NativeEventEmitter(TyradsSdk);
|
30
|
+
|
31
|
+
let languageChangedSubscription: any = null;
|
27
32
|
|
28
33
|
const Tyrads = {
|
29
34
|
init: async (apiKey: string, apiSecret: string, encKey?: string) => {
|
30
35
|
const data = await TyradsSdk.init(apiKey, apiSecret, encKey);
|
36
|
+
|
37
|
+
await saveData("credentials", {
|
38
|
+
'X-API-Key': apiKey,
|
39
|
+
'X-API-Secret': apiSecret
|
40
|
+
});
|
41
|
+
|
42
|
+
let languageCode = "en";
|
43
|
+
try {
|
44
|
+
const parsed = typeof data === "string" ? JSON.parse(data) : data;
|
45
|
+
if (parsed?.languageCode) {
|
46
|
+
languageCode = parsed.languageCode;
|
47
|
+
}
|
48
|
+
} catch { }
|
49
|
+
|
50
|
+
TyradsSdk.startObserving();
|
51
|
+
languageChangedSubscription?.remove();
|
52
|
+
languageChangedSubscription = tyradsEmitter.addListener(
|
53
|
+
'LanguageChanged',
|
54
|
+
async (lang: string) => {
|
55
|
+
console.log('LanguageChanged event from Android SDK:', lang);
|
56
|
+
await changeProviderLanguage(lang);
|
57
|
+
}
|
58
|
+
);
|
59
|
+
|
60
|
+
await saveData("language", languageCode);
|
61
|
+
await Localization.getInstance().init(languageCode);
|
62
|
+
await updateProviderLanguage(languageCode);
|
63
|
+
|
31
64
|
return data;
|
32
65
|
},
|
33
66
|
loginUser: async (userId: string) => {
|
34
67
|
try {
|
35
68
|
const data = await TyradsSdk.loginUser(userId);
|
36
|
-
|
37
69
|
if (typeof data === "object") {
|
38
70
|
await saveData('apiHeaders', JSON.stringify(data));
|
39
71
|
await saveData('language', data.languageCode);
|
@@ -41,54 +73,64 @@ const Tyrads = {
|
|
41
73
|
await saveData('apiHeaders', data);
|
42
74
|
await saveData('language', JSON.parse(data).languageCode);
|
43
75
|
}
|
44
|
-
|
45
76
|
return data;
|
46
77
|
} catch (err) {
|
47
78
|
return null;
|
48
79
|
}
|
49
80
|
},
|
50
|
-
|
81
|
+
|
51
82
|
showOffers: async ({
|
52
83
|
launchMode = 3,
|
53
84
|
route,
|
54
|
-
campaignID
|
55
|
-
}: { launchMode?: number; route?: string; campaignID?: number } = {}) => {
|
85
|
+
campaignID,
|
86
|
+
}: { launchMode?: number; route?: string; campaignID?: number | null } = {}) => {
|
56
87
|
if (Platform.OS === 'ios') {
|
57
|
-
|
88
|
+
if (campaignID == null) {
|
89
|
+
return await TyradsSdk.showOffers(launchMode, route);
|
90
|
+
}
|
91
|
+
return await TyradsSdk.showOfferDetails(launchMode, route, campaignID);
|
58
92
|
} else {
|
59
|
-
|
93
|
+
if (campaignID == null) {
|
94
|
+
return await TyradsSdk.showOffers(route);
|
95
|
+
}
|
96
|
+
return await TyradsSdk.showOfferDetails(route, campaignID);
|
60
97
|
}
|
61
98
|
},
|
62
99
|
topPremiumOffers: ({
|
63
|
-
|
64
|
-
showMyOffers = true,
|
65
|
-
showMyOffersEmptyView = false,
|
66
|
-
viewStyle = 1,
|
100
|
+
widgetStyle,
|
67
101
|
launchMode = 2,
|
68
102
|
}: {
|
69
|
-
|
70
|
-
showMyOffers?: boolean;
|
71
|
-
showMyOffersEmptyView?: boolean;
|
72
|
-
viewStyle?: number;
|
103
|
+
widgetStyle?: PremiumWidgetStyles;
|
73
104
|
launchMode?: number;
|
74
105
|
} = {}) => {
|
75
|
-
const handleNavigation = (route?: string, campaignID?: number) => {
|
76
|
-
Tyrads.showOffers({ route: route, campaignID: campaignID, launchMode: launchMode});
|
106
|
+
const handleNavigation = (route?: string, campaignID?: number | null) => {
|
107
|
+
Tyrads.showOffers({ route: route, campaignID: campaignID, launchMode: launchMode });
|
77
108
|
};
|
78
109
|
return (
|
79
|
-
<
|
110
|
+
<LocalizationProvider>
|
80
111
|
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
|
81
112
|
<TopOffers
|
82
|
-
|
83
|
-
showMyOffers={showMyOffers}
|
84
|
-
showMyOffersEmptyView={showMyOffersEmptyView}
|
85
|
-
style={viewStyle}
|
113
|
+
widgetStyle={widgetStyle}
|
86
114
|
onNavigate={handleNavigation}
|
87
115
|
/>
|
88
116
|
</View>
|
89
|
-
</
|
117
|
+
</LocalizationProvider>
|
90
118
|
);
|
91
119
|
},
|
120
|
+
topPremiumOffersLoading: (
|
121
|
+
{ widgetStyle = PremiumWidgetStyles.list }: {
|
122
|
+
widgetStyle?: PremiumWidgetStyles;
|
123
|
+
}
|
124
|
+
) => {
|
125
|
+
return (
|
126
|
+
<PremiumWidgetsLoading
|
127
|
+
widgetStyle={widgetStyle}
|
128
|
+
/>
|
129
|
+
);
|
130
|
+
},
|
131
|
+
changeLanguage: async (lang: string) => {
|
132
|
+
return await TyradsSdk.changeLanguage(lang);
|
133
|
+
},
|
92
134
|
};
|
93
135
|
|
94
136
|
export default Tyrads;
|