refactor: refactored functions & added translation

This commit is contained in:
Sean Riley Hawkins 2022-05-31 11:41:55 +02:00
parent c4ca0553a9
commit 2648a54482
3 changed files with 14 additions and 16 deletions

View File

@ -96,6 +96,12 @@
"lightMode": "Switch to Light mode",
"darkMode": "Switch to Dark mode"
},
"notifications": {
"export": {
"markdown": "Exported Note To Markdown",
"path": "Documents/flowy"
}
},
"contactsPage": {
"title": "Contacts",
"whatsHappening": "What's happening this week?",

View File

@ -1,6 +1,6 @@
import 'dart:async';
import 'dart:io';
import 'package:app_flowy/startup/startup.dart';
import 'package:app_flowy/startup/tasks/rust_sdk.dart';
import 'package:app_flowy/workspace/application/doc/share_service.dart';
import 'package:app_flowy/workspace/application/markdown/delta_markdown.dart';
import 'package:flowy_sdk/protobuf/flowy-text-block/entities.pb.dart';
@ -8,7 +8,6 @@ import 'package:flowy_sdk/protobuf/flowy-folder-data-model/view.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:path_provider/path_provider.dart';
import 'package:dartz/dartz.dart';
part 'share_bloc.freezed.dart';
@ -41,21 +40,14 @@ class DocShareBloc extends Bloc<DocShareEvent, DocShareState> {
return value;
}
Future<Directory> appFlowyDocumentDirectory() async {
Directory documentsDir = await getApplicationDocumentsDirectory();
Future<Directory> get _ExportDir async {
Directory documentsDir = await appFlowyDocumentDirectory();
switch (integrationEnv()) {
case IntegrationMode.develop:
return Directory('${documentsDir.path}/flowy_dev').create();
case IntegrationMode.release:
return Directory('${documentsDir.path}/flowy').create();
case IntegrationMode.test:
return Directory("${Directory.current.path}/.sandbox");
}
return documentsDir;
}
Future<String> get _localPath async {
final dir = await appFlowyDocumentDirectory();
final dir = await _ExportDir;
return dir.path;
}

View File

@ -179,9 +179,9 @@ class DocumentShareButton extends StatelessWidget {
switch (action) {
case ShareAction.markdown:
context.read<DocShareBloc>().add(const DocShareEvent.shareMarkdown());
const BubbleNotification(
msgTitle: 'Exported Complete ^_^',
msgBody: "Check in the flowy folder inside your documents directory")
BubbleNotification(
msgTitle: LocaleKeys.notifications_export_markdown.tr(),
msgBody: 'Path: ${LocaleKeys.notifications_export_path.tr()}')
.show(context);
break;
case ShareAction.copyLink: