Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

Commit

Permalink
Merge pull request #214 from mintware-de/fix_211
Browse files Browse the repository at this point in the history
Add @keep annotation prevent renaming of dynamically invoked platform channel methods.
  • Loading branch information
devtronic committed Apr 18, 2020
2 parents 878a222 + 5d50b8a commit 0339b42
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.mintware.barcode_scan

import android.hardware.Camera
import androidx.annotation.Keep
import androidx.annotation.Nullable
import io.flutter.plugin.common.BinaryMessenger
import io.flutter.plugin.common.EventChannel
Expand All @@ -20,6 +21,7 @@ class ChannelHandler(private val activityHelper: ActivityHelper
@Nullable
private var sink: EventChannel.EventSink? = null

@Keep
@Suppress("unused", "UNUSED_PARAMETER")
fun scan(call: MethodCall, result: MethodChannel.Result) {
var config: Protos.Configuration = Protos.Configuration.newBuilder()
Expand All @@ -42,11 +44,13 @@ class ChannelHandler(private val activityHelper: ActivityHelper
activityHelper.showScannerActivity(result, config)
}

@Keep
@Suppress("unused", "UNUSED_PARAMETER")
fun numberOfCameras(call: MethodCall, result: MethodChannel.Result) {
result.success(Camera.getNumberOfCameras())
}

@Keep
@Suppress("unused", "UNUSED_PARAMETER")
fun requestCameraPermission(call: MethodCall, result: MethodChannel.Result) {
result.success(activityHelper.requestCameraAccessIfNecessary(sink))
Expand Down

0 comments on commit 0339b42

Please sign in to comment.