react-native-flyy 1.4.30 → 1.4.32

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 (36) hide show
  1. package/android/.project +1 -1
  2. package/android/.settings/org.eclipse.buildship.core.prefs +2 -5
  3. package/android/build.gradle +1 -1
  4. package/android/src/main/java/com/reactnativeflyy/FlyyModule.kt +49 -155
  5. package/android/src/main/java/com/reactnativeflyy/FlyyRouteActivity.java +0 -16
  6. package/ios/ReactNativeFlyy.m +122 -276
  7. package/lib/commonjs/index.js +3 -592
  8. package/lib/commonjs/index.js.map +1 -1
  9. package/lib/module/index.js +3 -580
  10. package/lib/module/index.js.map +1 -1
  11. package/lib/typescript/index.d.ts +0 -12
  12. package/package.json +1 -1
  13. package/react-native-flyy.podspec +1 -1
  14. package/src/index.tsx +1 -544
  15. package/ios/Montserrat-Bold.ttf +0 -0
  16. package/lib/commonjs/assets/images/check.png +0 -0
  17. package/lib/commonjs/assets/images/medal.png +0 -0
  18. package/lib/commonjs/assets/images/radio.png +0 -0
  19. package/lib/commonjs/assets/images/reward_flyy.png +0 -0
  20. package/lib/commonjs/assets/images/xmark.png +0 -0
  21. package/lib/commonjs/flyy_checkin_view.js +0 -379
  22. package/lib/commonjs/flyy_checkin_view.js.map +0 -1
  23. package/lib/module/assets/images/check.png +0 -0
  24. package/lib/module/assets/images/medal.png +0 -0
  25. package/lib/module/assets/images/radio.png +0 -0
  26. package/lib/module/assets/images/reward_flyy.png +0 -0
  27. package/lib/module/assets/images/xmark.png +0 -0
  28. package/lib/module/flyy_checkin_view.js +0 -365
  29. package/lib/module/flyy_checkin_view.js.map +0 -1
  30. package/lib/typescript/flyy_checkin_view.d.ts +0 -19
  31. package/src/assets/images/check.png +0 -0
  32. package/src/assets/images/medal.png +0 -0
  33. package/src/assets/images/radio.png +0 -0
  34. package/src/assets/images/reward_flyy.png +0 -0
  35. package/src/assets/images/xmark.png +0 -0
  36. package/src/flyy_checkin_view.tsx +0 -214
package/src/index.tsx CHANGED
@@ -1,367 +1,19 @@
1
- // @ts-nocheck
2
- import React, { useEffect, useState } from 'react';
1
+ import React from 'react';
3
2
  import {
4
3
  Image,
5
4
  NativeModules,
6
5
  Text,
7
6
  TouchableOpacity,
8
7
  View,
9
- Dimensions,
10
- AppState,
11
- ToastAndroid,
12
- Linking,
13
- FlatList
14
8
  } from 'react-native';
15
- // import Draggable from 'react-native-draggable';
16
- import FlyyCheckinComponent from './flyy_checkin_view';
17
- import { FlyyStoriesWidget } from './flyy_stories';
18
9
 
19
10
  type FlyyType = {
20
- getUserId(arg0: (data: any) => void): unknown;
21
11
  multiply(a: number, b: number): Promise<number>;
22
12
  };
23
13
 
24
14
  const { Flyy } = NativeModules;
25
15
 
26
16
  export default Flyy as FlyyType;
27
-
28
- // ****** Flyy CheckinView Widget ******
29
- export const FlyyCheckinView = (props: any) => {
30
- return (<FlyyCheckinComponent style={{
31
- checkInBtnTextColor: props.checkInBtnTextColor,
32
- checkInTitleColor: props.checkInTitleColor,
33
- checkInDescriptionColor: props.checkInDescriptionColor,
34
- checkInDaysColor: props.checkInDaysColor,
35
- checkInEarnColor: props.checkInEarnColor,
36
- fontFamily: props.fontFamily
37
- }} />)
38
- }
39
- const windowHeight = Dimensions.get('window').height;
40
- const windowWidth = Dimensions.get('window').width;
41
-
42
- // ****** Flyy Floating Widget ******
43
- // export const FlyyFloatingWidget = ({
44
- // props = {
45
- // backgroundColor: "#654EA3",
46
- // buttonHeight: 55,
47
- // buttonWidth: 55,
48
- // buttonCornerRadius: 40,
49
- // buttonIcon: require('./assets/images/rewardwidget.png'),
50
- // onPress: () => { },
51
- // x: windowWidth - 75,
52
- // y: windowHeight - 100,
53
- // minX: 5,
54
- // minY: 5,
55
- // maxX: windowWidth - 5,
56
- // maxY: windowHeight - 5,
57
- // show: true,
58
- // stick: false,
59
- // startDate: 0,
60
- // endDate: 0
61
- // } }) => {
62
-
63
- // const [showWidget,setShowWidget] = useState(false);
64
- // const [userData,setUserData] = useState({});
65
- // const [iconUrl,setIconUrl] = useState(require('./assets/images/rewardwidget.png'));
66
- // const [backgroundColor,setBackgroundColor] = useState("#654EA3");
67
- // const [buttonSize,setButtonSize] = useState(55);
68
- // const [buttonXPosition,setButtonXPosition] = useState(windowWidth - 75);
69
- // const [buttonYPosition,setButtonYPosition] = useState(windowHeight - 100);
70
- // const [deeplink,setDeeplink] = useState(null);
71
- // const flyyConfigDate = "flyy_config_date";
72
- // const flyyConfigUserId = "user_id";
73
- // var oldState = null;
74
- // var currentState = null;
75
- // var data = null;
76
-
77
- // useEffect(()=>{
78
- // fetchData();
79
- // },[]);
80
-
81
- // const fetchData = async() => {
82
- // const sdkInfo = await Flyy.getUserData();
83
- // const appData = await Flyy.getAppData();
84
- // const resp = await fetch(`https://${sdkInfo["environment"] == 0 ? "ghc-stage" : "ghc"}.theflyy.com/api/v8/flyy_app_info`, {
85
- // headers: {
86
- // "X-Key": sdkInfo["partner_id"],
87
- // "Content-Type": "application/json",
88
- // "X-App-Data": appData
89
- // }
90
- // });
91
- // data = await resp.json();
92
- // if(!data.success){
93
- // if (Platform.OS === 'android') {
94
- // ToastAndroid.show(data.message, ToastAndroid.SHORT);
95
- // } else {
96
- // // Toast.showWithGravity(data.message, Toast.SHORT, Toast.BOTTOM);
97
- // }
98
- // return;
99
- // }
100
- // const widgetConfig = data.info.floating_widget_configuration;
101
-
102
- // if (widgetConfig.icon_url != null && widgetConfig.icon_url != '') {
103
- // setIconUrl({ uri: widgetConfig.icon_url })
104
- // } else {
105
- // setIconUrl(props.buttonIcon)
106
- // }
107
-
108
- // if (widgetConfig.color != null && widgetConfig.color != '') {
109
- // setBackgroundColor(widgetConfig.color)
110
- // } else {
111
- // setBackgroundColor(props.backgroundColor)
112
- // }
113
-
114
- // if (widgetConfig.size != null && widgetConfig.color != 0) {
115
- // setButtonSize(parseInt(data.info.floating_widget_configuration.size))
116
- // } else {
117
- // setButtonSize(props.buttonHeight)
118
- // }
119
-
120
- // //FloatingButton Position
121
- // if (widgetConfig.position == "bottom_left") {
122
- // setButtonXPosition(10)
123
- // } else if (widgetConfig.position == "bottom_right") {
124
- // setButtonXPosition(windowWidth - 75)
125
- // } else if (widgetConfig.position == "upper_left") {
126
- // setButtonXPosition(10)
127
- // if (Platform.OS === 'android'){
128
- // setButtonYPosition(10)
129
- // }else{
130
- // setButtonYPosition(50)
131
- // }
132
- // } else if (widgetConfig.position == "upper_right") {
133
- // setButtonXPosition(windowWidth - 75)
134
- // if (Platform.OS === 'android'){
135
- // setButtonYPosition(10)
136
- // }else{
137
- // setButtonYPosition(50)
138
- // }
139
- // }
140
-
141
- // //Set DeepLink
142
- // if (widgetConfig.deeplink != null && widgetConfig.deeplink != "") {
143
- // setDeeplink(widgetConfig.deeplink)
144
- // }
145
- // //Set Visibility of FloatingButton
146
- // var currentDate = new Date();
147
- // const getDate = await AsyncStorage.getItem(flyyConfigDate);
148
- // const userId = await AsyncStorage.getItem(flyyConfigUserId);
149
- // var date = new Date(parseInt(getDate));
150
- // const diffTime = Math.abs(getDate - currentDate);
151
- // const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))-1;
152
- // if(diffDays != 0 || userId == null || userId != sdkInfo[flyyConfigUserId]){
153
- // var data = await Flyy.getAppOccurence(1);
154
- // await AsyncStorage.setItem(
155
- // flyyConfigUserId,
156
- // sdkInfo[flyyConfigUserId]
157
- // );
158
- // }
159
- // const occurrenceCount = await Flyy.getAppOccurence(0);
160
- // if (widgetConfig.show_to_user && occurrenceCount <= parseInt(widgetConfig.num_times)) {
161
- // // var numberOfDaysToAdd = widgetConfig.num_days+1;
162
- // // var result = currentDate.setDate(currentDate.getDate() + numberOfDaysToAdd);
163
- // if(getDate === null || userId == null || userId != sdkInfo[flyyConfigUserId]){
164
- // await AsyncStorage.setItem(
165
- // flyyConfigDate,
166
- // JSON.stringify(currentDate.getTime())
167
- // );
168
- // }
169
- // const getDate2 = await AsyncStorage.getItem(flyyConfigDate);
170
- // var date = new Date(parseInt(getDate2));
171
- // const diffTime = Math.abs(getDate2 - currentDate);
172
- // const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))-1;
173
- // //Show widget on same day
174
- // if(diffDays === 0 || diffDays === -1){
175
- // setShowWidget(true)
176
- // }else{
177
- // //reset occurrence on next day
178
- // await Flyy.getAppOccurence(1);
179
- // if(diffDays >= parseInt(widgetConfig.num_days)+1){
180
- // await AsyncStorage.setItem(
181
- // flyyConfigDate,
182
- // JSON.stringify(currentDate.getTime())
183
- // );
184
- // setShowWidget(true)
185
- // }
186
- // }
187
- // }else{
188
- // setShowWidget(false);
189
- // const getDate2 = await AsyncStorage.getItem(flyyConfigDate);
190
- // var date = new Date(parseInt(getDate2));
191
- // const diffTime = Math.abs(getDate2 - currentDate);
192
- // const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
193
- // if(diffDays != 1){
194
- // var data = await Flyy.getAppOccurence(1);
195
- // }
196
- // }
197
- // }
198
-
199
- // // if(props.show){
200
- // // if(props.startDate != null && props.startDate != 0){
201
- // // var now = new Date().getTime();
202
- // // if(now >= props.startDate && now <= props.endDate){
203
- // // props.show = true
204
- // // }else{
205
- // // props.show = false
206
- // // }
207
- // // }
208
- // // }
209
-
210
- // // AppState.addEventListener('change', state =>{
211
- // // console.log('AppState updated to', AppState.currentState)
212
- // // oldState = currentState;
213
- // // currentState = state;
214
- // // if(oldState == null){
215
- // // console.log('App is newly start :::')
216
- // // }})
217
-
218
- // return (
219
- // // @ts-ignore
220
- // props.show && showWidget? <Draggable x={buttonXPosition}
221
- // y={buttonYPosition}
222
- // minX={props.minX ?? 5}
223
- // minY={props.minY ?? 5}
224
- // maxX={props.maxX ?? windowWidth - 5}
225
- // maxY={props.maxY ?? windowHeight - 5}
226
- // renderSize={56}
227
- // // shouldReverse = {true}
228
- // onDragRelease={props.stick ? () => {
229
-
230
- // } : null} isCircle>
231
- // <TouchableOpacity
232
- // onPress={deeplink != null ? async()=>{
233
- // if (Platform.OS === 'android' || !deeplink.startsWith("flyy://")) {
234
- // const supported = await Linking.canOpenURL(deeplink);
235
- // await Linking.openURL(deeplink);
236
- // } else {
237
- // navigateTo(deeplink);
238
- // }
239
- // }:props.onPress}
240
- // style={{
241
- // height: buttonSize,
242
- // width: buttonSize,
243
- // backgroundColor: backgroundColor,
244
- // borderRadius: buttonSize/2,
245
- // justifyContent: 'center',
246
- // alignItems: 'center',
247
- // }}>
248
- // <Image source={iconUrl} style={{ height: buttonSize*55/100, width: buttonSize*55/100 }} />
249
- // <TouchableOpacity
250
- // onPress={()=>{
251
- // props.show = false;
252
- // setShowWidget(false);
253
- // }}
254
- // style = {{height: 20, width: 20, backgroundColor: "transparent",position:'absolute',left:buttonSize-11, bottom: buttonSize*72/100}}>
255
- // <Image source={require('./assets/images/xmark.png')} style={{ height: 18, width: 18, tintColor: "black"}} />
256
- // </TouchableOpacity>
257
- // </TouchableOpacity>
258
- // </Draggable> : <View/>
259
- // );
260
- // }
261
-
262
- const navigateTo = (deeplink) => {
263
- let components = deeplink.split("/");
264
- let screenCode = components[components.length - 1];
265
- switch (screenCode) {
266
- case "flyy_offers":
267
- {
268
- Flyy.openOffersScreen();
269
- }
270
- break;
271
- case "challenge_details":
272
- {
273
- Flyy.openFlyyChallengeDetailPage(0);
274
- }
275
- break;
276
-
277
- case "flyy_quiz_list":
278
- {
279
- Flyy.openFlyyQuizListPage();
280
- }
281
- break;
282
-
283
- case "stamp_campaign_new":
284
- {
285
- Flyy.openFlyyStampsPage();
286
- }
287
- break;
288
-
289
- case "campaign_home":
290
- {
291
- Flyy.openFlyyStampsPage();
292
- }
293
- break;
294
-
295
- case "bonanza_details":
296
- {
297
- Flyy.openFlyyBonanzaPage();
298
- }
299
- break;
300
- case "invite_earn":
301
- {
302
- Flyy.openFlyyInviteAndEarnPage(0);
303
- }
304
- break;
305
- case "invite_details":
306
- {
307
- Flyy.openFlyyInviteDetailsPage(0);
308
- }
309
- break;
310
- case "custom_invite_details":
311
- {
312
- Flyy.openFlyyCustomInviteAndEarnPage(0, FlyyFlutterPlugin.themeColor);
313
- }
314
- break;
315
- case "raffle_details":
316
- {
317
- Flyy.openFlyyRafflePage(0);
318
- }
319
- break;
320
- case "quiz_history":
321
- {
322
- Flyy.openFlyyQuizHistoryPage();
323
- }
324
- break;
325
- case "flyy_rewards":
326
- {
327
- Flyy.openRewardsScreen();
328
- }
329
- break;
330
- case "flyy_referrals":
331
- {
332
- Flyy.openReferralHistory();
333
- }
334
- break;
335
- case "flyy_gift_cards":
336
- {
337
- Flyy.openGiftCardScreen();
338
- }
339
- break;
340
- case "flyy_wallet":
341
- {
342
- Flyy.openWalletScreen();
343
- }
344
- break;
345
- case "game_list":
346
- {
347
- Flyy.openFlyyGamesPage();
348
- }
349
- break;
350
- case "flyy_bonanza":
351
- {
352
- Flyy.openFlyyBonanzaPage();
353
- }
354
- break;
355
- case "flyy_quiz_detail":
356
- {
357
- Flyy.openFlyyQuizPage(0);
358
- }
359
- break;
360
- default:
361
- // Toast.showWithGravity("ACTION NOT FOUND", Toast.SHORT, Toast.BOTTOM);
362
-
363
- }
364
- }
365
17
  export const FlyyWidget = ({
366
18
  widgetStyle = {
367
19
  rewardsButtonIcon: require('./assets/images/rewardwidget.png'),
@@ -498,198 +150,3 @@ const FlyyCardView = ({ cardStyle, buttonTitle, buttonIcon }) => {
498
150
  </View>
499
151
  );
500
152
  };
501
-
502
-
503
- // ****** Flyy Stories Widget ******
504
-
505
- export const FlyyStories = ({
506
- widgetStyle = {
507
- titleColor: 'black',
508
- iconButtonBgColor: '#654EA3',
509
- fontSize: 16.0,
510
- iconCornerRadius: 55,
511
- iconSize: 60,
512
- iconBgSize: 100
513
- },
514
- }) => {
515
- const [data,setData] = useState(null);
516
-
517
- useEffect(()=>{
518
- fetchStoriesData();
519
- },[]);
520
-
521
- const fetchStoriesData = async() => {
522
- const sdkInfo = await Flyy.getUserData();
523
- const appData = await Flyy.getAppData();
524
- const resp = await fetch(`https://${sdkInfo["environment"] == 0 ? "ghc-stage" : "ghc"}.theflyy.com/api/storyboard`, {
525
- headers: {
526
- "X-Key": sdkInfo["partner_id"],
527
- "Content-Type": "application/json",
528
- "X-App-Data": appData
529
- }
530
- });
531
- const responseData = await resp.json();
532
- setData(responseData.storyboard_items);
533
- }
534
-
535
- const navigateTo = (screenCode) => {
536
- switch (screenCode) {
537
- case "offers":
538
- {
539
- Flyy.openOffersScreen();
540
- }
541
- break;
542
- case "spin_wheel":
543
- {
544
- Flyy.openFlyySpinTheWheelPage(0);
545
- }
546
- break;
547
-
548
- case "challenge":
549
- {
550
- Flyy.openFlyyChallengeDetailPage(0);
551
- }
552
- break;
553
-
554
- case "quiz_list":
555
- {
556
- Flyy.openFlyyQuizListPage();
557
- }
558
- break;
559
-
560
- case "stamp_campaign":
561
- {
562
- Flyy.openFlyyStampsPage();
563
- }
564
- break;
565
-
566
- case "campaign_home":
567
- {
568
- Flyy.openFlyyStampsPage();
569
- }
570
- break;
571
-
572
- case "bonanza_details":
573
- {
574
- Flyy.openFlyyBonanzaPage();
575
- }
576
- break;
577
- case "invite_earn":
578
- {
579
- Flyy.openFlyyInviteAndEarnPage(0);
580
- }
581
- break;
582
- case "invite_details":
583
- {
584
- Flyy.openFlyyInviteDetailsPage(0);
585
- }
586
- break;
587
- case "custom_invite_details":
588
- {
589
- Flyy.openFlyyCustomInviteAndEarnPage(0, FlyyFlutterPlugin.themeColor);
590
- }
591
- break;
592
- case "raffle":
593
- {
594
- Flyy.openFlyyRafflePage(0);
595
- }
596
- break;
597
- case "quiz_history":
598
- {
599
- Flyy.openFlyyQuizHistoryPage();
600
- }
601
- break;
602
- case "flyy_rewards":
603
- {
604
- Flyy.openRewardsScreen();
605
- }
606
- break;
607
- case "referrals":
608
- {
609
- Flyy.openReferralHistory();
610
- }
611
- break;
612
- case "flyy_gift_cards":
613
- {
614
- Flyy.openGiftCardScreen();
615
- }
616
- break;
617
- case "wallet":
618
- {
619
- Flyy.openWalletScreen();
620
- }
621
- break;
622
- case "game_list":
623
- {
624
- Flyy.openFlyyGamesPage();
625
- }
626
- break;
627
- case "bonanza":
628
- {
629
- Flyy.openFlyyBonanzaPage();
630
- }
631
- break;
632
- case "quiz_detail":
633
- {
634
- Flyy.openFlyyQuizPage(0);
635
- }
636
- break;
637
- default:
638
- // Toast.showWithGravity("ACTION NOT FOUND", Toast.SHORT, Toast.BOTTOM);
639
-
640
- }
641
- }
642
-
643
- const StoriesItem = ({data}) => {
644
- return (
645
- <View style = {{alignItems: 'center'}}>
646
- <View style={{ height: 10 }} />
647
- <TouchableOpacity
648
- onPress={()=>{
649
- navigateTo(data.screen_code);
650
- }}
651
- style={{
652
- backgroundColor: widgetStyle.iconButtonBgColor ?? '#654EA3',
653
- height: widgetStyle.iconBgSize ?? 60,
654
- width: widgetStyle.iconBgSize ?? 60,
655
- borderRadius: widgetStyle.iconCornerRadius ?? 55,
656
- alignSelf: 'center',
657
- justifyContent: 'center',
658
- alignItems: 'center',
659
- marginHorizontal: 10
660
- }}
661
- >
662
- <Image source={{uri: data.icon_url}} style={{ height: 60, width: 60 }} />
663
- </TouchableOpacity>
664
- <View style={{ height: 10 }} />
665
- <View style = {{width:120}}>
666
- <Text
667
- style={{
668
- alignSelf: 'center',
669
- flexShrink: 1,
670
- color: widgetStyle.titleColor ?? 'black',
671
- fontSize: widgetStyle.fontSize ?? 14,
672
- fontFamily: 'Montserrat-Bold',
673
- textAlign: 'center',
674
- paddingLeft: 5,
675
- paddingRight: 5,
676
- }}
677
- numberOfLines={2}
678
- >
679
- {data.title}
680
- </Text>
681
- </View>
682
- <View style={{ height: 10 }} />
683
- </View>
684
- );
685
- };
686
-
687
- return (<View style = {{flexDirection: "row",justifyContent: "center",width:"100%",alignItems:'center',alignContent:'center',backgroundColor: "white"}}>
688
- <FlatList
689
- horizontal={true}
690
- data={data}
691
- renderItem={({ item }) => <StoriesItem data={item} />}
692
- keyExtractor={item => item.id}
693
- />
694
- </View>);
695
- }
Binary file