|
7 | 7 | import android.app.DownloadManager; |
8 | 8 | import android.content.Context; |
9 | 9 | import android.content.Intent; |
| 10 | +import android.content.SharedPreferences; |
10 | 11 | import android.content.pm.ActivityInfo; |
11 | 12 | import android.content.pm.PackageManager; |
12 | 13 | import android.net.Uri; |
@@ -316,15 +317,22 @@ public boolean shouldOverrideUrlLoading(final WebView view, final String url) { |
316 | 317 | if (isGoogleLogin && ALLOW_GOOGLE_LOGIN) { |
317 | 318 | view.getSettings().setUserAgentString(CHROME_USER_AGENT); |
318 | 319 |
|
319 | | - new AlertDialog.Builder(MainActivity.this) |
320 | | - .setTitle("אזהרה") |
321 | | - .setMessage("גוגל אוסרת התחברות מדפדפנים מותאמים אישית. השימוש על אחריותך בלבד.") |
322 | | - .setPositiveButton("הבנתי", (dialog, which) -> { |
323 | | - mProgressBar.setVisibility(View.VISIBLE); |
324 | | - view.loadUrl(url); |
325 | | - }) |
326 | | - .setCancelable(false) |
327 | | - .show(); |
| 320 | + SharedPreferences prefs = getSharedPreferences("app_prefs", MODE_PRIVATE); |
| 321 | + boolean warningAccepted = prefs.getBoolean("google_login_warning_accepted", false); |
| 322 | + |
| 323 | + if (!warningAccepted) { |
| 324 | + new AlertDialog.Builder(MainActivity.this) |
| 325 | + .setTitle("אזהרה") |
| 326 | + .setMessage("גוגל אוסרת התחברות מדפדפנים מותאמים אישית. השימוש על אחריותך בלבד.") |
| 327 | + .setPositiveButton("הבנתי", (dialog, which) -> { |
| 328 | + prefs.edit().putBoolean("google_login_warning_accepted", true).apply(); |
| 329 | + mProgressBar.setVisibility(View.VISIBLE); |
| 330 | + view.loadUrl(url); |
| 331 | + }) |
| 332 | + .setCancelable(false) |
| 333 | + .show(); |
| 334 | + } |
| 335 | + |
328 | 336 | return true; |
329 | 337 | } else if (!isGoogleLogin) { |
330 | 338 | view.getSettings().setUserAgentString(defaultUserAgent); |
|
0 commit comments