Merge pull request #1349 from deltachat/prep-1.8

prep 1.8
This commit is contained in:
bjoern
2020-05-11 01:16:01 +02:00
committed by GitHub
9 changed files with 46 additions and 21 deletions
+13
View File
@@ -1,5 +1,16 @@
# Delta Chat Android Changelog
## v1.8.0
2020-05-11
* by default, the permantent notification is no longer shown;
the background fetch realibility depends on the system and the
permantent notification can be enabled at "Settings / Notifications" as needed
* fix a bug that stops receiving messages under some circumstances
* more bug fixes
* update translations
## v1.6.2
2020-05-02
@@ -19,6 +30,8 @@
* new experimental feature that allows switching the account in use
* improve interaction with traditional mail clients
* improved onboarding when the provider returns a link
* to improve background fetch, show a permantent notification by default
* the permantent notification can be disabled at "Settins / Notifications"
* bug fixes
* add Indonesian and Persian translations, update other translations
+2 -2
View File
@@ -89,8 +89,8 @@ android {
}
defaultConfig {
versionCode 580
versionName "1.7.0"
versionCode 581
versionName "1.8.0"
applicationId "com.b44t.messenger"
multiDexEnabled true
+1
View File
@@ -693,6 +693,7 @@
<!-- android specific strings, developers: please take care to remove strings that are no longer used! -->
<!-- this message is shown in the device chat, starting in version 1.6, it should explain the need for the permanent-notifiation and also use the same wording as used there (see "Background connection enabled") -->
<string name="device_talk_background_connection_android">You may already have noticed, that there is a hint \"Background connection enabled\" shown by the system.\n\n👉 The hint normally prevents the operating system from killing the connection between Delta Chat and your server.\n\n👉 If the hint disappears without any action on your part, the connection has probably been killed anyway.\nIf you think this is weird, we totally agree - but many manufacturers do exactly that. The site https://dontkillmyapp.com shows some workarounds.\n\nHowever, we are happy that we could improve the receiving of messages in background with this change and could fulfil the requests of many users - thanks for reporting 🤗</string>
<string name="device_talk_background_connection2_android">You can now enable and disabled the \"Background connection\" as needed at \"Settings / Notifications\".</string>
</resources>
+7 -6
View File
@@ -7,6 +7,13 @@
android:title="@string/pref_notifications"
android:defaultValue="true" />
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:dependency="pref_key_enable_notifications"
android:defaultValue="false"
android:key="pref_reliable_service"
android:title="@string/pref_reliable_service"
android:summary="@string/pref_reliable_service_explain"/>
<Preference
android:dependency="pref_key_enable_notifications"
android:key="pref_key_ringtone"
@@ -58,10 +65,4 @@
android:entries="@array/pref_notification_priority_entries"
android:entryValues="@array/pref_notification_priority_values"/>
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:defaultValue="true"
android:key="pref_reliable_service"
android:title="@string/pref_reliable_service"
android:summary="@string/pref_reliable_service_explain"/>
</PreferenceScreen>
@@ -84,14 +84,13 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
protected void onCreate(Bundle icicle, boolean ready) {
ApplicationDcContext dcContext = DcHelper.getContext(this);
// show the permanent-notification hint above the welcome-messages (that is also visible in the preview)
// for existing installation, of course, that will be the last as the welcome-messages are added long time ago.
DcMsg msg = new DcMsg(dcContext, DcMsg.DC_MSG_TEXT);
msg.setText(getString(R.string.device_talk_background_connection_android));
dcContext.addDeviceMsg("update1.6.0-h", msg);
// add welcome message
dcContext.updateDeviceChats();
if (dcContext.wasDeviceMsgEverAdded("update1.6.0-h")) {
DcMsg msg = new DcMsg(dcContext, DcMsg.DC_MSG_TEXT);
msg.setText(getString(R.string.device_talk_background_connection2_android));
dcContext.addDeviceMsg("update1.8.0-a", msg);
}
setContentView(R.layout.conversation_list_activity);
@@ -241,6 +241,8 @@ public class LogViewFragment extends Fragment {
builder.append("ignoreBatteryOptimizations=").append(
powerManager.isIgnoringBatteryOptimizations(context.getPackageName())).append("\n");
}
builder.append("notifications=").append(
Prefs.isNotificationsEnabled(context)).append("\n");
builder.append("reliableService=").append(
Prefs.reliableService(context)).append("\n");
} catch (Exception e) {
@@ -25,7 +25,7 @@ public class KeepAliveService extends Service {
// note, that unfortunately, the check for isIgnoringBatteryOptimizations() is not sufficient,
// this checks only stock-android settings, several os have additional "optimizers" that ignore this setting.
// therefore, the most reliable way to not get killed is a permanent-foreground-notification.
if(Prefs.reliableService(context)) {
if (Prefs.isNotificationsEnabled(context) && Prefs.reliableService(context)) {
startSelf(context);
}
}
@@ -71,14 +71,26 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
CheckBoxPreference reliableService = this.findPreference("pref_reliable_service");
reliableService.setOnPreferenceChangeListener((preference, newValue) -> {
Context context = getContext();
boolean enabled = (Boolean) newValue;
if (enabled) {
boolean enabled = (Boolean) newValue; // Prefs.reliableService() still has the old value
if (enabled && Prefs.isNotificationsEnabled(context)) {
KeepAliveService.startSelf(context);
} else {
context.stopService(new Intent(context, KeepAliveService.class));
}
return true;
});
CheckBoxPreference notificationsEnabled = this.findPreference("pref_key_enable_notifications");
notificationsEnabled.setOnPreferenceChangeListener((preference, newValue) -> {
Context context = getContext();
boolean enabled = (Boolean) newValue; // Prefs.isNotificationsEnabled() still has the old value
if (enabled && Prefs.reliableService(context)) {
KeepAliveService.startSelf(context);
} else {
context.stopService(new Intent(context, KeepAliveService.class));
}
return true;
});
}
@Override
@@ -137,9 +149,6 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
public static CharSequence getSummary(Context context) {
boolean notificationsEnabled = Prefs.isNotificationsEnabled(context);
String ret = context.getString(notificationsEnabled ? R.string.on : R.string.off);
if (notificationsEnabled && !Prefs.reliableService(context)) {
ret += ", " + context.getString(R.string.pref_reliable_service) + " " + context.getString(R.string.off);
}
return ret;
}
@@ -236,7 +236,7 @@ public class Prefs {
public static boolean reliableService(Context context) {
try {
return getBooleanPreference(context, "pref_reliable_service", true);
return getBooleanPreference(context, "pref_reliable_service", false);
}
catch(Exception e) {
return false;