Fix issues with notifications and Peertube

This commit is contained in:
tom79 2019-06-07 18:50:49 +02:00
parent 03874c6794
commit ff7c4825ce
7 changed files with 40 additions and 8 deletions

View File

@ -6,8 +6,8 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 279
versionName "2.4.0"
versionCode 280
versionName "2.5.0"
multiDexEnabled true
renderscriptTargetApi 28 as int
renderscriptSupportModeEnabled true

View File

@ -716,12 +716,16 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
if( (account.getAvatar() == null || account.getAvatar().equals("null"))&& MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PEERTUBE) {
Glide.with(getApplicationContext()).load(R.drawable.missing_peertube).apply(RequestOptions.circleCropTransform()).into(account_pp);
}else{
String url = account.getAvatar();
if( url != null && url.startsWith("/")){
url = Helper.getLiveInstanceWithProtocol(ShowAccountActivity.this) + url;
}
if( !disableGif)
Glide.with(getApplicationContext()).load(account.getAvatar()).apply(RequestOptions.circleCropTransform()).into(account_pp);
else
Glide.with(getApplicationContext()).load(url).apply(RequestOptions.circleCropTransform()).into(account_pp);
else {
Glide.with(getApplicationContext())
.asBitmap()
.load(account.getAvatar())
.load(url)
.into(new SimpleTarget<Bitmap>() {
@Override
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
@ -730,6 +734,7 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
account_pp.setImageDrawable(circularBitmapDrawable);
}
});
}
}
account_pp.setOnClickListener(new View.OnClickListener() {
@Override
@ -899,8 +904,8 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
DisplayAccountsFragment displayAccountsFragment = new DisplayAccountsFragment();
bundle.putSerializable("type", RetrieveAccountsAsyncTask.Type.CHANNELS);
bundle.putString("targetedid", account.getId());
bundle.putString("instance",account.getAcct().split("@")[1]);
bundle.putString("name",account.getAcct().split("@")[0]);
bundle.putString("instance", Helper.getLiveInstance(ShowAccountActivity.this));
bundle.putString("name",account.getAcct());
displayAccountsFragment.setArguments(bundle);
return displayAccountsFragment;
}else{

View File

@ -1195,6 +1195,7 @@ public class API {
accounts = parseAccountResponsePeertube(context, instance, jsonArray);
} catch (HttpsConnection.HttpsConnectionException e) {
setError(e.getStatusCode(), e);
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (IOException e) {

View File

@ -27,6 +27,7 @@ public class PeertubeAccountNotification {
private String displayName;
private String name;
private String type;
private String host;
public String getId() {
return id;
@ -67,4 +68,12 @@ public class PeertubeAccountNotification {
public void setType(String type) {
this.type = type;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
}

View File

@ -17,6 +17,7 @@ package app.fedilab.android.client;
import android.content.Context;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@ -426,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();
@ -1559,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);
}
@ -1606,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());
}

View File

@ -23,6 +23,7 @@ import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -188,7 +189,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter {
Intent intent = new Intent(context, ShowAccountActivity.class);
Bundle b = new Bundle();
b.putBoolean("peertubeaccount", true);
b.putString("accountId", finalAccountAction.getName());
b.putString("accountId", finalAccountAction.getName() + "@" + finalAccountAction.getHost());
intent.putExtras(b);
context.startActivity(intent);
}

View File

@ -0,0 +1,8 @@
Added
- Allow to mute a conversation
Changed
- Improve the upload for Peertube
Fixed
- Fix an issue when using GIF from keyboard