chore: enable cloud setting on mobile (#4060)

* chore: enable cloud setting on mobile

* chore: disable ansi

* chore: bump up client api

* chore: bump up client api
This commit is contained in:
Nathan.fooo 2023-11-30 19:17:49 -08:00 committed by GitHub
parent 0683483fd4
commit b43b522d97
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 110 additions and 69 deletions

View File

@ -66,6 +66,16 @@
},
"cwd": "${workspaceRoot}/appflowy_flutter"
},
{
"name": "AF-iOS-Simulator: Build Dart only",
"request": "launch",
"program": "./lib/main.dart",
"type": "dart",
"env": {
"RUST_LOG": "trace"
},
"cwd": "${workspaceRoot}/appflowy_flutter"
},
{
"name": "AF-iOS-Simulator: Build All",
"request": "launch",

View File

@ -202,4 +202,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 8c681999c7764593c94846b2a64b44d86f7a27ac
COCOAPODS: 1.12.1
COCOAPODS: 1.11.3

View File

@ -1,4 +1,6 @@
import 'package:appflowy/env/env.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/mobile/presentation/setting/cloud/cloud_setting_group.dart';
import 'package:appflowy/mobile/presentation/presentation.dart';
import 'package:appflowy/mobile/presentation/setting/logout_setting_group.dart';
import 'package:appflowy/mobile/presentation/widgets/widgets.dart';
@ -60,6 +62,7 @@ class _MobileHomeSettingPageState extends State<MobileHomeSettingPage> {
const NotificationsSettingGroup(),
const AppearanceSettingGroup(),
const LanguageSettingGroup(),
if (Env.enableCustomCloud) const CloudSettingGroup(),
const SupportSettingGroup(),
const AboutSettingGroup(),
const LogoutSettingGroup(),

View File

@ -0,0 +1,28 @@
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/startup/startup.dart';
import 'package:appflowy/workspace/presentation/settings/widgets/setting_cloud.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
class AppFlowyCloudPage extends StatelessWidget {
const AppFlowyCloudPage({super.key});
static const routeName = '/AppFlowyCloudPage';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(LocaleKeys.settings_mobile_privacyPolicy.tr()),
),
body: Padding(
padding: const EdgeInsets.all(20.0),
child: SettingCloud(
didResetServerUrl: () async {
await runAppFlowy();
},
),
),
);
}
}

View File

@ -0,0 +1,33 @@
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/mobile/presentation/setting/cloud/appflowy_cloud_page.dart';
import 'package:appflowy/mobile/presentation/setting/widgets/mobile_setting_group_widget.dart';
import 'package:appflowy/mobile/presentation/setting/widgets/mobile_setting_item_widget.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:package_info_plus/package_info_plus.dart';
class CloudSettingGroup extends StatelessWidget {
const CloudSettingGroup({
super.key,
});
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: PackageInfo.fromPlatform(),
builder: (context, snapshot) => MobileSettingGroup(
groupTitle: LocaleKeys.settings_menu_cloudSetting.tr(),
settingItemList: [
MobileSettingItem(
name: LocaleKeys.settings_menu_cloudAppFlowy.tr(),
trailing: const Icon(
Icons.chevron_right,
),
onTap: () => context.push(AppFlowyCloudPage.routeName),
),
],
),
);
}
}

View File

@ -8,6 +8,7 @@ import 'package:appflowy/mobile/presentation/database/mobile_calendar_screen.dar
import 'package:appflowy/mobile/presentation/database/mobile_grid_screen.dart';
import 'package:appflowy/mobile/presentation/favorite/mobile_favorite_page.dart';
import 'package:appflowy/mobile/presentation/presentation.dart';
import 'package:appflowy/mobile/presentation/setting/cloud/appflowy_cloud_page.dart';
import 'package:appflowy/mobile/presentation/setting/font/font_picker_screen.dart';
import 'package:appflowy/mobile/presentation/setting/language/language_picker_screen.dart';
import 'package:appflowy/plugins/base/color/color_picker_screen.dart';
@ -48,6 +49,7 @@ GoRouter generateRouter(Widget child) {
_mobileHomeSettingPageRoute(),
_mobileSettingPrivacyPolicyPageRoute(),
_mobileSettingUserAgreementPageRoute(),
_mobileCloudSettingAppFlowyCloudPageRoute(),
// view page
_mobileEditorScreenRoute(),
@ -216,6 +218,16 @@ GoRoute _mobileSettingPrivacyPolicyPageRoute() {
);
}
GoRoute _mobileCloudSettingAppFlowyCloudPageRoute() {
return GoRoute(
parentNavigatorKey: AppGlobals.rootNavKey,
path: AppFlowyCloudPage.routeName,
pageBuilder: (context, state) {
return const MaterialPage(child: AppFlowyCloudPage());
},
);
}
GoRoute _mobileSettingUserAgreementPageRoute() {
return GoRoute(
parentNavigatorKey: AppGlobals.rootNavKey,

View File

@ -51,6 +51,7 @@ AppFlowyConfiguration _makeAppFlowyConfiguration(
required Map<String, String> rustEnvs,
}) {
final env = getIt<AppFlowyCloudSharedEnv>();
rustEnvs["RUST_LOG"] = 'trace';
return AppFlowyConfiguration(
root: root,
custom_app_path: customAppPath,

View File

@ -2,7 +2,6 @@ import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/user/application/sign_in_bloc.dart';
import 'package:appflowy/user/presentation/presentation.dart';
import 'package:appflowy/util/platform_extension.dart';
import 'package:appflowy/workspace/application/settings/appearance/appearance_cubit.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra/size.dart';
@ -80,52 +79,6 @@ class _ThirdPartySignInButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
final style = Theme.of(context);
final isMobile = PlatformExtension.isMobile;
if (isMobile) {
return Container(
height: 48,
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(
Radius.circular(4),
),
border: Border.all(
color: style.colorScheme.outline,
width: 0.5,
),
),
child: Center(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
// The icon could be in different height as original aspect ratio, we use a fixed sizebox to wrap it to make sure they all occupy the same space.
width: 30,
height: 30,
child: Center(
child: SizedBox(
width: 24,
child: FlowySvg(
icon,
blendMode: null,
),
),
),
),
const HSpace(8),
SizedBox(
// To fit the longest label 'Log in with Discord'
width: 135,
child: Text(
labelText,
style: Theme.of(context).textTheme.titleSmall,
),
),
],
),
),
);
}
// In desktop, the width of button is limited by [AuthFormContainer]
return SizedBox(
height: 48,
width: AuthFormContainer.width,

View File

@ -139,7 +139,7 @@ checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
[[package]]
name = "app-error"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"reqwest",
@ -786,7 +786,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"app-error",
@ -1474,7 +1474,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "database-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"app-error",
@ -2833,7 +2833,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"futures-util",
@ -2849,7 +2849,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"app-error",
@ -3271,7 +3271,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"reqwest",
@ -5042,7 +5042,7 @@ dependencies = [
[[package]]
name = "realtime-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"bincode",
@ -5795,7 +5795,7 @@ dependencies = [
[[package]]
name = "shared_entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"app-error",
@ -7685,7 +7685,7 @@ dependencies = [
[[package]]
name = "workspace-template"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"async-trait",

View File

@ -57,7 +57,7 @@ custom-protocol = ["tauri/custom-protocol"]
# Run the script:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "62abd8abbf4dddb5822842f28d1fba67ccfae6de" }
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "208a353fefe08ff2521d4be72be936329f5c0256" }
# Please use the following script to update collab.
# Working directory: frontend
#

View File

@ -125,7 +125,7 @@ checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
[[package]]
name = "app-error"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"reqwest",
@ -667,7 +667,7 @@ dependencies = [
[[package]]
name = "client-api"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"app-error",
@ -1280,7 +1280,7 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308"
[[package]]
name = "database-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"app-error",
@ -2474,7 +2474,7 @@ dependencies = [
[[package]]
name = "gotrue"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"futures-util",
@ -2490,7 +2490,7 @@ dependencies = [
[[package]]
name = "gotrue-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"app-error",
@ -2851,7 +2851,7 @@ dependencies = [
[[package]]
name = "infra"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"reqwest",
@ -4331,7 +4331,7 @@ dependencies = [
[[package]]
name = "realtime-entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"bincode",
@ -4997,7 +4997,7 @@ dependencies = [
[[package]]
name = "shared_entity"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"app-error",
@ -6335,7 +6335,7 @@ dependencies = [
[[package]]
name = "workspace-template"
version = "0.1.0"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=62abd8abbf4dddb5822842f28d1fba67ccfae6de#62abd8abbf4dddb5822842f28d1fba67ccfae6de"
source = "git+https://github.com/AppFlowy-IO/AppFlowy-Cloud?rev=208a353fefe08ff2521d4be72be936329f5c0256#208a353fefe08ff2521d4be72be936329f5c0256"
dependencies = [
"anyhow",
"async-trait",

View File

@ -99,7 +99,7 @@ incremental = false
# Run the script:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "62abd8abbf4dddb5822842f28d1fba67ccfae6de" }
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "208a353fefe08ff2521d4be72be936329f5c0256" }
# Please use the following script to update collab.
# Working directory: frontend
#

View File

@ -107,6 +107,7 @@ impl DocumentManager {
if let Some(doc) = self.documents.lock().get(doc_id).cloned() {
return Ok(doc);
}
let mut updates = vec![];
if !self.is_doc_exist(doc_id)? {
// Try to get the document from the cloud service

View File

@ -47,7 +47,7 @@ impl Builder {
.with_target(false)
.with_max_level(tracing::Level::TRACE)
.with_thread_ids(false)
.with_writer(std::io::stdout)
.with_writer(std::io::stderr)
.pretty()
.with_env_filter(env_filter)
.finish()