mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2025-04-06 07:00:01 +03:00
Fix Peertube instances picker
This commit is contained in:
parent
fc24e63319
commit
c49fe7901a
6 changed files with 16 additions and 7 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -24,14 +24,14 @@ import app.fedilab.android.mastodon.activities.BaseActivity;
|
|||
|
||||
public class PeertubeBaseMainActivity extends BaseActivity {
|
||||
|
||||
protected ActivityMainPeertubeBinding binding;
|
||||
protected ActivityMainPeertubeBinding parentBinding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = ActivityMainPeertubeBinding.inflate(getLayoutInflater());
|
||||
View view = binding.getRoot();
|
||||
parentBinding = ActivityMainPeertubeBinding.inflate(getLayoutInflater());
|
||||
View view = parentBinding.getRoot();
|
||||
setContentView(view);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue