Detailed changes
@@ -2724,8 +2724,7 @@ public class XmppConnectionService extends Service {
}
}
- public void createContact(Contact contact) {
- boolean autoGrant = getBooleanPreference("grant_new_contacts", R.bool.grant_new_contacts);
+ public void createContact(Contact contact, boolean autoGrant) {
if (autoGrant) {
contact.setOption(Contact.Options.PREEMPTIVE_GRANT);
contact.setOption(Contact.Options.ASKING);
@@ -309,7 +309,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
public void onClick(View v) {
final Contact contact = conversation == null ? null : conversation.getContact();
if (contact != null) {
- activity.xmppConnectionService.createContact(contact);
+ activity.xmppConnectionService.createContact(contact,true);
activity.switchToContactDetails(contact);
}
}
@@ -1701,6 +1701,8 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
setupIme();
+ final boolean scrolledToBottomAndNoPending = this.scrolledToBottom() && pendingScrollState.peek() == null;
+
this.binding.textSendButton.setContentDescription(activity.getString(R.string.send_message_to_x, conversation.getName()));
this.binding.textinput.setKeyboardListener(null);
this.binding.textinput.setText("");
@@ -1710,8 +1712,6 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
refresh(false);
this.conversation.messagesLoaded.set(true);
- final boolean scrolledToBottomAndNoPending = this.scrolledToBottom() && pendingScrollState.peek() == null;
-
Log.d(Config.LOGTAG,"scrolledToBottomAndNoPending="+Boolean.toString(scrolledToBottomAndNoPending));
if (hasExtras || scrolledToBottomAndNoPending) {
@@ -91,6 +91,8 @@ public class SettingsActivity extends XmppActivity implements
}
}
+ PreferenceScreen mainPreferenceScreen = (PreferenceScreen) mSettingsFragment.findPreference("main_screen");
+
//this feature is only available on Huawei Android 6.
PreferenceScreen huaweiPreferenceScreen = (PreferenceScreen) mSettingsFragment.findPreference("huawei");
if (huaweiPreferenceScreen != null) {
@@ -99,6 +101,11 @@ public class SettingsActivity extends XmppActivity implements
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M || !isCallable(intent)) {
PreferenceCategory generalCategory = (PreferenceCategory) mSettingsFragment.findPreference("general");
generalCategory.removePreference(huaweiPreferenceScreen);
+ if (generalCategory.getPreferenceCount() == 0) {
+ if (mainPreferenceScreen != null) {
+ mainPreferenceScreen.removePreference(generalCategory);
+ }
+ }
}
}
@@ -474,7 +474,7 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
} else if (contact.showInRoster()) {
throw new EnterJidDialog.JidError(getString(R.string.contact_already_exists));
} else {
- xmppConnectionService.createContact(contact);
+ xmppConnectionService.createContact(contact,true);
if (invite != null && invite.hasFingerprints()) {
xmppConnectionService.verifyFingerprints(contact, invite.getFingerprints());
}
@@ -683,13 +683,7 @@ public abstract class XmppActivity extends AppCompatActivity {
builder.setTitle(contact.getJid().toString());
builder.setMessage(getString(R.string.not_in_roster));
builder.setNegativeButton(getString(R.string.cancel), null);
- builder.setPositiveButton(getString(R.string.add_contact),
- (dialog, which) -> {
- final Jid jid = contact.getJid();
- Account account = contact.getAccount();
- Contact contact1 = account.getRoster().getContact(jid);
- xmppConnectionService.createContact(contact1);
- });
+ builder.setPositiveButton(getString(R.string.add_contact), (dialog, which) -> xmppConnectionService.createContact(contact,true));
builder.create().show();
}
@@ -7,7 +7,6 @@
<bool name="headsup_notifications">false</bool>
<bool name="dnd_on_silent_mode">false</bool>
<bool name="treat_vibrate_as_silent">false</bool>
- <bool name="grant_new_contacts">true</bool>
<bool name="confirm_messages">true</bool>
<bool name="chat_states">false</bool>
<bool name="last_activity">false</bool>
@@ -125,8 +125,6 @@
<string name="openpgp_error">OpenKeychain reported an error</string>
<string name="accept">Accept</string>
<string name="error">An error has occurred</string>
- <string name="pref_grant_presence_updates">Grant presence updates</string>
- <string name="pref_grant_presence_updates_summary">Preemptively grant and request presence subscriptions for contacts you have created</string>
<string name="your_account">Your account</string>
<string name="send_presence_updates">Send presence updates</string>
<string name="receive_presence_updates">Receive presence updates</string>
@@ -1,14 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+<PreferenceScreen
+ android:key="main_screen"
+ xmlns:android="http://schemas.android.com/apk/res/android"
android:background="?attr/color_background_secondary">
<PreferenceCategory android:title="@string/pref_general"
android:key="general">
- <CheckBoxPreference
- android:defaultValue="@bool/grant_new_contacts"
- android:key="grant_new_contacts"
- android:summary="@string/pref_grant_presence_updates_summary"
- android:title="@string/pref_grant_presence_updates"/>
<PreferenceScreen
android:key="huawei"
android:title="@string/huawei_protected_apps"