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/src/index.tsx
CHANGED
|
@@ -12,10 +12,7 @@ import {
|
|
|
12
12
|
Linking,
|
|
13
13
|
FlatList
|
|
14
14
|
} from 'react-native';
|
|
15
|
-
import Draggable from 'react-native-draggable';
|
|
16
15
|
import FlyyCheckinComponent from './flyy_checkin_view';
|
|
17
|
-
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
18
|
-
import Toast from 'react-native-simple-toast';
|
|
19
16
|
import { FlyyStoriesWidget } from './flyy_stories';
|
|
20
17
|
|
|
21
18
|
type FlyyType = {
|
|
@@ -42,224 +39,224 @@ const windowHeight = Dimensions.get('window').height;
|
|
|
42
39
|
const windowWidth = Dimensions.get('window').width;
|
|
43
40
|
|
|
44
41
|
// ****** Flyy Floating Widget ******
|
|
45
|
-
export const FlyyFloatingWidget = ({
|
|
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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
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
|
+
// }
|
|
263
260
|
|
|
264
261
|
const navigateTo = (deeplink) => {
|
|
265
262
|
let components = deeplink.split("/");
|
|
@@ -360,7 +357,7 @@ const navigateTo = (deeplink) => {
|
|
|
360
357
|
}
|
|
361
358
|
break;
|
|
362
359
|
default:
|
|
363
|
-
Toast.showWithGravity("ACTION NOT FOUND", Toast.SHORT, Toast.BOTTOM);
|
|
360
|
+
// Toast.showWithGravity("ACTION NOT FOUND", Toast.SHORT, Toast.BOTTOM);
|
|
364
361
|
|
|
365
362
|
}
|
|
366
363
|
}
|
|
@@ -637,7 +634,7 @@ export const FlyyStories = ({
|
|
|
637
634
|
}
|
|
638
635
|
break;
|
|
639
636
|
default:
|
|
640
|
-
Toast.showWithGravity("ACTION NOT FOUND", Toast.SHORT, Toast.BOTTOM);
|
|
637
|
+
// Toast.showWithGravity("ACTION NOT FOUND", Toast.SHORT, Toast.BOTTOM);
|
|
641
638
|
|
|
642
639
|
}
|
|
643
640
|
}
|