Skip to content

Commit

Permalink
fix: apply changes from review
Browse files Browse the repository at this point in the history
  • Loading branch information
WoLewicki committed Aug 8, 2024
1 parent 3b0f913 commit b8417d8
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 9 deletions.
6 changes: 3 additions & 3 deletions android/src/main/java/com/rncamerakit/RNCameraKitModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ class RNCameraKitModule(private val reactContext: ReactApplicationContext) : Nat
*/
@ReactMethod
override fun capture(options: ReadableMap?, tag: Double?, promise: Promise) {
// CameraManager does not allow us to return values
val context = reactContext
val viewTag = tag?.toInt()
if (viewTag != null && options != null) {
val uiManager = UIManagerHelper.getUIManagerForReactTag(reactContext, viewTag)
context.runOnUiQueueThread {
reactContext.runOnUiQueueThread {
val camera = uiManager?.resolveView(viewTag) as CKCamera
camera.capture(options.toHashMap(), promise)
}
} else {
promise.reject("E_CAPTURE_FAILED", "options or/and tag arguments are null, options: $options, tag: $viewTag")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class RNCameraKitPackage : TurboReactPackage() {
RNCameraKitModule.REACT_CLASS,
false, // canOverrideExistingModule
false, // needsEagerInit
true, // hasConstants
false, // isCxxModule
isTurboModule // isTurboModule
)
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/java/com/rncamerakit/events/ErrorEvent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ErrorEvent(
) : Event<ErrorEvent>(surfaceId, viewId) {
override fun getEventName(): String = EVENT_NAME

override fun getEventData(): WritableMap? =
override fun getEventData(): WritableMap =
Arguments.createMap().apply {
putString("errorMessage", errorMessage)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class OrientationChangeEvent(
) : Event<OrientationChangeEvent>(surfaceId, viewId) {
override fun getEventName(): String = EVENT_NAME

override fun getEventData(): WritableMap? =
override fun getEventData(): WritableMap =
Arguments.createMap().apply {
putInt("orientation", orientation)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class PictureTakenEvent(
) : Event<PictureTakenEvent>(surfaceId, viewId) {
override fun getEventName(): String = EVENT_NAME

override fun getEventData(): WritableMap? =
override fun getEventData(): WritableMap =
Arguments.createMap().apply {
putString("uri", uri)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ReadCodeEvent(
) : Event<ReadCodeEvent>(surfaceId, viewId) {
override fun getEventName(): String = EVENT_NAME

override fun getEventData(): WritableMap? =
override fun getEventData(): WritableMap =
Arguments.createMap().apply {
putString("codeFormat", codeFormat)
putString("codeStringValue", codeStringValue)
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/java/com/rncamerakit/events/ZoomEvent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ZoomEvent(
) : Event<ZoomEvent>(surfaceId, viewId) {
override fun getEventName(): String = EVENT_NAME

override fun getEventData(): WritableMap? =
override fun getEventData(): WritableMap =
Arguments.createMap().apply {
putDouble("zoom", zoom)
}
Expand Down

0 comments on commit b8417d8

Please sign in to comment.