Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
Prompt to accept identity server policies before inviting them to a r…
Browse files Browse the repository at this point in the history
…oom (#3227)
  • Loading branch information
bmarty committed Aug 30, 2019
1 parent 4ce36b0 commit 483317a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}
};

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 483317a

Please sign in to comment.