Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

feat: using appflowy cloud as the default cloud type (#4380)

Nathan.foooc4f4bcf45755
diff --git a/frontend/appflowy_flutter/lib/env/cloud_env.dart b/frontend/appflowy_flutter/lib/env/cloud_env.dart
index 7d22829f2c..252349c02f 100644
--- a/frontend/appflowy_flutter/lib/env/cloud_env.dart
+++ b/frontend/appflowy_flutter/lib/env/cloud_env.dart
@@ -20,20 +20,23 @@ import 'package:dartz/dartz.dart';
Future<void> setAuthenticatorType(AuthenticatorType ty) async {
switch (ty) {
case AuthenticatorType.local:
- getIt<KeyValueStorage>().set(KVKeys.kCloudType, 0.toString());
+ await getIt<KeyValueStorage>().set(KVKeys.kCloudType, 0.toString());
break;
case AuthenticatorType.supabase:
- getIt<KeyValueStorage>().set(KVKeys.kCloudType, 1.toString());
+ await getIt<KeyValueStorage>().set(KVKeys.kCloudType, 1.toString());
break;
case AuthenticatorType.appflowyCloud:
- getIt<KeyValueStorage>().set(KVKeys.kCloudType, 2.toString());
+ await getIt<KeyValueStorage>().set(KVKeys.kCloudType, 2.toString());
+ await setAppFlowyCloudUrl(const Some(kAppflowyCloudUrl));
break;
case AuthenticatorType.appflowyCloudSelfHost:
- getIt<KeyValueStorage>().set(KVKeys.kCloudType, 3.toString());
+ await getIt<KeyValueStorage>().set(KVKeys.kCloudType, 3.toString());
break;
}
}
+const String kAppflowyCloudUrl = "https://beta.appflowy.cloud";
+
/// Retrieves the currently set cloud type.
///
/// This method fetches the cloud type setting from the key-value storage
@@ -47,20 +50,24 @@ Future<void> setAuthenticatorType(AuthenticatorType ty) async {
///
Future<AuthenticatorType> getAuthenticatorType() async {
final value = await getIt<KeyValueStorage>().get(KVKeys.kCloudType);
- return value.fold(() => AuthenticatorType.local, (s) {
- switch (s) {
- case "0":
- return AuthenticatorType.local;
- case "1":
- return AuthenticatorType.supabase;
- case "2":
- return AuthenticatorType.appflowyCloud;
- case "3":
- return AuthenticatorType.appflowyCloudSelfHost;
- default:
- return AuthenticatorType.local;
- }
- });
+ if (value.isNone() && integrationMode().isRelease) {
+ await setAuthenticatorType(AuthenticatorType.appflowyCloud);
+ return AuthenticatorType.appflowyCloud;
+ }
+
+ switch (value.getOrElse(() => "0")) {
+ case "0":
+ return AuthenticatorType.local;
+ case "1":
+ return AuthenticatorType.supabase;
+ case "2":
+ return AuthenticatorType.appflowyCloud;
+ case "3":
+ return AuthenticatorType.appflowyCloudSelfHost;
+ default:
+ await setAuthenticatorType(AuthenticatorType.appflowyCloud);
+ return AuthenticatorType.appflowyCloud;
+ }
}
/// Determines whether authentication is enabled.
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart
index 1e600feb76..52729c0779 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart
@@ -59,7 +59,7 @@ class AppFlowyCloudViewSetting extends StatelessWidget {
title: LocaleKeys.settings_menu_restartAppTip.tr(),
confirm: () async {
await setAppFlowyCloudUrl(
- const Some("https://beta.appflowy.cloud"),
+ const Some(kAppflowyCloudUrl),
);
await setAuthenticatorType(AuthenticatorType.appflowyCloud);