mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: workspace service in user crate (#4373)
* refactor: user manager * feat: implement workspace service * refactor: migrate user data when sign up * chore: fmt * chore: enable beta cloud * chore: update ci * chore: trim slash
This commit is contained in:
@ -31,8 +31,8 @@ class AppFlowyCloudURLsBloc
|
||||
} else {
|
||||
validateUrl(state.updatedServerUrl).fold(
|
||||
(url) async {
|
||||
if (state.config.base_url != state.updatedServerUrl) {
|
||||
await setAppFlowyCloudUrl(Some(state.updatedServerUrl));
|
||||
if (state.config.base_url != url) {
|
||||
await setAppFlowyCloudUrl(Some(url));
|
||||
}
|
||||
add(const AppFlowyCloudURLsEvent.didSaveConfig());
|
||||
},
|
||||
@ -83,7 +83,7 @@ class AppFlowyCloudURLsState with _$AppFlowyCloudURLsState {
|
||||
Either<String, String> validateUrl(String url) {
|
||||
try {
|
||||
// Use Uri.parse to validate the url.
|
||||
final uri = Uri.parse(url);
|
||||
final uri = Uri.parse(removeTrailingSlash(url));
|
||||
if (uri.isScheme('HTTP') || uri.isScheme('HTTPS')) {
|
||||
return left(uri.toString());
|
||||
} else {
|
||||
@ -93,3 +93,10 @@ Either<String, String> validateUrl(String url) {
|
||||
return right(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
String removeTrailingSlash(String input) {
|
||||
if (input.endsWith('/')) {
|
||||
return input.substring(0, input.length - 1);
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ class CloudSettingBloc extends Bloc<CloudSettingEvent, CloudSettingState> {
|
||||
await event.when(
|
||||
initial: () async {},
|
||||
updateCloudType: (AuthenticatorType newCloudType) async {
|
||||
await setAuthenticatorType(newCloudType);
|
||||
emit(state.copyWith(cloudType: newCloudType));
|
||||
},
|
||||
);
|
||||
|
@ -2,7 +2,7 @@ import 'package:appflowy/plugins/database/application/defines.dart';
|
||||
import 'package:appflowy_backend/dispatch/dispatch.dart';
|
||||
import 'package:appflowy_backend/log.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-folder/import.pb.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-user/import_data.pb.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
@ -25,7 +25,7 @@ class SettingFileImportBloc
|
||||
emit(
|
||||
state.copyWith(loadingState: const LoadingState.loading()),
|
||||
);
|
||||
FolderEventImportAppFlowyDataFolder(payload).send().then((result) {
|
||||
UserEventImportAppFlowyDataFolder(payload).send().then((result) {
|
||||
if (!isClosed) {
|
||||
add(SettingFileImportEvent.finishImport(result));
|
||||
}
|
||||
|
Reference in New Issue
Block a user