diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 265c5f40..aee112fa 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -40,6 +40,13 @@ + + + + + + + diff --git a/app/src/main/java/io/lbry/browser/MainActivity.java b/app/src/main/java/io/lbry/browser/MainActivity.java index 85918c01..ec91595d 100644 --- a/app/src/main/java/io/lbry/browser/MainActivity.java +++ b/app/src/main/java/io/lbry/browser/MainActivity.java @@ -8,6 +8,7 @@ import android.app.NotificationManager; import android.app.PendingIntent; import android.app.PictureInPictureParams; import android.content.BroadcastReceiver; +import android.content.ClipData; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -560,6 +561,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener protected void onNewIntent(Intent intent) { super.onNewIntent(intent); + checkSendToIntent(intent); checkUrlIntent(intent); checkNotificationOpenIntent(intent); } @@ -814,6 +816,12 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener openFragment(FileViewFragment.class, true, NavMenuItem.ID_ITEM_FOLLOWING, params); } + public void openSendTo(String path) { + Map params = new HashMap<>(); + params.put("directFilePath", path); + openFragment(PublishFormFragment.class, true, NavMenuItem.ID_ITEM_NEW_PUBLISH, params); + } + public void openFileClaim(Claim claim) { Map params = new HashMap<>(); params.put("claimId", claim.getClaimId()); @@ -2625,6 +2633,19 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener LbryAnalytics.logEvent(LbryAnalytics.EVENT_LBRY_NOTIFICATION_OPEN, bundle); } + private void checkSendToIntent(Intent intent) { + String intentAction = intent.getAction(); + if (intentAction != null && intentAction.equals("android.intent.action.SEND")) { + ClipData clipData = intent.getClipData(); + if (clipData != null) { + Uri uri = clipData.getItemAt(0).getUri(); + + String path = Helper.getRealPathFromURI_API19(this, uri); + openSendTo(path); + } + } + } + private void registerServiceActionsReceiver() { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(DownloadManager.ACTION_DOWNLOAD_EVENT);