warn on missing presence subscription
This commit is contained in:
parent
409fdd8596
commit
19f98f5143
|
@ -243,5 +243,7 @@
|
||||||
<string name="unable_to_decrypt_otr_message">Unable to decrypt OTR message</string>
|
<string name="unable_to_decrypt_otr_message">Unable to decrypt OTR message</string>
|
||||||
<string name="delete_fingerprint">Delete Fingerprint</string>
|
<string name="delete_fingerprint">Delete Fingerprint</string>
|
||||||
<string name="sure_delete_fingerprint">Are you sure you would like to delete this fingerprint?</string>
|
<string name="sure_delete_fingerprint">Are you sure you would like to delete this fingerprint?</string>
|
||||||
|
<string name="ignore">Ignore</string>
|
||||||
|
<string name="without_mutual_presence_updates"><b>Warning:</b> Sending this without mutual presence updates could cause unexpected problems.\n\n<small>Go to contact details to verify your presence subscriptions.</small></string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -115,7 +115,7 @@ public class XmppConnectionService extends Service {
|
||||||
public void onContactStatusChanged(Contact contact, boolean online) {
|
public void onContactStatusChanged(Contact contact, boolean online) {
|
||||||
Conversation conversation = find(getConversations(), contact);
|
Conversation conversation = find(getConversations(), contact);
|
||||||
if (conversation != null) {
|
if (conversation != null) {
|
||||||
conversation.endOtrIfNeeded();
|
conversation.resetOtrSession();
|
||||||
if (online && (contact.getPresences().size() == 1)) {
|
if (online && (contact.getPresences().size() == 1)) {
|
||||||
sendUnsendMessages(conversation);
|
sendUnsendMessages(conversation);
|
||||||
}
|
}
|
||||||
|
|
|
@ -760,7 +760,7 @@ public class ConversationActivity extends XmppActivity {
|
||||||
public void updateConversationList() {
|
public void updateConversationList() {
|
||||||
xmppConnectionService
|
xmppConnectionService
|
||||||
.populateWithOrderedConversations(conversationList);
|
.populateWithOrderedConversations(conversationList);
|
||||||
listView.invalidateViews();
|
listAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runIntent(PendingIntent pi, int requestCode) {
|
public void runIntent(PendingIntent pi, int requestCode) {
|
||||||
|
|
|
@ -41,7 +41,6 @@ import android.view.View;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
public abstract class XmppActivity extends Activity {
|
public abstract class XmppActivity extends Activity {
|
||||||
|
|
||||||
|
@ -303,8 +302,8 @@ public abstract class XmppActivity extends Activity {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle(contact.getJid());
|
builder.setTitle(contact.getJid());
|
||||||
builder.setMessage(R.string.request_presence_updates);
|
builder.setMessage(R.string.request_presence_updates);
|
||||||
builder.setNegativeButton(getString(R.string.cancel), null);
|
builder.setNegativeButton(R.string.cancel, null);
|
||||||
builder.setPositiveButton(getString(R.string.request_now),
|
builder.setPositiveButton(R.string.request_now,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -318,6 +317,24 @@ public abstract class XmppActivity extends Activity {
|
||||||
});
|
});
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void warnMutalPresenceSubscription(final Conversation conversation,final OnPresenceSelected listener) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setTitle(conversation.getContact().getJid());
|
||||||
|
builder.setMessage(R.string.without_mutual_presence_updates);
|
||||||
|
builder.setNegativeButton(R.string.cancel, null);
|
||||||
|
builder.setPositiveButton(R.string.ignore, new OnClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
conversation.setNextPresence(null);
|
||||||
|
if (listener!=null) {
|
||||||
|
listener.onPresenceSelected();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
builder.create().show();
|
||||||
|
}
|
||||||
|
|
||||||
protected void quickEdit(String previousValue, OnValueEdited callback) {
|
protected void quickEdit(String previousValue, OnValueEdited callback) {
|
||||||
quickEdit(previousValue, callback, false);
|
quickEdit(previousValue, callback, false);
|
||||||
|
@ -371,15 +388,12 @@ public abstract class XmppActivity extends Activity {
|
||||||
&& !contact.getOption(Contact.Options.ASKING)
|
&& !contact.getOption(Contact.Options.ASKING)
|
||||||
&& contact.getAccount().getStatus() == Account.STATUS_ONLINE) {
|
&& contact.getAccount().getStatus() == Account.STATUS_ONLINE) {
|
||||||
showAskForPresenceDialog(contact);
|
showAskForPresenceDialog(contact);
|
||||||
return;
|
} else if (!contact.getOption(Contact.Options.TO) || !contact.getOption(Contact.Options.FROM)) {
|
||||||
} else if (!contact.getOption(Contact.Options.TO)) {
|
warnMutalPresenceSubscription(conversation,listener);
|
||||||
Toast toast = Toast.makeText(this,
|
} else {
|
||||||
R.string.missing_presence_updates,
|
conversation.setNextPresence(null);
|
||||||
Toast.LENGTH_LONG);
|
listener.onPresenceSelected();
|
||||||
toast.show();
|
|
||||||
}
|
}
|
||||||
conversation.setNextPresence(null);
|
|
||||||
listener.onPresenceSelected();
|
|
||||||
} else if (presences.size() == 1) {
|
} else if (presences.size() == 1) {
|
||||||
String presence = (String) presences.asStringArray()[0];
|
String presence = (String) presences.asStringArray()[0];
|
||||||
conversation.setNextPresence(presence);
|
conversation.setNextPresence(presence);
|
||||||
|
|
Loading…
Reference in New Issue