From ed7705ca7feb8186d6d48d8b485bb77c2faa3df4 Mon Sep 17 00:00:00 2001 From: Julien Eluard Date: Thu, 1 Mar 2018 15:02:21 +0100 Subject: [PATCH] [ISSUE #3051] Implemented notification settings redirection Signed-off-by: Julien Eluard --- android/app/src/main/AndroidManifest.xml | 10 +++++++- .../java/im/status/ethereum/MainActivity.java | 25 +++++++++++++++++++ .../ui/screens/profile/user/views.cljs | 6 ++--- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 9a4369bbf8..89108f3db3 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -38,11 +38,19 @@ android:screenOrientation="portrait" android:windowSoftInputMode="adjustResize" android:configChanges="keyboard|keyboardHidden|orientation|screenSize" - android:resizeableActivity="false"> + android:resizeableActivity="false" + android:launchMode="singleTask"> + + + + + + = Build.VERSION_CODES.O) { + intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS); + intent.putExtra("app_package", getPackageName()); + intent.putExtra("app_uid", getApplicationInfo().uid); + } else { + intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); + intent.addCategory(Intent.CATEGORY_DEFAULT); + intent.setData(Uri.parse("package:" + getPackageName())); + } + return intent; + } + + @Override + public void onNewIntent(final Intent intent) { + if (intent.getData().getScheme().startsWith("app-settings")) { + startActivity(createNotificationSettingsIntent()); + } + } + @Override protected void onCreate(Bundle savedInstanceState) { + // Make sure we get an Alert for every uncaught exceptions registerUncaughtExceptionHandler(MainActivity.this); diff --git a/src/status_im/ui/screens/profile/user/views.cljs b/src/status_im/ui/screens/profile/user/views.cljs index e050ac3eac..b81be3fc3f 100644 --- a/src/status_im/ui/screens/profile/user/views.cljs +++ b/src/status_im/ui/screens/profile/user/views.cljs @@ -81,14 +81,12 @@ [react/view styles/share-contact-icon-container [vector-icons/icon :icons/qr {:color colors/blue}]]]]) - - (defn my-profile-settings [{:keys [network networks]}] [react/view [profile.components/settings-title (i18n/label :t/settings)] [profile.components/settings-item :t/main-currency "USD" #() false] [profile.components/settings-item-separator] - [profile.components/settings-item :t/notifications "" #() true] + [profile.components/settings-item :t/notifications "" #(.openURL react/linking "app-settings://notification/status-im") true] [profile.components/settings-item-separator] [profile.components/settings-item :t/network (get-in networks [network :name]) #(re-frame/dispatch [:navigate-to :network-settings]) true] @@ -134,4 +132,4 @@ [share-contact-code current-account public-key]] [react/view profile.components.styles/profile-info-container [my-profile-settings current-account]] - [logout]]]))) \ No newline at end of file + [logout]]])))