react-native-flyy 1.4.28 → 1.4.30
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/.settings/org.eclipse.buildship.core.prefs +1 -1
- package/android/src/main/java/com/reactnativeflyy/FlyyModule.kt +20 -0
- package/android/src/main/java/com/reactnativeflyy/FlyyRouteActivity.java +12 -0
- package/ios/ReactNativeFlyy.m +58 -12
- package/lib/commonjs/flyy_checkin_view.js +1 -6
- package/lib/commonjs/flyy_checkin_view.js.map +1 -1
- package/lib/commonjs/index.js +542 -207
- 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 +540 -201
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +10 -20
- package/package.json +1 -4
- package/react-native-flyy.podspec +1 -1
- package/src/flyy_checkin_view.tsx +1 -1
- package/src/index.tsx +506 -191
package/src/index.tsx
CHANGED
|
@@ -9,11 +9,12 @@ import {
|
|
|
9
9
|
Dimensions,
|
|
10
10
|
AppState,
|
|
11
11
|
ToastAndroid,
|
|
12
|
-
Linking
|
|
12
|
+
Linking,
|
|
13
|
+
FlatList
|
|
13
14
|
} from 'react-native';
|
|
14
|
-
import Draggable from 'react-native-draggable';
|
|
15
|
+
// import Draggable from 'react-native-draggable';
|
|
15
16
|
import FlyyCheckinComponent from './flyy_checkin_view';
|
|
16
|
-
import
|
|
17
|
+
import { FlyyStoriesWidget } from './flyy_stories';
|
|
17
18
|
|
|
18
19
|
type FlyyType = {
|
|
19
20
|
getUserId(arg0: (data: any) => void): unknown;
|
|
@@ -39,209 +40,328 @@ const windowHeight = Dimensions.get('window').height;
|
|
|
39
40
|
const windowWidth = Dimensions.get('window').width;
|
|
40
41
|
|
|
41
42
|
// ****** Flyy Floating Widget ******
|
|
42
|
-
export const FlyyFloatingWidget = ({
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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;
|
|
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
|
+
// } }) => {
|
|
75
62
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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;
|
|
79
76
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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);
|
|
101
274
|
}
|
|
275
|
+
break;
|
|
102
276
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
setBackgroundColor(props.backgroundColor)
|
|
277
|
+
case "flyy_quiz_list":
|
|
278
|
+
{
|
|
279
|
+
Flyy.openFlyyQuizListPage();
|
|
107
280
|
}
|
|
281
|
+
break;
|
|
108
282
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
setButtonSize(props.buttonHeight)
|
|
283
|
+
case "stamp_campaign_new":
|
|
284
|
+
{
|
|
285
|
+
Flyy.openFlyyStampsPage();
|
|
113
286
|
}
|
|
287
|
+
break;
|
|
114
288
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
} else if (widgetConfig.position == "bottom_right") {
|
|
119
|
-
setButtonXPosition(windowWidth - 75)
|
|
120
|
-
} else if (widgetConfig.position == "upper_left") {
|
|
121
|
-
setButtonXPosition(10)
|
|
122
|
-
setButtonYPosition(10)
|
|
123
|
-
} else if (widgetConfig.position == "upper_right") {
|
|
124
|
-
setButtonXPosition(windowWidth - 75)
|
|
125
|
-
setButtonYPosition(10)
|
|
289
|
+
case "campaign_home":
|
|
290
|
+
{
|
|
291
|
+
Flyy.openFlyyStampsPage();
|
|
126
292
|
}
|
|
293
|
+
break;
|
|
127
294
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
295
|
+
case "bonanza_details":
|
|
296
|
+
{
|
|
297
|
+
Flyy.openFlyyBonanzaPage();
|
|
131
298
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
var date = new Date(parseInt(getDate));
|
|
137
|
-
const diffTime = Math.abs(getDate - currentDate);
|
|
138
|
-
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))-1;
|
|
139
|
-
if(diffDays != 0 || userId == null || userId != sdkInfo[flyyConfigUserId]){
|
|
140
|
-
var data = await Flyy.getAppOccurence(1);
|
|
141
|
-
await AsyncStorage.setItem(
|
|
142
|
-
flyyConfigUserId,
|
|
143
|
-
sdkInfo[flyyConfigUserId]
|
|
144
|
-
);
|
|
299
|
+
break;
|
|
300
|
+
case "invite_earn":
|
|
301
|
+
{
|
|
302
|
+
Flyy.openFlyyInviteAndEarnPage(0);
|
|
145
303
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if(getDate === null || userId == null || userId != sdkInfo[flyyConfigUserId]){
|
|
151
|
-
await AsyncStorage.setItem(
|
|
152
|
-
flyyConfigDate,
|
|
153
|
-
JSON.stringify(currentDate.getTime())
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
const getDate2 = await AsyncStorage.getItem(flyyConfigDate);
|
|
157
|
-
var date = new Date(parseInt(getDate2));
|
|
158
|
-
const diffTime = Math.abs(getDate2 - currentDate);
|
|
159
|
-
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24))-1;
|
|
160
|
-
//Show widget on same day
|
|
161
|
-
if(diffDays === 0 || diffDays === -1){
|
|
162
|
-
setShowWidget(true)
|
|
163
|
-
}else{
|
|
164
|
-
//reset occurrence on next day
|
|
165
|
-
await Flyy.getAppOccurence(1);
|
|
166
|
-
if(diffDays >= parseInt(widgetConfig.num_days)+1){
|
|
167
|
-
await AsyncStorage.setItem(
|
|
168
|
-
flyyConfigDate,
|
|
169
|
-
JSON.stringify(currentDate.getTime())
|
|
170
|
-
);
|
|
171
|
-
setShowWidget(true)
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}else{
|
|
175
|
-
setShowWidget(false);
|
|
176
|
-
const getDate2 = await AsyncStorage.getItem(flyyConfigDate);
|
|
177
|
-
var date = new Date(parseInt(getDate2));
|
|
178
|
-
const diffTime = Math.abs(getDate2 - currentDate);
|
|
179
|
-
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
|
180
|
-
if(diffDays != 1){
|
|
181
|
-
var data = await Flyy.getAppOccurence(1);
|
|
182
|
-
}
|
|
304
|
+
break;
|
|
305
|
+
case "invite_details":
|
|
306
|
+
{
|
|
307
|
+
Flyy.openFlyyInviteDetailsPage(0);
|
|
183
308
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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);
|
|
204
362
|
|
|
205
|
-
|
|
206
|
-
// @ts-ignore
|
|
207
|
-
props.show && showWidget? <Draggable x={buttonXPosition}
|
|
208
|
-
y={buttonYPosition}
|
|
209
|
-
minX={props.minX ?? 5}
|
|
210
|
-
minY={props.minY ?? 5}
|
|
211
|
-
maxX={props.maxX ?? windowWidth - 5}
|
|
212
|
-
maxY={props.maxY ?? windowHeight - 5}
|
|
213
|
-
renderSize={56}
|
|
214
|
-
// shouldReverse = {true}
|
|
215
|
-
onDragRelease={props.stick ? () => {
|
|
216
|
-
|
|
217
|
-
} : null} isCircle>
|
|
218
|
-
<TouchableOpacity
|
|
219
|
-
onPress={deeplink != null ? async()=>{
|
|
220
|
-
const supported = await Linking.canOpenURL(deeplink);
|
|
221
|
-
await Linking.openURL(deeplink);
|
|
222
|
-
}:props.onPress}
|
|
223
|
-
style={{
|
|
224
|
-
height: buttonSize,
|
|
225
|
-
width: buttonSize,
|
|
226
|
-
backgroundColor: backgroundColor,
|
|
227
|
-
borderRadius: buttonSize/2,
|
|
228
|
-
justifyContent: 'center',
|
|
229
|
-
alignItems: 'center',
|
|
230
|
-
}}>
|
|
231
|
-
<Image source={iconUrl} style={{ height: buttonSize*55/100, width: buttonSize*55/100 }} />
|
|
232
|
-
<TouchableOpacity
|
|
233
|
-
onPress={()=>{
|
|
234
|
-
props.show = false;
|
|
235
|
-
setShowWidget(false);
|
|
236
|
-
}}
|
|
237
|
-
style = {{height: 20, width: 20, backgroundColor: "transparent",position:'absolute',left:buttonSize-11, bottom: buttonSize*72/100}}>
|
|
238
|
-
<Image source={require('./assets/images/xmark.png')} style={{ height: 18, width: 18, tintColor: "black"}} />
|
|
239
|
-
</TouchableOpacity>
|
|
240
|
-
</TouchableOpacity>
|
|
241
|
-
</Draggable> : <View/>
|
|
242
|
-
);
|
|
363
|
+
}
|
|
243
364
|
}
|
|
244
|
-
|
|
245
365
|
export const FlyyWidget = ({
|
|
246
366
|
widgetStyle = {
|
|
247
367
|
rewardsButtonIcon: require('./assets/images/rewardwidget.png'),
|
|
@@ -378,3 +498,198 @@ const FlyyCardView = ({ cardStyle, buttonTitle, buttonIcon }) => {
|
|
|
378
498
|
</View>
|
|
379
499
|
);
|
|
380
500
|
};
|
|
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
|
+
}
|