fix(mobile): copy shared link (#6310)

* fix(mobile): copy shared link

* fix: handle trailing slash

---------

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2024-01-10 15:32:09 +00:00 committed by GitHub
parent 0e0a472de1
commit 4f942bc182
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 16 deletions

View file

@ -76,8 +76,11 @@ class SharedLinkItem extends ConsumerWidget {
final externalDomain = ref.read(
serverInfoProvider.select((s) => s.serverConfig.externalDomain),
);
final serverUrl =
var serverUrl =
externalDomain.isNotEmpty ? externalDomain : getServerUrl();
if (serverUrl != null && !serverUrl.endsWith('/')) {
serverUrl += '/';
}
if (serverUrl == null) {
ImmichToast.show(
context: context,
@ -89,9 +92,7 @@ class SharedLinkItem extends ConsumerWidget {
}
Clipboard.setData(
ClipboardData(
text: "$serverUrl/share/${sharedLink.key}",
),
ClipboardData(text: "${serverUrl}share/${sharedLink.key}"),
).then((_) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(