Skip to content

Commit

Permalink
Don't ask for Play Store rating in website builds.
Browse files Browse the repository at this point in the history
  • Loading branch information
Leptopoda authored and greyson-signal committed Mar 15, 2021
1 parent d24a71b commit 3837598
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
Expand Up @@ -10,7 +10,9 @@
import androidx.appcompat.app.AlertDialog;

import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.BuildConfig;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.util.PlayStoreUtil;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.util.VersionTracker;

Expand All @@ -24,7 +26,7 @@ public class RatingManager {
private static final String TAG = RatingManager.class.getSimpleName();

public static void showRatingDialogIfNecessary(Context context) {
if (!TextSecurePreferences.isRatingEnabled(context)) return;
if (!TextSecurePreferences.isRatingEnabled(context) || BuildConfig.PLAY_STORE_DISABLED) return;

long daysSinceInstall = VersionTracker.getDaysSinceFirstInstalled(context);
long laterTimestamp = TextSecurePreferences.getRatingLaterTimestamp(context);
Expand All @@ -44,7 +46,7 @@ private static void showRatingDialog(final Context context) {
@Override
public void onClick(DialogInterface dialog, int which) {
TextSecurePreferences.setRatingEnabled(context, false);
startPlayStore(context);
PlayStoreUtil.openPlayStoreOrOurApkDownloadPage(context);
}
})
.setNegativeButton(R.string.RatingManager_no_thanks, new DialogInterface.OnClickListener() {
Expand All @@ -62,15 +64,4 @@ public void onClick(DialogInterface dialog, int which) {
})
.show();
}

private static void startPlayStore(Context context) {
Uri uri = Uri.parse("market://details?id=" + context.getPackageName());
try {
context.startActivity(new Intent(Intent.ACTION_VIEW, uri));
} catch (ActivityNotFoundException e) {
Log.w(TAG, e);
Toast.makeText(context, R.string.RatingManager_whoops_the_play_store_app_does_not_appear_to_be_installed, Toast.LENGTH_LONG).show();
}
}

}
Expand Up @@ -11,9 +11,6 @@

public final class PlayStoreUtil {

private PlayStoreUtil() {
}

public static void openPlayStoreOrOurApkDownloadPage(@NonNull Context context) {
if (BuildConfig.PLAY_STORE_DISABLED) {
CommunicationActions.openBrowserLink(context, "https://signal.org/android/apk");
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Expand Up @@ -1336,7 +1336,6 @@
<string name="RatingManager_rate_now">Rate now!</string>
<string name="RatingManager_no_thanks">No thanks</string>
<string name="RatingManager_later">Later</string>
<string name="RatingManager_whoops_the_play_store_app_does_not_appear_to_be_installed">Whoops, the Play Store app does not appear to be installed on your device.</string>

<!-- ReactionsBottomSheetDialogFragment -->
<string name="ReactionsBottomSheetDialogFragment_all">All &#183; %1$d</string>
Expand Down

0 comments on commit 3837598

Please sign in to comment.