code clean up in contact details presence handling
This commit is contained in:
parent
6c27d07803
commit
8a987f23f6
|
@ -35,7 +35,7 @@ dependencies {
|
|||
exclude group: 'com.google.firebase', module: 'firebase-core'
|
||||
}
|
||||
implementation 'org.sufficientlysecure:openpgp-api:10.0'
|
||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
|
||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
|
||||
implementation "com.android.support:support-v13:$supportLibVersion"
|
||||
implementation "com.android.support:appcompat-v7:$supportLibVersion"
|
||||
implementation "com.android.support:cardview-v7:$supportLibVersion"
|
||||
|
|
|
@ -340,7 +340,10 @@ public class Contact implements ListItem, Blockable {
|
|||
String ask = item.getAttribute("ask");
|
||||
String subscription = item.getAttribute("subscription");
|
||||
|
||||
if (subscription != null) {
|
||||
if (subscription == null) {
|
||||
this.resetOption(Options.FROM);
|
||||
this.resetOption(Options.TO);
|
||||
} else {
|
||||
switch (subscription) {
|
||||
case "to":
|
||||
this.resetOption(Options.FROM);
|
||||
|
|
|
@ -61,39 +61,27 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
|
|||
private OnCheckedChangeListener mOnSendCheckedChange = new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
if (contact
|
||||
.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) {
|
||||
xmppConnectionService.sendPresencePacket(contact
|
||||
.getAccount(),
|
||||
xmppConnectionService.getPresenceGenerator()
|
||||
.sendPresenceUpdatesTo(contact));
|
||||
if (contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) {
|
||||
xmppConnectionService.sendPresencePacket(contact.getAccount(), xmppConnectionService.getPresenceGenerator().sendPresenceUpdatesTo(contact));
|
||||
} else {
|
||||
contact.setOption(Contact.Options.PREEMPTIVE_GRANT);
|
||||
}
|
||||
} else {
|
||||
contact.resetOption(Contact.Options.PREEMPTIVE_GRANT);
|
||||
xmppConnectionService.sendPresencePacket(contact.getAccount(),
|
||||
xmppConnectionService.getPresenceGenerator()
|
||||
.stopPresenceUpdatesTo(contact));
|
||||
xmppConnectionService.sendPresencePacket(contact.getAccount(),xmppConnectionService.getPresenceGenerator().stopPresenceUpdatesTo(contact));
|
||||
}
|
||||
}
|
||||
};
|
||||
private OnCheckedChangeListener mOnReceiveCheckedChange = new OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView,
|
||||
boolean isChecked) {
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (isChecked) {
|
||||
xmppConnectionService.sendPresencePacket(contact.getAccount(),
|
||||
xmppConnectionService.getPresenceGenerator()
|
||||
.requestPresenceUpdatesFrom(contact));
|
||||
xmppConnectionService.sendPresencePacket(contact.getAccount(), xmppConnectionService.getPresenceGenerator().requestPresenceUpdatesFrom(contact));
|
||||
} else {
|
||||
xmppConnectionService.sendPresencePacket(contact.getAccount(),
|
||||
xmppConnectionService.getPresenceGenerator()
|
||||
.stopPresenceUpdatesFrom(contact));
|
||||
xmppConnectionService.sendPresencePacket(contact.getAccount(), xmppConnectionService.getPresenceGenerator().stopPresenceUpdatesFrom(contact));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue