feat: trim instance URL on InstanceInfoFragment

This is for the akkoma instances, where the local timeline would be inaccessible due to the https header being there. And it also looks better
This commit is contained in:
LucasGGamerM 2023-06-14 21:29:37 -03:00
parent 45e3cc2d24
commit f197d6f19a
1 changed files with 8 additions and 0 deletions

View File

@ -49,6 +49,8 @@ import org.joinmastodon.android.ui.views.CoverImageView;
import org.joinmastodon.android.ui.views.LinkedTextView;
import org.parceler.Parcels;
import java.net.URI;
import java.net.URISyntaxException;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Collections;
@ -166,6 +168,12 @@ public class InstanceInfoFragment extends LoaderFragment {
public void onSuccess(Instance result){
if (getActivity() == null) return;
instance = result;
try {
// This is for akkoma instances where the instance URI contains the https header as well, so this is to get rid of it
instance.uri = new URI(instance.uri).getHost();
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
bindViews();
dataLoaded();
invalidateOptionsMenu();