Presentation hotfixes
This commit is contained in:
parent
9687f94878
commit
a1f224d800
|
@ -137,9 +137,14 @@ public class AccountDetailsFragment extends Fragment {
|
|||
.replace(R.id.fragment, IkeySetupFragment.newInstance(accountId))
|
||||
.commit();
|
||||
return true;
|
||||
|
||||
case R.id.action_publish_ikey_element:
|
||||
sendIkeyElement();
|
||||
return true;
|
||||
|
||||
case R.id.action_send_presence:
|
||||
sendPresence();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
@ -152,6 +157,10 @@ public class AccountDetailsFragment extends Fragment {
|
|||
viewModel.sendIkeyElement(accountId);
|
||||
}
|
||||
|
||||
private void sendPresence() {
|
||||
viewModel.sendPresence(accountId);
|
||||
}
|
||||
|
||||
private void observeViewModel() {
|
||||
viewModel.getIkeyFingerprint().observe(getViewLifecycleOwner(), this::displayIkeyFingerprintAndDecisionButton);
|
||||
viewModel.getLocalFingerprint().observe(getViewLifecycleOwner(), this::displayLocalOxFingerprint);
|
||||
|
|
|
@ -157,6 +157,15 @@ public class AndroidAccountDetailsViewModel extends AndroidViewModel implements
|
|||
return accountAuthenticated;
|
||||
}
|
||||
|
||||
public void sendPresence(UUID accountId) {
|
||||
addDisposable(
|
||||
getCommonViewModel().sendPresence(accountId)
|
||||
.subscribeOn(schedulers.getNewThread())
|
||||
.observeOn(schedulers.getUiScheduler())
|
||||
.subscribe(() -> LOGGER.log(Level.INFO, "Presence update sent for account " + accountId),
|
||||
e -> LOGGER.log(Level.SEVERE, "Error sending presence update for account " + accountId, e)));
|
||||
}
|
||||
|
||||
public static class AndroidAccountDetailsViewModelFactory implements ViewModelProvider.Factory {
|
||||
|
||||
private final Application application;
|
||||
|
|
|
@ -31,4 +31,8 @@
|
|||
android:id="@+id/action_publish_ikey_element"
|
||||
android:title="Publish Ikey Element" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_send_presence"
|
||||
android:title="Send Presence" />
|
||||
|
||||
</menu>
|
|
@ -2,6 +2,8 @@ package org.mercury_im.messenger.core.viewmodel.account.detail;
|
|||
|
||||
import org.bouncycastle.openpgp.PGPSecretKeyRing;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.Presence;
|
||||
import org.jivesoftware.smack.packet.PresenceBuilder;
|
||||
import org.jivesoftware.smackx.ikey.IkeyManager;
|
||||
import org.jivesoftware.smackx.ikey.element.IkeyElement;
|
||||
import org.jivesoftware.smackx.ikey.element.SubordinateElement;
|
||||
|
@ -254,4 +256,12 @@ public class AccountDetailsViewModel implements MercuryViewModel {
|
|||
.map(ConnectionState::getConnectivity)
|
||||
.map(connectivity -> connectivity == ConnectivityState.authenticated);
|
||||
}
|
||||
|
||||
public Completable sendPresence(UUID accountId) {
|
||||
return Completable.fromAction(() -> {
|
||||
XMPPConnection connection = connectionManager.getConnection(accountId).getConnection();
|
||||
connection.sendStanza(PresenceBuilder.buildPresence().ofType(Presence.Type.available).build());
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d35354b1b05d80a6ab45fed9548304707eaab460
|
||||
Subproject commit 4849c6c544962b198ca761b8c697fd3f96292994
|
Loading…
Reference in New Issue