-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Add warning banner about ongoing google certification for android apps #13282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,12 +20,14 @@ | |
|
|
||
| package org.schabi.newpipe; | ||
|
|
||
| import android.app.AlertDialog; | ||
| import android.content.BroadcastReceiver; | ||
| import android.content.Context; | ||
| import android.content.Intent; | ||
| import android.content.IntentFilter; | ||
| import android.content.SharedPreferences; | ||
| import android.content.pm.PackageManager; | ||
| import android.net.Uri; | ||
| import android.os.Bundle; | ||
| import android.os.Handler; | ||
| import android.os.Looper; | ||
|
|
@@ -96,6 +98,8 @@ | |
| import org.schabi.newpipe.util.external_communication.ShareUtils; | ||
| import org.schabi.newpipe.views.FocusOverlayView; | ||
|
|
||
| import java.time.Instant; | ||
| import java.time.temporal.ChronoUnit; | ||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
| import java.util.Objects; | ||
|
|
@@ -196,6 +200,8 @@ protected void onCreate(final Bundle savedInstanceState) { | |
| UpdateSettingsFragment.askForConsentToUpdateChecks(this); | ||
| } | ||
|
|
||
| showKeepAndroidDialog(); | ||
|
|
||
| MigrationManager.showUserInfoIfPresent(this); | ||
| } | ||
|
|
||
|
|
@@ -973,4 +979,58 @@ private boolean bottomSheetHiddenOrCollapsed() { | |
| || sheetState == BottomSheetBehavior.STATE_COLLAPSED; | ||
| } | ||
|
|
||
| private void showKeepAndroidDialog() { | ||
| final var prefs = PreferenceManager.getDefaultSharedPreferences(this); | ||
|
|
||
| final var now = Instant.now(); | ||
| final var kaoLastCheck = Instant.ofEpochMilli(prefs.getLong( | ||
| getString(R.string.kao_last_checked_key), | ||
| 0 | ||
| )); | ||
|
|
||
| final var supportedLannguages = List.of("fr", "de", "ca", "es", "id", "it", "pl", | ||
| "pt", "cs", "sk", "fa", "ar", "tr", "el", "th", "ru", "uk", "ko", "zh", "ja"); | ||
| final var locale = Localization.getAppLocale(); | ||
| final String kaoBaseUrl = "https://keepandroidopen.org/"; | ||
| final String kaoURIString; | ||
| if (supportedLannguages.contains(locale.getLanguage())) { | ||
| if ("zh".equals(locale.getLanguage())) { | ||
| kaoURIString = kaoBaseUrl + ("TW".equals(locale.getCountry()) ? "zh-TW" : "zh-CN"); | ||
| } else { | ||
| kaoURIString = kaoBaseUrl + locale.getLanguage(); | ||
| } | ||
| } else { | ||
| kaoURIString = kaoBaseUrl; | ||
| } | ||
| final var kaoURI = Uri.parse(kaoURIString); | ||
| final var solutionURI = Uri.parse( | ||
| "https://github.com/woheller69/FreeDroidWarn?tab=readme-ov-file#solutions"); | ||
|
|
||
| if (kaoLastCheck.plus(30, ChronoUnit.DAYS).isBefore(now)) { | ||
| final var dialog = new AlertDialog.Builder(this) | ||
| .setTitle("Keep Android Open") | ||
| .setCancelable(false) | ||
| .setMessage(this.getString(R.string.kao_dialog_warning)) | ||
| .setPositiveButton(this.getString(android.R.string.ok), (d, w) -> { | ||
| prefs.edit() | ||
| .putLong( | ||
| getString(R.string.kao_last_checked_key), | ||
| now.toEpochMilli() | ||
| ) | ||
| .apply(); | ||
| }) | ||
| .setNeutralButton(this.getString(R.string.kao_solution), null) | ||
| .setNegativeButton(this.getString(R.string.kao_dialog_more_info), null) | ||
| .show(); | ||
dustdfg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // If we use setNeutralButton and etc. dialog will close after pressing the buttons, | ||
| // but we want it to close only when positive button is pressed | ||
| dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setOnClickListener(v -> | ||
| this.startActivity(new Intent(Intent.ACTION_VIEW, kaoURI)) | ||
| ); | ||
| dialog.getButton(AlertDialog.BUTTON_NEUTRAL).setOnClickListener(v -> | ||
| this.startActivity(new Intent(Intent.ACTION_VIEW, solutionURI)) | ||
| ); | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -254,6 +254,13 @@ class AboutActivity : AppCompatActivity() { | |
| "ByteHamster", | ||
| "https://github.com/ByteHamster/SearchPreference", | ||
| StandardLicenses.MIT | ||
| ), | ||
| SoftwareComponent( | ||
| "FreeDroidWarn", | ||
| "2026", | ||
| "woheller69", | ||
| "https://github.com/woheller69/FreeDroidWarn", | ||
| StandardLicenses.APACHE2 | ||
|
Comment on lines
+257
to
+263
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you add this? The app does not use this library with your changes.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We used initial translations from there
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, but it doesn't change the fact we don't use this library, this should be removed. |
||
| ) | ||
| ) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if keeping this in English only is a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is the name of the site.... And to be honest it seems to me that site itself not very sure if it should be translated. Because half of the translations use english version while another half translates without clear rule when so...