mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-28 00:35:58 +00:00
Attemp to take sound URI
This commit is contained in:
parent
21df2e4885
commit
2d3bf83cb4
2 changed files with 14 additions and 4 deletions
|
@ -730,9 +730,14 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
|
||||||
if (uri == null) // silent sound
|
if (uri == null) // silent sound
|
||||||
prefs.edit().putString("sound", "").apply();
|
prefs.edit().putString("sound", "").apply();
|
||||||
else {
|
else {
|
||||||
if ("content".equals(uri.getScheme()))
|
if ("content".equals(uri.getScheme())) {
|
||||||
|
try {
|
||||||
|
getContext().getContentResolver().takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.w(ex);
|
||||||
|
}
|
||||||
prefs.edit().putString("sound", uri.toString()).apply();
|
prefs.edit().putString("sound", uri.toString()).apply();
|
||||||
else
|
} else
|
||||||
prefs.edit().remove("sound").apply();
|
prefs.edit().remove("sound").apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -740,9 +740,14 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||||
if (uri == null) // no/silent sound
|
if (uri == null) // no/silent sound
|
||||||
prefs.edit().remove("sound_sent").apply();
|
prefs.edit().remove("sound_sent").apply();
|
||||||
else {
|
else {
|
||||||
if ("content".equals(uri.getScheme()))
|
if ("content".equals(uri.getScheme())) {
|
||||||
|
try {
|
||||||
|
getContext().getContentResolver().takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.w(ex);
|
||||||
|
}
|
||||||
prefs.edit().putString("sound_sent", uri.toString()).apply();
|
prefs.edit().putString("sound_sent", uri.toString()).apply();
|
||||||
else
|
} else
|
||||||
prefs.edit().remove("sound_sent").apply();
|
prefs.edit().remove("sound_sent").apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue