Fix Pixelfed account fetch

This commit is contained in:
tom79 2019-07-15 09:10:22 +02:00
parent 253f17441e
commit 69d5891161
2 changed files with 20 additions and 12 deletions

View File

@ -19,6 +19,7 @@ import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
@ -3285,18 +3286,21 @@ public class API {
} }
if( offset != null) if( offset != null)
params.put("offset", offset); params.put("offset", offset);
switch (type){ if( type != null) {
case TAGS: switch (type) {
params.put("type", "hashtags"); case TAGS:
break; params.put("type", "hashtags");
case ACCOUNTS: break;
params.put("type", "accounts"); case ACCOUNTS:
break; params.put("type", "accounts");
case STATUSES: break;
params.put("type", "statuses"); case STATUSES:
break; params.put("type", "statuses");
break;
}
} }
params.put("limit", "20"); params.put("limit", "20");
params.put("resolve", "true");
try { try {
HttpsConnection httpsConnection = new HttpsConnection(context, this.instance); HttpsConnection httpsConnection = new HttpsConnection(context, this.instance);
String response = httpsConnection.get(getAbsoluteUr2l("/search"), 10, params, prefKeyOauthTokenT); String response = httpsConnection.get(getAbsoluteUr2l("/search"), 10, params, prefKeyOauthTokenT);
@ -5409,7 +5413,11 @@ public class API {
account.setAcct(resobj.get("acct").toString()); account.setAcct(resobj.get("acct").toString());
account.setDisplay_name(resobj.get("display_name").toString()); account.setDisplay_name(resobj.get("display_name").toString());
account.setLocked(Boolean.parseBoolean(resobj.get("locked").toString())); account.setLocked(Boolean.parseBoolean(resobj.get("locked").toString()));
account.setCreated_at(Helper.mstStringToDate(context, resobj.get("created_at").toString())); if( resobj.has("created_at") && !resobj.isNull("created_at")) {
account.setCreated_at(Helper.mstStringToDate(context, resobj.get("created_at").toString()));
}else {
account.setCreated_at(new Date());
}
account.setFollowers_count(Integer.valueOf(resobj.get("followers_count").toString())); account.setFollowers_count(Integer.valueOf(resobj.get("followers_count").toString()));
account.setFollowing_count(Integer.valueOf(resobj.get("following_count").toString())); account.setFollowing_count(Integer.valueOf(resobj.get("following_count").toString()));
account.setStatuses_count(Integer.valueOf(resobj.get("statuses_count").toString())); account.setStatuses_count(Integer.valueOf(resobj.get("statuses_count").toString()));

View File

@ -334,7 +334,7 @@ public class CrossActions {
else else
url = "https://" + remoteAccount.getInstance() + "/@" + remoteAccount.getAcct(); url = "https://" + remoteAccount.getInstance() + "/@" + remoteAccount.getAcct();
} }
APIResponse apiResponse = api.search(url); APIResponse apiResponse = api.search2(url, null, null);
response = apiResponse.getResults(); response = apiResponse.getResults();
return null; return null;
} }