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'
|
exclude group: 'com.google.firebase', module: 'firebase-core'
|
||||||
}
|
}
|
||||||
implementation 'org.sufficientlysecure:openpgp-api:10.0'
|
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:support-v13:$supportLibVersion"
|
||||||
implementation "com.android.support:appcompat-v7:$supportLibVersion"
|
implementation "com.android.support:appcompat-v7:$supportLibVersion"
|
||||||
implementation "com.android.support:cardview-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 ask = item.getAttribute("ask");
|
||||||
String subscription = item.getAttribute("subscription");
|
String subscription = item.getAttribute("subscription");
|
||||||
|
|
||||||
if (subscription != null) {
|
if (subscription == null) {
|
||||||
|
this.resetOption(Options.FROM);
|
||||||
|
this.resetOption(Options.TO);
|
||||||
|
} else {
|
||||||
switch (subscription) {
|
switch (subscription) {
|
||||||
case "to":
|
case "to":
|
||||||
this.resetOption(Options.FROM);
|
this.resetOption(Options.FROM);
|
||||||
|
|
|
@ -61,39 +61,27 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp
|
||||||
private OnCheckedChangeListener mOnSendCheckedChange = new OnCheckedChangeListener() {
|
private OnCheckedChangeListener mOnSendCheckedChange = new OnCheckedChangeListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView,
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
boolean isChecked) {
|
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
if (contact
|
if (contact.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) {
|
||||||
.getOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST)) {
|
xmppConnectionService.sendPresencePacket(contact.getAccount(), xmppConnectionService.getPresenceGenerator().sendPresenceUpdatesTo(contact));
|
||||||
xmppConnectionService.sendPresencePacket(contact
|
|
||||||
.getAccount(),
|
|
||||||
xmppConnectionService.getPresenceGenerator()
|
|
||||||
.sendPresenceUpdatesTo(contact));
|
|
||||||
} else {
|
} else {
|
||||||
contact.setOption(Contact.Options.PREEMPTIVE_GRANT);
|
contact.setOption(Contact.Options.PREEMPTIVE_GRANT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
contact.resetOption(Contact.Options.PREEMPTIVE_GRANT);
|
contact.resetOption(Contact.Options.PREEMPTIVE_GRANT);
|
||||||
xmppConnectionService.sendPresencePacket(contact.getAccount(),
|
xmppConnectionService.sendPresencePacket(contact.getAccount(),xmppConnectionService.getPresenceGenerator().stopPresenceUpdatesTo(contact));
|
||||||
xmppConnectionService.getPresenceGenerator()
|
|
||||||
.stopPresenceUpdatesTo(contact));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private OnCheckedChangeListener mOnReceiveCheckedChange = new OnCheckedChangeListener() {
|
private OnCheckedChangeListener mOnReceiveCheckedChange = new OnCheckedChangeListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView,
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
boolean isChecked) {
|
|
||||||
if (isChecked) {
|
if (isChecked) {
|
||||||
xmppConnectionService.sendPresencePacket(contact.getAccount(),
|
xmppConnectionService.sendPresencePacket(contact.getAccount(), xmppConnectionService.getPresenceGenerator().requestPresenceUpdatesFrom(contact));
|
||||||
xmppConnectionService.getPresenceGenerator()
|
|
||||||
.requestPresenceUpdatesFrom(contact));
|
|
||||||
} else {
|
} else {
|
||||||
xmppConnectionService.sendPresencePacket(contact.getAccount(),
|
xmppConnectionService.sendPresencePacket(contact.getAccount(), xmppConnectionService.getPresenceGenerator().stopPresenceUpdatesFrom(contact));
|
||||||
xmppConnectionService.getPresenceGenerator()
|
|
||||||
.stopPresenceUpdatesFrom(contact));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue