-
-
Notifications
You must be signed in to change notification settings - Fork 799
Handle notification permission in BaseActivity #6440
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
0e7ba3d
0bab39f
43f4387
fe84ce4
623dc18
8c54ac9
9ecc93d
8cec53e
22431de
4fb129e
9b0da9d
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 |
|---|---|---|
|
|
@@ -2,12 +2,14 @@ package org.wikipedia.util | |
|
|
||
| import android.app.Activity | ||
| import android.content.Context | ||
| import android.content.Intent | ||
| import android.content.res.Configuration | ||
| import android.content.res.Resources | ||
| import android.graphics.Color | ||
| import android.net.ConnectivityManager | ||
| import android.os.Build | ||
| import android.os.Handler | ||
| import android.provider.Settings | ||
| import android.view.KeyCharacterMap | ||
| import android.view.KeyEvent | ||
| import android.view.View | ||
|
|
@@ -16,6 +18,7 @@ import android.view.accessibility.AccessibilityManager | |
| import android.view.inputmethod.InputMethodManager | ||
| import androidx.activity.enableEdgeToEdge | ||
| import androidx.annotation.ColorInt | ||
| import androidx.annotation.RequiresApi | ||
| import androidx.appcompat.app.AppCompatActivity | ||
| import androidx.core.content.ContextCompat | ||
| import androidx.core.view.WindowCompat | ||
|
|
@@ -107,6 +110,14 @@ object DeviceUtil { | |
| WindowCompat.getInsetsController(activity.window, activity.window.decorView).isAppearanceLightStatusBars = !WikipediaApp.instance.currentTheme.isDark | ||
| } | ||
|
|
||
| @RequiresApi(Build.VERSION_CODES.O) | ||
| fun openNotificationSettings(context: Context){ | ||
| val intent= Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS).apply { | ||
| putExtra(Settings.EXTRA_APP_PACKAGE,context.packageName) | ||
| } | ||
|
Comment on lines
+112
to
+121
|
||
| context.startActivity(intent) | ||
| } | ||
|
|
||
| val isOnWiFi: Boolean | ||
| get() { | ||
| val info = (WikipediaApp.instance.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager) | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -825,6 +825,9 @@ | |||||
| <string name="notifications_all_types_text">All types</string> | ||||||
| <string name="notifications_menu_user_talk_page">%s\'s talk page</string> | ||||||
| <string name="notifications_offline_disable_message">The function is not available while offline.</string> | ||||||
| <string name="notification_permission_rationale">Enable Notification to stay updated</string> | ||||||
|
||||||
| <string name="notification_permission_rationale">Enable Notification to stay updated</string> | |
| <string name="notification_permission_rationale">Enable notifications to stay up to date.</string> |
Uh oh!
There was an error while loading. Please reload this page.