kUnsupportedOSError casing

This commit is contained in:
shenlong-tanwen 2026-08-17 17:45:10 +05:30
parent e78060521d
commit 5e11269531
5 changed files with 8 additions and 6 deletions

View file

@ -144,7 +144,7 @@ class NativeSyncApiImpl: ImmichPlugin, NativeSyncApi, FlutterPlugin {
private func getMediaChanges() throws -> SyncDelta {
guard #available(iOS 16, *) else {
throw PigeonError(code: kUnSupportedOSError, message: "This feature requires iOS 16 or later.", details: nil)
throw PigeonError(code: kUnsupportedOSError, message: "This feature requires iOS 16 or later.", details: nil)
}
guard PHPhotoLibrary.authorizationStatus(for: .readWrite) == .authorized else {
@ -437,7 +437,7 @@ class NativeSyncApiImpl: ImmichPlugin, NativeSyncApi, FlutterPlugin {
}
func getTrashedAssets() throws -> [String: [PlatformAsset]] {
throw PigeonError(code: kUnSupportedOSError, message: "This feature not supported on iOS.", details: nil)
throw PigeonError(code: kUnsupportedOSError, message: "This feature not supported on iOS.", details: nil)
}
func restoreFromTrashById(mediaId: String, type: Int64, completion: @escaping (Result<Bool, Error>) -> Void) {
@ -477,7 +477,7 @@ class NativeSyncApiImpl: ImmichPlugin, NativeSyncApi, FlutterPlugin {
func getCloudIdForAssetIds(assetIds: [String]) throws -> [CloudIdResult] {
guard #available(iOS 16, *) else {
throw PigeonError(code: kUnSupportedOSError, message: "This feature requires iOS 16 or later.", details: nil)
throw PigeonError(code: kUnsupportedOSError, message: "This feature requires iOS 16 or later.", details: nil)
}
var mappings: [CloudIdResult] = []

View file

@ -28,7 +28,7 @@ Future<void> resolveCloudIds(
try {
results = await nativeSyncApi.getCloudIdForAssetIds(batch);
} on PlatformException catch (error, stack) {
if (error.code == kUnSupportedOSError) {
if (error.code == kUnsupportedOSError) {
logger.warning('Cloud IDs are unavailable on this device. Skipping resolution.', error, stack);
return;
}

View file

@ -8,6 +8,7 @@ import 'package:immich_mobile/constants/constants.dart';
import 'package:immich_mobile/domain/models/asset/asset_metadata.model.dart';
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart';
import 'package:immich_mobile/domain/models/server_capability.model.dart';
import 'package:immich_mobile/domain/utils/cloud_id_resolver.dart';
import 'package:immich_mobile/extensions/platform_extensions.dart';
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
import 'package:immich_mobile/infrastructure/repositories/local_album.repository.dart';
@ -31,6 +32,7 @@ Future<void> syncCloudIds(ProviderContainer ref) async {
if (!CurrentPlatform.isIOS) {
return;
}
final logger = Logger('migrateCloudIds');
final db = ref.read(driftProvider);

View file

@ -11,7 +11,7 @@ import 'package:pigeon/pigeon.dart';
dartPackageName: 'immich_mobile',
),
)
const String kUnSupportedOSError = 'UNSUPPORTED_OS';
const String kUnsupportedOSError = 'UNSUPPORTED_OS';
enum PlatformAssetPlaybackStyle { unknown, image, video, imageAnimated, livePhoto, videoLooping }

View file

@ -87,7 +87,7 @@ void main() {
final ids = List.generate(kCloudIdChunkSize + 1, (i) => 'asset-$i');
when(
() => mockNativeSyncApi.getCloudIdForAssetIds(any()),
).thenThrow(PlatformException(code: kUnSupportedOSError));
).thenThrow(PlatformException(code: kUnsupportedOSError));
await resolveCloudIds(mockNativeSyncApi, albumRepository, ids);