2022-11-18 03:07:42 +00:00
|
|
|
import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_creator.dart';
|
2023-01-30 15:44:52 +00:00
|
|
|
import 'package:selfprivacy/logic/providers/provider_settings.dart';
|
2022-11-18 03:07:42 +00:00
|
|
|
import 'package:selfprivacy/logic/api_maps/rest_maps/dns_providers/dns_provider_factory.dart';
|
|
|
|
import 'package:selfprivacy/logic/api_maps/rest_maps/server_providers/server_provider_factory.dart';
|
|
|
|
|
|
|
|
class ApiController {
|
|
|
|
static VolumeProviderApiFactory? get currentVolumeProviderApiFactory =>
|
|
|
|
_volumeProviderApiFactory;
|
|
|
|
static DnsProviderApiFactory? get currentDnsProviderApiFactory =>
|
|
|
|
_dnsProviderApiFactory;
|
|
|
|
static ServerProviderApiFactory? get currentServerProviderApiFactory =>
|
|
|
|
_serverProviderApiFactory;
|
|
|
|
|
|
|
|
static void initVolumeProviderApiFactory(
|
2023-01-30 15:44:52 +00:00
|
|
|
final ServerProviderSettings settings,
|
2022-11-18 03:07:42 +00:00
|
|
|
) {
|
|
|
|
_volumeProviderApiFactory =
|
|
|
|
VolumeApiFactoryCreator.createVolumeProviderApiFactory(settings);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void initDnsProviderApiFactory(
|
2023-01-30 15:44:52 +00:00
|
|
|
final DnsProviderFactorySettings settings,
|
2022-11-18 03:07:42 +00:00
|
|
|
) {
|
|
|
|
_dnsProviderApiFactory =
|
|
|
|
ApiFactoryCreator.createDnsProviderApiFactory(settings);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void initServerProviderApiFactory(
|
2023-01-30 15:44:52 +00:00
|
|
|
final ServerProviderSettings settings,
|
2022-11-18 03:07:42 +00:00
|
|
|
) {
|
|
|
|
_serverProviderApiFactory =
|
|
|
|
ApiFactoryCreator.createServerProviderApiFactory(settings);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void clearProviderApiFactories() {
|
|
|
|
_volumeProviderApiFactory = null;
|
|
|
|
_dnsProviderApiFactory = null;
|
|
|
|
_serverProviderApiFactory = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
static VolumeProviderApiFactory? _volumeProviderApiFactory;
|
|
|
|
static DnsProviderApiFactory? _dnsProviderApiFactory;
|
|
|
|
static ServerProviderApiFactory? _serverProviderApiFactory;
|
|
|
|
}
|