react-native-flyy 1.4.33 → 1.4.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnativeflyy/FlyyModule.kt +0 -5
- package/android/src/main/java/com/reactnativeflyy/FlyyRouteActivity.java +2 -2
- package/lib/commonjs/index.js +208 -246
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +208 -242
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +0 -20
- package/package.json +1 -2
- package/src/index.tsx +220 -220
package/android/build.gradle
CHANGED
|
@@ -134,7 +134,7 @@ dependencies {
|
|
|
134
134
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
135
135
|
|
|
136
136
|
//Flyy sdk dependency
|
|
137
|
-
implementation 'com.github.roid-software:flyy-sdk:1.4.
|
|
137
|
+
implementation 'com.github.roid-software:flyy-sdk:1.4.51.1'
|
|
138
138
|
// implementation project(path: ':flyy')
|
|
139
139
|
|
|
140
140
|
implementation 'com.google.code.gson:gson:2.8.7'
|
|
@@ -799,11 +799,6 @@ fun getPreviousLeaderboardWinners(tag: String, callBack: Callback) {
|
|
|
799
799
|
}
|
|
800
800
|
}
|
|
801
801
|
|
|
802
|
-
@ReactMethod
|
|
803
|
-
fun getAppData(promise: Promise) {
|
|
804
|
-
promise.resolve(Flyy.getAppData())
|
|
805
|
-
}
|
|
806
|
-
|
|
807
802
|
@Throws(JSONException::class)
|
|
808
803
|
private fun convertMapToJson(readableMap: ReadableMap?): JSONObject? {
|
|
809
804
|
val `object` = JSONObject()
|
|
@@ -100,10 +100,10 @@ public class FlyyRouteActivity extends AppCompatActivity {
|
|
|
100
100
|
Flyy.navigateToRaffleDetailActivity(this, OFFER_ID);
|
|
101
101
|
break;
|
|
102
102
|
case FLYY_OPEN_CHECKIN_PAGE:
|
|
103
|
-
Flyy.navigateToCheckInActivity(this);
|
|
103
|
+
//Flyy.navigateToCheckInActivity(this);
|
|
104
104
|
break;
|
|
105
105
|
case FLYY_OPEN_LEADERBOARD_HISTORY:
|
|
106
|
-
Flyy.navigateToLeaderBoardHistoryActivity(this);
|
|
106
|
+
//Flyy.navigateToLeaderBoardHistoryActivity(this);
|
|
107
107
|
break;
|
|
108
108
|
case FLYY_OPEN_TOURNAMENT_LIST:
|
|
109
109
|
Flyy.navigateToTournamentListActivity(this,null);
|
package/lib/commonjs/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.FlyyStories = exports.FlyyWidget = exports.
|
|
6
|
+
exports.FlyyStories = exports.FlyyWidget = exports.FlyyCheckinView = exports.default = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
@@ -11,10 +11,6 @@ var _reactNative = require("react-native");
|
|
|
11
11
|
|
|
12
12
|
var _flyy_checkin_view = _interopRequireDefault(require("./flyy_checkin_view"));
|
|
13
13
|
|
|
14
|
-
var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
|
|
15
|
-
|
|
16
|
-
var _reactNativeDraggable = _interopRequireDefault(require("react-native-draggable"));
|
|
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); }
|
|
@@ -47,249 +43,215 @@ exports.FlyyCheckinView = FlyyCheckinView;
|
|
|
47
43
|
const windowHeight = _reactNative.Dimensions.get('window').height;
|
|
48
44
|
|
|
49
45
|
const windowWidth = _reactNative.Dimensions.get('window').width; // ****** Flyy Floating Widget ******
|
|
46
|
+
// export const FlyyFloatingWidget = ({
|
|
47
|
+
// props = {
|
|
48
|
+
// backgroundColor: "#654EA3",
|
|
49
|
+
// buttonHeight: 55,
|
|
50
|
+
// buttonWidth: 55,
|
|
51
|
+
// buttonCornerRadius: 40,
|
|
52
|
+
// buttonIcon: require('./assets/images/rewardwidget.png'),
|
|
53
|
+
// onPress: () => { },
|
|
54
|
+
// x: windowWidth - 75,
|
|
55
|
+
// y: windowHeight - 100,
|
|
56
|
+
// minX: 5,
|
|
57
|
+
// minY: 5,
|
|
58
|
+
// maxX: windowWidth - 5,
|
|
59
|
+
// maxY: windowHeight - 5,
|
|
60
|
+
// show: true,
|
|
61
|
+
// stick: false,
|
|
62
|
+
// startDate: 0,
|
|
63
|
+
// endDate: 0
|
|
64
|
+
// } }) => {
|
|
65
|
+
// const [showWidget,setShowWidget] = useState(false);
|
|
66
|
+
// const [userData,setUserData] = useState({});
|
|
67
|
+
// const [iconUrl,setIconUrl] = useState(require('./assets/images/rewardwidget.png'));
|
|
68
|
+
// const [backgroundColor,setBackgroundColor] = useState("#654EA3");
|
|
69
|
+
// const [buttonSize,setButtonSize] = useState(55);
|
|
70
|
+
// const [buttonXPosition,setButtonXPosition] = useState(windowWidth - 75);
|
|
71
|
+
// const [buttonYPosition,setButtonYPosition] = useState(windowHeight - 200);
|
|
72
|
+
// const [deeplink,setDeeplink] = useState(null);
|
|
73
|
+
// const flyyConfigDate = "flyy_config_date";
|
|
74
|
+
// const flyyConfigUserId = "user_id";
|
|
75
|
+
// var oldState = null;
|
|
76
|
+
// var currentState = null;
|
|
77
|
+
// var data = null;
|
|
78
|
+
// useEffect(()=>{
|
|
79
|
+
// fetchData();
|
|
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
|
+
// Alert.alert(data.message);
|
|
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
|
+
// }
|
|
50
253
|
|
|
51
254
|
|
|
52
|
-
const FlyyFloatingWidget = ({
|
|
53
|
-
props = {
|
|
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 - 200);
|
|
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
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
data = await resp.json();
|
|
102
|
-
|
|
103
|
-
if (!data.success) {
|
|
104
|
-
if (Platform.OS === 'android') {
|
|
105
|
-
_reactNative.ToastAndroid.show(data.message, _reactNative.ToastAndroid.SHORT);
|
|
106
|
-
} else {
|
|
107
|
-
// Toast.showWithGravity(data.message, Toast.SHORT, Toast.BOTTOM);
|
|
108
|
-
_reactNative.Alert.alert(data.message);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const widgetConfig = data.info.floating_widget_configuration;
|
|
115
|
-
|
|
116
|
-
if (widgetConfig.icon_url != null && widgetConfig.icon_url != '') {
|
|
117
|
-
setIconUrl({
|
|
118
|
-
uri: widgetConfig.icon_url
|
|
119
|
-
});
|
|
120
|
-
} else {
|
|
121
|
-
setIconUrl(props.buttonIcon);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (widgetConfig.color != null && widgetConfig.color != '') {
|
|
125
|
-
setBackgroundColor(widgetConfig.color);
|
|
126
|
-
} else {
|
|
127
|
-
setBackgroundColor(props.backgroundColor);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (widgetConfig.size != null && widgetConfig.color != 0) {
|
|
131
|
-
setButtonSize(parseInt(data.info.floating_widget_configuration.size));
|
|
132
|
-
} else {
|
|
133
|
-
setButtonSize(props.buttonHeight);
|
|
134
|
-
} //FloatingButton Position
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
if (widgetConfig.position == "bottom_left") {
|
|
138
|
-
setButtonXPosition(10);
|
|
139
|
-
} else if (widgetConfig.position == "bottom_right") {
|
|
140
|
-
setButtonXPosition(windowWidth - 75);
|
|
141
|
-
} else if (widgetConfig.position == "upper_left") {
|
|
142
|
-
setButtonXPosition(10);
|
|
143
|
-
|
|
144
|
-
if (Platform.OS === 'android') {
|
|
145
|
-
setButtonYPosition(10);
|
|
146
|
-
} else {
|
|
147
|
-
setButtonYPosition(50);
|
|
148
|
-
}
|
|
149
|
-
} else if (widgetConfig.position == "upper_right") {
|
|
150
|
-
setButtonXPosition(windowWidth - 75);
|
|
151
|
-
|
|
152
|
-
if (Platform.OS === 'android') {
|
|
153
|
-
setButtonYPosition(10);
|
|
154
|
-
} else {
|
|
155
|
-
setButtonYPosition(50);
|
|
156
|
-
}
|
|
157
|
-
} //Set DeepLink
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (widgetConfig.deeplink != null && widgetConfig.deeplink != "") {
|
|
161
|
-
setDeeplink(widgetConfig.deeplink);
|
|
162
|
-
} //Set Visibility of FloatingButton
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
var currentDate = new Date();
|
|
166
|
-
const getDate = await _asyncStorage.default.getItem(flyyConfigDate);
|
|
167
|
-
const userId = await _asyncStorage.default.getItem(flyyConfigUserId);
|
|
168
|
-
var date = new Date(parseInt(getDate));
|
|
169
|
-
const diffTime = Math.abs(getDate - currentDate);
|
|
170
|
-
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) - 1;
|
|
171
|
-
|
|
172
|
-
if (diffDays != 0 || userId == null || userId != sdkInfo[flyyConfigUserId]) {
|
|
173
|
-
var data = await Flyy.getAppOccurence(1);
|
|
174
|
-
await _asyncStorage.default.setItem(flyyConfigUserId, sdkInfo[flyyConfigUserId]);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const occurrenceCount = await Flyy.getAppOccurence(0);
|
|
178
|
-
|
|
179
|
-
if (widgetConfig.show_to_user && occurrenceCount <= parseInt(widgetConfig.num_times)) {
|
|
180
|
-
// var numberOfDaysToAdd = widgetConfig.num_days+1;
|
|
181
|
-
// var result = currentDate.setDate(currentDate.getDate() + numberOfDaysToAdd);
|
|
182
|
-
if (getDate === null || userId == null || userId != sdkInfo[flyyConfigUserId]) {
|
|
183
|
-
await _asyncStorage.default.setItem(flyyConfigDate, JSON.stringify(currentDate.getTime()));
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
const getDate2 = await _asyncStorage.default.getItem(flyyConfigDate);
|
|
187
|
-
var date = new Date(parseInt(getDate2));
|
|
188
|
-
const diffTime = Math.abs(getDate2 - currentDate);
|
|
189
|
-
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) - 1; //Show widget on same day
|
|
190
|
-
|
|
191
|
-
if (diffDays === 0 || diffDays === -1) {
|
|
192
|
-
setShowWidget(true);
|
|
193
|
-
} else {
|
|
194
|
-
//reset occurrence on next day
|
|
195
|
-
await Flyy.getAppOccurence(1);
|
|
196
|
-
|
|
197
|
-
if (diffDays >= parseInt(widgetConfig.num_days) + 1) {
|
|
198
|
-
await _asyncStorage.default.setItem(flyyConfigDate, JSON.stringify(currentDate.getTime()));
|
|
199
|
-
setShowWidget(true);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
} else {
|
|
203
|
-
setShowWidget(false);
|
|
204
|
-
const getDate2 = await _asyncStorage.default.getItem(flyyConfigDate);
|
|
205
|
-
var date = new Date(parseInt(getDate2));
|
|
206
|
-
const diffTime = Math.abs(getDate2 - currentDate);
|
|
207
|
-
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
|
208
|
-
|
|
209
|
-
if (diffDays != 1) {
|
|
210
|
-
var data = await Flyy.getAppOccurence(1);
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
}; // if(props.show){
|
|
214
|
-
// if(props.startDate != null && props.startDate != 0){
|
|
215
|
-
// var now = new Date().getTime();
|
|
216
|
-
// if(now >= props.startDate && now <= props.endDate){
|
|
217
|
-
// props.show = true
|
|
218
|
-
// }else{
|
|
219
|
-
// props.show = false
|
|
220
|
-
// }
|
|
221
|
-
// }
|
|
222
|
-
// }
|
|
223
|
-
// AppState.addEventListener('change', state =>{
|
|
224
|
-
// console.log('AppState updated to', AppState.currentState)
|
|
225
|
-
// oldState = currentState;
|
|
226
|
-
// currentState = state;
|
|
227
|
-
// if(oldState == null){
|
|
228
|
-
// console.log('App is newly start :::')
|
|
229
|
-
// }})
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
return (// @ts-ignore
|
|
233
|
-
props.show && showWidget ? /*#__PURE__*/_react.default.createElement(_reactNativeDraggable.default, {
|
|
234
|
-
x: buttonXPosition,
|
|
235
|
-
y: buttonYPosition,
|
|
236
|
-
minX: (_props$minX = props.minX) !== null && _props$minX !== void 0 ? _props$minX : 5,
|
|
237
|
-
minY: (_props$minY = props.minY) !== null && _props$minY !== void 0 ? _props$minY : 5,
|
|
238
|
-
maxX: (_props$maxX = props.maxX) !== null && _props$maxX !== void 0 ? _props$maxX : windowWidth - 5,
|
|
239
|
-
maxY: (_props$maxY = props.maxY) !== null && _props$maxY !== void 0 ? _props$maxY : windowHeight - 5,
|
|
240
|
-
renderSize: 56 // shouldReverse = {true}
|
|
241
|
-
,
|
|
242
|
-
onDragRelease: props.stick ? () => {} : null,
|
|
243
|
-
isCircle: true
|
|
244
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
245
|
-
onPress: deeplink != null ? async () => {
|
|
246
|
-
if (Platform.OS === 'android' || !deeplink.startsWith("flyy://")) {
|
|
247
|
-
const supported = await _reactNative.Linking.canOpenURL(deeplink);
|
|
248
|
-
await _reactNative.Linking.openURL(deeplink);
|
|
249
|
-
} else {
|
|
250
|
-
navigateTo(deeplink);
|
|
251
|
-
}
|
|
252
|
-
} : props.onPress,
|
|
253
|
-
style: {
|
|
254
|
-
height: buttonSize,
|
|
255
|
-
width: buttonSize,
|
|
256
|
-
backgroundColor: backgroundColor,
|
|
257
|
-
borderRadius: buttonSize / 2,
|
|
258
|
-
justifyContent: 'center',
|
|
259
|
-
alignItems: 'center'
|
|
260
|
-
}
|
|
261
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
|
|
262
|
-
source: iconUrl,
|
|
263
|
-
style: {
|
|
264
|
-
height: buttonSize * 55 / 100,
|
|
265
|
-
width: buttonSize * 55 / 100
|
|
266
|
-
}
|
|
267
|
-
}), /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
268
|
-
onPress: () => {
|
|
269
|
-
props.show = false;
|
|
270
|
-
setShowWidget(false);
|
|
271
|
-
},
|
|
272
|
-
style: {
|
|
273
|
-
height: 20,
|
|
274
|
-
width: 20,
|
|
275
|
-
backgroundColor: "transparent",
|
|
276
|
-
position: 'absolute',
|
|
277
|
-
left: buttonSize - 11,
|
|
278
|
-
bottom: buttonSize * 72 / 100
|
|
279
|
-
}
|
|
280
|
-
}, /*#__PURE__*/_react.default.createElement(_reactNative.Image, {
|
|
281
|
-
source: require('./assets/images/xmark.png'),
|
|
282
|
-
style: {
|
|
283
|
-
height: 18,
|
|
284
|
-
width: 18,
|
|
285
|
-
tintColor: "black"
|
|
286
|
-
}
|
|
287
|
-
})))) : /*#__PURE__*/_react.default.createElement(_reactNative.View, null)
|
|
288
|
-
);
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
exports.FlyyFloatingWidget = FlyyFloatingWidget;
|
|
292
|
-
|
|
293
255
|
const navigateTo = deeplink => {
|
|
294
256
|
let components = deeplink.split("/");
|
|
295
257
|
let screenCode = components[components.length - 1];
|