mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-08 00:51:20 +00:00
chore: resolve ui conflicts and make it build
This commit is contained in:
parent
3b49805c9c
commit
4aa13dd63a
|
@ -3,7 +3,6 @@ import 'dart:async';
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:selfprivacy/config/get_it_config.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server_api.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart';
|
||||
import 'package:selfprivacy/logic/common_enum/common_enum.dart';
|
||||
import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart';
|
||||
import 'package:selfprivacy/logic/models/disk_size.dart';
|
||||
|
@ -36,7 +35,7 @@ class ApiProviderVolumeCubit
|
|||
}
|
||||
|
||||
Future<void> _refetch() async {
|
||||
if (ApiController.currentVolumeProviderApiFactory == null) {
|
||||
if (ProvidersController.currentServerProvider == null) {
|
||||
return emit(const ApiProviderVolumeState([], LoadingStatus.error, false));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,23 +1,22 @@
|
|||
import 'package:selfprivacy/config/get_it_config.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/graphql_maps/server_api/server_api.dart';
|
||||
import 'package:selfprivacy/logic/api_maps/rest_maps/api_controller.dart';
|
||||
import 'package:selfprivacy/logic/models/auto_upgrade_settings.dart';
|
||||
import 'package:selfprivacy/logic/models/server_metadata.dart';
|
||||
import 'package:selfprivacy/logic/models/timezone_settings.dart';
|
||||
import 'package:selfprivacy/logic/providers/providers_controller.dart';
|
||||
|
||||
class ServerDetailsRepository {
|
||||
ServerApi server = ServerApi();
|
||||
|
||||
Future<ServerDetailsRepositoryDto> load() async {
|
||||
final serverProviderApi = ApiController.currentServerProviderApiFactory;
|
||||
final serverProviderApi = ProvidersController.currentServerProvider;
|
||||
final settings = await server.getSystemSettings();
|
||||
final serverId = getIt<ApiConfigModel>().serverDetails!.id;
|
||||
final metadata =
|
||||
await serverProviderApi!.getServerProvider().getMetadata(serverId);
|
||||
final metadata = await serverProviderApi?.getMetadata(serverId);
|
||||
|
||||
return ServerDetailsRepositoryDto(
|
||||
autoUpgradeSettings: settings.autoUpgradeSettings,
|
||||
metadata: metadata,
|
||||
metadata: metadata!.data,
|
||||
serverTimezone: TimeZoneSettings.fromString(
|
||||
settings.timezone,
|
||||
),
|
||||
|
|
|
@ -61,16 +61,7 @@ class ServerInstallationRepository {
|
|||
if (serverProvider != null ||
|
||||
(serverDetails != null &&
|
||||
serverDetails.provider != ServerProviderType.unknown)) {
|
||||
ApiController.initServerProviderApiFactory(
|
||||
ServerProviderSettings(
|
||||
provider: serverProvider ?? serverDetails!.provider,
|
||||
location: location,
|
||||
),
|
||||
);
|
||||
|
||||
// All current providers support volumes
|
||||
// so it's safe to hardcode for now
|
||||
ApiController.initVolumeProviderApiFactory(
|
||||
ProvidersController.initServerProvider(
|
||||
ServerProviderSettings(
|
||||
provider: serverProvider ?? serverDetails!.provider,
|
||||
location: location,
|
||||
|
@ -250,8 +241,7 @@ class ServerInstallationRepository {
|
|||
}) async {
|
||||
final DnsProviderApi dnsProviderApi =
|
||||
ApiController.currentDnsProviderApiFactory!.getDnsProvider();
|
||||
final ServerProviderApi serverApi =
|
||||
ApiController.currentServerProviderApiFactory!.getServerProvider();
|
||||
final serverProvider = ProvidersController.currentServerProvider!;
|
||||
|
||||
void showDomainErrorPopUp(final String error) {
|
||||
showPopUpAlert(
|
||||
|
@ -260,8 +250,8 @@ class ServerInstallationRepository {
|
|||
cancelButtonOnPressed: onCancel,
|
||||
actionButtonTitle: 'basis.delete'.tr(),
|
||||
actionButtonOnPressed: () async {
|
||||
await serverApi.deleteServer(
|
||||
domainName: domain.domainName,
|
||||
await serverProvider.deleteServer(
|
||||
domain.domainName,
|
||||
);
|
||||
onCancel();
|
||||
},
|
||||
|
@ -299,16 +289,6 @@ class ServerInstallationRepository {
|
|||
return false;
|
||||
}
|
||||
|
||||
final GenericResult createReverseResult = await serverApi.createReverseDns(
|
||||
serverDetails: serverDetails,
|
||||
domain: domain,
|
||||
);
|
||||
|
||||
if (!createReverseResult.success) {
|
||||
showDomainErrorPopUp(errorMessage);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -586,9 +566,7 @@ class ServerInstallationRepository {
|
|||
}
|
||||
|
||||
Future<List<ServerBasicInfo>> getServersOnProviderAccount() async =>
|
||||
ApiController.currentServerProviderApiFactory!
|
||||
.getServerProvider()
|
||||
.getServers();
|
||||
(await ProvidersController.currentServerProvider!.getServers()).data;
|
||||
|
||||
Future<void> saveServerDetails(
|
||||
final ServerHostingDetails serverDetails,
|
||||
|
@ -681,12 +659,10 @@ class ServerInstallationRepository {
|
|||
}
|
||||
|
||||
Future<bool> deleteServer(final ServerDomain serverDomain) async {
|
||||
final GenericResult<bool> deletionResult = await ApiController
|
||||
.currentServerProviderApiFactory!
|
||||
.getServerProvider()
|
||||
.deleteServer(
|
||||
domainName: serverDomain.domainName,
|
||||
);
|
||||
final deletionResult =
|
||||
await ProvidersController.currentServerProvider!.deleteServer(
|
||||
serverDomain.domainName,
|
||||
);
|
||||
|
||||
if (!deletionResult.success) {
|
||||
getIt<NavigationService>()
|
||||
|
@ -694,12 +670,6 @@ class ServerInstallationRepository {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!deletionResult.data) {
|
||||
getIt<NavigationService>()
|
||||
.showSnackBar('modals.server_deletion_error'.tr());
|
||||
return false;
|
||||
}
|
||||
|
||||
await box.put(BNames.hasFinalChecked, false);
|
||||
await box.put(BNames.isServerStarted, false);
|
||||
await box.put(BNames.isServerResetedFirstTime, false);
|
||||
|
|
|
@ -5,6 +5,8 @@ import 'package:selfprivacy/logic/models/hive/server_details.dart';
|
|||
import 'package:selfprivacy/logic/models/launch_installation_data.dart';
|
||||
import 'package:selfprivacy/logic/models/metrics.dart';
|
||||
import 'package:selfprivacy/logic/models/price.dart';
|
||||
import 'package:selfprivacy/logic/models/server_basic_info.dart';
|
||||
import 'package:selfprivacy/logic/models/server_metadata.dart';
|
||||
import 'package:selfprivacy/logic/models/server_provider_location.dart';
|
||||
import 'package:selfprivacy/logic/models/server_type.dart';
|
||||
|
||||
|
@ -12,12 +14,17 @@ export 'package:selfprivacy/logic/api_maps/generic_result.dart';
|
|||
export 'package:selfprivacy/logic/models/launch_installation_data.dart';
|
||||
|
||||
abstract class ServerProvider {
|
||||
Future<GenericResult<List<ServerBasicInfo>>> getServers();
|
||||
Future<GenericResult<bool>> trySetServerLocation(final String location);
|
||||
Future<GenericResult<bool>> tryInitApiByToken(final String token);
|
||||
Future<GenericResult<List<ServerProviderLocation>>> getAvailableLocations();
|
||||
Future<GenericResult<List<ServerType>>> getServerTypes({
|
||||
required final ServerProviderLocation location,
|
||||
});
|
||||
|
||||
Future<GenericResult<CallbackDialogueBranching?>> deleteServer(
|
||||
final String hostname,
|
||||
);
|
||||
Future<GenericResult<CallbackDialogueBranching?>> launchInstallation(
|
||||
final LaunchInstallationData installationData,
|
||||
);
|
||||
|
@ -42,5 +49,8 @@ abstract class ServerProvider {
|
|||
final int serverId,
|
||||
);
|
||||
Future<GenericResult<bool>> detachVolume(final ServerVolume volume);
|
||||
Future<GenericResult<List<ServerMetadataEntity>>> getMetadata(
|
||||
final int serverId,
|
||||
);
|
||||
GenericResult<bool> get success => GenericResult(success: true, data: true);
|
||||
}
|
||||
|
|
|
@ -209,6 +209,7 @@ class HetznerServerProvider extends ServerProvider {
|
|||
return GenericResult(success: true, data: servers);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<GenericResult<List<ServerMetadataEntity>>> getMetadata(
|
||||
final int serverId,
|
||||
) async {
|
||||
|
@ -573,6 +574,7 @@ class HetznerServerProvider extends ServerProvider {
|
|||
return GenericResult(success: true, data: null);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<GenericResult<CallbackDialogueBranching?>> deleteServer(
|
||||
final String hostname,
|
||||
) async {
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
part of 'router.dart';
|
||||
|
||||
abstract class _$RootRouter extends RootStackRouter {
|
||||
_$RootRouter([GlobalKey<NavigatorState>? navigatorKey])
|
||||
: super(navigatorKey: navigatorKey);
|
||||
_$RootRouter([GlobalKey<NavigatorState>? navigatorKey]) : super(navigatorKey: navigatorKey);
|
||||
|
||||
@override
|
||||
final Map<String, PageFactory> pagesMap = {
|
||||
|
|
Loading…
Reference in a new issue