2023-05-03 02:42:18 +00:00
|
|
|
import 'package:selfprivacy/logic/providers/dns_providers/dns_provider.dart';
|
|
|
|
import 'package:selfprivacy/logic/providers/dns_providers/dns_provider_factory.dart';
|
2023-01-30 15:44:52 +00:00
|
|
|
import 'package:selfprivacy/logic/providers/provider_settings.dart';
|
2023-05-03 02:42:18 +00:00
|
|
|
import 'package:selfprivacy/logic/providers/server_providers/server_provider.dart';
|
2023-01-30 15:44:52 +00:00
|
|
|
import 'package:selfprivacy/logic/providers/server_providers/server_provider_factory.dart';
|
|
|
|
|
|
|
|
class ProvidersController {
|
|
|
|
static ServerProvider? get currentServerProvider => _serverProvider;
|
2023-05-03 02:42:18 +00:00
|
|
|
static DnsProvider? get currentDnsProvider => _dnsProvider;
|
2023-01-30 15:44:52 +00:00
|
|
|
|
|
|
|
static void initServerProvider(
|
|
|
|
final ServerProviderSettings settings,
|
|
|
|
) {
|
2023-05-03 02:42:18 +00:00
|
|
|
_serverProvider = ServerProviderFactory.createServerProviderInterface(
|
|
|
|
settings,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void initDnsProvider(
|
|
|
|
final DnsProviderSettings settings,
|
|
|
|
) {
|
|
|
|
_dnsProvider = DnsProviderFactory.createDnsProviderInterface(
|
|
|
|
settings,
|
|
|
|
);
|
2023-01-30 15:44:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void clearProviders() {
|
|
|
|
_serverProvider = null;
|
2023-05-03 02:42:18 +00:00
|
|
|
_dnsProvider = null;
|
2023-01-30 15:44:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ServerProvider? _serverProvider;
|
2023-05-03 02:42:18 +00:00
|
|
|
static DnsProvider? _dnsProvider;
|
2023-01-30 15:44:52 +00:00
|
|
|
}
|