mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
create flowy directory if not exist
This commit is contained in:
parent
c8ba8284ef
commit
e67683abc7
@ -19,20 +19,22 @@ class RustSDKInitTask extends LaunchTask {
|
|||||||
|
|
||||||
Directory directory = await getApplicationDocumentsDirectory();
|
Directory directory = await getApplicationDocumentsDirectory();
|
||||||
final documentPath = directory.path;
|
final documentPath = directory.path;
|
||||||
final flowySandbox = Directory('$documentPath/flowy');
|
|
||||||
switch (context.env) {
|
|
||||||
case IntegrationEnv.dev:
|
|
||||||
// await context.getIt<FlowySDK>().init(Directory('./temp/flowy_dev'));
|
|
||||||
await context.getIt<FlowySDK>().init(flowySandbox);
|
|
||||||
break;
|
|
||||||
case IntegrationEnv.pro:
|
|
||||||
await context.getIt<FlowySDK>().init(flowySandbox);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
assert(false, 'Unsupported env');
|
|
||||||
}
|
|
||||||
|
|
||||||
return Future(() => {});
|
return Directory('$documentPath/flowy')
|
||||||
|
.create()
|
||||||
|
.then((Directory directory) async {
|
||||||
|
switch (context.env) {
|
||||||
|
case IntegrationEnv.dev:
|
||||||
|
// await context.getIt<FlowySDK>().init(Directory('./temp/flowy_dev'));
|
||||||
|
await context.getIt<FlowySDK>().init(directory);
|
||||||
|
break;
|
||||||
|
case IntegrationEnv.pro:
|
||||||
|
await context.getIt<FlowySDK>().init(directory);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert(false, 'Unsupported env');
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class AppRepository {
|
|||||||
..appId = appId
|
..appId = appId
|
||||||
..readViews = false;
|
..readViews = false;
|
||||||
|
|
||||||
return WorkspaceEventGetApp(request).send();
|
return WorkspaceEventReadApp(request).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Either<View, WorkspaceError>> createView(
|
Future<Either<View, WorkspaceError>> createView(
|
||||||
@ -42,7 +42,7 @@ class AppRepository {
|
|||||||
..appId = appId
|
..appId = appId
|
||||||
..readViews = true;
|
..readViews = true;
|
||||||
|
|
||||||
return WorkspaceEventGetApp(request).send().then((result) {
|
return WorkspaceEventReadApp(request).send().then((result) {
|
||||||
return result.fold(
|
return result.fold(
|
||||||
(app) => left(app.views.items),
|
(app) => left(app.views.items),
|
||||||
(error) => right(error),
|
(error) => right(error),
|
||||||
|
@ -20,7 +20,7 @@ class WorkspaceRepo {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Future<Either<App, WorkspaceError>> createApp(String appName, String desc) {
|
Future<Either<App, WorkspaceError>> createApp(String appName, String desc) {
|
||||||
return WorkspaceEventGetCurWorkspace().send().then((result) {
|
return WorkspaceEventReadCurWorkspace().send().then((result) {
|
||||||
return result.fold(
|
return result.fold(
|
||||||
(workspace) {
|
(workspace) {
|
||||||
final request = CreateAppRequest.create()
|
final request = CreateAppRequest.create()
|
||||||
@ -42,7 +42,7 @@ class WorkspaceRepo {
|
|||||||
..workspaceId = user.workspace
|
..workspaceId = user.workspace
|
||||||
..readApps = readApps;
|
..readApps = readApps;
|
||||||
|
|
||||||
return WorkspaceEventGetWorkspace(request).send().then((result) {
|
return WorkspaceEventReadWorkspace(request).send().then((result) {
|
||||||
return result.fold(
|
return result.fold(
|
||||||
(workspace) => left(workspace),
|
(workspace) => left(workspace),
|
||||||
(error) => right(error),
|
(error) => right(error),
|
||||||
|
@ -87,12 +87,12 @@ class WorkspaceEventCreateWorkspace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class WorkspaceEventGetCurWorkspace {
|
class WorkspaceEventReadCurWorkspace {
|
||||||
WorkspaceEventGetCurWorkspace();
|
WorkspaceEventReadCurWorkspace();
|
||||||
|
|
||||||
Future<Either<Workspace, WorkspaceError>> send() {
|
Future<Either<Workspace, WorkspaceError>> send() {
|
||||||
final request = FFIRequest.create()
|
final request = FFIRequest.create()
|
||||||
..event = WorkspaceEvent.GetCurWorkspace.toString();
|
..event = WorkspaceEvent.ReadCurWorkspace.toString();
|
||||||
|
|
||||||
return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
|
return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
|
||||||
(okBytes) => left(Workspace.fromBuffer(okBytes)),
|
(okBytes) => left(Workspace.fromBuffer(okBytes)),
|
||||||
@ -101,13 +101,13 @@ class WorkspaceEventGetCurWorkspace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class WorkspaceEventGetWorkspace {
|
class WorkspaceEventReadWorkspace {
|
||||||
QueryWorkspaceRequest request;
|
QueryWorkspaceRequest request;
|
||||||
WorkspaceEventGetWorkspace(this.request);
|
WorkspaceEventReadWorkspace(this.request);
|
||||||
|
|
||||||
Future<Either<Workspace, WorkspaceError>> send() {
|
Future<Either<Workspace, WorkspaceError>> send() {
|
||||||
final request = FFIRequest.create()
|
final request = FFIRequest.create()
|
||||||
..event = WorkspaceEvent.GetWorkspace.toString()
|
..event = WorkspaceEvent.ReadWorkspace.toString()
|
||||||
..payload = requestToBytes(this.request);
|
..payload = requestToBytes(this.request);
|
||||||
|
|
||||||
return Dispatch.asyncRequest(request)
|
return Dispatch.asyncRequest(request)
|
||||||
@ -118,6 +118,23 @@ class WorkspaceEventGetWorkspace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class WorkspaceEventDeleteWorkspace {
|
||||||
|
DeleteWorkspaceRequest request;
|
||||||
|
WorkspaceEventDeleteWorkspace(this.request);
|
||||||
|
|
||||||
|
Future<Either<Unit, WorkspaceError>> send() {
|
||||||
|
final request = FFIRequest.create()
|
||||||
|
..event = WorkspaceEvent.DeleteWorkspace.toString()
|
||||||
|
..payload = requestToBytes(this.request);
|
||||||
|
|
||||||
|
return Dispatch.asyncRequest(request)
|
||||||
|
.then((bytesResult) => bytesResult.fold(
|
||||||
|
(bytes) => left(unit),
|
||||||
|
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class WorkspaceEventReadAllWorkspace {
|
class WorkspaceEventReadAllWorkspace {
|
||||||
WorkspaceEventReadAllWorkspace();
|
WorkspaceEventReadAllWorkspace();
|
||||||
|
|
||||||
@ -149,13 +166,30 @@ class WorkspaceEventCreateApp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class WorkspaceEventGetApp {
|
class WorkspaceEventDeleteApp {
|
||||||
|
DeleteAppRequest request;
|
||||||
|
WorkspaceEventDeleteApp(this.request);
|
||||||
|
|
||||||
|
Future<Either<Unit, WorkspaceError>> send() {
|
||||||
|
final request = FFIRequest.create()
|
||||||
|
..event = WorkspaceEvent.DeleteApp.toString()
|
||||||
|
..payload = requestToBytes(this.request);
|
||||||
|
|
||||||
|
return Dispatch.asyncRequest(request)
|
||||||
|
.then((bytesResult) => bytesResult.fold(
|
||||||
|
(bytes) => left(unit),
|
||||||
|
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class WorkspaceEventReadApp {
|
||||||
QueryAppRequest request;
|
QueryAppRequest request;
|
||||||
WorkspaceEventGetApp(this.request);
|
WorkspaceEventReadApp(this.request);
|
||||||
|
|
||||||
Future<Either<App, WorkspaceError>> send() {
|
Future<Either<App, WorkspaceError>> send() {
|
||||||
final request = FFIRequest.create()
|
final request = FFIRequest.create()
|
||||||
..event = WorkspaceEvent.GetApp.toString()
|
..event = WorkspaceEvent.ReadApp.toString()
|
||||||
..payload = requestToBytes(this.request);
|
..payload = requestToBytes(this.request);
|
||||||
|
|
||||||
return Dispatch.asyncRequest(request)
|
return Dispatch.asyncRequest(request)
|
||||||
@ -166,6 +200,23 @@ class WorkspaceEventGetApp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class WorkspaceEventUpdateApp {
|
||||||
|
UpdateAppRequest request;
|
||||||
|
WorkspaceEventUpdateApp(this.request);
|
||||||
|
|
||||||
|
Future<Either<Unit, WorkspaceError>> send() {
|
||||||
|
final request = FFIRequest.create()
|
||||||
|
..event = WorkspaceEvent.UpdateApp.toString()
|
||||||
|
..payload = requestToBytes(this.request);
|
||||||
|
|
||||||
|
return Dispatch.asyncRequest(request)
|
||||||
|
.then((bytesResult) => bytesResult.fold(
|
||||||
|
(bytes) => left(unit),
|
||||||
|
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class WorkspaceEventCreateView {
|
class WorkspaceEventCreateView {
|
||||||
CreateViewRequest request;
|
CreateViewRequest request;
|
||||||
WorkspaceEventCreateView(this.request);
|
WorkspaceEventCreateView(this.request);
|
||||||
@ -217,6 +268,23 @@ class WorkspaceEventUpdateView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class WorkspaceEventDeleteView {
|
||||||
|
DeleteViewRequest request;
|
||||||
|
WorkspaceEventDeleteView(this.request);
|
||||||
|
|
||||||
|
Future<Either<Unit, WorkspaceError>> send() {
|
||||||
|
final request = FFIRequest.create()
|
||||||
|
..event = WorkspaceEvent.DeleteView.toString()
|
||||||
|
..payload = requestToBytes(this.request);
|
||||||
|
|
||||||
|
return Dispatch.asyncRequest(request)
|
||||||
|
.then((bytesResult) => bytesResult.fold(
|
||||||
|
(bytes) => left(unit),
|
||||||
|
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class UserEventGetStatus {
|
class UserEventGetStatus {
|
||||||
UserEventGetStatus();
|
UserEventGetStatus();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user