@tyrads.com/tyrads-sdk 2.0.0-beta.2 → 2.0.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.
Files changed (122) hide show
  1. package/LICENSE +11 -11
  2. package/android/build.gradle +117 -117
  3. package/android/gradle.properties +5 -5
  4. package/android/src/main/AndroidManifest.xml +3 -3
  5. package/android/src/main/AndroidManifestNew.xml +2 -2
  6. package/android/src/main/java/com/tyradssdk/TyradsSdkComposeViewManager.kt +112 -112
  7. package/android/src/main/java/com/tyradssdk/TyradsSdkModule.kt +56 -56
  8. package/android/src/main/java/com/tyradssdk/TyradsSdkPackage.kt +18 -21
  9. package/ios/Tyrads/AcmoConfig.swift +32 -31
  10. package/ios/Tyrads/ApiHeaders.swift +12 -0
  11. package/ios/Tyrads/InitModel.swift +48 -46
  12. package/ios/Tyrads/Tyrads.swift +199 -176
  13. package/ios/TyradsSdk-Bridging-Header.h +2 -2
  14. package/ios/TyradsSdk.mm +14 -11
  15. package/ios/TyradsSdk.swift +47 -27
  16. package/lib/commonjs/acmo/core/marquee.js.map +1 -1
  17. package/lib/commonjs/acmo/core/storage/storage.js.map +1 -1
  18. package/lib/commonjs/acmo/core/types/types.d.js.map +1 -1
  19. package/lib/commonjs/acmo/modules/dashboard/components/auto_scroller.js.map +1 -1
  20. package/lib/commonjs/acmo/modules/dashboard/components/custom_card.js.map +1 -1
  21. package/lib/commonjs/acmo/modules/dashboard/components/my_games_button.js +3 -5
  22. package/lib/commonjs/acmo/modules/dashboard/components/my_games_button.js.map +1 -1
  23. package/lib/commonjs/acmo/modules/dashboard/components/offer_info_section.js +3 -8
  24. package/lib/commonjs/acmo/modules/dashboard/components/offer_info_section.js.map +1 -1
  25. package/lib/commonjs/acmo/modules/dashboard/components/premium_header.js +3 -3
  26. package/lib/commonjs/acmo/modules/dashboard/components/premium_header.js.map +1 -1
  27. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_1.js +2 -7
  28. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_1.js.map +1 -1
  29. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_2.js +4 -6
  30. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_2.js.map +1 -1
  31. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_3.js +4 -6
  32. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_3.js.map +1 -1
  33. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_4.js +5 -6
  34. package/lib/commonjs/acmo/modules/dashboard/components/premium_option_4.js.map +1 -1
  35. package/lib/commonjs/acmo/modules/dashboard/repository.js.map +1 -1
  36. package/lib/commonjs/acmo/modules/dashboard/top_offers.js +23 -7
  37. package/lib/commonjs/acmo/modules/dashboard/top_offers.js.map +1 -1
  38. package/lib/commonjs/i18n.js.map +1 -1
  39. package/lib/commonjs/index.js +12 -2
  40. package/lib/commonjs/index.js.map +1 -1
  41. package/lib/module/acmo/core/marquee.js.map +1 -1
  42. package/lib/module/acmo/core/storage/storage.js.map +1 -1
  43. package/lib/module/acmo/core/types/types.d.js.map +1 -1
  44. package/lib/module/acmo/modules/dashboard/components/auto_scroller.js.map +1 -1
  45. package/lib/module/acmo/modules/dashboard/components/custom_card.js.map +1 -1
  46. package/lib/module/acmo/modules/dashboard/components/my_games_button.js +3 -5
  47. package/lib/module/acmo/modules/dashboard/components/my_games_button.js.map +1 -1
  48. package/lib/module/acmo/modules/dashboard/components/offer_info_section.js +3 -8
  49. package/lib/module/acmo/modules/dashboard/components/offer_info_section.js.map +1 -1
  50. package/lib/module/acmo/modules/dashboard/components/premium_header.js +3 -3
  51. package/lib/module/acmo/modules/dashboard/components/premium_header.js.map +1 -1
  52. package/lib/module/acmo/modules/dashboard/components/premium_option_1.js +2 -7
  53. package/lib/module/acmo/modules/dashboard/components/premium_option_1.js.map +1 -1
  54. package/lib/module/acmo/modules/dashboard/components/premium_option_2.js +4 -6
  55. package/lib/module/acmo/modules/dashboard/components/premium_option_2.js.map +1 -1
  56. package/lib/module/acmo/modules/dashboard/components/premium_option_3.js +4 -6
  57. package/lib/module/acmo/modules/dashboard/components/premium_option_3.js.map +1 -1
  58. package/lib/module/acmo/modules/dashboard/components/premium_option_4.js +5 -6
  59. package/lib/module/acmo/modules/dashboard/components/premium_option_4.js.map +1 -1
  60. package/lib/module/acmo/modules/dashboard/repository.js.map +1 -1
  61. package/lib/module/acmo/modules/dashboard/top_offers.js +23 -7
  62. package/lib/module/acmo/modules/dashboard/top_offers.js.map +1 -1
  63. package/lib/module/i18n.js.map +1 -1
  64. package/lib/module/index.js +12 -2
  65. package/lib/module/index.js.map +1 -1
  66. package/lib/typescript/commonjs/src/acmo/core/storage/storage.d.ts.map +1 -1
  67. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/my_games_button.d.ts +1 -0
  68. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/my_games_button.d.ts.map +1 -1
  69. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_info_section.d.ts +1 -0
  70. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/offer_info_section.d.ts.map +1 -1
  71. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_header.d.ts +1 -0
  72. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_header.d.ts.map +1 -1
  73. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_1.d.ts +1 -0
  74. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_1.d.ts.map +1 -1
  75. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_2.d.ts +1 -0
  76. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_2.d.ts.map +1 -1
  77. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_3.d.ts +1 -0
  78. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_3.d.ts.map +1 -1
  79. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_4.d.ts +1 -0
  80. package/lib/typescript/commonjs/src/acmo/modules/dashboard/components/premium_option_4.d.ts.map +1 -1
  81. package/lib/typescript/commonjs/src/acmo/modules/dashboard/repository.d.ts.map +1 -1
  82. package/lib/typescript/commonjs/src/acmo/modules/dashboard/top_offers.d.ts +1 -0
  83. package/lib/typescript/commonjs/src/acmo/modules/dashboard/top_offers.d.ts.map +1 -1
  84. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  85. package/lib/typescript/module/src/acmo/core/storage/storage.d.ts.map +1 -1
  86. package/lib/typescript/module/src/acmo/modules/dashboard/components/my_games_button.d.ts +1 -0
  87. package/lib/typescript/module/src/acmo/modules/dashboard/components/my_games_button.d.ts.map +1 -1
  88. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_info_section.d.ts +1 -0
  89. package/lib/typescript/module/src/acmo/modules/dashboard/components/offer_info_section.d.ts.map +1 -1
  90. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_header.d.ts +1 -0
  91. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_header.d.ts.map +1 -1
  92. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_1.d.ts +1 -0
  93. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_1.d.ts.map +1 -1
  94. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_2.d.ts +1 -0
  95. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_2.d.ts.map +1 -1
  96. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_3.d.ts +1 -0
  97. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_3.d.ts.map +1 -1
  98. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_4.d.ts +1 -0
  99. package/lib/typescript/module/src/acmo/modules/dashboard/components/premium_option_4.d.ts.map +1 -1
  100. package/lib/typescript/module/src/acmo/modules/dashboard/repository.d.ts.map +1 -1
  101. package/lib/typescript/module/src/acmo/modules/dashboard/top_offers.d.ts +1 -0
  102. package/lib/typescript/module/src/acmo/modules/dashboard/top_offers.d.ts.map +1 -1
  103. package/lib/typescript/module/src/index.d.ts.map +1 -1
  104. package/package.json +197 -197
  105. package/readme.md +95 -97
  106. package/src/acmo/core/marquee.tsx +61 -61
  107. package/src/acmo/core/storage/storage.ts +27 -27
  108. package/src/acmo/core/types/types.d.ts +93 -93
  109. package/src/acmo/modules/dashboard/components/auto_scroller.tsx +84 -84
  110. package/src/acmo/modules/dashboard/components/custom_card.tsx +30 -30
  111. package/src/acmo/modules/dashboard/components/my_games_button.tsx +39 -39
  112. package/src/acmo/modules/dashboard/components/offer_info_section.tsx +138 -143
  113. package/src/acmo/modules/dashboard/components/premium_header.tsx +80 -80
  114. package/src/acmo/modules/dashboard/components/premium_option_1.tsx +155 -160
  115. package/src/acmo/modules/dashboard/components/premium_option_2.tsx +99 -103
  116. package/src/acmo/modules/dashboard/components/premium_option_3.tsx +41 -45
  117. package/src/acmo/modules/dashboard/components/premium_option_4.tsx +184 -183
  118. package/src/acmo/modules/dashboard/repository.ts +94 -94
  119. package/src/acmo/modules/dashboard/top_offers.tsx +144 -131
  120. package/src/i18n.ts +114 -114
  121. package/src/index.tsx +89 -81
  122. package/tyrads-sdk.podspec +41 -41
@@ -1,62 +1,62 @@
1
- import React, { useEffect, useRef } from 'react';
2
- import { Animated, View, StyleSheet, Dimensions, type TextStyle,} from 'react-native';
3
-
4
- interface MarqueeTextProps {
5
- text: string;
6
- speed?: number;
7
- repeat?: number;
8
- style?: TextStyle;
9
- }
10
-
11
- const MarqueeText: React.FC<MarqueeTextProps> = ({ text, speed = 15, repeat = 100, style }) => {
12
- const translateX = useRef(new Animated.Value(0)).current;
13
-
14
- useEffect(() => {
15
- const textWidth = text.length * 4;
16
- const screenWidth = Dimensions.get('window').width;
17
-
18
- const animation = Animated.loop(
19
- Animated.sequence([
20
- Animated.timing(translateX, {
21
- toValue: -textWidth,
22
- duration: (textWidth + screenWidth) * speed,
23
- useNativeDriver: true,
24
- }),
25
- Animated.timing(translateX, {
26
- toValue: screenWidth,
27
- duration: 0,
28
- useNativeDriver: true,
29
- }),
30
- ]),
31
- { iterations: repeat }
32
- );
33
-
34
- animation.start();
35
-
36
- return () => animation.stop();
37
- }, [text, speed, repeat, translateX]);
38
-
39
- return (
40
- <View style={styles.container}>
41
- <Animated.Text
42
- numberOfLines={1}
43
- style={[styles.text, style, { transform: [{ translateX }] }]}
44
- >
45
- {text}
46
- </Animated.Text>
47
- </View>
48
- );
49
- };
50
-
51
- const styles = StyleSheet.create({
52
- container: {
53
- overflow: 'hidden',
54
- width: '100%',
55
- },
56
- text: {
57
- fontSize: 16,
58
- fontWeight: 'bold',
59
- },
60
- });
61
-
1
+ import React, { useEffect, useRef } from 'react';
2
+ import { Animated, View, StyleSheet, Dimensions, type TextStyle,} from 'react-native';
3
+
4
+ interface MarqueeTextProps {
5
+ text: string;
6
+ speed?: number;
7
+ repeat?: number;
8
+ style?: TextStyle;
9
+ }
10
+
11
+ const MarqueeText: React.FC<MarqueeTextProps> = ({ text, speed = 15, repeat = 100, style }) => {
12
+ const translateX = useRef(new Animated.Value(0)).current;
13
+
14
+ useEffect(() => {
15
+ const textWidth = text.length * 4;
16
+ const screenWidth = Dimensions.get('window').width;
17
+
18
+ const animation = Animated.loop(
19
+ Animated.sequence([
20
+ Animated.timing(translateX, {
21
+ toValue: -textWidth,
22
+ duration: (textWidth + screenWidth) * speed,
23
+ useNativeDriver: true,
24
+ }),
25
+ Animated.timing(translateX, {
26
+ toValue: screenWidth,
27
+ duration: 0,
28
+ useNativeDriver: true,
29
+ }),
30
+ ]),
31
+ { iterations: repeat }
32
+ );
33
+
34
+ animation.start();
35
+
36
+ return () => animation.stop();
37
+ }, [text, speed, repeat, translateX]);
38
+
39
+ return (
40
+ <View style={styles.container}>
41
+ <Animated.Text
42
+ numberOfLines={1}
43
+ style={[styles.text, style, { transform: [{ translateX }] }]}
44
+ >
45
+ {text}
46
+ </Animated.Text>
47
+ </View>
48
+ );
49
+ };
50
+
51
+ const styles = StyleSheet.create({
52
+ container: {
53
+ overflow: 'hidden',
54
+ width: '100%',
55
+ },
56
+ text: {
57
+ fontSize: 16,
58
+ fontWeight: 'bold',
59
+ },
60
+ });
61
+
62
62
  export default MarqueeText;
@@ -1,28 +1,28 @@
1
- import AsyncStorage from '@react-native-async-storage/async-storage';
2
-
3
- export const saveData = async (key: string, object: any): Promise<void> => {
4
- try {
5
- const jsonValue: string = JSON.stringify(object);
6
- await AsyncStorage.setItem(key, jsonValue);
7
- } catch (e: any) {
8
- if (e instanceof Error) {
9
- console.error('Error saving object:', e.message);
10
- } else {
11
- console.error('An unknown error occurred while saving.');
12
- }
13
- }
14
- };
15
-
16
- export const getData = async <T>(key: string): Promise<T | null> => {
17
- try {
18
- const jsonValue: string | null = await AsyncStorage.getItem(key);
19
- return jsonValue != null ? JSON.parse(jsonValue) as T : null;
20
- } catch (e: any) {
21
- if (e instanceof Error) {
22
- console.error('Error getting object:', e.message);
23
- } else {
24
- console.error('An unknown error occurred while getting.');
25
- }
26
- return null;
27
- }
1
+ import AsyncStorage from '@react-native-async-storage/async-storage';
2
+
3
+ export const saveData = async (key: string, object: any): Promise<void> => {
4
+ try {
5
+ const jsonValue: string = JSON.stringify(object);
6
+ await AsyncStorage.setItem(key, jsonValue);
7
+ } catch (e: any) {
8
+ if (e instanceof Error) {
9
+ console.error('Error saving object:', e.message);
10
+ } else {
11
+ console.error('An unknown error occurred while saving.');
12
+ }
13
+ }
14
+ };
15
+
16
+ export const getData = async <T>(key: string): Promise<T | null> => {
17
+ try {
18
+ const jsonValue: string | null = await AsyncStorage.getItem(key);
19
+ return jsonValue != null ? JSON.parse(jsonValue) as T : null;
20
+ } catch (e: any) {
21
+ if (e instanceof Error) {
22
+ console.error('Error getting object:', e.message);
23
+ } else {
24
+ console.error('An unknown error occurred while getting.');
25
+ }
26
+ return null;
27
+ }
28
28
  };
@@ -1,94 +1,94 @@
1
- interface TransformedCampaign {
2
- campaignId: number;
3
- appId: number;
4
- title: string;
5
- creativePackName: string;
6
- fileUrl: string;
7
- points: number;
8
- rewards: number;
9
- currency: any;
10
- thumbnail: string;
11
- premium: boolean;
12
- sortingScore: number;
13
- }
14
-
15
- interface Campaign {
16
- campaignId: number;
17
- campaignName: string;
18
- campaignDescription: null | string;
19
- createdOn: string;
20
- sortingScore: number;
21
- status: string;
22
- expiredOn: null | string;
23
- hasPlaytimeEvents: boolean;
24
- app: {
25
- id: number;
26
- title: string;
27
- packageName: string;
28
- rating: number;
29
- shortDescription: string;
30
- store: string;
31
- storeCategory: string;
32
- previewUrl: string;
33
- thumbnail: string;
34
- confidenceScore: number;
35
- securityLabel: string;
36
- };
37
- currency: {
38
- name: string;
39
- symbol: string;
40
- adUnitName: string;
41
- adUnitCurrencyName: string;
42
- adUnitCurrencyConversion: number;
43
- adUnitCurrencyIcon: string;
44
- };
45
- campaignPayout: {
46
- totalEvents: number;
47
- totalPayout: number;
48
- totalPlayablePayout: number;
49
- totalMicrochargePayout: number;
50
- totalPayoutConverted: number;
51
- totalPlayablePayoutConverted: number;
52
- totalMicrochargePayoutConverted: number;
53
- };
54
- tracking: {
55
- impressionUrl: string;
56
- clickUrl: string;
57
- };
58
- targeting: {
59
- os: string;
60
- targetingType: string;
61
- reward: {
62
- rewardDifficulty: string;
63
- incentRewardDescription: string;
64
- };
65
- };
66
- creative: {
67
- creativeUrl: string;
68
- creativePacks: {
69
- creativePackId: null | number;
70
- creativePackName: string;
71
- languageName: string;
72
- languageCode: string;
73
- creatives: {
74
- creativeId: null | number;
75
- creativeName: string;
76
- callToAction: string;
77
- text: string;
78
- byteSize: string;
79
- fileUrl: string;
80
- duration: string;
81
- creativeType: {
82
- name: string;
83
- type: string;
84
- width: string;
85
- height: string;
86
- creativeCategoryType: string;
87
- };
88
- }[];
89
- }[];
90
- };
91
- isRetryDownload: boolean;
92
- capReached: boolean;
93
- premium: boolean;
1
+ interface TransformedCampaign {
2
+ campaignId: number;
3
+ appId: number;
4
+ title: string;
5
+ creativePackName: string;
6
+ fileUrl: string;
7
+ points: number;
8
+ rewards: number;
9
+ currency: any;
10
+ thumbnail: string;
11
+ premium: boolean;
12
+ sortingScore: number;
13
+ }
14
+
15
+ interface Campaign {
16
+ campaignId: number;
17
+ campaignName: string;
18
+ campaignDescription: null | string;
19
+ createdOn: string;
20
+ sortingScore: number;
21
+ status: string;
22
+ expiredOn: null | string;
23
+ hasPlaytimeEvents: boolean;
24
+ app: {
25
+ id: number;
26
+ title: string;
27
+ packageName: string;
28
+ rating: number;
29
+ shortDescription: string;
30
+ store: string;
31
+ storeCategory: string;
32
+ previewUrl: string;
33
+ thumbnail: string;
34
+ confidenceScore: number;
35
+ securityLabel: string;
36
+ };
37
+ currency: {
38
+ name: string;
39
+ symbol: string;
40
+ adUnitName: string;
41
+ adUnitCurrencyName: string;
42
+ adUnitCurrencyConversion: number;
43
+ adUnitCurrencyIcon: string;
44
+ };
45
+ campaignPayout: {
46
+ totalEvents: number;
47
+ totalPayout: number;
48
+ totalPlayablePayout: number;
49
+ totalMicrochargePayout: number;
50
+ totalPayoutConverted: number;
51
+ totalPlayablePayoutConverted: number;
52
+ totalMicrochargePayoutConverted: number;
53
+ };
54
+ tracking: {
55
+ impressionUrl: string;
56
+ clickUrl: string;
57
+ };
58
+ targeting: {
59
+ os: string;
60
+ targetingType: string;
61
+ reward: {
62
+ rewardDifficulty: string;
63
+ incentRewardDescription: string;
64
+ };
65
+ };
66
+ creative: {
67
+ creativeUrl: string;
68
+ creativePacks: {
69
+ creativePackId: null | number;
70
+ creativePackName: string;
71
+ languageName: string;
72
+ languageCode: string;
73
+ creatives: {
74
+ creativeId: null | number;
75
+ creativeName: string;
76
+ callToAction: string;
77
+ text: string;
78
+ byteSize: string;
79
+ fileUrl: string;
80
+ duration: string;
81
+ creativeType: {
82
+ name: string;
83
+ type: string;
84
+ width: string;
85
+ height: string;
86
+ creativeCategoryType: string;
87
+ };
88
+ }[];
89
+ }[];
90
+ };
91
+ isRetryDownload: boolean;
92
+ capReached: boolean;
93
+ premium: boolean;
94
94
  }
@@ -1,85 +1,85 @@
1
- import React, { useRef, useState, useEffect } from 'react';
2
- import { View, ScrollView, StyleSheet, Dimensions } from 'react-native';
3
-
4
- const { width } = Dimensions.get('window');
5
-
6
- interface AutoScrollPagerWithIndicatorsProps {
7
- totalPages: number;
8
- delayInMillis?: number;
9
- premiumColor?: string;
10
- content: (index: number) => React.ReactNode;
11
- }
12
-
13
- const AutoScrollPagerWithIndicators: React.FC<AutoScrollPagerWithIndicatorsProps> = ({
14
- totalPages,
15
- delayInMillis = 5000,
16
- premiumColor,
17
- content,
18
- }) => {
19
- const [currentPage, setCurrentPage] = useState(0);
20
- const scrollViewRef = useRef<ScrollView>(null);
21
-
22
- useEffect(() => {
23
- const intervalId = setInterval(() => {
24
- const nextBanner = (currentPage + 1) % totalPages;
25
- setCurrentPage(nextBanner);
26
- scrollViewRef.current?.scrollTo({ x: nextBanner * width, animated: true });
27
- }, delayInMillis);
28
-
29
- return () => clearInterval(intervalId);
30
- }, [currentPage, totalPages, delayInMillis]);
31
-
32
- useEffect(() => {
33
- scrollViewRef.current?.scrollTo({ x: currentPage * width, animated: false });
34
- }, [currentPage]);
35
-
36
- const renderIndicators = () => {
37
- const indicators: React.ReactNode[] = [];
38
- for (let i = 0; i < totalPages; i++) {
39
- indicators.push(
40
- <View
41
- key={i}
42
- style={[
43
- styles.indicator,
44
- { backgroundColor: currentPage === i ? (premiumColor|| '#1C90DF') : 'lightgray' },
45
- ]}
46
- />
47
- );
48
- }
49
- return <View style={styles.indicatorContainer}>{indicators}</View>;
50
- };
51
-
52
- return (
53
- <View style={styles.container}>
54
- <ScrollView
55
- ref={scrollViewRef}
56
- horizontal
57
- pagingEnabled
58
- showsHorizontalScrollIndicator={true}
59
- scrollEnabled={false}
60
- contentContainerStyle={{ width: totalPages * width }}
61
- >
62
- {Array.from({ length: totalPages }, (_, i) => content(i))}
63
- </ScrollView>
64
- {renderIndicators()}
65
- </View>
66
- );
67
- };
68
-
69
- const styles = StyleSheet.create({
70
- container: {
71
- alignItems: 'center',
72
- },
73
- indicatorContainer: {
74
- flexDirection: 'row',
75
- marginTop: 10,
76
- },
77
- indicator: {
78
- width: 8,
79
- height: 8,
80
- borderRadius: 4,
81
- marginHorizontal: 2,
82
- },
83
- });
84
-
1
+ import React, { useRef, useState, useEffect } from 'react';
2
+ import { View, ScrollView, StyleSheet, Dimensions } from 'react-native';
3
+
4
+ const { width } = Dimensions.get('window');
5
+
6
+ interface AutoScrollPagerWithIndicatorsProps {
7
+ totalPages: number;
8
+ delayInMillis?: number;
9
+ premiumColor?: string;
10
+ content: (index: number) => React.ReactNode;
11
+ }
12
+
13
+ const AutoScrollPagerWithIndicators: React.FC<AutoScrollPagerWithIndicatorsProps> = ({
14
+ totalPages,
15
+ delayInMillis = 5000,
16
+ premiumColor,
17
+ content,
18
+ }) => {
19
+ const [currentPage, setCurrentPage] = useState(0);
20
+ const scrollViewRef = useRef<ScrollView>(null);
21
+
22
+ useEffect(() => {
23
+ const intervalId = setInterval(() => {
24
+ const nextBanner = (currentPage + 1) % totalPages;
25
+ setCurrentPage(nextBanner);
26
+ scrollViewRef.current?.scrollTo({ x: nextBanner * width, animated: true });
27
+ }, delayInMillis);
28
+
29
+ return () => clearInterval(intervalId);
30
+ }, [currentPage, totalPages, delayInMillis]);
31
+
32
+ useEffect(() => {
33
+ scrollViewRef.current?.scrollTo({ x: currentPage * width, animated: false });
34
+ }, [currentPage]);
35
+
36
+ const renderIndicators = () => {
37
+ const indicators: React.ReactNode[] = [];
38
+ for (let i = 0; i < totalPages; i++) {
39
+ indicators.push(
40
+ <View
41
+ key={i}
42
+ style={[
43
+ styles.indicator,
44
+ { backgroundColor: currentPage === i ? (premiumColor|| '#1C90DF') : 'lightgray' },
45
+ ]}
46
+ />
47
+ );
48
+ }
49
+ return <View style={styles.indicatorContainer}>{indicators}</View>;
50
+ };
51
+
52
+ return (
53
+ <View style={styles.container}>
54
+ <ScrollView
55
+ ref={scrollViewRef}
56
+ horizontal
57
+ pagingEnabled
58
+ showsHorizontalScrollIndicator={true}
59
+ scrollEnabled={false}
60
+ contentContainerStyle={{ width: totalPages * width }}
61
+ >
62
+ {Array.from({ length: totalPages }, (_, i) => content(i))}
63
+ </ScrollView>
64
+ {renderIndicators()}
65
+ </View>
66
+ );
67
+ };
68
+
69
+ const styles = StyleSheet.create({
70
+ container: {
71
+ alignItems: 'center',
72
+ },
73
+ indicatorContainer: {
74
+ flexDirection: 'row',
75
+ marginTop: 10,
76
+ },
77
+ indicator: {
78
+ width: 8,
79
+ height: 8,
80
+ borderRadius: 4,
81
+ marginHorizontal: 2,
82
+ },
83
+ });
84
+
85
85
  export default AutoScrollPagerWithIndicators;
@@ -1,31 +1,31 @@
1
- import React, { type ReactNode } from 'react';
2
- import { View, StyleSheet, type ViewStyle } from 'react-native';
3
-
4
- interface CustomCardProps {
5
- children: ReactNode;
6
- style?: ViewStyle;
7
- }
8
-
9
- const CustomCard: React.FC<CustomCardProps> = ({ children, style }) => {
10
- return <View style={[styles.card, style]}>{children}</View>;
11
- };
12
-
13
- const styles = StyleSheet.create({
14
- card: {
15
- backgroundColor: 'white',
16
- borderTopLeftRadius: 20,
17
- borderTopRightRadius: 20,
18
- borderBottomLeftRadius: 14,
19
- borderBottomRightRadius: 14,
20
- paddingTop: 6,
21
- paddingBottom: 5,
22
- shadowColor: '#000',
23
- shadowOffset: { width: 4, height: 4 },
24
- shadowOpacity: 0.2,
25
- shadowRadius: 4,
26
- elevation: 4,
27
- alignSelf: 'center',
28
- },
29
- });
30
-
1
+ import React, { type ReactNode } from 'react';
2
+ import { View, StyleSheet, type ViewStyle } from 'react-native';
3
+
4
+ interface CustomCardProps {
5
+ children: ReactNode;
6
+ style?: ViewStyle;
7
+ }
8
+
9
+ const CustomCard: React.FC<CustomCardProps> = ({ children, style }) => {
10
+ return <View style={[styles.card, style]}>{children}</View>;
11
+ };
12
+
13
+ const styles = StyleSheet.create({
14
+ card: {
15
+ backgroundColor: 'white',
16
+ borderTopLeftRadius: 20,
17
+ borderTopRightRadius: 20,
18
+ borderBottomLeftRadius: 14,
19
+ borderBottomRightRadius: 14,
20
+ paddingTop: 6,
21
+ paddingBottom: 5,
22
+ shadowColor: '#000',
23
+ shadowOffset: { width: 4, height: 4 },
24
+ shadowOpacity: 0.2,
25
+ shadowRadius: 4,
26
+ elevation: 4,
27
+ alignSelf: 'center',
28
+ },
29
+ });
30
+
31
31
  export default CustomCard;
@@ -1,40 +1,40 @@
1
- import React from 'react';
2
- import { TouchableOpacity, Text, StyleSheet,} from 'react-native';
3
- import Tyrads from '../../../..';
4
- import { useTranslation } from 'react-i18next';
5
-
6
- interface MyGamesButtonProps {
7
- premiumColor?: string;
8
- }
9
-
10
- const MyGamesButton: React.FC<MyGamesButtonProps> = ({ premiumColor }) => {
11
- const { t } = useTranslation();
12
- return (
13
- <TouchableOpacity
14
- style={[styles.button, { backgroundColor: premiumColor || '#1C90DF' }]}
15
- onPress={() => Tyrads.showOffers({ route: 'campaigns-activated' })}
16
- >
17
- <Text style={styles.buttonText}>{t('dashboard.my_games')}</Text>
18
- </TouchableOpacity>
19
- );
20
- };
21
-
22
- const styles = StyleSheet.create({
23
- button: {
24
- borderRadius: 8,
25
- paddingHorizontal: 16,
26
- paddingVertical: 8,
27
- height: 40,
28
- justifyContent: 'center',
29
- alignItems: 'center',
30
- marginHorizontal: 16,
31
- marginBottom: 16,
32
- },
33
- buttonText: {
34
- color: 'white',
35
- fontSize: 16,
36
- fontWeight: 'bold',
37
- },
38
- });
39
-
1
+ import React from 'react';
2
+ import { TouchableOpacity, Text, StyleSheet,} from 'react-native';
3
+ import { useTranslation } from 'react-i18next';
4
+
5
+ interface MyGamesButtonProps {
6
+ premiumColor?: string;
7
+ onPress: (route: string) => void;
8
+ }
9
+
10
+ const MyGamesButton: React.FC<MyGamesButtonProps> = ({ premiumColor , onPress}) => {
11
+ const { t } = useTranslation();
12
+ return (
13
+ <TouchableOpacity
14
+ style={[styles.button, { backgroundColor: premiumColor || '#1C90DF' }]}
15
+ onPress={() => onPress && onPress('campaigns-activated')}
16
+ >
17
+ <Text style={styles.buttonText}>{t('dashboard.my_games')}</Text>
18
+ </TouchableOpacity>
19
+ );
20
+ };
21
+
22
+ const styles = StyleSheet.create({
23
+ button: {
24
+ borderRadius: 8,
25
+ paddingHorizontal: 16,
26
+ paddingVertical: 8,
27
+ height: 40,
28
+ justifyContent: 'center',
29
+ alignItems: 'center',
30
+ marginHorizontal: 16,
31
+ marginBottom: 16,
32
+ },
33
+ buttonText: {
34
+ color: 'white',
35
+ fontSize: 16,
36
+ fontWeight: 'bold',
37
+ },
38
+ });
39
+
40
40
  export default MyGamesButton;