The dashboard (Raspberry Pi 3.5" screen + web pages), the end-to-end encrypted sync mailbox (PHP + SQLite) and the Android companion app (Flutter), with docs, clean-install checks and screenshots made from demo data. Built mostly with an AI coding assistant; not yet reviewed line by line by a human (see README and SECURITY.md). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
1.1 KiB
Dart
25 lines
1.1 KiB
Dart
// Gadgetbridge's database export on this phone, through Android's file picker: picked once (the read
|
|
// permission is kept), then read again after every new export — from the app and from background tasks
|
|
// (a plugin, so WorkManager's engine has it too). Android: GbExportPlugin.kt.
|
|
import 'package:flutter/services.dart';
|
|
|
|
const _channel = MethodChannel('dash/gbexport');
|
|
|
|
/// The system file picker → the file's uri (null = cancelled). Needs the app on screen.
|
|
Future<String?> pickExport() => _channel.invokeMethod<String>('pick');
|
|
|
|
/// {size, modified (ms)} — null when the file is gone or no longer readable.
|
|
Future<Map<String, int>?> exportInfo(String uri) => _channel.invokeMapMethod<String, int>('info', {'uri': uri});
|
|
|
|
/// The phone's time zone ("Europe/Bucharest"); null where there's no Android (tests).
|
|
Future<String?> timeZone() async {
|
|
try {
|
|
return await _channel.invokeMethod<String>('timeZone');
|
|
} on MissingPluginException {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/// Copy the file to [path] → true when copied.
|
|
Future<bool> copyExport(String uri, String path) async =>
|
|
await _channel.invokeMethod<bool>('copy', {'uri': uri, 'path': path}) ?? false;
|