Skip to content

Commit

Permalink
Merge pull request #328 from TaYaKi71751/dev-git-toast
Browse files Browse the repository at this point in the history
Add showToast in exportbookmarkgit
  • Loading branch information
violet-dev authored Jan 10, 2024
2 parents 2e94523 + 6df6491 commit f4020e0
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 9 deletions.
1 change: 1 addition & 0 deletions assets/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"importingbookmark": "Import Bookmark",
"exportingbookmark": "Export Bookmark",
"exportingbookmarkgit": "Export Bookmark to Git Repository",
"failexportbookmark": "Failed to export bookmark",
"noauth": "You do not have permission to run it.",
"noselectedb": "No database selected.",
"importbookmark": "Bookmark Imported!",
Expand Down
1 change: 1 addition & 0 deletions assets/locale/eo.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"importingbookmark": "Importar Marcador",
"exportingbookmark": "Exportar Marcador",
"exportingbookmarkgit": "Export Bookmark to Git Repository",
"failexportbookmark": "Failed to export bookmark",
"noauth": "No tienes permiso para iniciar.",
"noselectedb": "No se ha seleccionado ninguna base de datos.",
"importbookmark": "¡Marcador Importado!",
Expand Down
1 change: 1 addition & 0 deletions assets/locale/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"importingbookmark": "Importa Segnalibri",
"exportingbookmark": "Esporta Segnalibri",
"exportingbookmarkgit": "Export Bookmark to Git Repository",
"failexportbookmark": "Failed to export bookmark",
"noauth": "Non hai il permesso di avviarlo.",
"noselectedb": "Nessun database selezionato.",
"importbookmark": "Segnalibri Importati!",
Expand Down
1 change: 1 addition & 0 deletions assets/locale/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"importingbookmark": "ブックマークを読み込む",
"exportingbookmark": "ブックマークの書き出す",
"exportingbookmarkgit": "Export Bookmark to Git Repository",
"failexportbookmark": "Failed to export bookmark",
"noauth": "権限がないため、実行できません。",
"noselectedb": "選択されたデータベースがありません。",
"importbookmark": "ブックマークを読み込みしました!",
Expand Down
1 change: 1 addition & 0 deletions assets/locale/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"importingbookmark": "북마크 가져오기",
"exportingbookmark": "북마크 내보내기",
"exportingbookmarkgit": "Export Bookmark to Git Repository",
"failexportbookmark": "Failed to export bookmark",
"noauth": "권한이 없어서 실행할 수 없습니다.",
"noselectedb": "선택된 데이터베이스가 없습니다.",
"importbookmark": "북마크를 가져왔습니다!",
Expand Down
1 change: 1 addition & 0 deletions assets/locale/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"importingbookmark": "Importar marcador",
"exportingbookmark": "Exportar marcador",
"exportingbookmarkgit": "Export Bookmark to Git Repository",
"failexportbookmark": "Failed to export bookmark",
"noauth": "Você não tem permissão para executar isso.",
"noselectedb": "Nenhum banco de dados selecionado.",
"importbookmark": "Marcador importado!",
Expand Down
1 change: 1 addition & 0 deletions assets/locale/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"importingbookmark": "Import Bookmark",
"exportingbookmark": "Export Bookmark",
"exportingbookmarkgit": "Export Bookmark to Git Repository",
"failexportbookmark": "Failed to export bookmark",
"noauth": "You do not have permission to run it.",
"noselectedb": "No database selected.",
"importbookmark": "Bookmark Imported!",
Expand Down
1 change: 1 addition & 0 deletions assets/locale/zh_Hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"importingbookmark": "导入书签",
"exportingbookmark": "导出书签",
"exportingbookmarkgit": "Export Bookmark to Git Repository",
"failexportbookmark": "Failed to export bookmark",
"noauth": "你没有权限执行此操作.",
"noselectedb": "没有数据库被选中.",
"importbookmark": "书签导入成功!",
Expand Down
1 change: 1 addition & 0 deletions assets/locale/zh_Hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"importingbookmark": "Import Bookmark",
"exportingbookmark": "Export Bookmark",
"exportingbookmarkgit": "Export Bookmark to Git Repository",
"failexportbookmark": "Failed to export bookmark",
"noauth": "You do not have permission to run it.",
"noselectedb": "No database selected.",
"importbookmark": "Bookmark Imported!",
Expand Down
46 changes: 37 additions & 9 deletions lib/pages/settings/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2022,17 +2022,45 @@ class _SettingsPageState extends State<SettingsPage>
if (await Directory(gitPath).exists()) {
await Directory(gitPath).delete(recursive: true);
}

final git = BookmarkGit();
await git.clone(gitPath);
final extpath = '$gitPath/bookmark.db';
await bookmarkDatabaseFile.copy(extpath);
await git.addAll(gitPath);
await git.commit(gitPath);
await git.push(gitPath);
try {
final git = BookmarkGit();
await git.clone(gitPath);
final extpath = '$gitPath/bookmark.db';
await bookmarkDatabaseFile.copy(extpath);
await git.addAll(gitPath);
await git.commit(gitPath);
await git.push(gitPath);
} catch (e, st) {
Logger.error('[exportingbookmarkgit] $e\n'
'$st');
flutterToast.showToast(
child: ToastWrapper(
isCheck: true,
isWarning: false,
msg: Translations.of(context).trans('failexportbookmark'),
),
ignorePointer: true,
gravity: ToastGravity.BOTTOM,
toastDuration: const Duration(seconds: 4),
);
if (await Directory(gitPath).exists()) {
await Directory(gitPath).delete(recursive: true);
}
return;
}
if (await Directory(gitPath).exists()) {
await Directory(gitPath).delete(recursive: true);
}
flutterToast.showToast(
child: ToastWrapper(
isCheck: true,
isWarning: false,
msg: Translations.of(context).trans('exportbookmark'),
),
ignorePointer: true,
gravity: ToastGravity.BOTTOM,
toastDuration: const Duration(seconds: 4),
);
},
),
InkWell(
Expand Down Expand Up @@ -2105,7 +2133,7 @@ class _SettingsPageState extends State<SettingsPage>
element.description() == description &&
// element.color() == color.value &&
DateTime.tryParse(element.datetime()) == datetime))
.first
.last
.id();
for (int j = 0;
j <
Expand Down

0 comments on commit f4020e0

Please sign in to comment.