Skip to content

Commit

Permalink
Merge pull request #2 from klippa-app/feature/upgrade-plugin
Browse files Browse the repository at this point in the history
Upgrade implementations.
  • Loading branch information
RobinFarmer authored Jan 30, 2024
2 parents 114fd48 + aeeec50 commit 1c14ec4
Show file tree
Hide file tree
Showing 18 changed files with 553 additions and 301 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 0.1.0

- Bumped Android SDK to `3.1.3`.
- Bumped iOS SDK to `1.2.0`.
- Removed `allowMultipleDocuments`.
- Removed `defaultMultipleDocuments`.
- Added `DocumentMode`.
- Added `cameraModeSingle`, `cameraModeMulti`, `cameraModeSegmented` which are all of type `DocumentMode`.
- Fixed typo `imageColorGrayscaleText` becomes `imageColorGrayScaleText`.

## 0.0.2

- Fixed typo`Filepath` becomes `filePath` in Android SDK.
Expand Down
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ const KlippaScannerConfig: CameraConfig = {
cancelAndDeleteImagesButtonText: "Delete images",
// The camera mode for scanning one part documents.
cameraModeSingle: { name: "Single", message: "Instructions" },
// The camera mode for scanning documents that consist of multiple pages.
cameraModeMulti: { name: "Multi", message: "Instructions" },
// The camera mode for scanning long documents in separate parts.
cameraModeSegmented: { name: "Segmented", message: "Instructions" },
startingIndex: 0,
// Optional. Only affects Android.
Expand Down Expand Up @@ -285,7 +295,7 @@ Add or edit the file `android/app/src/main/res/values/strings.xml`, add the foll

### iOS

Use the following properties in the config when running `getCameraResult`: `imageTooBrightMessage`, `imageTooDarkMessage`, `deleteButtonText`, `retakeButtonText`, `cancelButtonText`, `cancelAndDeleteImagesButtonText`, `cancelConfirmationMessage`, `moveCloserMessage`, `imageMovingMessage`, `imageLimitReachedMessage`, `orientationWarningMessage`, `imageColorOriginalText`, `imageColorGrayscaleText`, `imageColorEnhancedText`.
Use the following properties in the config when running `getCameraResult`: `imageTooBrightMessage`, `imageTooDarkMessage`, `deleteButtonText`, `retakeButtonText`, `cancelButtonText`, `cancelAndDeleteImagesButtonText`, `cancelConfirmationMessage`, `moveCloserMessage`, `imageMovingMessage`, `imageLimitReachedMessage`, `orientationWarningMessage`, `imageColorOriginalText`, `imageColorGrayScaleText`, `imageColorEnhancedText`.

## Important iOS notes
Older iOS versions do not ship the Swift libraries. To make sure the SDK works on older iOS versions, you can configure the build to embed the Swift libraries using the build setting `EMBEDDED_CONTENT_CONTAINS_SWIFT = YES`.
Expand All @@ -303,6 +313,17 @@ android {
}
```
### Using the Example App
- Clone the project
- Run `npm install` in both `root` and `example` folders.
- Run `npm run build` in both `root` and `example` folders.
- Run `npx cap sync` in example folder.
- Run `npx cap run ios` or `npx cap run android` for whichever OS you want to run on.
Note: You will need to add your own Klippa username and password to the `Podfile` and `build.gradle` to pull the dependencies correctly.
You might also need to run `pod install` in example/ios/App/ folder.
## About Klippa
[Klippa](https://www.klippa.com/en) is a scale-up from [Groningen, The Netherlands](https://goo.gl/maps/CcCGaPTBz3u8noSd6) and was founded in 2015 by six Dutch IT specialists with the goal to digitize paper processes with modern technologies.
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
def DEFAULT_COMPILE_SDK_VERSION = 33
def DEFAULT_COMPILE_SDK_VERSION = 34
def DEFAULT_BUILD_TOOLS_VERSION = '30.0.3'
def DEFAULT_MIN_SDK_VERSION = 21
def DEFAULT_TARGET_SDK_VERSION = 33
def DEFAULT_TARGET_SDK_VERSION = 34

def safeExtGet(prop, fallback) {
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
Expand Down Expand Up @@ -55,7 +55,7 @@ android {
}

dependencies {
def fallbackKlippaScannerVersion = "2.1.11"
def fallbackKlippaScannerVersion = "3.1.3"
def klippaScannerVersion = project.hasProperty('klippaScannerVersion') ? project.klippaScannerVersion : fallbackKlippaScannerVersion
implementation "com.klippa:scanner:$klippaScannerVersion"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.klippa.capacitorscanner

import org.json.JSONObject

fun JSONObject.getStringOrNull(name: String) : String? {
return try {
this.getString(name)
} catch (e: Exception) {
return null
}
}

fun JSONObject.getBooleanOrNull(name: String) : Boolean? {
return try {
this.getBoolean(name)
} catch (e: Exception) {
return null
}
}

fun JSONObject.getIntOrNull(name: String) : Int? {
return try {
this.getInt(name)
} catch (e: Exception) {
return null
}
}

fun JSONObject.getDoubleOrNull(name: String) : Double? {
return try {
this.getDouble(name)
} catch (e: Exception) {
return null
}
}

fun JSONObject.getJsonObjectOrNull(name: String) : JSONObject? {
return try {
this.getJSONObject(name)
} catch (e: Exception) {
return null
}
}
Loading

0 comments on commit 1c14ec4

Please sign in to comment.