diff options
Diffstat (limited to 'app/src/main/java/app/fedilab/android/client/PeertubeAPI.java')
-rw-r--r-- | app/src/main/java/app/fedilab/android/client/PeertubeAPI.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/app/src/main/java/app/fedilab/android/client/PeertubeAPI.java b/app/src/main/java/app/fedilab/android/client/PeertubeAPI.java index 04c2a3a23..bb0c9e49a 100644 --- a/app/src/main/java/app/fedilab/android/client/PeertubeAPI.java +++ b/app/src/main/java/app/fedilab/android/client/PeertubeAPI.java @@ -21,8 +21,6 @@ import android.database.sqlite.SQLiteDatabase; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; - -import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; @@ -429,6 +427,7 @@ public class PeertubeAPI { String response = new HttpsConnection(context, this.instance).get(getAbsoluteUrl(String.format("/accounts/%s",accountId)), 60, null, prefKeyOauthTokenT); account = parseAccountResponsePeertube(context, new JSONObject(response)); } catch (HttpsConnection.HttpsConnectionException e) { + e.printStackTrace(); setError(e.getStatusCode(), e); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); @@ -764,11 +763,10 @@ public class PeertubeAPI { targetedAccount.setToken(values.get("access_token")); String token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null); //This account is currently logged in, the token is updated - if (prefKeyOauthTokenT.equals(token)) { - SharedPreferences.Editor editor = sharedpreferences.edit(); - editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, targetedAccount.getToken()); - editor.apply(); - } + SharedPreferences.Editor editor = sharedpreferences.edit(); + prefKeyOauthTokenT = targetedAccount.getToken(); + editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, targetedAccount.getToken()); + editor.apply(); } if (values.containsKey("refresh_token") && values.get("refresh_token") != null) targetedAccount.setRefresh_token(values.get("refresh_token")); @@ -1563,6 +1561,9 @@ public class PeertubeAPI { peertubeAccountNotification.setDisplayName(account.get("displayName").toString()); peertubeAccountNotification.setName(account.get("name").toString()); peertubeAccountNotification.setId(account.get("id").toString()); + if( account.has("host")) { + peertubeAccountNotification.setHost(account.get("host").toString()); + } peertubeAccountNotification.setAvatar(account.getJSONObject("avatar").get("path").toString()); peertubeComment.setPeertubeAccountNotification(peertubeAccountNotification); } @@ -1610,6 +1611,9 @@ public class PeertubeAPI { peertubeAccountNotification.setDisplayName(follower.get("displayName").toString()); peertubeAccountNotification.setName(follower.get("name").toString()); peertubeAccountNotification.setId(follower.get("id").toString()); + if( follower.has("host")) { + peertubeAccountNotification.setHost(follower.get("host").toString()); + } if( follower.has("avatar")){ peertubeAccountNotification.setAvatar(follower.getJSONObject("avatar").get("path").toString()); } |