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