From 3e4bacb7b939b1de98a2fb07115f638750637357 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 8 May 2026 00:05:39 +0300 Subject: Rewrite as Flutter app and rename to Quicklog Drop the Go/Fyne implementation and replace it with a native Flutter app targeting Android (primary) and Linux desktop (development). Rename quicklogger -> quicklog throughout (project, applicationId, MethodChannel, cache filename, AppBar title, Linux binary). Storage on Android moves to /Android/data/org.buetow.quicklog/files/ so MANAGE_EXTERNAL_STORAGE is no longer required. Share-intent receive is preserved via a Kotlin ShareActivity that writes shared text to the app cache, which Dart reads through a MethodChannel on app resume; MainActivity also accepts SEND directly so launchers that prefer the main target work. New since the Fyne version: an entry browser screen with read-only viewer and long-press delete. Cross-compiling to Android ARM from amd64 Linux no longer needs Docker / fyne-cross / NDK -- flutter build apk emits ARM binaries directly. Co-Authored-By: Claude Opus 4.7 --- lib/services/shared_text_handler.dart | 57 +++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 lib/services/shared_text_handler.dart (limited to 'lib/services/shared_text_handler.dart') diff --git a/lib/services/shared_text_handler.dart b/lib/services/shared_text_handler.dart new file mode 100644 index 0000000..c8e99a4 --- /dev/null +++ b/lib/services/shared_text_handler.dart @@ -0,0 +1,57 @@ +enum SharedTextLoadMode { prefill, autoLog } + +class SharedTextDecision { + const SharedTextDecision({required this.mode, required this.text, required this.proceed}); + final SharedTextLoadMode mode; + final String text; + final bool proceed; +} + +SharedTextDecision prepareSharedTextLoad(String text, bool autoLog) { + if (text.trim().isEmpty) { + return const SharedTextDecision(mode: SharedTextLoadMode.prefill, text: '', proceed: false); + } + return SharedTextDecision( + mode: autoLog ? SharedTextLoadMode.autoLog : SharedTextLoadMode.prefill, + text: text, + proceed: true, + ); +} + +typedef LogFn = Future Function(String dir, String text); +typedef ShowInfo = void Function(String title, String message); +typedef ShowError = void Function(Object error); + +Future handleSharedTextLoad({ + required String text, + required bool autoLog, + required String dir, + required void Function(String) prefill, + required void Function() focus, + required void Function() resetInput, + required Future Function() clearCache, + required LogFn logFn, + required ShowInfo showInfo, + required ShowError showError, +}) async { + final decision = prepareSharedTextLoad(text, autoLog); + if (!decision.proceed) { + await clearCache(); + return; + } + if (decision.mode == SharedTextLoadMode.autoLog) { + try { + await logFn(dir, decision.text); + } catch (e) { + showError(e); + return; + } + showInfo('Logged', 'Shared text has been logged.'); + resetInput(); + await clearCache(); + return; + } + prefill(decision.text); + focus(); + await clearCache(); +} -- cgit v1.2.3