Verify in profiles
This commit is contained in:
parent
aa6d438acc
commit
8e5f79d563
|
@ -32,6 +32,7 @@ import android.text.Spanned;
|
|||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.UnderlineSpan;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
@ -77,6 +78,7 @@ import app.fedilab.android.asynctasks.PostActionAsyncTask;
|
|||
import app.fedilab.android.asynctasks.RetrieveAccountAsyncTask;
|
||||
import app.fedilab.android.asynctasks.RetrieveAccountsAsyncTask;
|
||||
import app.fedilab.android.asynctasks.RetrieveFeedsAsyncTask;
|
||||
import app.fedilab.android.asynctasks.RetrieveIdentityProofAsyncTask;
|
||||
import app.fedilab.android.asynctasks.RetrieveRelationshipAsyncTask;
|
||||
import app.fedilab.android.asynctasks.UpdateAccountInfoAsyncTask;
|
||||
import app.fedilab.android.client.API;
|
||||
|
@ -84,6 +86,7 @@ import app.fedilab.android.client.APIResponse;
|
|||
import app.fedilab.android.client.Entities.Account;
|
||||
import app.fedilab.android.client.Entities.Attachment;
|
||||
import app.fedilab.android.client.Entities.Error;
|
||||
import app.fedilab.android.client.Entities.IdentityProof;
|
||||
import app.fedilab.android.client.Entities.InstanceNodeInfo;
|
||||
import app.fedilab.android.client.Entities.ManageTimelines;
|
||||
import app.fedilab.android.client.Entities.Relationship;
|
||||
|
@ -103,6 +106,7 @@ import app.fedilab.android.interfaces.OnRetrieveAccountInterface;
|
|||
import app.fedilab.android.interfaces.OnRetrieveEmojiAccountInterface;
|
||||
import app.fedilab.android.interfaces.OnRetrieveFeedsAccountInterface;
|
||||
import app.fedilab.android.interfaces.OnRetrieveFeedsInterface;
|
||||
import app.fedilab.android.interfaces.OnRetrieveIdentityProofInterface;
|
||||
import app.fedilab.android.interfaces.OnRetrieveRelationshipInterface;
|
||||
import app.fedilab.android.sqlite.AccountDAO;
|
||||
import app.fedilab.android.sqlite.InstancesDAO;
|
||||
|
@ -121,7 +125,7 @@ import static app.fedilab.android.helper.Helper.getLiveInstance;
|
|||
* Show account activity class
|
||||
*/
|
||||
|
||||
public class ShowAccountActivity extends BaseActivity implements OnPostActionInterface, OnRetrieveAccountInterface, OnRetrieveFeedsAccountInterface, OnRetrieveRelationshipInterface, OnRetrieveFeedsInterface, OnRetrieveEmojiAccountInterface, OnListActionInterface {
|
||||
public class ShowAccountActivity extends BaseActivity implements OnPostActionInterface, OnRetrieveAccountInterface, OnRetrieveFeedsAccountInterface, OnRetrieveRelationshipInterface, OnRetrieveFeedsInterface, OnRetrieveEmojiAccountInterface, OnListActionInterface, OnRetrieveIdentityProofInterface {
|
||||
|
||||
|
||||
private List<Status> statuses;
|
||||
|
@ -306,7 +310,10 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
header_edit_profile.setVisibility(View.VISIBLE);
|
||||
header_edit_profile.bringToFront();
|
||||
}
|
||||
|
||||
//TODO: add other software that supports identity proofs
|
||||
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON) {
|
||||
new RetrieveIdentityProofAsyncTask(ShowAccountActivity.this, account.getId(), ShowAccountActivity.this).execute();
|
||||
}
|
||||
String urlHeader = account.getHeader();
|
||||
if (urlHeader != null && urlHeader.startsWith("/")) {
|
||||
urlHeader = Helper.getLiveInstanceWithProtocol(ShowAccountActivity.this) + account.getHeader();
|
||||
|
@ -1537,6 +1544,17 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
|
|||
return show_boosts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIdentityProof(APIResponse apiResponse) {
|
||||
if( apiResponse == null) {
|
||||
return;
|
||||
}
|
||||
List<IdentityProof> identityProofs = apiResponse.getIdentityProofs();
|
||||
if( identityProofs != null && identityProofs.size() > 0 ){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public enum action {
|
||||
FOLLOW,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 2018 Thomas Schneider
|
||||
/* Copyright 2019 Thomas Schneider
|
||||
*
|
||||
* This file is a part of Fedilab
|
||||
*
|
||||
|
@ -21,37 +21,40 @@ import java.lang.ref.WeakReference;
|
|||
|
||||
import app.fedilab.android.client.API;
|
||||
import app.fedilab.android.client.APIResponse;
|
||||
import app.fedilab.android.interfaces.OnRetrieveHowToInterface;
|
||||
|
||||
import app.fedilab.android.interfaces.OnRetrieveIdentityProofInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Thomas on 29/09/2018.
|
||||
* Retrieves how to videos
|
||||
* Created by Thomas on 17/12/2019.
|
||||
* Retrieves identity
|
||||
*/
|
||||
|
||||
public class RetrieveHowToAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||
public class RetrieveIdentityProofAsyncTask extends AsyncTask<Void, Void, Void> {
|
||||
|
||||
|
||||
private APIResponse apiResponse;
|
||||
private OnRetrieveHowToInterface listener;
|
||||
private OnRetrieveIdentityProofInterface listener;
|
||||
private WeakReference<Context> contextReference;
|
||||
private String userId;
|
||||
|
||||
|
||||
public RetrieveHowToAsyncTask(Context context, OnRetrieveHowToInterface onRetrieveHowToInterface) {
|
||||
public RetrieveIdentityProofAsyncTask(Context context, String userId, OnRetrieveIdentityProofInterface onRetrieveHowToInterface) {
|
||||
this.contextReference = new WeakReference<>(context);
|
||||
this.listener = onRetrieveHowToInterface;
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
API api = new API(this.contextReference.get());
|
||||
apiResponse = api.getHowTo();
|
||||
apiResponse = api.getIdentityProof(userId);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void result) {
|
||||
listener.onRetrieveHowTo(apiResponse);
|
||||
listener.onIdentityProof(apiResponse);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3151,11 +3151,12 @@ public class API {
|
|||
* @param userId user_id String
|
||||
* @return APIResponse
|
||||
*/
|
||||
private APIResponse getIdentityProof(String userId) {
|
||||
public APIResponse getIdentityProof(String userId) {
|
||||
List<IdentityProof> identityProofs = new ArrayList<>();
|
||||
try {
|
||||
HttpsConnection httpsConnection = new HttpsConnection(context, this.instance);
|
||||
String response = httpsConnection.get(getAbsoluteUrl(String.format("/accounts/%s/identity_proofs", userId)), 10, null, prefKeyOauthTokenT);
|
||||
|
||||
identityProofs = parseIdentityProof(context, new JSONArray(response));
|
||||
} catch (UnknownHostException e){
|
||||
} catch(HttpsConnection.HttpsConnectionException e) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright 2018 Thomas Schneider
|
||||
/* Copyright 2019 Thomas Schneider
|
||||
*
|
||||
* This file is a part of Fedilab
|
||||
*
|
||||
|
@ -17,9 +17,9 @@ package app.fedilab.android.interfaces;
|
|||
import app.fedilab.android.client.APIResponse;
|
||||
|
||||
/**
|
||||
* Created by Thomas on 29/09/2018.
|
||||
* Interface when how to videos have been retrieved
|
||||
* Created by Thomas on 17/12/2019.
|
||||
* Interface when identity proof is retrieved
|
||||
*/
|
||||
public interface OnRetrieveHowToInterface {
|
||||
void onRetrieveHowTo(APIResponse apiResponse);
|
||||
public interface OnRetrieveIdentityProofInterface {
|
||||
void onIdentityProof(APIResponse apiResponse);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue