Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return action => {
const state = store.getState().reviewState;
let result = null;
if( actionTypeWhitelist.indexOf(action.type) > -1 ){
// This API is only available on iOS 10.3 or later
if ( state.actionCounter == MAX_REVIEW_POSITIVE_ACTIONS ) {
console.log('trigger appstore review panel!')
StoreReview.isAvailable && StoreReview.requestReview();
store.dispatch(reviewCountDoneAction());
}
if (
state.actionCounter === MAX_INTERACTION_COUNT ||
state.dailyActionCounter === MAX_DAILY_INTERACTION_COUNT
) {
console.log('max songs reached - block inflight change track action')
} else {
result = next(action);
}
} else {
result = next(action);
}
return result;
}
}
showPopupRating() {
if (Platform.OS === 'ios') {
// This API is only available on iOS 10.3 or later
if (StoreReview.isAvailable) {
StoreReview.requestReview()
}
} else {
Alert.alert(
constant.titleRatingApp,
constant.desRatingApp,
[
{ text: constant.ratingLater },
{ text: constant.cancel, onPress: () => { }, style: 'cancel' },
{
text: constant.rating,
onPress: () => {
Linking.openURL(PLAY_STORE_LINK)
.catch(err => console.error('An error occurred', err))
}
}
],
showPopupRating() {
if (Platform.OS === 'ios') {
// This API is only available on iOS 10.3 or later
if (StoreReview.isAvailable) {
StoreReview.requestReview()
} else {
NavStore.popupCustom.show('Store review is not available')
}
} else {
Alert.alert(
constant.titleRatingApp,
constant.desRatingApp,
[
{ text: constant.ratingLater },
{ text: constant.cancel, onPress: () => { }, style: 'cancel' },
{
text: constant.rating,
onPress: () => {
Linking.openURL(PLAY_STORE_LINK)
.catch(err => console.error('An error occurred', err))
}