fix: fixes remote attachments pointing to unexistent file in local server
This fixes broken links to file attachments from calckey accounts on mastodon instances
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
package org.joinmastodon.android.api.misskey.requests.timelines;
|
||||||
|
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
|
import org.joinmastodon.android.GlobalUserPreferences;
|
||||||
|
import org.joinmastodon.android.api.MastodonAPIRequest;
|
||||||
|
import org.joinmastodon.android.model.Status;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class GetHomeTimeline extends MastodonAPIRequest<List<Status>>{
|
||||||
|
public GetHomeTimeline(String maxID, String minID, int limit, String sinceID){
|
||||||
|
super(HttpMethod.GET, "/timelines/home", new TypeToken<>(){});
|
||||||
|
if(maxID!=null)
|
||||||
|
addQueryParameter("max_id", maxID);
|
||||||
|
if(minID!=null)
|
||||||
|
addQueryParameter("min_id", minID);
|
||||||
|
if(sinceID!=null)
|
||||||
|
addQueryParameter("since_id", sinceID);
|
||||||
|
if(limit>0)
|
||||||
|
addQueryParameter("limit", ""+limit);
|
||||||
|
if(GlobalUserPreferences.replyVisibility != null)
|
||||||
|
addQueryParameter("reply_visibility", GlobalUserPreferences.replyVisibility);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -48,12 +48,12 @@ public class FileStatusDisplayItem extends StatusDisplayItem{
|
|||||||
@Override
|
@Override
|
||||||
public void onBind(FileStatusDisplayItem item){
|
public void onBind(FileStatusDisplayItem item){
|
||||||
title.setText(item.attachment.description == null ? title.getContext().getText(R.string.media_no_description) : item.attachment.description);
|
title.setText(item.attachment.description == null ? title.getContext().getText(R.string.media_no_description) : item.attachment.description);
|
||||||
domain.setText(Uri.parse(item.attachment.url).getHost());
|
domain.setText(Uri.parse(item.attachment.remoteUrl == null ? item.attachment.url : item.attachment.remoteUrl).getHost());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onClick(View v){
|
private void onClick(View v){
|
||||||
UiUtils.openURL(itemView.getContext(), item.parentFragment.getAccountID(), item.attachment.url);
|
UiUtils.openURL(itemView.getContext(), item.parentFragment.getAccountID(), item.attachment.remoteUrl == null ? item.attachment.url : item.attachment.remoteUrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user