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