Add Supa account and search changes

This commit is contained in:
Fabian Freund
2026-05-22 18:10:22 +02:00
parent 3a19865b2e
commit 51289f1266
374 changed files with 54061 additions and 5013 deletions
@@ -26,11 +26,61 @@ class IntentReceiver extends IntentEvents {
final _controller = StreamController<Intent>.broadcast();
int? _lastAdded;
Stream<Intent> get events => _controller.stream;
/// Intent events, including the cold-start launch intent for each listener.
///
/// New-intent callbacks still arrive through the broadcast controller below.
/// The initial intent is replayed per listener so existing callers that only
/// listen to [events] continue to receive terminated-app launches.
Stream<Intent> get events {
return Stream.multi((controller) {
final subscription = _controller.stream.listen(
controller.add,
onError: controller.addError,
onDone: controller.close,
);
unawaited(
initialIntent.then(
(intent) {
if (intent != null && !controller.isClosed) {
controller.add(intent);
}
},
onError: (Object error, StackTrace stackTrace) {
if (!controller.isClosed) {
controller.addError(error, stackTrace);
}
},
),
);
controller.onCancel = subscription.cancel;
}, isBroadcast: true);
}
/// The launch intent recovered from the host, if any. Resolves to
/// `Future<null>` for instances not constructed via [IntentReceiver.setUp]
/// (e.g. test fakes / subclasses), so callers can always `await` without
/// guarding for `LateInitializationError`.
///
/// On cold start the Android plugin sees the launch intent from
/// onAttachedToActivity before Dart has registered the Pigeon handler, so it
/// caches the value for Dart to recover. The [events] stream already replays
/// this value for compatibility; use this future directly only when the
/// launch intent needs one-shot handling outside the event stream.
///
/// Note on rotation: the Android plugin's `pendingInitialIntent` cache
/// is intentionally overwritten on configuration change. If the user
/// triggers a new deep link via the activity launcher before Dart
/// drains the previous initial intent (rare — the future is read on
/// IntentReceiver construction, which happens during app bootstrap),
/// only the newest intent is delivered.
Future<Intent?> initialIntent = Future.value(null);
@override
void onIntentReceived(int sequence, Intent intent) {
if (_lastAdded == null || sequence > _lastAdded!) {
_lastAdded = sequence;
_controller.add(intent);
}
}
@@ -44,6 +94,12 @@ class IntentReceiver extends IntentEvents {
binaryMessenger: binaryMessenger,
messageChannelSuffix: messageChannelSuffix,
);
final host = IntentHost(
binaryMessenger: binaryMessenger,
messageChannelSuffix: messageChannelSuffix,
);
initialIntent = host.getInitialIntent();
}
Future<void> dispose() async {
@@ -199,6 +199,43 @@ class _PigeonCodec extends StandardMessageCodec {
}
}
class IntentHost {
/// Constructor for [IntentHost]. The [binaryMessenger] named argument is
/// available for dependency injection. If it is left null, the default
/// BinaryMessenger will be used which routes to the host platform.
IntentHost({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''})
: pigeonVar_binaryMessenger = binaryMessenger,
pigeonVar_messageChannelSuffix = messageChannelSuffix.isNotEmpty ? '.$messageChannelSuffix' : '';
final BinaryMessenger? pigeonVar_binaryMessenger;
static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();
final String pigeonVar_messageChannelSuffix;
/// Returns the launch intent that started the activity, if any.
/// This allows Dart to retrieve an intent that arrived before
/// IntentEvents.setUp() was called (cold-start deep links).
/// Returns null if no launch intent is pending.
Future<Intent?> getInitialIntent() async {
final pigeonVar_channelName = 'dev.flutter.pigeon.simple_intent_receiver.IntentHost.getInitialIntent$pigeonVar_messageChannelSuffix';
final pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null);
final pigeonVar_replyList = await pigeonVar_sendFuture as List<Object?>?;
final Object? pigeonVar_replyValue = _extractReplyValueOrThrow(
pigeonVar_replyList,
pigeonVar_channelName,
isNullValid: true,
)
;
return pigeonVar_replyValue as Intent?;
}
}
abstract class IntentEvents {
static const MessageCodec<Object?> pigeonChannelCodec = _PigeonCodec();