fix: af cloud sync auth (#3873)

* feat: open workspace

* chore: update env docs

* fix: invalid user callback

* fix: token invalid

* chore: update

* chore: update

* chore: update

* chore: fix test

* chore: fix tauri build
This commit is contained in:
Nathan.fooo
2023-11-05 14:00:24 +08:00
committed by GitHub
parent b35d6131d4
commit 1025b6d553
59 changed files with 658 additions and 478 deletions

View File

@ -1,11 +1,9 @@
export 'package:async/async.dart';
import 'dart:convert';
import 'dart:io';
import 'dart:async';
import 'package:appflowy_backend/rust_stream.dart';
import 'package:flutter/services.dart';
import 'dart:ffi';
import 'env_serde.dart';
import 'ffi.dart' as ffi;
import 'package:ffi/ffi.dart';
@ -37,8 +35,7 @@ class FlowySDK {
ffi.init_sdk(sdkDir.path.toNativeUtf8());
}
void setEnv(AppFlowyEnv env) {
final jsonStr = jsonEncode(env.toJson());
ffi.set_env(jsonStr.toNativeUtf8());
void setEnv(String envStr) {
ffi.set_env(envStr.toNativeUtf8());
}
}

View File

@ -1,60 +0,0 @@
import 'package:json_annotation/json_annotation.dart';
// Run `dart run build_runner build` to generate the json serialization If the
// file `env_serde.g.dart` is existed, delete it first.
//
// the file `env_serde.g.dart` will be generated in the same directory.
part 'env_serde.g.dart';
@JsonSerializable()
class AppFlowyEnv {
final SupabaseConfiguration supabase_config;
final AppFlowyCloudConfiguration appflowy_cloud_config;
AppFlowyEnv({
required this.supabase_config,
required this.appflowy_cloud_config,
});
factory AppFlowyEnv.fromJson(Map<String, dynamic> json) =>
_$AppFlowyEnvFromJson(json);
Map<String, dynamic> toJson() => _$AppFlowyEnvToJson(this);
}
@JsonSerializable()
class SupabaseConfiguration {
/// Indicates whether the sync feature is enabled.
final bool enable_sync;
final String url;
final String anon_key;
SupabaseConfiguration({
this.enable_sync = true,
required this.url,
required this.anon_key,
});
factory SupabaseConfiguration.fromJson(Map<String, dynamic> json) =>
_$SupabaseConfigurationFromJson(json);
Map<String, dynamic> toJson() => _$SupabaseConfigurationToJson(this);
}
@JsonSerializable()
class AppFlowyCloudConfiguration {
final String base_url;
final String ws_base_url;
final String gotrue_url;
AppFlowyCloudConfiguration({
required this.base_url,
required this.ws_base_url,
required this.gotrue_url,
});
factory AppFlowyCloudConfiguration.fromJson(Map<String, dynamic> json) =>
_$AppFlowyCloudConfigurationFromJson(json);
Map<String, dynamic> toJson() => _$AppFlowyCloudConfigurationToJson(this);
}