Merge dev; fix share-location and discovered-contact import/export; update docs
Merge dev (#588 share location, #436 discovered-contact import/export) into fix/review-fixes-and-issue-batch. Conflicts: keep the node-scan button alongside dev's import/export menu; take dev's marker label prompt. Share location (#588): - Never share a missing or 0,0 radio position; hide the chat action and show "Your radio has no location set" - Sanitise marker labels ('|' -> '/', newlines -> spaces) on every path - One shared MarkerLabelDialog owning its controller/focus node, with keyboard submit, replacing three copies - Map pins default to "Point of interest" again; "Share my location" uses the node name - Location shares honour the send cooldown and handle send errors Discovered-contact import/export (#436): - Per-entry decoding with imported/skipped/invalid counts; reject keys that are not 32 bytes; skip in-file duplicates and the radio's own key - Strip routing paths on import and stop exporting them; clamp future timestamps; enforce the discovered-contact cap; require a connection; 2 MB file limit - Export via in-memory XFile (fixes web); pass sharePositionOrigin for iPad (also GPX export and image save); macOS user-selected read-write entitlement for save dialogs Docs: cover share location, import/export, node scan, TCP reconnect, channel auto-resend options, arrival ordering, badge, password length and image limits. Translations for all new strings in every locale.
This commit is contained in:
commit
5fb67abdde
66 files changed
+3118
-168
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import 'dart:ui' show Rect;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:gpx/gpx.dart';
|
||||
import 'package:meshcore_open/connector/meshcore_connector.dart';
|
||||
@@ -122,8 +124,9 @@ class GpxExport {
|
||||
String description,
|
||||
String filename,
|
||||
String shareText,
|
||||
String subject,
|
||||
) async {
|
||||
String subject, {
|
||||
Rect? sharePositionOrigin,
|
||||
}) async {
|
||||
if (PlatformInfo.isWeb) {
|
||||
debugPrint("GPX export is not supported on Web.");
|
||||
return gpxExportNotAvailable;
|
||||
@@ -197,7 +200,12 @@ class GpxExport {
|
||||
await file.writeAsString(xml);
|
||||
|
||||
final result = await SharePlus.instance.share(
|
||||
ShareParams(text: shareText, subject: subject, files: [XFile(path)]),
|
||||
ShareParams(
|
||||
text: shareText,
|
||||
subject: subject,
|
||||
files: [XFile(path)],
|
||||
sharePositionOrigin: sharePositionOrigin,
|
||||
),
|
||||
);
|
||||
|
||||
await file.delete();
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'package:file_selector/file_selector.dart';
|
||||
import 'dart:ui' show Rect;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
@@ -12,6 +14,7 @@ Future<bool> saveImagePng(
|
||||
Uint8List png,
|
||||
ReceivedImageEntry entry, {
|
||||
String? shareText,
|
||||
Rect? sharePositionOrigin,
|
||||
}) async {
|
||||
final name = entry.synthesized
|
||||
? 'meshcore-ai-reconstructed-${entry.streamId}.png'
|
||||
@@ -33,6 +36,7 @@ Future<bool> saveImagePng(
|
||||
files: [file],
|
||||
fileNameOverrides: [name],
|
||||
text: entry.synthesized ? shareText : null,
|
||||
sharePositionOrigin: sharePositionOrigin,
|
||||
),
|
||||
);
|
||||
return result.status != ShareResultStatus.unavailable;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
/// The on-screen rect of [context]'s widget, for share_plus'
|
||||
/// `sharePositionOrigin`. iPad anchors the share popover to it and throws
|
||||
/// without one; other platforms ignore it.
|
||||
Rect? shareOriginOf(BuildContext context) {
|
||||
final box = context.findRenderObject();
|
||||
if (box is! RenderBox || !box.hasSize || box.size.isEmpty) return null;
|
||||
return box.localToGlobal(Offset.zero) & box.size;
|
||||
}
|
||||
Reference in new issue
Block a user