Skip to content

Commit

Permalink
Merge pull request #26 from klippa-app/feature/bump-sdk
Browse files Browse the repository at this point in the history
bump android and ios sdk versions.
  • Loading branch information
RobinFarmer authored Dec 3, 2024
2 parents c8fcac5 + f28c8bd commit 0954e65
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 1.0.3

* Bumped Android to 4.0.5
* Bumped iOS to 2.0.4
* Added `userCanPickMediaFromStorage` and `shouldGoToReviewScreenOnFinishPressed`.
* Added `brightnessLowerThreshold` and `brightnessUpperThreshold` for iOS.

## 1.0.2

* Fixed issue where `PreviewDuration` was set incorrectly.
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ config.imageLimit = 10;
// Whether the camera automatically saves the images to the camera roll (iOS) / gallery (Android). Default true.
config.storeImagesToCameraRol = true;
// Whether to allow users to select media from their device (Shows a media button bottom left on the scanner screen).
config.userCanPickMediaFromStorage = true;
// Whether the next button in the bottom right of the scanner screen goes to the review screen instead of finishing the session.
config.shouldGoToReviewScreenOnFinishPressed = true;
// What the default color conversion will be (grayscale, original, enhanced).
config.defaultColor = DefaultColor.original;
Expand Down Expand Up @@ -260,6 +266,12 @@ config.isViewFinderEnabled = true;
// The threshold sensitive the motion detection is. (lower value is higher sensitivity, default 200).
config.imageMovingSensitivityiOS = 200;
// The lower threshold before the warning message informs the environment is too dark (default 0).
config.brightnessLowerThreshold = 0;
// The upper threshold before the warning message informs the environment is too bright (default 6).
config.brightnessUpperThreshold = 6;
```


Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ android {
}

dependencies {
def fallbackKlippaScannerVersion = "4.0.1"
def fallbackKlippaScannerVersion = "4.0.5"
def klippaScannerVersion = project.hasProperty('klippaScannerVersion') ? project.klippaScannerVersion : fallbackKlippaScannerVersion
implementation "com.klippa:scanner:$klippaScannerVersion"
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ class KlippaScannerSdkPlugin: FlutterPlugin, MethodCallHandler, ActivityAware, P
scannerSession.menu.userCanChangeColorSetting = it
}

call.argument<Boolean>("UserCanPickMediaFromStorage")?.let {
scannerSession.menu.userCanPickMediaFromStorage = it
}

call.argument<Boolean>("ShouldGoToReviewScreenOnFinishPressed")?.let {
scannerSession.menu.shouldGoToReviewScreenOnFinishPressed = it
}

val modes: MutableList<KlippaDocumentMode> = mutableListOf()

Expand Down
16 changes: 16 additions & 0 deletions ios/Classes/SwiftKlippaScannerSdkPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,22 @@ public class SwiftKlippaScannerSdkPlugin: NSObject, FlutterPlugin, KlippaScanner
builder.klippaImageAttributes.storeImagesToCameraRoll = storeImagesToCameraRoll
}

if let userCanPickMediaFromStorage = builderArgs?["UserCanPickMediaFromStorage"] as? Bool {
builder.klippaMenu.userCanPickMediaFromStorage = userCanPickMediaFromStorage
}

if let shouldGoToReviewScreenOnFinishPressed = builderArgs?["ShouldGoToReviewScreenOnFinishPressed"] as? Bool {
builder.klippaMenu.shouldGoToReviewScreenOnFinishPressed = shouldGoToReviewScreenOnFinishPressed
}

if let brightnessLowerThreshold = builderArgs?["BrightnessLowerThreshold"] as? Double {
builder.klippaImageAttributes.brightnessLowerThreshold = brightnessLowerThreshold
}

if let brightnessUpperThreshold = builderArgs?["BrightnessUpperThreshold"] as? Double {
builder.klippaImageAttributes.brightnessUpperThreshold = brightnessUpperThreshold
}

var modes: [KlippaDocumentMode] = []

if let cameraModeSingle = builderArgs?["CameraModeSingle"] as? Dictionary<String, String?> {
Expand Down
2 changes: 1 addition & 1 deletion ios/sdk_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.2
2.0.4
30 changes: 30 additions & 0 deletions lib/klippa_scanner_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ class CameraConfig {
/// The starting index for which mode will be preselected when starting.
num? startingIndex;

/// Whether to allow users to select media from their device (Shows a media button bottom left on the scanner screen).
bool? userCanPickMediaFromStorage;

/// Whether the next button in the bottom right of the scanner screen goes to the review screen instead of finishing the session.
bool? shouldGoToReviewScreenOnFinishPressed;

/// Android Options
/// Where to put the image results
Expand Down Expand Up @@ -238,6 +244,12 @@ class CameraConfig {

/// The threshold sensitive the motion detection is. (lower value is higher sensitivity, default 200).
num? imageMovingSensitivityiOS;

/// The lower threshold before the warning message informs the environment is too dark (default 0).
num? brightnessLowerThreshold;

/// The upper threshold before the warning message informs the environment is too bright (default 6).
num? brightnessUpperThreshold;
}

/// A helper to convert flutter Color to a hex ARGB.
Expand Down Expand Up @@ -373,6 +385,16 @@ class KlippaScannerSdk {
config.userCanChangeColorSetting;
}

if (config.userCanPickMediaFromStorage != null) {
parameters["UserCanPickMediaFromStorage"] =
config.userCanPickMediaFromStorage;
}

if (config.shouldGoToReviewScreenOnFinishPressed != null) {
parameters["ShouldGoToReviewScreenOnFinishPressed"] =
config.shouldGoToReviewScreenOnFinishPressed;
}

/// Android only
if (config.storagePath != null) {
Expand Down Expand Up @@ -523,6 +545,14 @@ class KlippaScannerSdk {
config.imageMovingSensitivityiOS;
}

if (config.brightnessLowerThreshold != null) {
parameters["BrightnessLowerThreshold"] = config.brightnessLowerThreshold;
}

if (config.brightnessUpperThreshold != null) {
parameters["BrightnessUpperThreshold"] = config.brightnessUpperThreshold;
}

final Map startSessionResult =
await _channel.invokeMethod('startSession', parameters);
return startSessionResult;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: klippa_scanner_sdk
description: Allows you to do document scanning with the Klippa Scanner SDK from Flutter apps.
version: 1.0.2
version: 1.0.3
homepage: https://github.com/klippa-app/flutter-klippa-scanner-sdk

environment:
Expand Down

0 comments on commit 0954e65

Please sign in to comment.