Skip to content

Commit

Permalink
Merge pull request #9 from klippa-app/feature/add_default_image_color…
Browse files Browse the repository at this point in the history
…_support_for_ios

Renamed `defaultImageColor` to `defaultColor` for iOS. (Android and i…
  • Loading branch information
RobinFarmer authored Aug 24, 2022
2 parents 9b9d0fa + 555ded3 commit 14052c0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 0.0.8

- Bump iOS to version 0.5.3
- Added `defaultColor` support for iOS.

## 0.0.7

Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,14 @@ config.cancelAndDeleteImagesButtonText = "Delete photos and exit";
// Whether the camera automatically saves the images to the camera roll (iOS) / gallery (Android). Default true.
config.storeImagesToCameraRol = true;
// What the default color conversion will be (grayscale, original, enhanced).
config.defaultColor = DefaultColor.original;
```

## Android only

```dart
// What the default color conversion will be (grayscale, original, enhanced).
config.defaultColor = DefaultColor.original;
// Where to put the image results.
config.storagePath = "/sdcard/scanner";
Expand All @@ -255,8 +256,6 @@ config.imageMovingSensitivityAndroid = 50;

## iOS only
```dart
// What the default image color conversion will be (grayscale, original, enhanced).
config.defaultImageColor = DefaultColor.original;
// The text inside of the color selection alert dialog button named original.
config.imageColorOriginalText = "original";
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class _MyAppState extends State<MyApp> {
config.model.fileName = "model";
config.model.modelLabels = "labelmap";
config.storeImagesToCameraRol = true;
config.defaultImageColor = DefaultColor.original;
config.defaultColor = DefaultColor.original;
config.imageColorOriginalText = "original";
config.imageColorGrayscaleText = "grayscale";
config.imageColorEnhancedText = "enhanced";
Expand Down
4 changes: 2 additions & 2 deletions ios/Classes/SwiftKlippaScannerSdkPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ public class SwiftKlippaScannerSdkPlugin: NSObject, FlutterPlugin, ImageScannerC
KlippaScanner.setup.imageTooDarkMessage = imageTooDarkMessage as? String ?? ""
}

if let defaultImageColor = builderArgs?["DefaultImageColor"] {
let imageColor = defaultImageColor as? String ?? "original"
if let defaultColor = builderArgs?["DefaultColor"] {
let imageColor = defaultColor as? String ?? "original"
if (imageColor == "original" || imageColor == "enhanced" || imageColor == "grayscale") {
KlippaScanner.setup.defaultImageColor = imageColor
} else {
Expand Down
15 changes: 4 additions & 11 deletions lib/klippa_scanner_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,6 @@ class CameraConfig {
/// The warning message when the camera result is too dark.
String imagetooDarkMessage;

/// What the default image color conversion will be (grayscale, original, enhanced).
DefaultColor defaultImageColor;

/// The text inside of the color selection alert dialog button named original.
String imageColorOriginalText;

Expand Down Expand Up @@ -347,16 +344,16 @@ class KlippaScannerSdk {
config.cancelAndDeleteImagesButtonText;
}

if (config.defaultColor != null) {
parameters["DefaultColor"] = describeEnum(config.defaultColor);
}

/// Android only
if (config.storagePath != null) {
parameters["StoragePath"] = config.storagePath;
}

if (config.defaultColor != null) {
parameters["DefaultColor"] = describeEnum(config.defaultColor);
}

if (config.outputFileName != null) {
parameters["OutputFilename"] = config.outputFileName;
}
Expand All @@ -376,10 +373,6 @@ class KlippaScannerSdk {
parameters["ImageTooDarkMessage"] = config.imagetooDarkMessage;
}

if (config.defaultImageColor != null) {
parameters["DefaultImageColor"] = describeEnum(config.defaultImageColor);
}

if (config.imageColorOriginalText != null) {
parameters["ImageColorOriginalText"] = config.imageColorOriginalText;
}
Expand Down

0 comments on commit 14052c0

Please sign in to comment.