react-native-flyy 1.4.31 → 1.4.32

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.
Files changed (36) hide show
  1. package/android/.project +1 -1
  2. package/android/.settings/org.eclipse.buildship.core.prefs +2 -5
  3. package/android/build.gradle +1 -1
  4. package/android/src/main/java/com/reactnativeflyy/FlyyModule.kt +49 -155
  5. package/android/src/main/java/com/reactnativeflyy/FlyyRouteActivity.java +0 -16
  6. package/ios/ReactNativeFlyy.m +122 -276
  7. package/lib/commonjs/index.js +3 -591
  8. package/lib/commonjs/index.js.map +1 -1
  9. package/lib/module/index.js +3 -579
  10. package/lib/module/index.js.map +1 -1
  11. package/lib/typescript/index.d.ts +0 -12
  12. package/package.json +1 -1
  13. package/react-native-flyy.podspec +1 -1
  14. package/src/index.tsx +1 -543
  15. package/ios/Montserrat-Bold.ttf +0 -0
  16. package/lib/commonjs/assets/images/check.png +0 -0
  17. package/lib/commonjs/assets/images/medal.png +0 -0
  18. package/lib/commonjs/assets/images/radio.png +0 -0
  19. package/lib/commonjs/assets/images/reward_flyy.png +0 -0
  20. package/lib/commonjs/assets/images/xmark.png +0 -0
  21. package/lib/commonjs/flyy_checkin_view.js +0 -379
  22. package/lib/commonjs/flyy_checkin_view.js.map +0 -1
  23. package/lib/module/assets/images/check.png +0 -0
  24. package/lib/module/assets/images/medal.png +0 -0
  25. package/lib/module/assets/images/radio.png +0 -0
  26. package/lib/module/assets/images/reward_flyy.png +0 -0
  27. package/lib/module/assets/images/xmark.png +0 -0
  28. package/lib/module/flyy_checkin_view.js +0 -365
  29. package/lib/module/flyy_checkin_view.js.map +0 -1
  30. package/lib/typescript/flyy_checkin_view.d.ts +0 -19
  31. package/src/assets/images/check.png +0 -0
  32. package/src/assets/images/medal.png +0 -0
  33. package/src/assets/images/radio.png +0 -0
  34. package/src/assets/images/reward_flyy.png +0 -0
  35. package/src/assets/images/xmark.png +0 -0
  36. package/src/flyy_checkin_view.tsx +0 -213
@@ -1,365 +0,0 @@
1
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
-
3
- // @ts-nocheck
4
- import React, { Component } from "react";
5
- import { View, Text, TouchableOpacity, StyleSheet, Image, VirtualizedList, Platform, ToastAndroid, Linking, NativeModules } from "react-native";
6
- const {
7
- Flyy
8
- } = NativeModules;
9
-
10
- class FlyyCheckinComponent extends Component {
11
- constructor(...args) {
12
- super(...args);
13
-
14
- _defineProperty(this, "state", {
15
- mileStoneData: [],
16
- checkinOffer: [],
17
- listItems: [],
18
- persons: [1, 2, 3, 4, 5],
19
- partnerId: "",
20
- userId: "",
21
- appData: "",
22
- environment: 0
23
- });
24
- }
25
-
26
- async componentDidMount() {
27
- try {
28
- const data = await Flyy.getUserData();
29
- const appData = await Flyy.getAppData();
30
- this.setState({
31
- partnerId: data["partner_id"],
32
- userId: data["user_id"],
33
- environment: data["environment"],
34
- appData: appData
35
- });
36
- } catch (e) {
37
- console.error(e);
38
- }
39
-
40
- await this.fetchData();
41
- }
42
-
43
- async fetchData() {
44
- this.setState({
45
- listItems: []
46
- });
47
- const resp = await fetch(`https://${this.state.environment == 0 ? "ghc-stage" : "ghc"}.theflyy.com/api/v7/flyy_app_info`, {
48
- headers: {
49
- "X-Key": this.state.partnerId,
50
- "Content-Type": "application/json",
51
- "X-App-Data": this.state.appData
52
- }
53
- });
54
- const data = await resp.json();
55
-
56
- for (var key in data.info.offers) {
57
- if (data.info.offers[key].offer_type_code === "checkin") {
58
- this.setState({
59
- checkinOffer: data.info.offers[key]
60
- });
61
- this.setState({
62
- mileStoneData: data.info.offers[key].milestones
63
- });
64
- break;
65
- }
66
- }
67
-
68
- var tempData = [];
69
- var isRewardDay = false;
70
- var isCheckedIn = false;
71
-
72
- for (let i = 0; i < this.state.checkinOffer.total_streak; i++) {
73
- for (let j = 0; j < this.state.mileStoneData.length; j++) {
74
- if (i + 1 === parseInt(this.state.mileStoneData[j].value)) {
75
- isRewardDay = true;
76
- }
77
- }
78
-
79
- if (i + 1 <= this.state.checkinOffer.streak) {
80
- isCheckedIn = true;
81
- }
82
-
83
- tempData.push({
84
- "isRewardDay": isRewardDay,
85
- "isCheckedIn": isCheckedIn
86
- });
87
- isRewardDay = false;
88
- isCheckedIn = false;
89
- }
90
-
91
- this.setState({
92
- listItems: tempData
93
- });
94
- }
95
-
96
- async checkInApi() {
97
- var url = `https://${this.state.environment == 0 ? "ghc-stage" : "ghc"}.theflyy.com/api/v1/checkin?offer_id=` + this.state.checkinOffer.id.toString();
98
- const resp = await fetch(url, {
99
- headers: {
100
- "X-Key": this.state.partnerId,
101
- "Content-Type": "application/json",
102
- "X-App-Data": this.state.appData
103
- }
104
- });
105
- const data = await resp.json();
106
-
107
- if (data.success) {
108
- this.fetchData();
109
- } else {
110
- this.notifyMessage(data.message);
111
- }
112
- }
113
-
114
- notifyMessage(msg) {
115
- if (Platform.OS === 'android') {
116
- ToastAndroid.show(msg, ToastAndroid.SHORT);
117
- } else {// Toast.showWithGravity(msg, Toast.SHORT, Toast.BOTTOM);
118
- }
119
- }
120
-
121
- render() {
122
- var _this$props$style$che3, _this$props$style3, _this$props$style$fon, _this$props$style4, _this$state$checkinOf, _this$props$style$che4, _this$props$style5, _this$props$style$fon2, _this$props$style6, _this$props$style$che5, _this$props$style7;
123
-
124
- const Divider = ({
125
- color = "black",
126
- index
127
- }) => {
128
- return /*#__PURE__*/React.createElement(View, {
129
- style: {
130
- flexDirection: 'row'
131
- }
132
- }, React.Children.toArray(this.state.persons.map(() => {
133
- return /*#__PURE__*/React.createElement(View, {
134
- style: {
135
- flexDirection: 'row'
136
- }
137
- }, /*#__PURE__*/React.createElement(View, {
138
- style: {
139
- height: 1,
140
- width: 2,
141
- backgroundColor: color,
142
- borderRadius: 2
143
- }
144
- }), /*#__PURE__*/React.createElement(View, {
145
- style: {
146
- width: 1,
147
- backgroundColor: "white",
148
- borderRadius: 2
149
- }
150
- }));
151
- })));
152
- };
153
-
154
- const getItemCount = () => this.state.listItems.length;
155
-
156
- const getItem = (data, index) => ({
157
- id: Math.random().toString(12).substring(0),
158
- isRewardDay: data[index].isRewardDay,
159
- isCheckedIn: data[index].isCheckedIn,
160
- index: index
161
- });
162
-
163
- const Item = ({
164
- title,
165
- index
166
- }) => {
167
- var _this$props$style$che, _this$props$style, _this$props$style$che2, _this$props$style2;
168
-
169
- const day = index + 1;
170
- return /*#__PURE__*/React.createElement(View, {
171
- style: {
172
- justifyContent: "center",
173
- alignItems: 'center',
174
- alignContent: 'center'
175
- }
176
- }, /*#__PURE__*/React.createElement(View, {
177
- style: {
178
- flexDirection: 'row',
179
- height: 35,
180
- justifyContent: 'center',
181
- alignItems: 'center'
182
- }
183
- }, title.isCheckedIn ? /*#__PURE__*/React.createElement(View, {
184
- style: {
185
- height: 1,
186
- width: 15,
187
- alignSelf: "center",
188
- backgroundColor: index == 0 ? "white" : "black"
189
- }
190
- }) : /*#__PURE__*/React.createElement(Divider, {
191
- color: index == 0 ? "white" : "black",
192
- index: index
193
- }), title.isRewardDay ? title.isCheckedIn ? /*#__PURE__*/React.createElement(Image, {
194
- source: require('./assets/images/reward_flyy.png'),
195
- style: {
196
- height: 20,
197
- width: 15
198
- }
199
- }) : /*#__PURE__*/React.createElement(Image, {
200
- source: {
201
- uri: this.state.checkinOffer["currency_icon_url"]
202
- },
203
- style: {
204
- height: 20,
205
- width: 20
206
- }
207
- }) : title.isCheckedIn ? /*#__PURE__*/React.createElement(View, {
208
- style: {
209
- height: 17,
210
- width: 17,
211
- backgroundColor: "black",
212
- borderRadius: 15,
213
- justifyContent: 'center',
214
- alignItems: 'center'
215
- }
216
- }, /*#__PURE__*/React.createElement(Text, {
217
- style: {
218
- color: "white",
219
- fontSize: 10
220
- }
221
- }, "\u2713")) : /*#__PURE__*/React.createElement(Image, {
222
- source: require('./assets/images/radio.png'),
223
- style: {
224
- height: 20,
225
- width: 20
226
- }
227
- }), index != this.state.listItems.length - 1 ? this.state.listItems[index + 1].isCheckedIn ? /*#__PURE__*/React.createElement(View, {
228
- style: {
229
- height: 1,
230
- width: 15,
231
- alignSelf: "center",
232
- backgroundColor: index == this.state.listItems.length - 1 ? "white" : "black"
233
- }
234
- }) : /*#__PURE__*/React.createElement(Divider, {
235
- color: index == this.state.listItems.length - 1 ? "white" : "black",
236
- index: index
237
- }) : /*#__PURE__*/React.createElement(View, {
238
- style: {
239
- width: 15
240
- }
241
- })), /*#__PURE__*/React.createElement(Text, {
242
- style: {
243
- textAlign: 'center',
244
- color: title.isRewardDay ? (_this$props$style$che = (_this$props$style = this.props.style) === null || _this$props$style === void 0 ? void 0 : _this$props$style.checkInEarnColor) !== null && _this$props$style$che !== void 0 ? _this$props$style$che : "black" : (_this$props$style$che2 = (_this$props$style2 = this.props.style) === null || _this$props$style2 === void 0 ? void 0 : _this$props$style2.checkInDaysColor) !== null && _this$props$style$che2 !== void 0 ? _this$props$style$che2 : "black"
245
- }
246
- }, title.isRewardDay ? title.isCheckedIn ? "Won" : "Earn" : title.isCheckedIn ? "Day " + day : "Day " + day));
247
- };
248
-
249
- return /*#__PURE__*/React.createElement(TouchableOpacity, {
250
- style: styles.main,
251
- onPress: () => {
252
- Flyy.openFlyyCheckinPage();
253
- }
254
- }, /*#__PURE__*/React.createElement(View, {
255
- style: {
256
- height: 10
257
- }
258
- }), /*#__PURE__*/React.createElement(Text, {
259
- style: {
260
- fontSize: 20,
261
- color: (_this$props$style$che3 = (_this$props$style3 = this.props.style) === null || _this$props$style3 === void 0 ? void 0 : _this$props$style3.checkInTitleColor) !== null && _this$props$style$che3 !== void 0 ? _this$props$style$che3 : "black",
262
- fontFamily: (_this$props$style$fon = (_this$props$style4 = this.props.style) === null || _this$props$style4 === void 0 ? void 0 : _this$props$style4.fontFamily) !== null && _this$props$style$fon !== void 0 ? _this$props$style$fon : "Montserrat-Regular"
263
- }
264
- }, (_this$state$checkinOf = this.state.checkinOffer["offer_type_title"]) !== null && _this$state$checkinOf !== void 0 ? _this$state$checkinOf : "N/A"), /*#__PURE__*/React.createElement(View, {
265
- style: {
266
- height: 10
267
- }
268
- }), /*#__PURE__*/React.createElement(View, {
269
- style: {
270
- flexDirection: 'row',
271
- width: 250,
272
- justifyContent: 'center'
273
- }
274
- }, /*#__PURE__*/React.createElement(Text, {
275
- numberOfLines: 1,
276
- style: {
277
- fontSize: 18,
278
- color: (_this$props$style$che4 = (_this$props$style5 = this.props.style) === null || _this$props$style5 === void 0 ? void 0 : _this$props$style5.checkInDescriptionColor) !== null && _this$props$style$che4 !== void 0 ? _this$props$style$che4 : "grey",
279
- fontFamily: (_this$props$style$fon2 = (_this$props$style6 = this.props.style) === null || _this$props$style6 === void 0 ? void 0 : _this$props$style6.fontFamily) !== null && _this$props$style$fon2 !== void 0 ? _this$props$style$fon2 : "Montserrat-Regular",
280
- textAlign: "center"
281
- }
282
- }, this.state.checkinOffer["description"] != null ? this.state.checkinOffer["description"].replace(/(<([^>]+)>)/ig, '') : "N/A")), /*#__PURE__*/React.createElement(View, {
283
- style: {
284
- height: 10
285
- }
286
- }), /*#__PURE__*/React.createElement(View, {
287
- style: styles.listContainer
288
- }, /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(VirtualizedList, {
289
- data: this.state.listItems,
290
- style: {
291
- alignSelf: "center"
292
- },
293
- initialNumToRender: 4,
294
- horizontal: true,
295
- renderItem: ({
296
- item,
297
- index
298
- }) => /*#__PURE__*/React.createElement(Item, {
299
- title: item,
300
- index: index
301
- }),
302
- getItemCount: getItemCount,
303
- getItem: getItem
304
- }))), /*#__PURE__*/React.createElement(View, {
305
- style: {
306
- height: 10
307
- }
308
- }), /*#__PURE__*/React.createElement(TouchableOpacity, {
309
- style: styles.button,
310
- onPress: async () => {
311
- const eventId = this.state.checkinOffer["event_id"];
312
- const url = this.state.checkinOffer["deeplink"];
313
-
314
- if (eventId != null) {
315
- if (url != "") {
316
- const supported = await Linking.canOpenURL(url);
317
-
318
- if (supported) {
319
- await Linking.openURL(url);
320
- }
321
- }
322
- } else {
323
- this.checkInApi();
324
- }
325
- }
326
- }, /*#__PURE__*/React.createElement(Text, {
327
- style: {
328
- fontSize: 20,
329
- color: (_this$props$style$che5 = (_this$props$style7 = this.props.style) === null || _this$props$style7 === void 0 ? void 0 : _this$props$style7.checkInBtnTextColor) !== null && _this$props$style$che5 !== void 0 ? _this$props$style$che5 : "white",
330
- paddingLeft: 10,
331
- paddingRight: 10,
332
- fontFamily: "Montserrat-Regular"
333
- }
334
- }, this.state.checkinOffer["checked_in"] ? "Checked In" : this.state.checkinOffer["button_text"] != "" ? this.state.checkinOffer["button_text"] : "Check In")));
335
- }
336
-
337
- }
338
-
339
- const styles = StyleSheet.create({
340
- main: {
341
- backgroundColor: "white",
342
- elevation: 5,
343
- height: 210,
344
- width: "90%",
345
- alignItems: "center",
346
- borderRadius: 10
347
- },
348
- listContainer: {
349
- height: 60,
350
- flexDirection: "row",
351
- justifyContent: "center",
352
- width: "100%",
353
- alignItems: 'center',
354
- alignContent: 'center',
355
- backgroundColor: "white"
356
- },
357
- button: {
358
- backgroundColor: "#f57242",
359
- height: 35,
360
- borderRadius: 5,
361
- justifyContent: "center"
362
- }
363
- });
364
- export default FlyyCheckinComponent;
365
- //# sourceMappingURL=flyy_checkin_view.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["flyy_checkin_view.tsx"],"names":["React","Component","View","Text","TouchableOpacity","StyleSheet","Image","VirtualizedList","Platform","ToastAndroid","Linking","NativeModules","Flyy","FlyyCheckinComponent","mileStoneData","checkinOffer","listItems","persons","partnerId","userId","appData","environment","componentDidMount","data","getUserData","getAppData","setState","e","console","error","fetchData","resp","fetch","state","headers","json","key","info","offers","offer_type_code","milestones","tempData","isRewardDay","isCheckedIn","i","total_streak","j","length","parseInt","value","streak","push","checkInApi","url","id","toString","success","notifyMessage","message","msg","OS","show","SHORT","render","Divider","color","index","flexDirection","Children","toArray","map","height","width","backgroundColor","borderRadius","getItemCount","getItem","Math","random","substring","Item","title","day","justifyContent","alignItems","alignContent","alignSelf","require","uri","fontSize","textAlign","props","style","checkInEarnColor","checkInDaysColor","styles","main","openFlyyCheckinPage","checkInTitleColor","fontFamily","checkInDescriptionColor","replace","listContainer","item","button","eventId","supported","canOpenURL","openURL","checkInBtnTextColor","paddingLeft","paddingRight","create","elevation"],"mappings":";;AAAA;AACA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;AACA,SAASC,IAAT,EAAeC,IAAf,EAAqBC,gBAArB,EAAsCC,UAAtC,EAAiDC,KAAjD,EAAwDC,eAAxD,EAAyEC,QAAzE,EAAmFC,YAAnF,EAAwGC,OAAxG,EAAiHC,aAAjH,QAAsI,cAAtI;AACA,MAAM;AAAEC,EAAAA;AAAF,IAAWD,aAAjB;;AAEA,MAAME,oBAAN,SAAmCZ,SAAnC,CAA6C;AAAA;AAAA;;AAAA,mCAEjC;AACJa,MAAAA,aAAa,EAAE,EADX;AAEJC,MAAAA,YAAY,EAAE,EAFV;AAGJC,MAAAA,SAAS,EAAE,EAHP;AAIJC,MAAAA,OAAO,EAAE,CAAC,CAAD,EAAG,CAAH,EAAK,CAAL,EAAO,CAAP,EAAS,CAAT,CAJL;AAKJC,MAAAA,SAAS,EAAE,EALP;AAMJC,MAAAA,MAAM,EAAE,EANJ;AAOJC,MAAAA,OAAO,EAAE,EAPL;AAQJC,MAAAA,WAAW,EAAE;AART,KAFiC;AAAA;;AAalB,QAAjBC,iBAAiB,GAAE;AACvB,QAAI;AACF,YAAMC,IAAI,GAAG,MAAMX,IAAI,CAACY,WAAL,EAAnB;AACA,YAAMJ,OAAO,GAAG,MAAMR,IAAI,CAACa,UAAL,EAAtB;AACA,WAAKC,QAAL,CAAc;AACFR,QAAAA,SAAS,EAAGK,IAAI,CAAC,YAAD,CADd;AAEFJ,QAAAA,MAAM,EAAGI,IAAI,CAAC,SAAD,CAFX;AAGFF,QAAAA,WAAW,EAAGE,IAAI,CAAC,aAAD,CAHhB;AA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\nimport { View, Text, TouchableOpacity,StyleSheet,Image, VirtualizedList, Platform, ToastAndroid, Alert, Linking, NativeModules } from \"react-native\";\nconst { Flyy } = NativeModules;\n\nclass FlyyCheckinComponent extends Component {\n\n state = {\n mileStoneData: [],\n checkinOffer: [],\n listItems: [],\n persons: [1,2,3,4,5],\n partnerId: \"\",\n userId: \"\",\n appData: \"\",\n environment: 0\n };\n\n async componentDidMount(){\n try {\n const data = await Flyy.getUserData();\n const appData = await Flyy.getAppData();\n this.setState({ \n partnerId : data[\"partner_id\"],\n userId : data[\"user_id\"],\n environment : data[\"environment\"],\n appData: appData\n })\n } catch (e) {\n console.error(e);\n }\n\n await this.fetchData();\n }\n\n\n async fetchData(){\n this.setState({ listItems : []})\n const resp = await fetch(`https://${this.state.environment == 0 ? \"ghc-stage\" : \"ghc\"}.theflyy.com/api/v7/flyy_app_info`, {\n headers: {\n \"X-Key\": this.state.partnerId,\n \"Content-Type\": \"application/json\",\n \"X-App-Data\": this.state.appData\n }\n });\n const data = await resp.json();\n for (var key in data.info.offers) {\n if (data.info.offers[key].offer_type_code === \"checkin\") {\n this.setState({ checkinOffer : data.info.offers[key] })\n this.setState({ mileStoneData : data.info.offers[key].milestones })\n break;\n }\n }\n var tempData = [];\n var isRewardDay = false;\n var isCheckedIn = false;\n for (let i = 0; i < this.state.checkinOffer.total_streak; i++) {\n for (let j = 0; j < this.state.mileStoneData.length; j++) {\n if (i + 1 === parseInt(this.state.mileStoneData[j].value)) {\n isRewardDay = true;\n }\n }\n if (i+1 <= this.state.checkinOffer.streak) {\n isCheckedIn = true;\n }\n tempData.push({ \"isRewardDay\": isRewardDay, \"isCheckedIn\": isCheckedIn })\n isRewardDay = false;\n isCheckedIn = false;\n }\n this.setState({ listItems : tempData })\n }\n\n\n async checkInApi() {\n var url = `https://${this.state.environment == 0 ? \"ghc-stage\" : \"ghc\"}.theflyy.com/api/v1/checkin?offer_id=` + this.state.checkinOffer.id.toString();\n const resp = await fetch(url, {\n headers: {\n \"X-Key\": this.state.partnerId,\n \"Content-Type\": \"application/json\",\n \"X-App-Data\": this.state.appData\n }\n });\n const data = await resp.json();\n if (data.success) {\n this.fetchData()\n } else {\n this.notifyMessage(data.message)\n }\n }\n\n notifyMessage(msg:string) {\n if (Platform.OS === 'android') {\n ToastAndroid.show(msg, ToastAndroid.SHORT)\n } else {\n // Toast.showWithGravity(msg, Toast.SHORT, Toast.BOTTOM);\n }\n }\n\n render() {\n const Divider = ({color = \"black\",index}:{color:any,index:any}) => {\n return (\n <View style={{ flexDirection: 'row'}}>\n {React.Children.toArray(\n this.state.persons.map(() => {\n return (\n <View style={{ flexDirection: 'row' }}>\n <View style={{ height: 1, width: 2, backgroundColor: color, borderRadius: 2 }} />\n <View style={{ width: 1, backgroundColor: \"white\", borderRadius: 2 }} />\n </View>\n );\n })\n )}\n </View>\n )\n }\n const getItemCount = () => this.state.listItems.length;\n const getItem = (data:any, index:any) => ({\n id: Math.random().toString(12).substring(0),\n isRewardDay: data[index].isRewardDay,\n isCheckedIn: data[index].isCheckedIn,\n index: index\n });\n const Item = ({ title, index }: {title:any,index:any}) => {\n const day = index + 1;\n return (\n <View style = {{justifyContent: \"center\",alignItems:'center',alignContent:'center'}}>\n <View style = {{flexDirection : 'row',height: 35,justifyContent:'center',alignItems:'center'}}>\n {title.isCheckedIn? <View style={{ height: 1, width: 15, alignSelf: \"center\" , backgroundColor: index == 0 ? \"white\" : \"black\"}} />:<Divider color={index == 0 ? \"white\" : \"black\"} index={index}/>}\n {title.isRewardDay ?\n title.isCheckedIn ? <Image source={require('./assets/images/reward_flyy.png')} style={{ height: 20, width: 15 }} /> : <Image source={{ uri: this.state.checkinOffer[\"currency_icon_url\"] }} style={{ height: 20, width: 20 }} />\n : title.isCheckedIn ?\n <View style = {{height:17,width:17,backgroundColor:\"black\",borderRadius:15,justifyContent:'center',alignItems:'center'}}><Text style={{color:\"white\",fontSize:10}}>✓</Text></View>\n : <Image source={require('./assets/images/radio.png')} style={{ height: 20, width: 20 }} />}\n {index != this.state.listItems.length-1 ? this.state.listItems[index+1].isCheckedIn ? <View style={{ height: 1, width: 15, alignSelf: \"center\" , backgroundColor: index == this.state.listItems.length-1 ? \"white\" : \"black\"}} />:<Divider color={index == this.state.listItems.length - 1 ? \"white\" : \"black\"} index={index}/>: <View style = {{width:15}}/>}\n </View>\n <Text style = {{textAlign: 'center',color: title.isRewardDay ? this.props.style?.checkInEarnColor ?? \"black\" : this.props.style?.checkInDaysColor ?? \"black\"}}>{title.isRewardDay ?\n title.isCheckedIn ? \"Won\" : \"Earn\"\n : title.isCheckedIn ? \"Day \"+day : \"Day \"+day}</Text>\n </View>\n )\n }\n return (\n <TouchableOpacity style={styles.main} onPress = {()=>{\n Flyy.openFlyyCheckinPage();\n }}>\n <View style={{ height: 10 }} />\n <Text style={{ fontSize: 20, color: this.props.style?.checkInTitleColor ?? \"black\", fontFamily: this.props.style?.fontFamily ?? \"Montserrat-Regular\" }}>\n {this.state.checkinOffer[\"offer_type_title\"] ?? \"N/A\"}\n </Text>\n <View style={{ height: 10 }} />\n <View style = {{flexDirection: 'row',width:250,justifyContent: 'center'}}>\n <Text numberOfLines={1} style={{ fontSize: 18, color: this.props.style?.checkInDescriptionColor ?? \"grey\", fontFamily: this.props.style?.fontFamily ?? \"Montserrat-Regular\",textAlign: \"center\"}}>\n {this.state.checkinOffer[\"description\"] != null ? this.state.checkinOffer[\"description\"].replace(/(<([^>]+)>)/ig, '') : \"N/A\"}\n </Text>\n </View>\n <View style={{ height: 10 }} />\n <View style={styles.listContainer}>\n <View>\n <VirtualizedList\n data={this.state.listItems}\n style = {{alignSelf: \"center\"}}\n initialNumToRender={4}\n horizontal={true}\n renderItem={({ item, index }) => <Item title={item} index={index} />}\n getItemCount={getItemCount}\n getItem={getItem}\n />\n </View>\n </View>\n <View style={{ height: 10 }} />\n <TouchableOpacity\n style={styles.button}\n onPress={async () => {\n const eventId = this.state.checkinOffer[\"event_id\"];\n const url = this.state.checkinOffer[\"deeplink\"];\n if(eventId != null){\n if (url != \"\") {\n const supported = await Linking.canOpenURL(url);\n if (supported) {\n await Linking.openURL(url);\n }\n }\n }else{\n this.checkInApi();\n }\n }}>\n <Text style={{\n fontSize: 20,\n color: this.props.style?.checkInBtnTextColor ?? \"white\",\n paddingLeft: 10, \n paddingRight: 10,\n fontFamily: \"Montserrat-Regular\"\n }}>{this.state.checkinOffer[\"checked_in\"] ? \"Checked In\" : this.state.checkinOffer[\"button_text\"] != \"\" ? this.state.checkinOffer[\"button_text\"] : \"Check In\"}</Text>\n </TouchableOpacity>\n </TouchableOpacity>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n main: {\n backgroundColor: \"white\",\n elevation: 5,\n height: 210,\n width: \"90%\",\n alignItems: \"center\",\n borderRadius: 10\n },\n listContainer: { height: 60,flexDirection: \"row\",justifyContent: \"center\",width:\"100%\",alignItems:'center',alignContent:'center',backgroundColor: \"white\"},\n button: { backgroundColor: \"#f57242\", height: 35, borderRadius: 5, justifyContent: \"center\" },\n});\n\nexport default FlyyCheckinComponent;"]}
@@ -1,19 +0,0 @@
1
- import { Component } from "react";
2
- declare class FlyyCheckinComponent extends Component {
3
- state: {
4
- mileStoneData: never[];
5
- checkinOffer: never[];
6
- listItems: never[];
7
- persons: number[];
8
- partnerId: string;
9
- userId: string;
10
- appData: string;
11
- environment: number;
12
- };
13
- componentDidMount(): Promise<void>;
14
- fetchData(): Promise<void>;
15
- checkInApi(): Promise<void>;
16
- notifyMessage(msg: string): void;
17
- render(): JSX.Element;
18
- }
19
- export default FlyyCheckinComponent;
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,213 +0,0 @@
1
- // @ts-nocheck
2
- import React, { Component } from "react";
3
- import { View, Text, TouchableOpacity,StyleSheet,Image, VirtualizedList, Platform, ToastAndroid, Alert, Linking, NativeModules } from "react-native";
4
- const { Flyy } = NativeModules;
5
-
6
- class FlyyCheckinComponent extends Component {
7
-
8
- state = {
9
- mileStoneData: [],
10
- checkinOffer: [],
11
- listItems: [],
12
- persons: [1,2,3,4,5],
13
- partnerId: "",
14
- userId: "",
15
- appData: "",
16
- environment: 0
17
- };
18
-
19
- async componentDidMount(){
20
- try {
21
- const data = await Flyy.getUserData();
22
- const appData = await Flyy.getAppData();
23
- this.setState({
24
- partnerId : data["partner_id"],
25
- userId : data["user_id"],
26
- environment : data["environment"],
27
- appData: appData
28
- })
29
- } catch (e) {
30
- console.error(e);
31
- }
32
-
33
- await this.fetchData();
34
- }
35
-
36
-
37
- async fetchData(){
38
- this.setState({ listItems : []})
39
- const resp = await fetch(`https://${this.state.environment == 0 ? "ghc-stage" : "ghc"}.theflyy.com/api/v7/flyy_app_info`, {
40
- headers: {
41
- "X-Key": this.state.partnerId,
42
- "Content-Type": "application/json",
43
- "X-App-Data": this.state.appData
44
- }
45
- });
46
- const data = await resp.json();
47
- for (var key in data.info.offers) {
48
- if (data.info.offers[key].offer_type_code === "checkin") {
49
- this.setState({ checkinOffer : data.info.offers[key] })
50
- this.setState({ mileStoneData : data.info.offers[key].milestones })
51
- break;
52
- }
53
- }
54
- var tempData = [];
55
- var isRewardDay = false;
56
- var isCheckedIn = false;
57
- for (let i = 0; i < this.state.checkinOffer.total_streak; i++) {
58
- for (let j = 0; j < this.state.mileStoneData.length; j++) {
59
- if (i + 1 === parseInt(this.state.mileStoneData[j].value)) {
60
- isRewardDay = true;
61
- }
62
- }
63
- if (i+1 <= this.state.checkinOffer.streak) {
64
- isCheckedIn = true;
65
- }
66
- tempData.push({ "isRewardDay": isRewardDay, "isCheckedIn": isCheckedIn })
67
- isRewardDay = false;
68
- isCheckedIn = false;
69
- }
70
- this.setState({ listItems : tempData })
71
- }
72
-
73
-
74
- async checkInApi() {
75
- var url = `https://${this.state.environment == 0 ? "ghc-stage" : "ghc"}.theflyy.com/api/v1/checkin?offer_id=` + this.state.checkinOffer.id.toString();
76
- const resp = await fetch(url, {
77
- headers: {
78
- "X-Key": this.state.partnerId,
79
- "Content-Type": "application/json",
80
- "X-App-Data": this.state.appData
81
- }
82
- });
83
- const data = await resp.json();
84
- if (data.success) {
85
- this.fetchData()
86
- } else {
87
- this.notifyMessage(data.message)
88
- }
89
- }
90
-
91
- notifyMessage(msg:string) {
92
- if (Platform.OS === 'android') {
93
- ToastAndroid.show(msg, ToastAndroid.SHORT)
94
- } else {
95
- // Toast.showWithGravity(msg, Toast.SHORT, Toast.BOTTOM);
96
- }
97
- }
98
-
99
- render() {
100
- const Divider = ({color = "black",index}:{color:any,index:any}) => {
101
- return (
102
- <View style={{ flexDirection: 'row'}}>
103
- {React.Children.toArray(
104
- this.state.persons.map(() => {
105
- return (
106
- <View style={{ flexDirection: 'row' }}>
107
- <View style={{ height: 1, width: 2, backgroundColor: color, borderRadius: 2 }} />
108
- <View style={{ width: 1, backgroundColor: "white", borderRadius: 2 }} />
109
- </View>
110
- );
111
- })
112
- )}
113
- </View>
114
- )
115
- }
116
- const getItemCount = () => this.state.listItems.length;
117
- const getItem = (data:any, index:any) => ({
118
- id: Math.random().toString(12).substring(0),
119
- isRewardDay: data[index].isRewardDay,
120
- isCheckedIn: data[index].isCheckedIn,
121
- index: index
122
- });
123
- const Item = ({ title, index }: {title:any,index:any}) => {
124
- const day = index + 1;
125
- return (
126
- <View style = {{justifyContent: "center",alignItems:'center',alignContent:'center'}}>
127
- <View style = {{flexDirection : 'row',height: 35,justifyContent:'center',alignItems:'center'}}>
128
- {title.isCheckedIn? <View style={{ height: 1, width: 15, alignSelf: "center" , backgroundColor: index == 0 ? "white" : "black"}} />:<Divider color={index == 0 ? "white" : "black"} index={index}/>}
129
- {title.isRewardDay ?
130
- title.isCheckedIn ? <Image source={require('./assets/images/reward_flyy.png')} style={{ height: 20, width: 15 }} /> : <Image source={{ uri: this.state.checkinOffer["currency_icon_url"] }} style={{ height: 20, width: 20 }} />
131
- : title.isCheckedIn ?
132
- <View style = {{height:17,width:17,backgroundColor:"black",borderRadius:15,justifyContent:'center',alignItems:'center'}}><Text style={{color:"white",fontSize:10}}>✓</Text></View>
133
- : <Image source={require('./assets/images/radio.png')} style={{ height: 20, width: 20 }} />}
134
- {index != this.state.listItems.length-1 ? this.state.listItems[index+1].isCheckedIn ? <View style={{ height: 1, width: 15, alignSelf: "center" , backgroundColor: index == this.state.listItems.length-1 ? "white" : "black"}} />:<Divider color={index == this.state.listItems.length - 1 ? "white" : "black"} index={index}/>: <View style = {{width:15}}/>}
135
- </View>
136
- <Text style = {{textAlign: 'center',color: title.isRewardDay ? this.props.style?.checkInEarnColor ?? "black" : this.props.style?.checkInDaysColor ?? "black"}}>{title.isRewardDay ?
137
- title.isCheckedIn ? "Won" : "Earn"
138
- : title.isCheckedIn ? "Day "+day : "Day "+day}</Text>
139
- </View>
140
- )
141
- }
142
- return (
143
- <TouchableOpacity style={styles.main} onPress = {()=>{
144
- Flyy.openFlyyCheckinPage();
145
- }}>
146
- <View style={{ height: 10 }} />
147
- <Text style={{ fontSize: 20, color: this.props.style?.checkInTitleColor ?? "black", fontFamily: this.props.style?.fontFamily ?? "Montserrat-Regular" }}>
148
- {this.state.checkinOffer["offer_type_title"] ?? "N/A"}
149
- </Text>
150
- <View style={{ height: 10 }} />
151
- <View style = {{flexDirection: 'row',width:250,justifyContent: 'center'}}>
152
- <Text numberOfLines={1} style={{ fontSize: 18, color: this.props.style?.checkInDescriptionColor ?? "grey", fontFamily: this.props.style?.fontFamily ?? "Montserrat-Regular",textAlign: "center"}}>
153
- {this.state.checkinOffer["description"] != null ? this.state.checkinOffer["description"].replace(/(<([^>]+)>)/ig, '') : "N/A"}
154
- </Text>
155
- </View>
156
- <View style={{ height: 10 }} />
157
- <View style={styles.listContainer}>
158
- <View>
159
- <VirtualizedList
160
- data={this.state.listItems}
161
- style = {{alignSelf: "center"}}
162
- initialNumToRender={4}
163
- horizontal={true}
164
- renderItem={({ item, index }) => <Item title={item} index={index} />}
165
- getItemCount={getItemCount}
166
- getItem={getItem}
167
- />
168
- </View>
169
- </View>
170
- <View style={{ height: 10 }} />
171
- <TouchableOpacity
172
- style={styles.button}
173
- onPress={async () => {
174
- const eventId = this.state.checkinOffer["event_id"];
175
- const url = this.state.checkinOffer["deeplink"];
176
- if(eventId != null){
177
- if (url != "") {
178
- const supported = await Linking.canOpenURL(url);
179
- if (supported) {
180
- await Linking.openURL(url);
181
- }
182
- }
183
- }else{
184
- this.checkInApi();
185
- }
186
- }}>
187
- <Text style={{
188
- fontSize: 20,
189
- color: this.props.style?.checkInBtnTextColor ?? "white",
190
- paddingLeft: 10,
191
- paddingRight: 10,
192
- fontFamily: "Montserrat-Regular"
193
- }}>{this.state.checkinOffer["checked_in"] ? "Checked In" : this.state.checkinOffer["button_text"] != "" ? this.state.checkinOffer["button_text"] : "Check In"}</Text>
194
- </TouchableOpacity>
195
- </TouchableOpacity>
196
- );
197
- }
198
- }
199
-
200
- const styles = StyleSheet.create({
201
- main: {
202
- backgroundColor: "white",
203
- elevation: 5,
204
- height: 210,
205
- width: "90%",
206
- alignItems: "center",
207
- borderRadius: 10
208
- },
209
- listContainer: { height: 60,flexDirection: "row",justifyContent: "center",width:"100%",alignItems:'center',alignContent:'center',backgroundColor: "white"},
210
- button: { backgroundColor: "#f57242", height: 35, borderRadius: 5, justifyContent: "center" },
211
- });
212
-
213
- export default FlyyCheckinComponent;