Skip to content

Commit cfc1449

Browse files
ayushin78Vivek Maskara
authored andcommitted
Launch Rate Us Feature from AboutActivity (commons-app#1264)
* Launch Rate Us Feature from AboutActivity Rate us feature is added in Utils, But it is never used/launched. * Add LaunchRatings Method in AboutActivity * Fix Package Name to enable rate us feature The rate us feature was not working for the debug build type since getPackageName() was returning the fr.free.nrw.commons.debug. Use of this package name was leading to an error on google play. * Replace getPackageName() with BuildConfig.class.getPackage().getName() in rateApp method of Utils.java
1 parent 51221f6 commit cfc1449

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

app/src/main/java/fr/free/nrw/commons/AboutActivity.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ public void launchWebsite(View view) {
8686
}
8787
}
8888

89-
89+
@OnClick(R.id.about_rate_us)
90+
public void launchRatings(View view){
91+
Utils.rateApp(this);
92+
}
93+
9094
@OnClick(R.id.about_credits)
9195
public void launchCredits(View view) {
9296
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/commons-app/apps-android-commons/blob/master/CREDITS/\\"));

app/src/main/java/fr/free/nrw/commons/Utils.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,13 @@ public static String getAppLogs() {
166166
}
167167

168168
public static void rateApp(Context context) {
169-
final String appPackageName = context.getPackageName();
169+
final String appPackageName = BuildConfig.class.getPackage().getName();
170170
try {
171171
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + appPackageName)));
172172
}
173173
catch (android.content.ActivityNotFoundException anfe) {
174174
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
175175
}
176-
return ;
177176
}
178177

179178
public static void handleWebUrl(Context context,Uri url){

0 commit comments

Comments
 (0)