m3_lightmeter/ios/Runner/PlatformChannels/CaffeinePlatformChannel.swift
Vadim 7c96b5a47d
ML-220 Show focal length when zooming (#233)
* extract focal length from exif

* added focal length section

* wip

* [android] calculate EFL

* split other platform handlers to separate files

* [ios] calculate EFL

* updated translations

* deleted `focalLengthFromTags`

* fixed unit tests

* [ios] link missing files

* updated Pro features screen

* [ios] fixed signing

* fixed screenshot generator

* updated goldens

* [android] updated store screenshots

* wip

* [ios] updated store screenshots

* enable focal length feature by default

* mock camera focal length for integration tests

* cleanup

* added logging to `CameraInfoService`
2025-05-14 10:26:59 +02:00

35 lines
1.2 KiB
Swift

//
// CaffeinePlatformChannel.swift
// Runner
//
// Created by Vadim Turko on 2025-05-11.
//
import Flutter
public class CaffeinePlatformChannel: NSObject {
let methodChannel: FlutterMethodChannel
init(binaryMessenger: FlutterBinaryMessenger) {
self.methodChannel = FlutterMethodChannel(
name: "com.vodemn.lightmeter.CaffeinePlatformChannel.MethodChannel",
binaryMessenger: binaryMessenger
)
super.init()
methodChannel.setMethodCallHandler({
(call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
switch call.method {
case "isKeepScreenOn":
result(UIApplication.shared.isIdleTimerDisabled)
case "setKeepScreenOn":
guard let keepOn = call.arguments as? Bool else {
result(FlutterError(code: "invalid arguments", message: "Argument should be of type Bool for 'setKeepScreenOn' call", details: nil))
return
}
UIApplication.shared.isIdleTimerDisabled = keepOn
result(true)
default:
result(FlutterMethodNotImplemented)
}
})
}
}