Commit c49fe790 authored by Thomas's avatar Thomas
Browse files

Fix Peertube instances picker

parent fc24e633
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ package app.fedilab.android.peertube.activities;
 * see <http://www.gnu.org/licenses>. */

import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE_PEERTUBE_BROWSING;
import static app.fedilab.android.mastodon.helper.Helper.TAG;
import static app.fedilab.android.mastodon.helper.Helper.addFragment;
import static app.fedilab.android.peertube.helper.Helper.recreatePeertubeActivity;

+2 −2
Original line number Diff line number Diff line
@@ -158,12 +158,12 @@ public class PeertubeMainActivity extends PeertubeBaseMainActivity {
        }
    }

    @SuppressLint("ApplySharedPref")
    @SuppressLint({"ApplySharedPref", "MissingSuperCall"})
    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        binding = super.binding;
        binding = super.parentBinding;


        ContextCompat.registerReceiver(PeertubeMainActivity.this, broadcast_data, new IntentFilter(app.fedilab.android.mastodon.helper.Helper.BROADCAST_DATA), ContextCompat.RECEIVER_NOT_EXPORTED);
+8 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_ID;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_INSTANCE;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_SOFTWARE;
import static app.fedilab.android.mastodon.helper.Helper.PREF_USER_TOKEN;
import static app.fedilab.android.mastodon.helper.Helper.TAG;

import android.app.Activity;
import android.content.Context;
@@ -1554,7 +1555,13 @@ public class RetrofitPeertubeAPI {
            Response<WellKnownNodeinfo> response = wellKnownNodeinfoCall.execute();
            if (response.isSuccessful() && response.body() != null) {
                int size = response.body().getLinks().size();
                String url = response.body().getLinks().get(size - 1).getHref();
                String url = null;
                for(int i =0 ; i < size ; i++) {
                    url = response.body().getLinks().get(i).getHref();
                    if(url.contains("nodeinfo")){
                        break;
                    }
                }
                if (size > 0 && url != null) {
                    peertubeService = initTranslation();
                    String path = new URL(url).getPath();
+1 −1
Original line number Diff line number Diff line
@@ -315,7 +315,7 @@ public class FragmentLoginPickInstancePeertube extends Fragment implements Insta
                new StoredInstanceDAO(requireActivity(), db).insertInstance(aboutInstance, instance);
                requireActivity().runOnUiThread(() -> {
                    recreatePeertubeActivity(requireActivity());
                    requireActivity().finish();
                    requireActivity().recreate();
                });
            }).start();
        } else {
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:background="?android:windowBackground">

    <com.google.android.material.card.MaterialCardView
Loading