mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2024-11-09 02:13:15 +00:00
45 lines
1.6 KiB
Dart
45 lines
1.6 KiB
Dart
|
import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_creator.dart';
|
||
|
import 'package:selfprivacy/logic/api_maps/rest_maps/api_factory_settings.dart';
|
||
|
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(
|
||
|
final ServerProviderApiFactorySettings settings,
|
||
|
) {
|
||
|
_volumeProviderApiFactory =
|
||
|
VolumeApiFactoryCreator.createVolumeProviderApiFactory(settings);
|
||
|
}
|
||
|
|
||
|
static void initDnsProviderApiFactory(
|
||
|
final DnsProviderApiFactorySettings settings,
|
||
|
) {
|
||
|
_dnsProviderApiFactory =
|
||
|
ApiFactoryCreator.createDnsProviderApiFactory(settings);
|
||
|
}
|
||
|
|
||
|
static void initServerProviderApiFactory(
|
||
|
final ServerProviderApiFactorySettings settings,
|
||
|
) {
|
||
|
_serverProviderApiFactory =
|
||
|
ApiFactoryCreator.createServerProviderApiFactory(settings);
|
||
|
}
|
||
|
|
||
|
static void clearProviderApiFactories() {
|
||
|
_volumeProviderApiFactory = null;
|
||
|
_dnsProviderApiFactory = null;
|
||
|
_serverProviderApiFactory = null;
|
||
|
}
|
||
|
|
||
|
static VolumeProviderApiFactory? _volumeProviderApiFactory;
|
||
|
static DnsProviderApiFactory? _dnsProviderApiFactory;
|
||
|
static ServerProviderApiFactory? _serverProviderApiFactory;
|
||
|
}
|