Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangtian616 committed Oct 27, 2024
1 parent 83b301b commit 753b51c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
1 change: 1 addition & 0 deletions lib/src/config/theme_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ThemeConfig {

return themeData.copyWith(
appBarTheme: themeData.appBarTheme.copyWith(backgroundColor: themeData.colorScheme.surface),
dialogTheme: DialogTheme(backgroundColor: themeData.colorScheme.surface),
);
}
}
36 changes: 26 additions & 10 deletions lib/src/pages/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,18 @@ class _HomePageState extends State<HomePage> with LoginRequiredMixin, WindowList
return;
}

ReceiveSharingIntent.getInitialText().then(
(String? rawText) {
if (isEmptyOrNull(rawText)) {
ReceiveSharingIntent.instance.getInitialMedia().then(
(List<SharedMediaFile> files) {
if (files.isEmpty) {
return;
}

GalleryUrl? galleryUrl = GalleryUrl.tryParse(rawText!);
SharedMediaFile file = files.first;
if (file.type != SharedMediaType.url) {
return;
}

GalleryUrl? galleryUrl = GalleryUrl.tryParse(file.path);
if (galleryUrl != null) {
toRoute(
Routes.details,
Expand All @@ -134,7 +139,7 @@ class _HomePageState extends State<HomePage> with LoginRequiredMixin, WindowList
return;
}

GalleryImagePageUrl? galleryImagePageUrl = GalleryImagePageUrl.tryParse(rawText);
GalleryImagePageUrl? galleryImagePageUrl = GalleryImagePageUrl.tryParse(file.path);
if (galleryImagePageUrl != null) {
toRoute(
Routes.imagePage,
Expand All @@ -146,11 +151,22 @@ class _HomePageState extends State<HomePage> with LoginRequiredMixin, WindowList

toast('Invalid jump link', isShort: false);
},
);
).whenComplete(() {
ReceiveSharingIntent.instance.reset();
});

_intentDataStreamSubscription = ReceiveSharingIntent.getTextStream().listen(
(String url) {
GalleryUrl? galleryUrl = GalleryUrl.tryParse(url);
_intentDataStreamSubscription = ReceiveSharingIntent.instance.getMediaStream().listen(
(List<SharedMediaFile> files) {
if (files.isEmpty) {
return;
}

SharedMediaFile file = files.first;
if (file.type != SharedMediaType.url) {
return;
}

GalleryUrl? galleryUrl = GalleryUrl.tryParse(file.path);
if (galleryUrl != null) {
toRoute(
Routes.details,
Expand All @@ -161,7 +177,7 @@ class _HomePageState extends State<HomePage> with LoginRequiredMixin, WindowList
return;
}

GalleryImagePageUrl? galleryImagePageUrl = GalleryImagePageUrl.tryParse(url);
GalleryImagePageUrl? galleryImagePageUrl = GalleryImagePageUrl.tryParse(file.path);
if (galleryImagePageUrl != null) {
toRoute(
Routes.imagePage,
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1339,10 +1339,10 @@ packages:
dependency: "direct main"
description:
name: receive_sharing_intent
sha256: "912bebb551bce75a14098891fd750305b30d53eba0d61cc70cd9973be9866e8d"
sha256: ec76056e4d258ad708e76d85591d933678625318e411564dcb9059048ca3a593
url: "https://pub.dev"
source: hosted
version: "1.4.5"
version: "1.8.1"
retry:
dependency: "direct main"
description:
Expand Down

0 comments on commit 753b51c

Please sign in to comment.