[ISSUE #3051] Implemented notification settings redirection
Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
parent
e9e1456afc
commit
ed7705ca7f
|
@ -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">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
<intent-filter android:label="@string/app_name">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
<data android:scheme="app-settings"
|
||||
android:host="notification" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<service
|
||||
android:name=".module.StatusService"
|
||||
|
|
|
@ -7,12 +7,15 @@ import android.content.DialogInterface;
|
|||
import android.content.DialogInterface.OnCancelListener;
|
||||
import android.content.DialogInterface.OnClickListener;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Looper;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.util.Log;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.provider.Settings;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.facebook.react.ReactActivity;
|
||||
|
@ -70,8 +73,30 @@ public class MainActivity extends ReactActivity
|
|||
properties.setProperty("https.nonProxyHosts", "localhost|127.0.0.1");
|
||||
}
|
||||
|
||||
private Intent createNotificationSettingsIntent() {
|
||||
final Intent intent = new Intent();
|
||||
if (Build.VERSION.SDK_INT >= 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);
|
||||
|
||||
|
|
|
@ -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]]])))
|
||||
[logout]]])))
|
||||
|
|
Loading…
Reference in New Issue