From 5247a201c8ba77329c7b1ee40da7b8e43a56b567 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 1 Mar 2026 18:10:19 +0200 Subject: =?UTF-8?q?Release=20v0.1.0:=20code=20quality=20audit=20=E2=80=94?= =?UTF-8?q?=20fix=20dialog=20bug,=20refactor,=20add=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix per-keystroke dialog storm when text exceeds maxTextLength - Extract logEntry() for testable persistence with filepath.Join - Extract newInputWidget() and deduplicate shared-text loading - Rename appId to appID per Go naming conventions - Delete unused debugSharedPath function - Add error distinction in readSharedFromCache (log real errors) - Fix ANDORID_NDK_HOME typo to ANDRIOD_NDK_HOME in Magefile - Run gofmt, go mod tidy; promote defaultDirectory to const - Add unit tests for logEntry and readSharedFromCache stub Co-Authored-By: Claude Opus 4.6 --- android_shared_android.go | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) (limited to 'android_shared_android.go') diff --git a/android_shared_android.go b/android_shared_android.go index b736fab..e46fab2 100644 --- a/android_shared_android.go +++ b/android_shared_android.go @@ -3,32 +3,24 @@ package main import ( - "os" - "path/filepath" + "os" + "path/filepath" ) // readSharedFromCache tries to read the shared text written by the Android activity. // The activity writes into getCacheDir()/quicklogger-shared.txt; on Go, os.TempDir() // maps to the same location in Android (app cache directory). func readSharedFromCache() (string, error) { - dir, derr := os.UserCacheDir() - if derr != nil || dir == "" { - dir = os.TempDir() - } - path := filepath.Join(dir, "quicklogger-shared.txt") - b, err := os.ReadFile(path) - if err != nil { - return "", err - } - // best-effort cleanup; ignore errors - _ = os.Remove(path) - return string(b), nil -} - -func debugSharedPath() string { - dir, _ := os.UserCacheDir() - if dir == "" { - dir = os.TempDir() - } - return filepath.Join(dir, "quicklogger-shared.txt") + dir, derr := os.UserCacheDir() + if derr != nil || dir == "" { + dir = os.TempDir() + } + path := filepath.Join(dir, "quicklogger-shared.txt") + b, err := os.ReadFile(path) + if err != nil { + return "", err + } + // best-effort cleanup; ignore errors + _ = os.Remove(path) + return string(b), nil } -- cgit v1.2.3