react-native-flyy 1.4.34 → 1.4.36
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/reactnativeflyy/FlyyModule.kt +18 -17
- package/android/src/main/java/com/reactnativeflyy/FlyyRouteActivity.java +2 -2
- package/ios/ReactNativeFlyy.h +2 -1
- package/ios/ReactNativeFlyy.m +20 -2
- package/lib/commonjs/index.js +208 -246
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +208 -242
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +0 -20
- package/package.json +1 -2
- package/react-native-flyy.podspec +1 -1
- package/src/index.tsx +220 -220
package/lib/module/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import React, { useEffect, useState } from 'react';
|
|
3
|
-
import { Image, NativeModules, Text, TouchableOpacity, View, Dimensions,
|
|
3
|
+
import { Image, NativeModules, Text, TouchableOpacity, View, Dimensions, FlatList, Alert } from 'react-native';
|
|
4
4
|
import FlyyCheckinComponent from './flyy_checkin_view';
|
|
5
|
-
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
6
|
-
import Draggable from 'react-native-draggable';
|
|
7
5
|
const {
|
|
8
6
|
Flyy
|
|
9
7
|
} = NativeModules;
|
|
@@ -23,245 +21,213 @@ export const FlyyCheckinView = props => {
|
|
|
23
21
|
};
|
|
24
22
|
const windowHeight = Dimensions.get('window').height;
|
|
25
23
|
const windowWidth = Dimensions.get('window').width; // ****** Flyy Floating Widget ******
|
|
26
|
-
|
|
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 - 200);
|
|
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
|
+
// Alert.alert(data.message);
|
|
76
|
+
// }
|
|
77
|
+
// return;
|
|
78
|
+
// }
|
|
79
|
+
// const widgetConfig = data.info.floating_widget_configuration;
|
|
80
|
+
// if (widgetConfig.icon_url != null && widgetConfig.icon_url != '') {
|
|
81
|
+
// setIconUrl({ uri: widgetConfig.icon_url })
|
|
82
|
+
// } else {
|
|
83
|
+
// setIconUrl(props.buttonIcon)
|
|
84
|
+
// }
|
|
85
|
+
// if (widgetConfig.color != null && widgetConfig.color != '') {
|
|
86
|
+
// setBackgroundColor(widgetConfig.color)
|
|
87
|
+
// } else {
|
|
88
|
+
// setBackgroundColor(props.backgroundColor)
|
|
89
|
+
// }
|
|
90
|
+
// if (widgetConfig.size != null && widgetConfig.color != 0) {
|
|
91
|
+
// setButtonSize(parseInt(data.info.floating_widget_configuration.size))
|
|
92
|
+
// } else {
|
|
93
|
+
// setButtonSize(props.buttonHeight)
|
|
94
|
+
// }
|
|
95
|
+
// //FloatingButton Position
|
|
96
|
+
// if (widgetConfig.position == "bottom_left") {
|
|
97
|
+
// setButtonXPosition(10)
|
|
98
|
+
// } else if (widgetConfig.position == "bottom_right") {
|
|
99
|
+
// setButtonXPosition(windowWidth - 75)
|
|
100
|
+
// } else if (widgetConfig.position == "upper_left") {
|
|
101
|
+
// setButtonXPosition(10)
|
|
102
|
+
// if (Platform.OS === 'android'){
|
|
103
|
+
// setButtonYPosition(10)
|
|
104
|
+
// }else{
|
|
105
|
+
// setButtonYPosition(50)
|
|
106
|
+
// }
|
|
107
|
+
// } else if (widgetConfig.position == "upper_right") {
|
|
108
|
+
// setButtonXPosition(windowWidth - 75)
|
|
109
|
+
// if (Platform.OS === 'android'){
|
|
110
|
+
// setButtonYPosition(10)
|
|
111
|
+
// }else{
|
|
112
|
+
// setButtonYPosition(50)
|
|
113
|
+
// }
|
|
114
|
+
// }
|
|
115
|
+
// //Set DeepLink
|
|
116
|
+
// if (widgetConfig.deeplink != null && widgetConfig.deeplink != "") {
|
|
117
|
+
// setDeeplink(widgetConfig.deeplink)
|
|
118
|
+
// }
|
|
119
|
+
// //Set Visibility of FloatingButton
|
|
120
|
+
// var currentDate = new Date();
|
|
121
|
+
// const getDate = await AsyncStorage.getItem(flyyConfigDate);
|
|
122
|
+
// const userId = await AsyncStorage.getItem(flyyConfigUserId);
|
|
123
|
+
// var date = new Date(parseInt(getDate));
|
|
124
|
+
// const diffTime = Math.abs(getDate - currentDate);
|
|
125
|
+
// const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))-1;
|
|
126
|
+
// if(diffDays != 0 || userId == null || userId != sdkInfo[flyyConfigUserId]){
|
|
127
|
+
// var data = await Flyy.getAppOccurence(1);
|
|
128
|
+
// await AsyncStorage.setItem(
|
|
129
|
+
// flyyConfigUserId,
|
|
130
|
+
// sdkInfo[flyyConfigUserId]
|
|
131
|
+
// );
|
|
132
|
+
// }
|
|
133
|
+
// const occurrenceCount = await Flyy.getAppOccurence(0);
|
|
134
|
+
// if (widgetConfig.show_to_user && occurrenceCount <= parseInt(widgetConfig.num_times)) {
|
|
135
|
+
// // var numberOfDaysToAdd = widgetConfig.num_days+1;
|
|
136
|
+
// // var result = currentDate.setDate(currentDate.getDate() + numberOfDaysToAdd);
|
|
137
|
+
// if(getDate === null || userId == null || userId != sdkInfo[flyyConfigUserId]){
|
|
138
|
+
// await AsyncStorage.setItem(
|
|
139
|
+
// flyyConfigDate,
|
|
140
|
+
// JSON.stringify(currentDate.getTime())
|
|
141
|
+
// );
|
|
142
|
+
// }
|
|
143
|
+
// const getDate2 = await AsyncStorage.getItem(flyyConfigDate);
|
|
144
|
+
// var date = new Date(parseInt(getDate2));
|
|
145
|
+
// const diffTime = Math.abs(getDate2 - currentDate);
|
|
146
|
+
// const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))-1;
|
|
147
|
+
// //Show widget on same day
|
|
148
|
+
// if(diffDays === 0 || diffDays === -1){
|
|
149
|
+
// setShowWidget(true)
|
|
150
|
+
// }else{
|
|
151
|
+
// //reset occurrence on next day
|
|
152
|
+
// await Flyy.getAppOccurence(1);
|
|
153
|
+
// if(diffDays >= parseInt(widgetConfig.num_days)+1){
|
|
154
|
+
// await AsyncStorage.setItem(
|
|
155
|
+
// flyyConfigDate,
|
|
156
|
+
// JSON.stringify(currentDate.getTime())
|
|
157
|
+
// );
|
|
158
|
+
// setShowWidget(true)
|
|
159
|
+
// }
|
|
160
|
+
// }
|
|
161
|
+
// }else{
|
|
162
|
+
// setShowWidget(false);
|
|
163
|
+
// const getDate2 = await AsyncStorage.getItem(flyyConfigDate);
|
|
164
|
+
// var date = new Date(parseInt(getDate2));
|
|
165
|
+
// const diffTime = Math.abs(getDate2 - currentDate);
|
|
166
|
+
// const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
|
167
|
+
// if(diffDays != 1){
|
|
168
|
+
// var data = await Flyy.getAppOccurence(1);
|
|
169
|
+
// }
|
|
170
|
+
// }
|
|
171
|
+
// }
|
|
172
|
+
// // if(props.show){
|
|
173
|
+
// // if(props.startDate != null && props.startDate != 0){
|
|
174
|
+
// // var now = new Date().getTime();
|
|
175
|
+
// // if(now >= props.startDate && now <= props.endDate){
|
|
176
|
+
// // props.show = true
|
|
177
|
+
// // }else{
|
|
178
|
+
// // props.show = false
|
|
179
|
+
// // }
|
|
180
|
+
// // }
|
|
181
|
+
// // }
|
|
182
|
+
// // AppState.addEventListener('change', state =>{
|
|
183
|
+
// // console.log('AppState updated to', AppState.currentState)
|
|
184
|
+
// // oldState = currentState;
|
|
185
|
+
// // currentState = state;
|
|
186
|
+
// // if(oldState == null){
|
|
187
|
+
// // console.log('App is newly start :::')
|
|
188
|
+
// // }})
|
|
189
|
+
// return (
|
|
190
|
+
// // @ts-ignore
|
|
191
|
+
// props.show && showWidget? <Draggable x={buttonXPosition}
|
|
192
|
+
// y={buttonYPosition}
|
|
193
|
+
// minX={props.minX ?? 5}
|
|
194
|
+
// minY={props.minY ?? 5}
|
|
195
|
+
// maxX={props.maxX ?? windowWidth - 5}
|
|
196
|
+
// maxY={props.maxY ?? windowHeight - 5}
|
|
197
|
+
// renderSize={56}
|
|
198
|
+
// // shouldReverse = {true}
|
|
199
|
+
// onDragRelease={props.stick ? () => {
|
|
200
|
+
// } : null} isCircle>
|
|
201
|
+
// <TouchableOpacity
|
|
202
|
+
// onPress={deeplink != null ? async()=>{
|
|
203
|
+
// if (Platform.OS === 'android' || !deeplink.startsWith("flyy://")) {
|
|
204
|
+
// const supported = await Linking.canOpenURL(deeplink);
|
|
205
|
+
// await Linking.openURL(deeplink);
|
|
206
|
+
// } else {
|
|
207
|
+
// navigateTo(deeplink);
|
|
208
|
+
// }
|
|
209
|
+
// }:props.onPress}
|
|
210
|
+
// style={{
|
|
211
|
+
// height: buttonSize,
|
|
212
|
+
// width: buttonSize,
|
|
213
|
+
// backgroundColor: backgroundColor,
|
|
214
|
+
// borderRadius: buttonSize/2,
|
|
215
|
+
// justifyContent: 'center',
|
|
216
|
+
// alignItems: 'center',
|
|
217
|
+
// }}>
|
|
218
|
+
// <Image source={iconUrl} style={{ height: buttonSize*55/100, width: buttonSize*55/100 }} />
|
|
219
|
+
// <TouchableOpacity
|
|
220
|
+
// onPress={()=>{
|
|
221
|
+
// props.show = false;
|
|
222
|
+
// setShowWidget(false);
|
|
223
|
+
// }}
|
|
224
|
+
// style = {{height: 20, width: 20, backgroundColor: "transparent",position:'absolute',left:buttonSize-11, bottom: buttonSize*72/100}}>
|
|
225
|
+
// <Image source={require('./assets/images/xmark.png')} style={{ height: 18, width: 18, tintColor: "black"}} />
|
|
226
|
+
// </TouchableOpacity>
|
|
227
|
+
// </TouchableOpacity>
|
|
228
|
+
// </Draggable> : <View/>
|
|
229
|
+
// );
|
|
230
|
+
// }
|
|
265
231
|
|
|
266
232
|
const navigateTo = deeplink => {
|
|
267
233
|
let components = deeplink.split("/");
|