From b3dd5fb8bd16d9063559c18e08664f1c5001532d Mon Sep 17 00:00:00 2001 From: "Nathan.fooo" <86001920+appflowy@users.noreply.github.com> Date: Sat, 25 Nov 2023 01:18:31 -0800 Subject: [PATCH] fix: windows callback (#4006) * tests: fix supabase integration test * ci: fix * chore: fix windows callback --- .github/workflows/flutter_ci.yaml | 8 ++++ frontend/appflowy_flutter/env.cloud.test | 20 +++++++++ ...auth_test.dart => supabase_auth_test.dart} | 42 ++++++++++--------- .../integration_test/runner.dart | 6 +-- .../integration_test/util/base.dart | 37 ++++++++++++++-- .../lib/env/{env.dart => cloud_env.dart} | 15 ++++++- .../lib/env/cloud_env_test.dart | 38 +++++++++++++++++ .../personal_info_setting_group.dart | 2 +- .../lib/startup/deps_resolver.dart | 2 +- .../appflowy_flutter/lib/startup/startup.dart | 4 ++ .../startup/tasks/appflowy_cloud_task.dart | 11 ++++- .../lib/startup/tasks/rust_sdk.dart | 2 +- .../lib/startup/tasks/supabase_task.dart | 2 +- .../auth/supabase_mock_auth_service.dart | 29 +++++++++---- .../desktop_sign_in_screen.dart | 2 +- .../sign_in_screen/mobile_sign_in_screen.dart | 2 +- .../presentation/screens/splash_screen.dart | 2 +- .../settings/appflowy_cloud_urls_bloc.dart | 8 ++-- .../settings/cloud_setting_bloc.dart | 2 +- .../settings/supabase_cloud_setting_bloc.dart | 2 +- .../settings/supabase_cloud_urls_bloc.dart | 2 +- .../settings/widgets/setting_cloud.dart | 2 +- .../widgets/setting_third_party_login.dart | 2 +- .../settings/widgets/settings_user_view.dart | 2 +- 24 files changed, 189 insertions(+), 55 deletions(-) create mode 100644 frontend/appflowy_flutter/env.cloud.test rename frontend/appflowy_flutter/integration_test/auth/{auth_test.dart => supabase_auth_test.dart} (63%) rename frontend/appflowy_flutter/lib/env/{env.dart => cloud_env.dart} (95%) create mode 100644 frontend/appflowy_flutter/lib/env/cloud_env_test.dart diff --git a/.github/workflows/flutter_ci.yaml b/.github/workflows/flutter_ci.yaml index 8e15ba9779..2ca1686639 100644 --- a/.github/workflows/flutter_ci.yaml +++ b/.github/workflows/flutter_ci.yaml @@ -300,6 +300,14 @@ jobs: - name: Uncompress appflowy_flutter run: tar -xf appflowy_flutter.tar.gz +# - name: Create .env.cloud.test file in flowy-server +# working-directory: frontend/appflowy_flutter +# run: | +# touch .env.cloud.test +# echo SUPABASE_URL=${{ secrets.SUPABASE_URL }} >> .env.cloud.test +# echo SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }} >> .env.cloud.test +# echo APPFLOWY_CLOUD_URL=${{ secrets.APPFLOWY_CLOUD_URL }} >> .env.cloud.test + - name: Run flutter pub get working-directory: frontend run: cargo make pub_get diff --git a/frontend/appflowy_flutter/env.cloud.test b/frontend/appflowy_flutter/env.cloud.test new file mode 100644 index 0000000000..c703bb5005 --- /dev/null +++ b/frontend/appflowy_flutter/env.cloud.test @@ -0,0 +1,20 @@ +# Only used for integration test + +# Cloud Type Configuration +# Use this configuration file to specify the cloud type and its associated settings. The available cloud types are: +# Local: 0 +# Supabase: 1 +# AppFlowy Cloud: 2 +# By default, it's set to Local. +CLOUD_TYPE=1 + +# Supabase Configuration +# If using Supabase (CLOUD_TYPE=1), provide the following details: +SUPABASE_URL= +SUPABASE_ANON_KEY= + +# AppFlowy Cloud Configuration +# If using Supabase (CLOUD_TYPE=2), provide the following details: +# +# When using localhost for development. you can use the following settings: +APPFLOWY_CLOUD_URL= diff --git a/frontend/appflowy_flutter/integration_test/auth/auth_test.dart b/frontend/appflowy_flutter/integration_test/auth/supabase_auth_test.dart similarity index 63% rename from frontend/appflowy_flutter/integration_test/auth/auth_test.dart rename to frontend/appflowy_flutter/integration_test/auth/supabase_auth_test.dart index 2a3c3aeee6..a135ee224a 100644 --- a/frontend/appflowy_flutter/integration_test/auth/auth_test.dart +++ b/frontend/appflowy_flutter/integration_test/auth/supabase_auth_test.dart @@ -1,3 +1,4 @@ +import 'package:appflowy/env/cloud_env.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/workspace/application/settings/prelude.dart'; import 'package:appflowy/workspace/presentation/settings/widgets/settings_user_view.dart'; @@ -11,13 +12,13 @@ void main() { group('auth', () { testWidgets('sign in with supabase', (tester) async { - await tester.initializeAppFlowy(); + await tester.initializeAppFlowy(cloudType: CloudType.supabase); await tester.tapGoogleLoginInButton(); tester.expectToSeeHomePage(); }); testWidgets('sign out with supabase', (tester) async { - await tester.initializeAppFlowy(); + await tester.initializeAppFlowy(cloudType: CloudType.supabase); await tester.tapGoogleLoginInButton(); // Open the setting page and sign out @@ -34,36 +35,37 @@ void main() { }); testWidgets('sign in as annoymous', (tester) async { - await tester.initializeAppFlowy(); + await tester.initializeAppFlowy(cloudType: CloudType.supabase); await tester.tapSignInAsGuest(); // should not see the sync setting page when sign in as annoymous await tester.openSettings(); - await tester.expectNoSettingsPage(SettingsPage.cloud); + await tester.openSettingsPage(SettingsPage.user); + tester.expectToSeeGoogleLoginButton(); }); - testWidgets('enable encryption', (tester) async { - await tester.initializeAppFlowy(); - await tester.tapGoogleLoginInButton(); + // testWidgets('enable encryption', (tester) async { + // await tester.initializeAppFlowy(cloudType: CloudType.supabase); + // await tester.tapGoogleLoginInButton(); - // Open the setting page and sign out - await tester.openSettings(); - await tester.openSettingsPage(SettingsPage.cloud); + // // Open the setting page and sign out + // await tester.openSettings(); + // await tester.openSettingsPage(SettingsPage.cloud); - // the switch should be off by default - tester.assertEnableEncryptSwitchValue(false); - await tester.toggleEnableEncrypt(); + // // the switch should be off by default + // tester.assertEnableEncryptSwitchValue(false); + // await tester.toggleEnableEncrypt(); - // the switch should be on after toggling - tester.assertEnableEncryptSwitchValue(true); + // // the switch should be on after toggling + // tester.assertEnableEncryptSwitchValue(true); - // the switch can not be toggled back to off - await tester.toggleEnableEncrypt(); - tester.assertEnableEncryptSwitchValue(true); - }); + // // the switch can not be toggled back to off + // await tester.toggleEnableEncrypt(); + // tester.assertEnableEncryptSwitchValue(true); + // }); testWidgets('enable sync', (tester) async { - await tester.initializeAppFlowy(); + await tester.initializeAppFlowy(cloudType: CloudType.supabase); await tester.tapGoogleLoginInButton(); // Open the setting page and sign out diff --git a/frontend/appflowy_flutter/integration_test/runner.dart b/frontend/appflowy_flutter/integration_test/runner.dart index ada0383dfd..521763c967 100644 --- a/frontend/appflowy_flutter/integration_test/runner.dart +++ b/frontend/appflowy_flutter/integration_test/runner.dart @@ -22,6 +22,7 @@ import 'share_markdown_test.dart' as share_markdown_test; import 'sidebar/sidebar_test_runner.dart' as sidebar_test_runner; import 'switch_folder_test.dart' as switch_folder_test; import 'tabs_test.dart' as tabs_test; +// import 'auth/supabase_auth_test.dart' as supabase_auth_test_runner; /// The main task runner for all integration tests in AppFlowy. /// @@ -74,10 +75,7 @@ Future main() async { // User settings settings_test_runner.main(); - // final cloudType = await getCloudType(); - // if (cloudType == CloudType.supabase) { - // auth_test_runner.main(); - // } + // supabase_auth_test_runner.main(); // board_test.main(); // empty_document_test.main(); diff --git a/frontend/appflowy_flutter/integration_test/util/base.dart b/frontend/appflowy_flutter/integration_test/util/base.dart index 835ca2ab87..e5f56cfb66 100644 --- a/frontend/appflowy_flutter/integration_test/util/base.dart +++ b/frontend/appflowy_flutter/integration_test/util/base.dart @@ -1,12 +1,14 @@ import 'dart:async'; import 'dart:io'; -import 'package:appflowy/env/env.dart'; +import 'package:appflowy/env/cloud_env.dart'; +import 'package:appflowy/env/cloud_env_test.dart'; import 'package:appflowy/startup/entry_point.dart'; import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/user/presentation/presentation.dart'; import 'package:appflowy/user/presentation/screens/sign_in_screen/widgets/widgets.dart'; import 'package:appflowy/workspace/application/settings/prelude.dart'; +import 'package:dartz/dartz.dart'; import 'package:flowy_infra/uuid.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/gestures.dart'; @@ -29,6 +31,7 @@ extension AppFlowyTestBase on WidgetTester { // use to append after the application data directory String? pathExtension, Size windowsSize = const Size(1600, 1200), + CloudType? cloudType, }) async { binding.setSurfaceSize(windowsSize); @@ -38,13 +41,28 @@ extension AppFlowyTestBase on WidgetTester { ); WidgetsFlutterBinding.ensureInitialized(); + await FlowyRunner.run( FlowyApp(), IntegrationMode.integrationTest, + didInitGetIt: Future( + () async { + if (cloudType != null) { + switch (cloudType) { + case CloudType.local: + break; + case CloudType.supabase: + await useSupabaseCloud(); + break; + case CloudType.appflowyCloud: + await useAppFlowyCloud(); + break; + } + } + }, + ), ); - await waitUntilSignInPageShow(); - return FlowyTestContext( applicationDataDirectory: directory, ); @@ -207,3 +225,16 @@ extension AppFlowyFinderTestBase on CommonFinders { ); } } + +Future useSupabaseCloud() async { + await setCloudType(CloudType.supabase); + await setSupbaseServer( + Some(TestEnv.supabaseUrl), + Some(TestEnv.supabaseAnonKey), + ); +} + +Future useAppFlowyCloud() async { + await setCloudType(CloudType.appflowyCloud); + await setAppFlowyCloudUrl(Some(TestEnv.afCloudUrl)); +} diff --git a/frontend/appflowy_flutter/lib/env/env.dart b/frontend/appflowy_flutter/lib/env/cloud_env.dart similarity index 95% rename from frontend/appflowy_flutter/lib/env/env.dart rename to frontend/appflowy_flutter/lib/env/cloud_env.dart index 750577f617..d33a6d7d07 100644 --- a/frontend/appflowy_flutter/lib/env/env.dart +++ b/frontend/appflowy_flutter/lib/env/cloud_env.dart @@ -142,13 +142,26 @@ enum CloudType { return 2; } } + + static fromValue(int value) { + switch (value) { + case 0: + return CloudType.local; + case 1: + return CloudType.supabase; + case 2: + return CloudType.appflowyCloud; + default: + return CloudType.local; + } + } } CloudType currentCloudType() { return getIt().cloudType; } -Future setAppFlowyCloudBaseUrl(Option url) async { +Future setAppFlowyCloudUrl(Option url) async { await url.fold( () => getIt().remove(KVKeys.kAppflowyCloudBaseURL), (s) => getIt().set(KVKeys.kAppflowyCloudBaseURL, s), diff --git a/frontend/appflowy_flutter/lib/env/cloud_env_test.dart b/frontend/appflowy_flutter/lib/env/cloud_env_test.dart new file mode 100644 index 0000000000..823975e100 --- /dev/null +++ b/frontend/appflowy_flutter/lib/env/cloud_env_test.dart @@ -0,0 +1,38 @@ +// lib/env/env.dart +import 'package:envied/envied.dart'; + +part 'cloud_env_test.g.dart'; + +/// Follow the guide on https://supabase.com/docs/guides/auth/social-login/auth-google to setup the auth provider. +/// +@Envied(path: '.env.cloud.test') +abstract class TestEnv { + @EnviedField( + obfuscate: true, + varName: 'CLOUD_TYPE', + defaultValue: '0', + ) + static final int cloudType = _TestEnv.cloudType; + + /// AppFlowy Cloud Configuration + @EnviedField( + obfuscate: true, + varName: 'APPFLOWY_CLOUD_URL', + defaultValue: '', + ) + static final String afCloudUrl = _TestEnv.afCloudUrl; + + // Supabase Configuration: + @EnviedField( + obfuscate: true, + varName: 'SUPABASE_URL', + defaultValue: '', + ) + static final String supabaseUrl = _TestEnv.supabaseUrl; + @EnviedField( + obfuscate: true, + varName: 'SUPABASE_ANON_KEY', + defaultValue: '', + ) + static final String supabaseAnonKey = _TestEnv.supabaseAnonKey; +} diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/setting/personal_info/personal_info_setting_group.dart b/frontend/appflowy_flutter/lib/mobile/presentation/setting/personal_info/personal_info_setting_group.dart index 9b9e2499e3..844d4fc5ab 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/setting/personal_info/personal_info_setting_group.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/setting/personal_info/personal_info_setting_group.dart @@ -1,4 +1,4 @@ -import 'package:appflowy/env/env.dart'; +import 'package:appflowy/env/cloud_env.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/workspace/application/user/prelude.dart'; diff --git a/frontend/appflowy_flutter/lib/startup/deps_resolver.dart b/frontend/appflowy_flutter/lib/startup/deps_resolver.dart index 433063d7f9..1d890ed7c3 100644 --- a/frontend/appflowy_flutter/lib/startup/deps_resolver.dart +++ b/frontend/appflowy_flutter/lib/startup/deps_resolver.dart @@ -1,6 +1,6 @@ import 'package:appflowy/core/config/kv.dart'; import 'package:appflowy/core/network_monitor.dart'; -import 'package:appflowy/env/env.dart'; +import 'package:appflowy/env/cloud_env.dart'; import 'package:appflowy/mobile/application/mobile_router.dart'; import 'package:appflowy/plugins/document/application/prelude.dart'; import 'package:appflowy/plugins/document/presentation/editor_plugins/copy_and_paste/clipboard_service.dart'; diff --git a/frontend/appflowy_flutter/lib/startup/startup.dart b/frontend/appflowy_flutter/lib/startup/startup.dart index 709d3242d9..9e3606dd08 100644 --- a/frontend/appflowy_flutter/lib/startup/startup.dart +++ b/frontend/appflowy_flutter/lib/startup/startup.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:io'; import 'package:appflowy/workspace/application/settings/prelude.dart'; @@ -37,6 +38,7 @@ class FlowyRunner { static Future run( EntryPoint f, IntegrationMode mode, { + Future? didInitGetIt, LaunchConfiguration config = const LaunchConfiguration( autoRegistrationSupported: false, ), @@ -47,6 +49,8 @@ class FlowyRunner { // Specify the env await initGetIt(getIt, mode, f, config); + await didInitGetIt; + final applicationDataDirectory = await getIt().getPath().then( (value) => Directory(value), diff --git a/frontend/appflowy_flutter/lib/startup/tasks/appflowy_cloud_task.dart b/frontend/appflowy_flutter/lib/startup/tasks/appflowy_cloud_task.dart index 1fd73a6467..3be940c0e6 100644 --- a/frontend/appflowy_flutter/lib/startup/tasks/appflowy_cloud_task.dart +++ b/frontend/appflowy_flutter/lib/startup/tasks/appflowy_cloud_task.dart @@ -1,7 +1,11 @@ -import 'package:appflowy/env/env.dart'; +import 'dart:io'; + +import 'package:appflowy/env/cloud_env.dart'; import 'package:appflowy/startup/startup.dart'; +import 'package:appflowy/startup/tasks/supabase_task.dart'; import 'package:appflowy/user/application/user_auth_listener.dart'; import 'package:appflowy_backend/log.dart'; +import 'package:url_protocol/url_protocol.dart'; class InitAppFlowyCloudTask extends LaunchTask { UserAuthStateListener? _authStateListener; @@ -25,6 +29,11 @@ class InitAppFlowyCloudTask extends LaunchTask { } }, ); + + if (Platform.isWindows) { + // register deep link for Windows + registerProtocolHandler(appflowyDeepLinkSchema); + } } @override diff --git a/frontend/appflowy_flutter/lib/startup/tasks/rust_sdk.dart b/frontend/appflowy_flutter/lib/startup/tasks/rust_sdk.dart index 2ad1793abd..44ec0f0816 100644 --- a/frontend/appflowy_flutter/lib/startup/tasks/rust_sdk.dart +++ b/frontend/appflowy_flutter/lib/startup/tasks/rust_sdk.dart @@ -2,7 +2,7 @@ import 'dart:convert'; import 'dart:io'; import 'package:appflowy/env/backend_env.dart'; -import 'package:appflowy/env/env.dart'; +import 'package:appflowy/env/cloud_env.dart'; import 'package:appflowy/user/application/auth/device_id.dart'; import 'package:appflowy_backend/appflowy_backend.dart'; import 'package:path_provider/path_provider.dart'; diff --git a/frontend/appflowy_flutter/lib/startup/tasks/supabase_task.dart b/frontend/appflowy_flutter/lib/startup/tasks/supabase_task.dart index 1dca479892..271d62be88 100644 --- a/frontend/appflowy_flutter/lib/startup/tasks/supabase_task.dart +++ b/frontend/appflowy_flutter/lib/startup/tasks/supabase_task.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'dart:io'; -import 'package:appflowy/env/env.dart'; +import 'package:appflowy/env/cloud_env.dart'; import 'package:appflowy/user/application/supabase_realtime.dart'; import 'package:appflowy/workspace/application/settings/application_data_storage.dart'; import 'package:flutter/foundation.dart'; diff --git a/frontend/appflowy_flutter/lib/user/application/auth/supabase_mock_auth_service.dart b/frontend/appflowy_flutter/lib/user/application/auth/supabase_mock_auth_service.dart index 5457cfc5a4..b71049358c 100644 --- a/frontend/appflowy_flutter/lib/user/application/auth/supabase_mock_auth_service.dart +++ b/frontend/appflowy_flutter/lib/user/application/auth/supabase_mock_auth_service.dart @@ -8,7 +8,6 @@ import 'package:appflowy_backend/log.dart'; import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart'; import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart'; import 'package:dartz/dartz.dart'; -import 'package:nanoid/nanoid.dart'; import 'package:supabase_flutter/supabase_flutter.dart'; import 'auth_error.dart'; @@ -16,6 +15,7 @@ import 'auth_error.dart'; /// Only used for testing. class MockAuthService implements AuthService { MockAuthService(); + static OauthSignInPB? signInPayload; SupabaseClient get _client => Supabase.instance.client; GoTrueClient get _auth => _client.auth; @@ -47,15 +47,25 @@ class MockAuthService implements AuthService { required String platform, Map params = const {}, }) async { + const password = "AppFlowyTest123!"; + const email = "supabase_integration_test@appflowy.io"; try { - final response = await _auth.signUp( - email: "${nanoid(10)}@appflowy.io", - password: "AppFlowyTest123!", - ); - - final uuid = response.user!.id; - final email = response.user!.email!; + if (_auth.currentSession == null) { + try { + await _auth.signInWithPassword( + password: password, + email: email, + ); + } catch (e) { + Log.error(e); + return Left(AuthError.supabaseSignUpError); + } + } + // Check if the user is already logged in. + final session = _auth.currentSession!; + final uuid = session.user.id; + // Create the OAuth sign-in payload. final payload = OauthSignInPB( authType: AuthTypePB.Supabase, map: { @@ -65,6 +75,7 @@ class MockAuthService implements AuthService { }, ); + // Send the sign-in event and handle the response. return UserEventOauthSignIn(payload).send().then((value) => value.swap()); } on AuthException catch (e) { Log.error(e); @@ -74,7 +85,7 @@ class MockAuthService implements AuthService { @override Future signOut() async { - await _auth.signOut(); + // await _auth.signOut(); await _appFlowyAuthService.signOut(); } diff --git a/frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/desktop_sign_in_screen.dart b/frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/desktop_sign_in_screen.dart index cfe8efb7d2..e499a5b927 100644 --- a/frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/desktop_sign_in_screen.dart +++ b/frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/desktop_sign_in_screen.dart @@ -1,5 +1,5 @@ import 'package:appflowy/core/frameless_window.dart'; -import 'package:appflowy/env/env.dart'; +import 'package:appflowy/env/cloud_env.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/user/presentation/screens/sign_in_screen/widgets/widgets.dart'; import 'package:appflowy/user/presentation/widgets/widgets.dart'; diff --git a/frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/mobile_sign_in_screen.dart b/frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/mobile_sign_in_screen.dart index 310f31e263..34907401d9 100644 --- a/frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/mobile_sign_in_screen.dart +++ b/frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/mobile_sign_in_screen.dart @@ -1,4 +1,4 @@ -import 'package:appflowy/env/env.dart'; +import 'package:appflowy/env/cloud_env.dart'; import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/user/presentation/screens/sign_in_screen/widgets/widgets.dart'; diff --git a/frontend/appflowy_flutter/lib/user/presentation/screens/splash_screen.dart b/frontend/appflowy_flutter/lib/user/presentation/screens/splash_screen.dart index 8f19b0b05f..1b40f2df58 100644 --- a/frontend/appflowy_flutter/lib/user/presentation/screens/splash_screen.dart +++ b/frontend/appflowy_flutter/lib/user/presentation/screens/splash_screen.dart @@ -1,4 +1,4 @@ -import 'package:appflowy/env/env.dart'; +import 'package:appflowy/env/cloud_env.dart'; import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/user/application/auth/auth_service.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_urls_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_urls_bloc.dart index cdf88ee111..c9484a2461 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_urls_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_urls_bloc.dart @@ -1,5 +1,5 @@ import 'package:appflowy/env/backend_env.dart'; -import 'package:appflowy/env/env.dart'; +import 'package:appflowy/env/cloud_env.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/startup/startup.dart'; import 'package:easy_localization/easy_localization.dart'; @@ -27,15 +27,15 @@ class AppFlowyCloudURLsBloc restartApp: true, ), ); - await setAppFlowyCloudBaseUrl(none()); + await setAppFlowyCloudUrl(none()); } else { validateUrl(state.updatedServerUrl).fold( (error) => emit(state.copyWith(urlError: Some(error))), (_) async { if (state.config.base_url != state.updatedServerUrl) { - await setAppFlowyCloudBaseUrl(Some(state.updatedServerUrl)); - add(const AppFlowyCloudURLsEvent.didSaveConfig()); + await setAppFlowyCloudUrl(Some(state.updatedServerUrl)); } + add(const AppFlowyCloudURLsEvent.didSaveConfig()); }, ); } diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/cloud_setting_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/cloud_setting_bloc.dart index 3bff8b7b40..98c098b903 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/settings/cloud_setting_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/settings/cloud_setting_bloc.dart @@ -1,4 +1,4 @@ -import 'package:appflowy/env/env.dart'; +import 'package:appflowy/env/cloud_env.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_setting_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_setting_bloc.dart index d8ad992eca..4051936431 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_setting_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_setting_bloc.dart @@ -1,5 +1,5 @@ import 'package:appflowy/env/backend_env.dart'; -import 'package:appflowy/env/env.dart'; +import 'package:appflowy/env/cloud_env.dart'; import 'package:appflowy/plugins/database_view/application/defines.dart'; import 'package:appflowy/startup/startup.dart'; import 'package:appflowy_backend/dispatch/dispatch.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_urls_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_urls_bloc.dart index 5186302c03..9922b9ce5c 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_urls_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_urls_bloc.dart @@ -1,5 +1,5 @@ import 'package:appflowy/env/backend_env.dart'; -import 'package:appflowy/env/env.dart'; +import 'package:appflowy/env/cloud_env.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/startup/startup.dart'; import 'package:appflowy_backend/dispatch/dispatch.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_cloud.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_cloud.dart index 94de68f93c..1fa7beef39 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_cloud.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_cloud.dart @@ -1,4 +1,4 @@ -import 'package:appflowy/env/env.dart'; +import 'package:appflowy/env/cloud_env.dart'; import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/workspace/application/settings/cloud_setting_bloc.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_third_party_login.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_third_party_login.dart index 7d79c30ed6..311493396d 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_third_party_login.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_third_party_login.dart @@ -1,4 +1,4 @@ -import 'package:appflowy/env/env.dart'; +import 'package:appflowy/env/cloud_env.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/startup/startup.dart'; import 'package:appflowy/user/application/sign_in_bloc.dart'; diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_user_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_user_view.dart index 474ee86948..a6f38024ec 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_user_view.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_user_view.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'dart:convert'; -import 'package:appflowy/env/env.dart'; +import 'package:appflowy/env/cloud_env.dart'; import 'package:appflowy/generated/flowy_svgs.g.dart'; import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/startup/startup.dart';