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 { defaultConfig {
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 28 targetSdkVersion 28
versionCode 279 versionCode 280
versionName "2.4.0" versionName "2.5.0"
multiDexEnabled true multiDexEnabled true
renderscriptTargetApi 28 as int renderscriptTargetApi 28 as int
renderscriptSupportModeEnabled true 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) { 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); Glide.with(getApplicationContext()).load(R.drawable.missing_peertube).apply(RequestOptions.circleCropTransform()).into(account_pp);
}else{ }else{
String url = account.getAvatar();
if( url != null && url.startsWith("/")){
url = Helper.getLiveInstanceWithProtocol(ShowAccountActivity.this) + url;
}
if( !disableGif) if( !disableGif)
Glide.with(getApplicationContext()).load(account.getAvatar()).apply(RequestOptions.circleCropTransform()).into(account_pp); Glide.with(getApplicationContext()).load(url).apply(RequestOptions.circleCropTransform()).into(account_pp);
else else {
Glide.with(getApplicationContext()) Glide.with(getApplicationContext())
.asBitmap() .asBitmap()
.load(account.getAvatar()) .load(url)
.into(new SimpleTarget<Bitmap>() { .into(new SimpleTarget<Bitmap>() {
@Override @Override
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) { 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.setImageDrawable(circularBitmapDrawable);
} }
}); });
}
} }
account_pp.setOnClickListener(new View.OnClickListener() { account_pp.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -899,8 +904,8 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
DisplayAccountsFragment displayAccountsFragment = new DisplayAccountsFragment(); DisplayAccountsFragment displayAccountsFragment = new DisplayAccountsFragment();
bundle.putSerializable("type", RetrieveAccountsAsyncTask.Type.CHANNELS); bundle.putSerializable("type", RetrieveAccountsAsyncTask.Type.CHANNELS);
bundle.putString("targetedid", account.getId()); bundle.putString("targetedid", account.getId());
bundle.putString("instance",account.getAcct().split("@")[1]); bundle.putString("instance", Helper.getLiveInstance(ShowAccountActivity.this));
bundle.putString("name",account.getAcct().split("@")[0]); bundle.putString("name",account.getAcct());
displayAccountsFragment.setArguments(bundle); displayAccountsFragment.setArguments(bundle);
return displayAccountsFragment; return displayAccountsFragment;
}else{ }else{

View File

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

View File

@ -27,6 +27,7 @@ public class PeertubeAccountNotification {
private String displayName; private String displayName;
private String name; private String name;
private String type; private String type;
private String host;
public String getId() { public String getId() {
return id; return id;
@ -67,4 +68,12 @@ public class PeertubeAccountNotification {
public void setType(String type) { public void setType(String type) {
this.type = 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.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; 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); String response = new HttpsConnection(context, this.instance).get(getAbsoluteUrl(String.format("/accounts/%s",accountId)), 60, null, prefKeyOauthTokenT);
account = parseAccountResponsePeertube(context, new JSONObject(response)); account = parseAccountResponsePeertube(context, new JSONObject(response));
} catch (HttpsConnection.HttpsConnectionException e) { } catch (HttpsConnection.HttpsConnectionException e) {
e.printStackTrace();
setError(e.getStatusCode(), e); setError(e.getStatusCode(), e);
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
e.printStackTrace(); e.printStackTrace();
@ -1559,6 +1561,9 @@ public class PeertubeAPI {
peertubeAccountNotification.setDisplayName(account.get("displayName").toString()); peertubeAccountNotification.setDisplayName(account.get("displayName").toString());
peertubeAccountNotification.setName(account.get("name").toString()); peertubeAccountNotification.setName(account.get("name").toString());
peertubeAccountNotification.setId(account.get("id").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()); peertubeAccountNotification.setAvatar(account.getJSONObject("avatar").get("path").toString());
peertubeComment.setPeertubeAccountNotification(peertubeAccountNotification); peertubeComment.setPeertubeAccountNotification(peertubeAccountNotification);
} }
@ -1606,6 +1611,9 @@ public class PeertubeAPI {
peertubeAccountNotification.setDisplayName(follower.get("displayName").toString()); peertubeAccountNotification.setDisplayName(follower.get("displayName").toString());
peertubeAccountNotification.setName(follower.get("name").toString()); peertubeAccountNotification.setName(follower.get("name").toString());
peertubeAccountNotification.setId(follower.get("id").toString()); peertubeAccountNotification.setId(follower.get("id").toString());
if( follower.has("host")) {
peertubeAccountNotification.setHost(follower.get("host").toString());
}
if( follower.has("avatar")){ if( follower.has("avatar")){
peertubeAccountNotification.setAvatar(follower.getJSONObject("avatar").get("path").toString()); 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.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.Html; import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -188,7 +189,7 @@ public class PeertubeNotificationsListAdapter extends RecyclerView.Adapter {
Intent intent = new Intent(context, ShowAccountActivity.class); Intent intent = new Intent(context, ShowAccountActivity.class);
Bundle b = new Bundle(); Bundle b = new Bundle();
b.putBoolean("peertubeaccount", true); b.putBoolean("peertubeaccount", true);
b.putString("accountId", finalAccountAction.getName()); b.putString("accountId", finalAccountAction.getName() + "@" + finalAccountAction.getHost());
intent.putExtras(b); intent.putExtras(b);
context.startActivity(intent); 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