costom tabs setting

This commit is contained in:
Fabian Freund
2026-07-07 17:17:07 +02:00
parent 9cdaa9735c
commit 1b4a74865a
13 changed files with 184 additions and 18 deletions
@@ -45,7 +45,12 @@ class NativeIntentGatekeeperReplicator
Future<void>? _pendingAllowSync;
Future<void> _push(
({bool enabled, Map<String, IntentSourcePolicy> policies}) config,
({
bool enabled,
Map<String, IntentSourcePolicy> policies,
bool customTabsEnabled,
})
config,
) async {
final blocked = config.policies.entries
.where((entry) => entry.value == IntentSourcePolicy.block)
@@ -54,6 +59,7 @@ class NativeIntentGatekeeperReplicator
try {
await _api.setConfig(config.enabled, blocked);
await _api.setCustomTabsEnabled(config.customTabsEnabled);
} catch (error, stackTrace) {
logger.e(
'Failed to replicate intent gatekeeper config to native',
@@ -116,6 +122,7 @@ class NativeIntentGatekeeperReplicator
(settings) => EquatableValue((
enabled: settings.blockExternalAppsEnabled,
policies: settings.externalAppIntentPolicies,
customTabsEnabled: settings.customTabsEnabled,
)),
),
fireImmediately: true,
@@ -125,6 +132,7 @@ class NativeIntentGatekeeperReplicator
if (previous != null &&
previous.enabled == next.enabled &&
previous.customTabsEnabled == next.customTabsEnabled &&
const DeepCollectionEquality.unordered().equals(
previous.policies,
next.policies,
@@ -139,6 +147,7 @@ class NativeIntentGatekeeperReplicator
await _push((
enabled: settings.blockExternalAppsEnabled,
policies: settings.externalAppIntentPolicies,
customTabsEnabled: settings.customTabsEnabled,
));
}());
},
@@ -65,7 +65,7 @@ final class NativeIntentGatekeeperReplicatorProvider
}
String _$nativeIntentGatekeeperReplicatorHash() =>
r'bb2e2a252143879e558d513f9c48f3e66513baa9';
r'1425d7d540d872d82a2d97e0a9fff6a4f6d9ae7b';
/// Mirrors the Flutter-side block list to the native side so the
/// `IntentReceiverActivity` can reject intents without launching Flutter.