Merge remote-tracking branch 'origin/dev' into cursor/routing-send-settings-ef15
# Conflicts: # documentation/design.md # lib/screens/channels_screen.dart # lib/screens/chat_screen.dart
This commit is contained in:
commit
84c0b97710
67 files changed
+5449
-880
No files matched your search
@@ -23,6 +23,7 @@ const String _encryptedBackupFormat = 'meshcore-open-encrypted-backup';
|
||||
const List<String> _contactPreferencePrefixes = [
|
||||
'contacts',
|
||||
'contact_groups',
|
||||
'contact_added_at_',
|
||||
'contact_smaz_',
|
||||
'contact_cyr2lat_',
|
||||
'contact_url_images_',
|
||||
@@ -1094,7 +1095,8 @@ class BackupService {
|
||||
return true;
|
||||
}
|
||||
if (items.contains(BackupItem.contacts) &&
|
||||
key.startsWith('contacts$devicePrefix')) {
|
||||
(key.startsWith('contacts$devicePrefix') ||
|
||||
key.startsWith('contact_added_at_$devicePrefix'))) {
|
||||
return true;
|
||||
}
|
||||
if (items.contains(BackupItem.perContactSettings) &&
|
||||
|
||||
@@ -871,14 +871,33 @@ class ImageCodecCancelled implements Exception {
|
||||
String toString() => 'Image processing stopped.';
|
||||
}
|
||||
|
||||
/// Whether this build can run the image codec at all.
|
||||
///
|
||||
/// False on web and in a build made with `scripts/onnx.sh off`, where
|
||||
/// `flutter_onnxruntime` is the pure-Dart stub whose [OnnxRuntime] constructor
|
||||
/// throws [UnsupportedError]. The real constructor has no side effects.
|
||||
final bool imageCodecRuntimeAvailable = _probeOnnxRuntime();
|
||||
|
||||
bool _probeOnnxRuntime() {
|
||||
if (kIsWeb) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
OnnxRuntime();
|
||||
return true;
|
||||
} on UnsupportedError {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// Factory used by the codec worker isolate.
|
||||
///
|
||||
/// Returns `null` on web, where there is no local model file and no isolate.
|
||||
/// Everywhere else it returns the real [OnnxImageCodecBackend]; the session
|
||||
/// turns a `null` here into an [ImageCodecUnimplemented], which the service
|
||||
/// surfaces as `lastError` and maps to `ImageCodecAvailability.unavailable`.
|
||||
/// Returns `null` when [imageCodecRuntimeAvailable] is false. Everywhere else
|
||||
/// it returns the real [OnnxImageCodecBackend]; the session turns a `null`
|
||||
/// here into an [ImageCodecUnimplemented], which the service surfaces as
|
||||
/// `lastError` and maps to `ImageCodecAvailability.unavailable`.
|
||||
ImageCodecBackend? createImageCodecBackend() {
|
||||
if (kIsWeb) {
|
||||
if (!imageCodecRuntimeAvailable) {
|
||||
return null;
|
||||
}
|
||||
return OnnxImageCodecBackend();
|
||||
|
||||
@@ -8,7 +8,8 @@ import '../models/image_codec_support.dart';
|
||||
import '../utils/app_logger.dart';
|
||||
import '../widgets/image_send_codec_binding.dart';
|
||||
import 'app_settings_service.dart';
|
||||
import 'image_codec_backend.dart' show kImageCodecBitstreamPathAvailable;
|
||||
import 'image_codec_backend.dart'
|
||||
show imageCodecRuntimeAvailable, kImageCodecBitstreamPathAvailable;
|
||||
import 'image_codec_file_store.dart';
|
||||
import 'image_codec_session.dart';
|
||||
import 'image_codec_settings_store.dart';
|
||||
@@ -177,9 +178,10 @@ class ImageCodecService extends ChangeNotifier implements ImageSendCodec {
|
||||
|
||||
/// Why [availability] is `unavailable`, or null when it is not.
|
||||
///
|
||||
/// EXACTLY THREE CAUSES, all of them permanent properties of the build or the
|
||||
/// EXACTLY FOUR CAUSES, all of them permanent properties of the build or the
|
||||
/// platform, none of them fixable by the user:
|
||||
/// * web, which has no native inference runtime;
|
||||
/// * a build made without ONNX Runtime ([imageCodecRuntimeAvailable]);
|
||||
/// * a build compiled without the entropy path
|
||||
/// ([kImageCodecBitstreamPathAvailable]);
|
||||
/// * a backend that failed to load.
|
||||
@@ -194,6 +196,10 @@ class ImageCodecService extends ChangeNotifier implements ImageSendCodec {
|
||||
return 'The image codec needs a native inference runtime, which the web '
|
||||
'build does not have.';
|
||||
}
|
||||
if (!imageCodecRuntimeAvailable) {
|
||||
return 'This build was made without ONNX Runtime, so it cannot send or '
|
||||
'show image messages.';
|
||||
}
|
||||
if (!kImageCodecBitstreamPathAvailable) {
|
||||
return 'This build ships the image decoder only. Encoding and decoding a '
|
||||
'bitstream also needs the entropy-side graph and the rANS coder, '
|
||||
@@ -510,7 +516,7 @@ class ImageCodecService extends ChangeNotifier implements ImageSendCodec {
|
||||
/// works. [canEncode]/[canDecode] additionally require the entropy path.
|
||||
bool get canRunInference {
|
||||
final model = selectedModel;
|
||||
return !kIsWeb &&
|
||||
return imageCodecRuntimeAvailable &&
|
||||
!_backendMissing &&
|
||||
model != null &&
|
||||
model.localPath.isNotEmpty;
|
||||
|
||||
Reference in new issue
Block a user