test: Import folder test (#4321)

* fix: import old version appflowy data

* chore: add 037 test

* chore: add default appflowy cloud url

* chore: bump collab
This commit is contained in:
Nathan.fooo
2024-01-07 11:12:05 +08:00
committed by GitHub
parent 2557e4f3cc
commit 76416cfdba
33 changed files with 643 additions and 251 deletions

View File

@ -30,13 +30,13 @@ class AppFlowyCloudURLsBloc
await setAppFlowyCloudUrl(none());
} else {
validateUrl(state.updatedServerUrl).fold(
(error) => emit(state.copyWith(urlError: Some(error))),
(_) async {
(url) async {
if (state.config.base_url != state.updatedServerUrl) {
await setAppFlowyCloudUrl(Some(state.updatedServerUrl));
}
add(const AppFlowyCloudURLsEvent.didSaveConfig());
},
(err) => emit(state.copyWith(urlError: Some(err))),
);
}
},
@ -80,16 +80,16 @@ class AppFlowyCloudURLsState with _$AppFlowyCloudURLsState {
);
}
Either<String, ()> validateUrl(String url) {
Either<String, String> validateUrl(String url) {
try {
// Use Uri.parse to validate the url.
final uri = Uri.parse(url);
if (uri.isScheme('HTTP') || uri.isScheme('HTTPS')) {
return right(());
return left(uri.toString());
} else {
return left(LocaleKeys.settings_menu_invalidCloudURLScheme.tr());
return right(LocaleKeys.settings_menu_invalidCloudURLScheme.tr());
}
} catch (e) {
return left(e.toString());
return right(e.toString());
}
}