proxy private tabs
This commit is contained in:
+29
-9
@@ -1,8 +1,10 @@
|
||||
import 'package:fast_equatable/fast_equatable.dart';
|
||||
import 'package:flutter_mozilla_components/flutter_mozilla_components.dart';
|
||||
import 'package:nullability/nullability.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:weblibre/features/geckoview/features/tabs/domain/providers.dart';
|
||||
import 'package:weblibre/features/tor/domain/services/tor_proxy.dart';
|
||||
import 'package:weblibre/features/user/domain/repositories/general_settings.dart';
|
||||
|
||||
part 'proxy_settings_replication.g.dart';
|
||||
|
||||
@@ -25,21 +27,39 @@ class ProxySettingsReplication extends _$ProxySettingsReplication {
|
||||
ref.listen(
|
||||
fireImmediately: true,
|
||||
containersWithCountProvider.select(
|
||||
(value) => EquatableValue(
|
||||
value.valueOrNull
|
||||
?.where((container) => container.metadata.useProxy)
|
||||
.map((container) => container.metadata.contextualIdentity)
|
||||
.nonNulls
|
||||
.toList(),
|
||||
),
|
||||
(value) => EquatableValue(value.valueOrNull),
|
||||
),
|
||||
(previous, next) async {
|
||||
if (next.value != null) {
|
||||
for (final contextId in next.value!) {
|
||||
await _service.addContainerProxy(contextId);
|
||||
for (final container in next.value!) {
|
||||
if (container.metadata.contextualIdentity.isNotEmpty) {
|
||||
if (container.metadata.useProxy) {
|
||||
await _service.addContainerProxy(
|
||||
container.metadata.contextualIdentity!,
|
||||
);
|
||||
} else {
|
||||
await _service.removeContainerProxy(
|
||||
container.metadata.contextualIdentity!,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
ref.listen(
|
||||
fireImmediately: true,
|
||||
generalSettingsRepositoryProvider.select(
|
||||
(value) => value.proxyPrivateTabsTor,
|
||||
),
|
||||
(previous, next) async {
|
||||
if (next) {
|
||||
await _service.addContainerProxy('private');
|
||||
} else {
|
||||
await _service.removeContainerProxy('private');
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ part of 'proxy_settings_replication.dart';
|
||||
// **************************************************************************
|
||||
|
||||
String _$proxySettingsReplicationHash() =>
|
||||
r'9571d178534f68ad3104f1168665ffb57711c6cc';
|
||||
r'cd3a7573abfa0b32562289c02e77f0b44e88a8ae';
|
||||
|
||||
/// See also [ProxySettingsReplication].
|
||||
@ProviderFor(ProxySettingsReplication)
|
||||
|
||||
Reference in New Issue
Block a user