diff --git a/app/src/fdroid_full/AndroidManifest.xml b/app/src/fdroid_full/AndroidManifest.xml new file mode 100644 index 0000000..3f8bb61 --- /dev/null +++ b/app/src/fdroid_full/AndroidManifest.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/google_full/AndroidManifest.xml b/app/src/google_full/AndroidManifest.xml new file mode 100644 index 0000000..2647385 --- /dev/null +++ b/app/src/google_full/AndroidManifest.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/app/fedilab/fedilabtube/PeertubeActivity.java b/app/src/main/java/app/fedilab/fedilabtube/PeertubeActivity.java index 2fa2c8a..70085c0 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/PeertubeActivity.java +++ b/app/src/main/java/app/fedilab/fedilabtube/PeertubeActivity.java @@ -94,6 +94,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import app.fedilab.fedilabtube.client.APIResponse; import app.fedilab.fedilabtube.client.RetrofitPeertubeAPI; @@ -207,7 +209,9 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd mode = sharedpreferences.getInt(Helper.SET_VIDEO_MODE, Helper.VIDEO_MODE_NORMAL); - Bundle b = getIntent().getExtras(); + Intent intent = getIntent(); + + Bundle b = intent.getExtras(); if (b != null) { peertubeInstance = b.getString("peertube_instance", Helper.getLiveInstance(PeertubeActivity.this)); videoUuid = b.getString("video_uuid", null); @@ -216,6 +220,16 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd peertube = b.getParcelable("video"); } + if(intent.getData() != null) { //Comes from a link + String url = intent.getData().toString(); + Pattern link = Pattern.compile("(https?://[\\da-z.-]+\\.[a-z.]{2,10})/videos/watch/(\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12})$"); + Matcher matcherLink = link.matcher(url); + if (matcherLink.find()) { + peertubeInstance = matcherLink.group(1).replace("https://","").replace("http://",""); + sepiaSearch = true; // Sepia search flag is used because, at this time we don't know if the video is federated. + videoUuid = matcherLink.group(2); + } + } if (!Helper.isLoggedIn(PeertubeActivity.this) || sepiaSearch) { binding.writeCommentContainerReply.setVisibility(View.GONE); diff --git a/app/src/main/java/app/fedilab/fedilabtube/helper/Helper.java b/app/src/main/java/app/fedilab/fedilabtube/helper/Helper.java index b82fe36..a91441a 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/helper/Helper.java +++ b/app/src/main/java/app/fedilab/fedilabtube/helper/Helper.java @@ -661,6 +661,9 @@ public class Helper { SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); String userName = sharedpreferences.getString(Helper.PREF_KEY_NAME, ""); String instance = sharedpreferences.getString(Helper.PREF_INSTANCE, ""); + if( video == null) { + return false; + } Account account = video.getAccount(); ChannelData.Channel channel = video.getChannel(); if (account != null && instance != null && userName != null) {