added support for multiple accounts, guardian login bugfixes, ui changes
This commit is contained in:
@@ -4,6 +4,7 @@ import 'dart:io';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
|
||||
|
||||
import '../auth_link/guardian_login_link.dart';
|
||||
import 'pending_share.dart';
|
||||
|
||||
/// Bridges native share intents (Android ACTION_SEND, iOS Share Extension)
|
||||
@@ -39,8 +40,7 @@ class ShareIntentListener {
|
||||
final share = _toPendingShare(items);
|
||||
if (share != null) _publish(share);
|
||||
},
|
||||
onError: (Object e) =>
|
||||
debugPrint('ShareIntentListener stream error: $e'),
|
||||
onError: (Object e) => debugPrint('ShareIntentListener stream error: $e'),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -87,6 +87,16 @@ class ShareIntentListener {
|
||||
unawaited(ReceiveSharingIntent.instance.reset());
|
||||
}
|
||||
|
||||
/// Android hands an opened App Link (guardian login mail) to the share
|
||||
/// plugin as a shared URL too; it belongs to [GuardianLinkListener] only.
|
||||
@visibleForTesting
|
||||
static bool isAppLink(String value) {
|
||||
final uri = Uri.tryParse(value.trim());
|
||||
return uri != null &&
|
||||
uri.hasScheme &&
|
||||
uri.path.endsWith(GuardianLoginLink.path);
|
||||
}
|
||||
|
||||
PendingShare? _toPendingShare(List<SharedMediaFile> items) {
|
||||
if (items.isEmpty) return null;
|
||||
final files = <String>[];
|
||||
@@ -99,7 +109,7 @@ class ShareIntentListener {
|
||||
files.add(item.path);
|
||||
case SharedMediaType.text:
|
||||
case SharedMediaType.url:
|
||||
texts.add(item.path);
|
||||
if (!isAppLink(item.path)) texts.add(item.path);
|
||||
}
|
||||
}
|
||||
if (files.isEmpty && texts.isEmpty) return null;
|
||||
|
||||
Reference in New Issue
Block a user