8989import it .niedermann .nextcloud .deck .ui .accountswitcher .AccountSwitcherDialog ;
9090import it .niedermann .nextcloud .deck .ui .board .ArchiveBoardListener ;
9191import it .niedermann .nextcloud .deck .ui .board .DeleteBoardListener ;
92+ import it .niedermann .nextcloud .deck .ui .board .ShareBoardLinkListener ;
9293import it .niedermann .nextcloud .deck .ui .board .edit .EditBoardDialogFragment ;
9394import it .niedermann .nextcloud .deck .ui .board .edit .EditBoardListener ;
9495import it .niedermann .nextcloud .deck .ui .card .CardActionListener ;
@@ -123,6 +124,7 @@ public class MainActivity extends AppCompatActivity implements DeleteStackListen
123124 DeleteBoardListener ,
124125 EditBoardListener ,
125126 ArchiveBoardListener ,
127+ ShareBoardLinkListener ,
126128 OnScrollListener ,
127129 CreateCardListener ,
128130 CardActionListener ,
@@ -1103,4 +1105,18 @@ protected void showExceptionDialog(@NonNull Throwable throwable, @Nullable Accou
11031105 .newInstance (throwable , account )
11041106 .show (getSupportFragmentManager (), ExceptionDialogFragment .class .getSimpleName ()));
11051107 }
1108+
1109+ @ Override
1110+ public void onShareBoardLink (Board board ) {
1111+ mainViewModel .getAccountFuture (board .getAccountId ()).thenAcceptAsync (account -> {
1112+ final int shareLinkRes = account .getServerDeckVersionAsObject ().getShareBoardLinkResource ();
1113+ final var shareIntent = new Intent ()
1114+ .setAction (Intent .ACTION_SEND )
1115+ .setType (TEXT_PLAIN )
1116+ .putExtra (Intent .EXTRA_SUBJECT , board .getTitle ())
1117+ .putExtra (Intent .EXTRA_TITLE , board .getTitle ())
1118+ .putExtra (Intent .EXTRA_TEXT , account .getUrl () + getString (shareLinkRes , board .getId ()));
1119+ startActivity (Intent .createChooser (shareIntent , board .getTitle ()));
1120+ }, ContextCompat .getMainExecutor (this ));
1121+ }
11061122}
0 commit comments