From ef15cdbb807b7537ed635f247e58edaa8c9b5a14 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Thu, 22 Aug 2019 17:22:49 +0200 Subject: [PATCH] Prompt to accept identity server policies before inviting them to a room (#3227) --- CHANGES.rst | 1 + .../VectorRoomInviteMembersActivity.java | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 2ab6352760..0a05db9c91 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -7,6 +7,7 @@ MatrixSdk: Features: - Use the hashed v2 lookup API for 3PIDs (#3257) + - Prompt to accept identity server policies before inviting them to a room (#3227) Improvements: - diff --git a/vector/src/main/java/im/vector/activity/VectorRoomInviteMembersActivity.java b/vector/src/main/java/im/vector/activity/VectorRoomInviteMembersActivity.java index 045c1e265d..5e0b2f1f60 100755 --- a/vector/src/main/java/im/vector/activity/VectorRoomInviteMembersActivity.java +++ b/vector/src/main/java/im/vector/activity/VectorRoomInviteMembersActivity.java @@ -17,6 +17,7 @@ package im.vector.activity; +import android.app.Activity; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; @@ -34,6 +35,7 @@ import org.matrix.androidsdk.core.Log; import org.matrix.androidsdk.core.MXPatterns; import org.matrix.androidsdk.core.callback.SimpleApiCallback; +import org.matrix.androidsdk.features.terms.TermsManager; import org.matrix.androidsdk.listeners.MXEventListener; import org.matrix.androidsdk.rest.model.Event; import org.matrix.androidsdk.rest.model.RoomMember; @@ -50,6 +52,7 @@ import butterknife.OnClick; import im.vector.Matrix; import im.vector.R; +import im.vector.activity.util.RequestCodesKt; import im.vector.adapters.ParticipantAdapterItem; import im.vector.adapters.VectorParticipantsAdapter; import im.vector.contacts.Contact; @@ -123,7 +126,9 @@ public void run() { @Override public void onIdentityServerTermsNotSigned(String token) { - Log.w(LOG_TAG, "onIdentityServerTermsNotSigned()"); + startActivityForResult(ReviewTermsActivity.Companion.intent(VectorRoomInviteMembersActivity.this, + TermsManager.ServiceType.IdentityService, mSession.getHomeServerConfig().getIdentityServerUri().toString(), token), + RequestCodesKt.TERMS_REQUEST_CODE); } }; @@ -253,6 +258,15 @@ protected void onPause() { ContactsManager.getInstance().removeListener(mContactsListener); } + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == RequestCodesKt.TERMS_REQUEST_CODE && resultCode == Activity.RESULT_OK) { + // Launch again the request + ContactsManager.getInstance().refreshLocalContactsSnapshot(); + onPatternUpdate(false); + } + } + @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (0 == permissions.length) {