react-native-flyy 1.4.29 → 1.4.31
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/lib/commonjs/flyy_checkin_view.js +1 -6
- package/lib/commonjs/flyy_checkin_view.js.map +1 -1
- package/lib/commonjs/index.js +209 -251
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/flyy_checkin_view.js +1 -3
- package/lib/module/flyy_checkin_view.js.map +1 -1
- package/lib/module/index.js +211 -246
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +0 -20
- package/package.json +1 -4
- package/react-native-flyy.podspec +1 -1
- package/src/flyy_checkin_view.tsx +1 -2
- package/src/index.tsx +220 -223
package/lib/module/index.js
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import React, { useEffect, useState } from 'react';
|
|
3
|
-
import { Image, NativeModules, Text, TouchableOpacity, View, Dimensions,
|
|
4
|
-
import Draggable from 'react-native-draggable';
|
|
3
|
+
import { Image, NativeModules, Text, TouchableOpacity, View, Dimensions, FlatList } from 'react-native';
|
|
5
4
|
import FlyyCheckinComponent from './flyy_checkin_view';
|
|
6
|
-
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
7
|
-
import Toast from 'react-native-simple-toast';
|
|
8
5
|
const {
|
|
9
6
|
Flyy
|
|
10
7
|
} = NativeModules;
|
|
@@ -24,244 +21,212 @@ export const FlyyCheckinView = props => {
|
|
|
24
21
|
};
|
|
25
22
|
const windowHeight = Dimensions.get('window').height;
|
|
26
23
|
const windowWidth = Dimensions.get('window').width; // ****** Flyy Floating Widget ******
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
justifyContent: 'center',
|
|
234
|
-
alignItems: 'center'
|
|
235
|
-
}
|
|
236
|
-
}, /*#__PURE__*/React.createElement(Image, {
|
|
237
|
-
source: iconUrl,
|
|
238
|
-
style: {
|
|
239
|
-
height: buttonSize * 55 / 100,
|
|
240
|
-
width: buttonSize * 55 / 100
|
|
241
|
-
}
|
|
242
|
-
}), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
243
|
-
onPress: () => {
|
|
244
|
-
props.show = false;
|
|
245
|
-
setShowWidget(false);
|
|
246
|
-
},
|
|
247
|
-
style: {
|
|
248
|
-
height: 20,
|
|
249
|
-
width: 20,
|
|
250
|
-
backgroundColor: "transparent",
|
|
251
|
-
position: 'absolute',
|
|
252
|
-
left: buttonSize - 11,
|
|
253
|
-
bottom: buttonSize * 72 / 100
|
|
254
|
-
}
|
|
255
|
-
}, /*#__PURE__*/React.createElement(Image, {
|
|
256
|
-
source: require('./assets/images/xmark.png'),
|
|
257
|
-
style: {
|
|
258
|
-
height: 18,
|
|
259
|
-
width: 18,
|
|
260
|
-
tintColor: "black"
|
|
261
|
-
}
|
|
262
|
-
})))) : /*#__PURE__*/React.createElement(View, null)
|
|
263
|
-
);
|
|
264
|
-
};
|
|
24
|
+
// export const FlyyFloatingWidget = ({
|
|
25
|
+
// props = {
|
|
26
|
+
// backgroundColor: "#654EA3",
|
|
27
|
+
// buttonHeight: 55,
|
|
28
|
+
// buttonWidth: 55,
|
|
29
|
+
// buttonCornerRadius: 40,
|
|
30
|
+
// buttonIcon: require('./assets/images/rewardwidget.png'),
|
|
31
|
+
// onPress: () => { },
|
|
32
|
+
// x: windowWidth - 75,
|
|
33
|
+
// y: windowHeight - 100,
|
|
34
|
+
// minX: 5,
|
|
35
|
+
// minY: 5,
|
|
36
|
+
// maxX: windowWidth - 5,
|
|
37
|
+
// maxY: windowHeight - 5,
|
|
38
|
+
// show: true,
|
|
39
|
+
// stick: false,
|
|
40
|
+
// startDate: 0,
|
|
41
|
+
// endDate: 0
|
|
42
|
+
// } }) => {
|
|
43
|
+
// const [showWidget,setShowWidget] = useState(false);
|
|
44
|
+
// const [userData,setUserData] = useState({});
|
|
45
|
+
// const [iconUrl,setIconUrl] = useState(require('./assets/images/rewardwidget.png'));
|
|
46
|
+
// const [backgroundColor,setBackgroundColor] = useState("#654EA3");
|
|
47
|
+
// const [buttonSize,setButtonSize] = useState(55);
|
|
48
|
+
// const [buttonXPosition,setButtonXPosition] = useState(windowWidth - 75);
|
|
49
|
+
// const [buttonYPosition,setButtonYPosition] = useState(windowHeight - 100);
|
|
50
|
+
// const [deeplink,setDeeplink] = useState(null);
|
|
51
|
+
// const flyyConfigDate = "flyy_config_date";
|
|
52
|
+
// const flyyConfigUserId = "user_id";
|
|
53
|
+
// var oldState = null;
|
|
54
|
+
// var currentState = null;
|
|
55
|
+
// var data = null;
|
|
56
|
+
// useEffect(()=>{
|
|
57
|
+
// fetchData();
|
|
58
|
+
// },[]);
|
|
59
|
+
// const fetchData = async() => {
|
|
60
|
+
// const sdkInfo = await Flyy.getUserData();
|
|
61
|
+
// const appData = await Flyy.getAppData();
|
|
62
|
+
// const resp = await fetch(`https://${sdkInfo["environment"] == 0 ? "ghc-stage" : "ghc"}.theflyy.com/api/v8/flyy_app_info`, {
|
|
63
|
+
// headers: {
|
|
64
|
+
// "X-Key": sdkInfo["partner_id"],
|
|
65
|
+
// "Content-Type": "application/json",
|
|
66
|
+
// "X-App-Data": appData
|
|
67
|
+
// }
|
|
68
|
+
// });
|
|
69
|
+
// data = await resp.json();
|
|
70
|
+
// if(!data.success){
|
|
71
|
+
// if (Platform.OS === 'android') {
|
|
72
|
+
// ToastAndroid.show(data.message, ToastAndroid.SHORT);
|
|
73
|
+
// } else {
|
|
74
|
+
// // Toast.showWithGravity(data.message, Toast.SHORT, Toast.BOTTOM);
|
|
75
|
+
// }
|
|
76
|
+
// return;
|
|
77
|
+
// }
|
|
78
|
+
// const widgetConfig = data.info.floating_widget_configuration;
|
|
79
|
+
// if (widgetConfig.icon_url != null && widgetConfig.icon_url != '') {
|
|
80
|
+
// setIconUrl({ uri: widgetConfig.icon_url })
|
|
81
|
+
// } else {
|
|
82
|
+
// setIconUrl(props.buttonIcon)
|
|
83
|
+
// }
|
|
84
|
+
// if (widgetConfig.color != null && widgetConfig.color != '') {
|
|
85
|
+
// setBackgroundColor(widgetConfig.color)
|
|
86
|
+
// } else {
|
|
87
|
+
// setBackgroundColor(props.backgroundColor)
|
|
88
|
+
// }
|
|
89
|
+
// if (widgetConfig.size != null && widgetConfig.color != 0) {
|
|
90
|
+
// setButtonSize(parseInt(data.info.floating_widget_configuration.size))
|
|
91
|
+
// } else {
|
|
92
|
+
// setButtonSize(props.buttonHeight)
|
|
93
|
+
// }
|
|
94
|
+
// //FloatingButton Position
|
|
95
|
+
// if (widgetConfig.position == "bottom_left") {
|
|
96
|
+
// setButtonXPosition(10)
|
|
97
|
+
// } else if (widgetConfig.position == "bottom_right") {
|
|
98
|
+
// setButtonXPosition(windowWidth - 75)
|
|
99
|
+
// } else if (widgetConfig.position == "upper_left") {
|
|
100
|
+
// setButtonXPosition(10)
|
|
101
|
+
// if (Platform.OS === 'android'){
|
|
102
|
+
// setButtonYPosition(10)
|
|
103
|
+
// }else{
|
|
104
|
+
// setButtonYPosition(50)
|
|
105
|
+
// }
|
|
106
|
+
// } else if (widgetConfig.position == "upper_right") {
|
|
107
|
+
// setButtonXPosition(windowWidth - 75)
|
|
108
|
+
// if (Platform.OS === 'android'){
|
|
109
|
+
// setButtonYPosition(10)
|
|
110
|
+
// }else{
|
|
111
|
+
// setButtonYPosition(50)
|
|
112
|
+
// }
|
|
113
|
+
// }
|
|
114
|
+
// //Set DeepLink
|
|
115
|
+
// if (widgetConfig.deeplink != null && widgetConfig.deeplink != "") {
|
|
116
|
+
// setDeeplink(widgetConfig.deeplink)
|
|
117
|
+
// }
|
|
118
|
+
// //Set Visibility of FloatingButton
|
|
119
|
+
// var currentDate = new Date();
|
|
120
|
+
// const getDate = await AsyncStorage.getItem(flyyConfigDate);
|
|
121
|
+
// const userId = await AsyncStorage.getItem(flyyConfigUserId);
|
|
122
|
+
// var date = new Date(parseInt(getDate));
|
|
123
|
+
// const diffTime = Math.abs(getDate - currentDate);
|
|
124
|
+
// const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))-1;
|
|
125
|
+
// if(diffDays != 0 || userId == null || userId != sdkInfo[flyyConfigUserId]){
|
|
126
|
+
// var data = await Flyy.getAppOccurence(1);
|
|
127
|
+
// await AsyncStorage.setItem(
|
|
128
|
+
// flyyConfigUserId,
|
|
129
|
+
// sdkInfo[flyyConfigUserId]
|
|
130
|
+
// );
|
|
131
|
+
// }
|
|
132
|
+
// const occurrenceCount = await Flyy.getAppOccurence(0);
|
|
133
|
+
// if (widgetConfig.show_to_user && occurrenceCount <= parseInt(widgetConfig.num_times)) {
|
|
134
|
+
// // var numberOfDaysToAdd = widgetConfig.num_days+1;
|
|
135
|
+
// // var result = currentDate.setDate(currentDate.getDate() + numberOfDaysToAdd);
|
|
136
|
+
// if(getDate === null || userId == null || userId != sdkInfo[flyyConfigUserId]){
|
|
137
|
+
// await AsyncStorage.setItem(
|
|
138
|
+
// flyyConfigDate,
|
|
139
|
+
// JSON.stringify(currentDate.getTime())
|
|
140
|
+
// );
|
|
141
|
+
// }
|
|
142
|
+
// const getDate2 = await AsyncStorage.getItem(flyyConfigDate);
|
|
143
|
+
// var date = new Date(parseInt(getDate2));
|
|
144
|
+
// const diffTime = Math.abs(getDate2 - currentDate);
|
|
145
|
+
// const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))-1;
|
|
146
|
+
// //Show widget on same day
|
|
147
|
+
// if(diffDays === 0 || diffDays === -1){
|
|
148
|
+
// setShowWidget(true)
|
|
149
|
+
// }else{
|
|
150
|
+
// //reset occurrence on next day
|
|
151
|
+
// await Flyy.getAppOccurence(1);
|
|
152
|
+
// if(diffDays >= parseInt(widgetConfig.num_days)+1){
|
|
153
|
+
// await AsyncStorage.setItem(
|
|
154
|
+
// flyyConfigDate,
|
|
155
|
+
// JSON.stringify(currentDate.getTime())
|
|
156
|
+
// );
|
|
157
|
+
// setShowWidget(true)
|
|
158
|
+
// }
|
|
159
|
+
// }
|
|
160
|
+
// }else{
|
|
161
|
+
// setShowWidget(false);
|
|
162
|
+
// const getDate2 = await AsyncStorage.getItem(flyyConfigDate);
|
|
163
|
+
// var date = new Date(parseInt(getDate2));
|
|
164
|
+
// const diffTime = Math.abs(getDate2 - currentDate);
|
|
165
|
+
// const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
|
166
|
+
// if(diffDays != 1){
|
|
167
|
+
// var data = await Flyy.getAppOccurence(1);
|
|
168
|
+
// }
|
|
169
|
+
// }
|
|
170
|
+
// }
|
|
171
|
+
// // if(props.show){
|
|
172
|
+
// // if(props.startDate != null && props.startDate != 0){
|
|
173
|
+
// // var now = new Date().getTime();
|
|
174
|
+
// // if(now >= props.startDate && now <= props.endDate){
|
|
175
|
+
// // props.show = true
|
|
176
|
+
// // }else{
|
|
177
|
+
// // props.show = false
|
|
178
|
+
// // }
|
|
179
|
+
// // }
|
|
180
|
+
// // }
|
|
181
|
+
// // AppState.addEventListener('change', state =>{
|
|
182
|
+
// // console.log('AppState updated to', AppState.currentState)
|
|
183
|
+
// // oldState = currentState;
|
|
184
|
+
// // currentState = state;
|
|
185
|
+
// // if(oldState == null){
|
|
186
|
+
// // console.log('App is newly start :::')
|
|
187
|
+
// // }})
|
|
188
|
+
// return (
|
|
189
|
+
// // @ts-ignore
|
|
190
|
+
// props.show && showWidget? <Draggable x={buttonXPosition}
|
|
191
|
+
// y={buttonYPosition}
|
|
192
|
+
// minX={props.minX ?? 5}
|
|
193
|
+
// minY={props.minY ?? 5}
|
|
194
|
+
// maxX={props.maxX ?? windowWidth - 5}
|
|
195
|
+
// maxY={props.maxY ?? windowHeight - 5}
|
|
196
|
+
// renderSize={56}
|
|
197
|
+
// // shouldReverse = {true}
|
|
198
|
+
// onDragRelease={props.stick ? () => {
|
|
199
|
+
// } : null} isCircle>
|
|
200
|
+
// <TouchableOpacity
|
|
201
|
+
// onPress={deeplink != null ? async()=>{
|
|
202
|
+
// if (Platform.OS === 'android' || !deeplink.startsWith("flyy://")) {
|
|
203
|
+
// const supported = await Linking.canOpenURL(deeplink);
|
|
204
|
+
// await Linking.openURL(deeplink);
|
|
205
|
+
// } else {
|
|
206
|
+
// navigateTo(deeplink);
|
|
207
|
+
// }
|
|
208
|
+
// }:props.onPress}
|
|
209
|
+
// style={{
|
|
210
|
+
// height: buttonSize,
|
|
211
|
+
// width: buttonSize,
|
|
212
|
+
// backgroundColor: backgroundColor,
|
|
213
|
+
// borderRadius: buttonSize/2,
|
|
214
|
+
// justifyContent: 'center',
|
|
215
|
+
// alignItems: 'center',
|
|
216
|
+
// }}>
|
|
217
|
+
// <Image source={iconUrl} style={{ height: buttonSize*55/100, width: buttonSize*55/100 }} />
|
|
218
|
+
// <TouchableOpacity
|
|
219
|
+
// onPress={()=>{
|
|
220
|
+
// props.show = false;
|
|
221
|
+
// setShowWidget(false);
|
|
222
|
+
// }}
|
|
223
|
+
// style = {{height: 20, width: 20, backgroundColor: "transparent",position:'absolute',left:buttonSize-11, bottom: buttonSize*72/100}}>
|
|
224
|
+
// <Image source={require('./assets/images/xmark.png')} style={{ height: 18, width: 18, tintColor: "black"}} />
|
|
225
|
+
// </TouchableOpacity>
|
|
226
|
+
// </TouchableOpacity>
|
|
227
|
+
// </Draggable> : <View/>
|
|
228
|
+
// );
|
|
229
|
+
// }
|
|
265
230
|
|
|
266
231
|
const navigateTo = deeplink => {
|
|
267
232
|
let components = deeplink.split("/");
|
|
@@ -376,8 +341,8 @@ const navigateTo = deeplink => {
|
|
|
376
341
|
}
|
|
377
342
|
break;
|
|
378
343
|
|
|
379
|
-
default:
|
|
380
|
-
|
|
344
|
+
default: // Toast.showWithGravity("ACTION NOT FOUND", Toast.SHORT, Toast.BOTTOM);
|
|
345
|
+
|
|
381
346
|
}
|
|
382
347
|
};
|
|
383
348
|
|
|
@@ -663,8 +628,8 @@ export const FlyyStories = ({
|
|
|
663
628
|
}
|
|
664
629
|
break;
|
|
665
630
|
|
|
666
|
-
default:
|
|
667
|
-
|
|
631
|
+
default: // Toast.showWithGravity("ACTION NOT FOUND", Toast.SHORT, Toast.BOTTOM);
|
|
632
|
+
|
|
668
633
|
}
|
|
669
634
|
};
|
|
670
635
|
|