Skip to content
This repository has been archived by the owner on Dec 5, 2024. It is now read-only.

feat: in app review #388

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tumeplayMobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,9 @@ dependencies {
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation 'com.google.android.gms:play-services-base:18.0.1'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-base:18.0.1'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation project(':react-native-in-app-review')
}

// Run this once to be able to run the application with BUCK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.ibits.react_native_in_app_review.AppReviewPackage;
import io.xogus.reactnative.versioncheck.RNVersionCheckPackage;
import com.reactnativecommunity.webview .RNCWebViewPackage;
import com.reactnativecommunity.webview.RNCWebViewPackage;
Expand All @@ -19,6 +20,7 @@
import java.util.List;
import de.bonify.reactnativematomo.MatomoPackage;


public class MainApplication extends Application implements ReactApplication {

private final ReactNativeHost mReactNativeHost =
Expand All @@ -31,6 +33,7 @@ public boolean getUseDeveloperSupport() {
@Override
protected List<ReactPackage> getPackages() {
new MatomoPackage();
new AppReviewPackage();
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
Expand All @@ -42,6 +45,7 @@ protected List<ReactPackage> getPackages() {
protected String getJSMainModuleName() {
return "index";
}

};

@Override
Expand Down
2 changes: 2 additions & 0 deletions tumeplayMobile/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
rootProject.name = 'tumeplay'
include ':react-native-in-app-review'
project(':react-native-in-app-review').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-in-app-review/android')
include ':react-native-version-check'
project(':react-native-version-check').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-version-check/android')
include ':react-native-webview'
Expand Down
2 changes: 2 additions & 0 deletions tumeplayMobile/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ target 'tumeplayMobile' do
pod 'react-native-version-check', :path => '../node_modules/react-native-version-check'


pod 'react-native-in-app-review', :path => '../node_modules/react-native-in-app-review'

target 'tumeplayMobileTests' do
inherit! :complete
# Pods for testing
Expand Down
11 changes: 11 additions & 0 deletions tumeplayMobile/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tumeplayMobile/src/components/Orders/HomeOrdersInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ const HomeOrdersInput = props => {
errors[item.name] ? '#D42201' : '#EAE2D7'
}
activeUnderlineColor="#D42201"
value={values[item.name]}
value={values[item.name].trim()}
onChangeText={handleChange(item.name)}
keyboardType={item.isNumber ? 'numeric' : 'default'}
/>
Expand Down
5 changes: 4 additions & 1 deletion tumeplayMobile/src/components/Orders/OrderConfirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ const OrderConfirm = props => {
const handleClosingModal = () => {
if (!isLoading) {
Event.boxOrdered();
navigation.navigate('Home', {screen: 'Accueil'});
navigation.navigate('Home', {
screen: 'Accueil',
params: {shouldReview: true},
});
setIsVisible(false);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ const PickupOrderConfirm = props => {

const handleClosingModal = () => {
if (!isLoading) {
navigation.navigate('Home', {screen: 'Accueil'});
navigation.navigate('Home', {
screen: 'Accueil',
params: {shouldReview: true},
});
setIsVisible(false);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const PickupOrderUserInfos = props => {
<TextInput
label={item.label}
style={styles.input}
value={values[item.name]}
value={values[item.name].trim()}
onBlur={handleBlur(item.name)}
onChangeText={handleChange(item.name)}
underlineColor={errors[item.name] ? '#D42201' : '#EAE2D7'}
Expand Down
18 changes: 18 additions & 0 deletions tumeplayMobile/src/hooks/useAppReview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import InAppReview from 'react-native-in-app-review';

export default function useAppReview() {
const onReview = async () => {
if (InAppReview.isAvailable()) {
InAppReview.RequestInAppReview()
.then(hasFlowFinishedSuccessfully => {
console.log('InAppReview', hasFlowFinishedSuccessfully);
})
.catch(error => {
console.log(error);
});
}
};
return {
onReview,
};
}
8 changes: 7 additions & 1 deletion tumeplayMobile/src/views/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import config from '../../config';
import {WebView} from 'react-native-webview';
import Event from '../services/api/matomo';
import handleRedirection from '../services/handleRedirection';
import useAppReview from '../hooks/useAppReview';

const HomePage = ({navigation}) => {
const HomePage = ({navigation, route}) => {
const {user} = useContext(AppContext);
const {onReview} = useAppReview();
const [tiktokHtmls, setTiktokHtmls] = useState([]);
const tiktokIds = [
'7058603040588188933',
Expand Down Expand Up @@ -49,6 +51,10 @@ const HomePage = ({navigation}) => {
}
}, [data, loading]);

useEffect(() => {
route?.params?.shouldReview && onReview();
}, [route]);

const renderItem = ({item}) => {
return (
<FreshContentCard
Expand Down