├── .eslintignore
├── .gitignore
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── Package.swift
├── PantristCapacitorPluginMlKitTextRecognition.podspec
├── README.md
├── android
├── .gitignore
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── proguard-rules.pro
├── settings.gradle
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── getcapacitor
│ │ └── android
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── pantrist
│ │ │ └── ml
│ │ │ └── CapacitorPluginMlKitTextRecognition.kt
│ └── res
│ │ └── .gitkeep
│ └── test
│ └── java
│ └── com
│ └── getcapacitor
│ └── ExampleUnitTest.java
├── ios
├── Plugin.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ ├── Plugin.xcscheme
│ │ └── PluginTests.xcscheme
├── Plugin.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── Plugin
│ ├── CapacitorPluginMlKitTextRecognitionPlugin.swift
│ └── Info.plist
├── PluginTests
│ ├── CapacitorPluginMlKitTextRecognitionTests.swift
│ └── Info.plist
└── Podfile
├── package-lock.json
├── package.json
├── rollup.config.mjs
├── src
├── definitions.ts
├── index.ts
└── web.ts
└── tsconfig.json
/.eslintignore:
--------------------------------------------------------------------------------
1 | build
2 | dist
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # node files
2 | dist
3 | node_modules
4 |
5 | # iOS files
6 | Pods
7 | Podfile.lock
8 | Build
9 | xcuserdata
10 |
11 | # macOS files
12 | .DS_Store
13 |
14 |
15 |
16 | # Based on Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore
17 |
18 | # Built application files
19 | *.apk
20 | *.ap_
21 |
22 | # Files for the ART/Dalvik VM
23 | *.dex
24 |
25 | # Java class files
26 | *.class
27 |
28 | # Generated files
29 | bin
30 | gen
31 | out
32 |
33 | # Gradle files
34 | .gradle
35 | build
36 |
37 | # Local configuration file (sdk path, etc)
38 | local.properties
39 |
40 | # Proguard folder generated by Eclipse
41 | proguard
42 |
43 | # Log Files
44 | *.log
45 |
46 | # Android Studio Navigation editor temp files
47 | .navigation
48 |
49 | # Android Studio captures folder
50 | captures
51 |
52 | # IntelliJ
53 | *.iml
54 | .idea
55 |
56 | # Keystore files
57 | # Uncomment the following line if you do not want to check your keystore files in.
58 | #*.jks
59 |
60 | # External native build folder generated in Android Studio 2.2 and later
61 | .externalNativeBuild
62 |
63 | Package.resolved
64 | .build
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4 |
5 | ## [7.0.0](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/compare/v6.2.1...v7.0.0) (2025-03-20)
6 |
7 |
8 | ### ⚠ BREAKING CHANGES
9 |
10 | * **cap-7:** migrate to capacitor 7
11 |
12 | ### Features
13 |
14 | * **cap-7:** migrate to capacitor 7 ([7a11983](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/7a119836f554d17eb716b142d781afdaee5fe647))
15 | * **spm:** migrate to Swift Package Manager ([da0cbee](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/da0cbee20cb10fd4f173fbcfb2c4225b8126d409))
16 |
17 | ### [6.2.1](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/compare/v6.2.0...v6.2.1) (2024-11-02)
18 |
19 |
20 | ### Bug Fixes
21 |
22 | * **ios:** update ‘GoogleMLKit/TextRecognition’ to version 6.0.0. for ios. ([#15](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/issues/15)) ([c1ddcb4](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/c1ddcb4ec9774b056a7147ec259584195c196f6b))
23 |
24 | ## [6.2.0](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/compare/v6.1.0...v6.2.0) (2024-09-06)
25 |
26 |
27 | ### Features
28 |
29 | * Added cornerPoints to Block, Line, Element in TextDetectionResult ([#12](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/issues/12)) ([76e35fd](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/76e35fd1d18316fd20e9da80a6a1e70132276d81))
30 |
31 | ## [6.1.0](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/compare/v6.0.0...v6.1.0) (2024-06-10)
32 |
33 |
34 | ### Features
35 |
36 | * **ios:** update `GoogleMLKit` to 5.0.0 ([134d15f](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/134d15fe522955057a6e6da96e6aebe9ad3f526e))
37 |
38 | ## [6.0.0](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/compare/v5.1.1...v6.0.0) (2024-04-29)
39 |
40 |
41 | ### ⚠ BREAKING CHANGES
42 |
43 | * **cap-6:** update to capacitor 6
44 |
45 | ### Features
46 |
47 | * **cap-6:** update to capacitor 6 ([8cf6c78](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/8cf6c784192edb7e9bd3f7e53823f5259a992cc2))
48 |
49 | ### [5.1.1](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/compare/v5.1.0...v5.1.1) (2023-11-14)
50 |
51 |
52 | ### Bug Fixes
53 |
54 | * **mlkit:** update to version 4.0.0 ([7efab4a](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/7efab4a30b15656e9d69a636ddc63fa39f79d199)), closes [de#march_21_2023](https://github.com/Pantrist-dev/de/issues/march_21_2023)
55 |
56 | ## [5.1.0](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/compare/v5.0.1...v5.1.0) (2023-11-13)
57 |
58 |
59 | ### Features
60 |
61 | * **mlkit:** update to version 4.0.0 ([f54ddd3](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/f54ddd37fbd3be281dbb414dc6bc2c58bf3580e7)), closes [de#march_21_2023](https://github.com/Pantrist-dev/de/issues/march_21_2023)
62 |
63 | ### [5.0.1](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/compare/v5.0.0...v5.0.1) (2023-10-20)
64 |
65 |
66 | ### Bug Fixes
67 |
68 | * **kotlin-version:** adds explicit kotlin version ([28dd0cf](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/28dd0cfe3d6dae6b25bcddeefb5a2db2213220ce))
69 |
70 | ## [5.0.0](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/compare/v4.1.1...v5.0.0) (2023-05-03)
71 |
72 |
73 | ### ⚠ BREAKING CHANGES
74 |
75 | * **cap-5:** support capacitor 5
76 |
77 | ### Features
78 |
79 | * **cap-5:** support capacitor 5 ([bd4b403](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/bd4b4039688896bd39d9dd87cf18637cee15d87b))
80 |
81 | ### [4.1.1](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/compare/v4.1.0...v4.1.1) (2023-03-22)
82 |
83 |
84 | ### Bug Fixes
85 |
86 | * **ios:** set explicit ml-kit version in podspec file [#8](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/issues/8) ([dda78e9](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/dda78e9d6c6d4a8c3697cc2b7d9b45fd8c6555ea))
87 |
88 | ## [4.1.0](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/compare/v4.0.1...v4.1.0) (2022-12-20)
89 |
90 |
91 | ### Features
92 |
93 | * add rotation attribute to DetectImageOptions ([73a09c1](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/73a09c1cb89ca45aa7b014ec0cf6e477aa846842))
94 | * **android:** make version of com.google.android.gms:play-services-mlkit-text-recognition configurable ([c1936de](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/c1936de5c4efeaae96bccfcc7daeca0ed0487977))
95 | * **android:** update mlkitTextRecognitionVersion to 18.0.2 ([94ebf35](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/94ebf35ab3aa6887d3c4563e4ef0ae83bda17cc7))
96 | * **ios:** upgrade MLKit to version 3.2.0 ([b047421](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/b047421131c5ef7b4de828c7cd2c840a1b02c7a9))
97 |
98 |
99 | ### Bug Fixes
100 |
101 | * **ios:** resolve small warning for ios ([02daf9c](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/02daf9c412481690ec6023481ffa53088ee1fa48))
102 |
103 | ## 4.0.1 (2022-09-09)
104 |
105 | ### Bug Fixes
106 |
107 | * **null-pointer:** solves issue with null-pointer exception for empty image ([a8cc0a5](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/a8cc0a595c124592dbdb6bfca813e658999b37f9))
108 |
109 | ## 4.0.0 (2022-06-08)
110 |
111 | ### ⚠ BREAKING CHANGES
112 |
113 | * **cap4-migration:** migrate to cap 4
114 | * **greater-interface:** resolve whole result of ml-kit
115 |
116 | ### Features
117 |
118 | * **cap4-migration:** migrate to cap 4 ([6662e03](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/6662e032111298f858005b67b0d207a9800228ff))
119 |
120 |
121 | ## 2.0.0 (2020-07-27)
122 |
123 | ### FEATURES
124 |
125 | * **greater-interface:** resolve whole result of ml-kit ([34e20cb](https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/commit/34e20cb1c6b68a4dd8d5ce27ab9fcf0ebc6d3a59))
126 |
127 | ### BREAKING CHANGES
128 |
129 | - To get the previous `lines` array you now have to use `blocks.map(block => block.text)`
130 |
131 |
132 | ## 1.0.0 (2022-05-19)
133 |
134 | - Initial release
135 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | This guide provides instructions for contributing to this Capacitor plugin.
4 |
5 | ## Developing
6 |
7 | ### Local Setup
8 |
9 | 1. Fork and clone the repo.
10 | 1. Install the dependencies.
11 |
12 | ```shell
13 | npm install
14 | ```
15 |
16 | 1. Install SwiftLint if you're on macOS.
17 |
18 | ```shell
19 | brew install swiftlint
20 | ```
21 |
22 | ### Scripts
23 |
24 | #### `npm run build`
25 |
26 | Build the plugin web assets and generate plugin API documentation using [`@capacitor/docgen`](https://github.com/ionic-team/capacitor-docgen).
27 |
28 | It will compile the TypeScript code from `src/` into ESM JavaScript in `dist/esm/`. These files are used in apps with bundlers when your plugin is imported.
29 |
30 | Then, Rollup will bundle the code into a single file at `dist/plugin.js`. This file is used in apps without bundlers by including it as a script in `index.html`.
31 |
32 | #### `npm run verify`
33 |
34 | Build and validate the web and native projects.
35 |
36 | This is useful to run in CI to verify that the plugin builds for all platforms.
37 |
38 | #### `npm run lint` / `npm run fmt`
39 |
40 | Check formatting and code quality, autoformat/autofix if possible.
41 |
42 | This template is integrated with ESLint, Prettier, and SwiftLint. Using these tools is completely optional, but the [Capacitor Community](https://github.com/capacitor-community/) strives to have consistent code style and structure for easier cooperation.
43 |
44 | ## Publishing
45 |
46 | There is a `prepublishOnly` hook in `package.json` which prepares the plugin before publishing, so all you need to do is run:
47 |
48 | ```shell
49 | npm publish
50 | ```
51 |
52 | > **Note**: The [`files`](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#files) array in `package.json` specifies which files get published. If you rename files/directories or add files elsewhere, you may need to update it.
53 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Nico Lueg
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Package.swift:
--------------------------------------------------------------------------------
1 | // swift-tools-version: 5.9
2 | import PackageDescription
3 |
4 | let package = Package(
5 | name: "PantristCapacitorPluginMlKitTextRecognition",
6 | platforms: [.iOS(.v14)],
7 | products: [
8 | .library(
9 | name: "CapacitorPluginMlKitTextRecognitionPlugin",
10 | targets: ["CapacitorPluginMlKitTextRecognitionPlugin"])
11 | ],
12 | dependencies: [
13 | .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", branch: "6.0.0")
14 | ],
15 | targets: [
16 | .target(
17 | name: "CapacitorPluginMlKitTextRecognitionPlugin",
18 | dependencies: [
19 | .product(name: "Capacitor", package: "capacitor-swift-pm"),
20 | .product(name: "Cordova", package: "capacitor-swift-pm")
21 | ],
22 | path: "ios/Sources/CapacitorPluginMlKitTextRecognitionPlugin"),
23 | .testTarget(
24 | name: "CapacitorPluginMlKitTextRecognitionPluginTests",
25 | dependencies: ["CapacitorPluginMlKitTextRecognitionPlugin"],
26 | path: "ios/Tests/CapacitorPluginMlKitTextRecognitionPluginTests")
27 | ]
28 | )
--------------------------------------------------------------------------------
/PantristCapacitorPluginMlKitTextRecognition.podspec:
--------------------------------------------------------------------------------
1 | require 'json'
2 |
3 | package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4 |
5 | Pod::Spec.new do |s|
6 | s.name = 'PantristCapacitorPluginMlKitTextRecognition'
7 | s.version = package['version']
8 | s.summary = package['description']
9 | s.license = package['license']
10 | s.homepage = package['repository']['url']
11 | s.author = package['author']
12 | s.source = { :git => package['repository']['url'], :tag => s.version.to_s }
13 | s.source_files = 'ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}'
14 | s.ios.deployment_target = '14.0'
15 | s.dependency 'Capacitor'
16 | s.dependency 'GoogleMLKit/TextRecognition', '7.0.0'
17 | s.swift_version = '5.1'
18 | s.static_framework = true
19 | end
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # @pantrist/capacitor-plugin-ml-kit-text-recognition
2 |
3 | [](https://badge.fury.io/js/@pantrist%2Fcapacitor-plugin-ml-kit-text-recognition)
4 | 
5 |
6 | Capacitor Wrapper for TextRecognition of Googles ML-Kit
7 |
8 | ## Install
9 |
10 | ```bash
11 | npm install @pantrist/capacitor-plugin-ml-kit-text-recognition
12 | npx cap sync
13 | ```
14 |
15 | ## Configuration
16 |
17 | ### Android
18 |
19 | **Optional** but recommended:
20 | You can configure your app to automatically download the ML model to the device after your app is installed from the Play Store.
21 | To do so, add the following declaration to your app's ``AndroidManifest.xml`` file:
22 |
23 | ```xml
24 |
25 | ...
26 |
29 |
30 |
31 | ```
32 |
33 | ### iOS
34 |
35 | Nothing to do for iOS
36 |
37 |
38 | ## Supported methods
39 |
40 | | Name | Android | iOS | Web |
41 | | ----------- | ----------- |-----|-----|
42 | | detectText | ✅ | ✅ | ❌ |
43 |
44 | ## API
45 |
46 |
47 |
48 | * [`detectText(...)`](#detecttext)
49 | * [Interfaces](#interfaces)
50 |
51 |
52 |
53 |
54 |
55 |
56 | ### detectText(...)
57 |
58 | ```typescript
59 | detectText(options: DetectImageOptions) => Promise
60 | ```
61 |
62 | Tries to detect text from the given image
63 |
64 | | Param | Type | Description |
65 | | ------------- | ----------------------------------------------------------------- | ------------------------------ |
66 | | **`options`** | DetectImageOptions
| Options for the text detection |
67 |
68 | **Returns:** Promise<TextDetectionResult>
69 |
70 | --------------------
71 |
72 |
73 | ### Interfaces
74 |
75 |
76 | #### TextDetectionResult
77 |
78 | | Prop | Type | Description |
79 | | ------------ | -------------------- | -------------------- |
80 | | **`text`** | string
| Found text |
81 | | **`blocks`** | Block[]
| Parsed text by lines |
82 |
83 |
84 | #### Block
85 |
86 | | Prop | Type |
87 | | ----------- | ------------------- |
88 | | **`lines`** | Line[]
|
89 |
90 |
91 | #### Line
92 |
93 | | Prop | Type |
94 | | -------------- | ---------------------- |
95 | | **`elements`** | Element[]
|
96 |
97 |
98 | #### Element
99 |
100 |
101 | #### DetectImageOptions
102 |
103 | | Prop | Type | Description |
104 | | ----------------- | ------------------- | ------------------------------------------------------------------------------------------------ |
105 | | **`base64Image`** | string
| The image to detect texts from |
106 | | **`rotation`** | number
| The image's counter-clockwise orientation degrees. Only 0, 90, 180, 270 are supported. Default 0 |
107 |
108 |
109 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | ext {
2 | junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
3 | androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.6.1'
4 | androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.5'
5 | androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.5.1'
6 | mlkitTextRecognitionVersion = project.hasProperty('mlkitTextRecognitionVersion') ? rootProject.ext.mlkitTextRecognitionVersion : '19.0.1'
7 | }
8 |
9 | buildscript {
10 | ext.kotlin_version = project.hasProperty("kotlin_version") ? rootProject.ext.kotlin_version : '1.9.10'
11 |
12 | repositories {
13 | google()
14 | jcenter()
15 | }
16 | dependencies {
17 | classpath 'com.android.tools.build:gradle:8.2.1'
18 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
19 | }
20 | }
21 |
22 | apply plugin: 'com.android.library'
23 | apply plugin: 'kotlin-android'
24 |
25 | android {
26 | namespace "com.pantrist.ml"
27 | compileSdk project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 34
28 | defaultConfig {
29 | minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
30 | targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 34
31 | versionCode 1
32 | versionName "1.0"
33 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
34 | }
35 | buildTypes {
36 | release {
37 | minifyEnabled false
38 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
39 | }
40 | }
41 | lintOptions {
42 | abortOnError false
43 | }
44 | compileOptions {
45 | sourceCompatibility JavaVersion.VERSION_17
46 | targetCompatibility JavaVersion.VERSION_17
47 | }
48 | kotlinOptions {
49 | jvmTarget = JavaVersion.VERSION_17
50 | }
51 | }
52 |
53 | repositories {
54 | google()
55 | mavenCentral()
56 | }
57 |
58 | dependencies {
59 | implementation fileTree(dir: 'libs', include: ['*.jar'])
60 | implementation project(':capacitor-android')
61 | implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
62 | testImplementation "junit:junit:$junitVersion"
63 | androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
64 | androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
65 | implementation "com.google.android.gms:play-services-mlkit-text-recognition:$mlkitTextRecognitionVersion"
66 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
67 | }
68 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
19 | # AndroidX package structure to make it clearer which packages are bundled with the
20 | # Android operating system, and which are packaged with your app's APK
21 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
22 | android.useAndroidX=true
23 |
24 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/72460516ea40b1e87f28939be74291d037255d1c/android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | #
21 | # Gradle start up script for POSIX generated by Gradle.
22 | #
23 | # Important for running:
24 | #
25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
26 | # noncompliant, but you have some other compliant shell such as ksh or
27 | # bash, then to run this script, type that shell name before the whole
28 | # command line, like:
29 | #
30 | # ksh Gradle
31 | #
32 | # Busybox and similar reduced shells will NOT work, because this script
33 | # requires all of these POSIX shell features:
34 | # * functions;
35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
37 | # * compound commands having a testable exit status, especially «case»;
38 | # * various built-in commands including «command», «set», and «ulimit».
39 | #
40 | # Important for patching:
41 | #
42 | # (2) This script targets any POSIX shell, so it avoids extensions provided
43 | # by Bash, Ksh, etc; in particular arrays are avoided.
44 | #
45 | # The "traditional" practice of packing multiple parameters into a
46 | # space-separated string is a well documented source of bugs and security
47 | # problems, so this is (mostly) avoided, by progressively accumulating
48 | # options in "$@", and eventually passing that to Java.
49 | #
50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
52 | # see the in-line comments for details.
53 | #
54 | # There are tweaks for specific operating systems such as AIX, CygWin,
55 | # Darwin, MinGW, and NonStop.
56 | #
57 | # (3) This script is generated from the Groovy template
58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59 | # within the Gradle project.
60 | #
61 | # You can find Gradle at https://github.com/gradle/gradle/.
62 | #
63 | ##############################################################################
64 |
65 | # Attempt to set APP_HOME
66 |
67 | # Resolve links: $0 may be a link
68 | app_path=$0
69 |
70 | # Need this for daisy-chained symlinks.
71 | while
72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
73 | [ -h "$app_path" ]
74 | do
75 | ls=$( ls -ld "$app_path" )
76 | link=${ls#*' -> '}
77 | case $link in #(
78 | /*) app_path=$link ;; #(
79 | *) app_path=$APP_HOME$link ;;
80 | esac
81 | done
82 |
83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84 |
85 | APP_NAME="Gradle"
86 | APP_BASE_NAME=${0##*/}
87 |
88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
90 |
91 | # Use the maximum available, or set MAX_FD != -1 to use that value.
92 | MAX_FD=maximum
93 |
94 | warn () {
95 | echo "$*"
96 | } >&2
97 |
98 | die () {
99 | echo
100 | echo "$*"
101 | echo
102 | exit 1
103 | } >&2
104 |
105 | # OS specific support (must be 'true' or 'false').
106 | cygwin=false
107 | msys=false
108 | darwin=false
109 | nonstop=false
110 | case "$( uname )" in #(
111 | CYGWIN* ) cygwin=true ;; #(
112 | Darwin* ) darwin=true ;; #(
113 | MSYS* | MINGW* ) msys=true ;; #(
114 | NONSTOP* ) nonstop=true ;;
115 | esac
116 |
117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
118 |
119 |
120 | # Determine the Java command to use to start the JVM.
121 | if [ -n "$JAVA_HOME" ] ; then
122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
123 | # IBM's JDK on AIX uses strange locations for the executables
124 | JAVACMD=$JAVA_HOME/jre/sh/java
125 | else
126 | JAVACMD=$JAVA_HOME/bin/java
127 | fi
128 | if [ ! -x "$JAVACMD" ] ; then
129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
130 |
131 | Please set the JAVA_HOME variable in your environment to match the
132 | location of your Java installation."
133 | fi
134 | else
135 | JAVACMD=java
136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137 |
138 | Please set the JAVA_HOME variable in your environment to match the
139 | location of your Java installation."
140 | fi
141 |
142 | # Increase the maximum file descriptors if we can.
143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144 | case $MAX_FD in #(
145 | max*)
146 | MAX_FD=$( ulimit -H -n ) ||
147 | warn "Could not query maximum file descriptor limit"
148 | esac
149 | case $MAX_FD in #(
150 | '' | soft) :;; #(
151 | *)
152 | ulimit -n "$MAX_FD" ||
153 | warn "Could not set maximum file descriptor limit to $MAX_FD"
154 | esac
155 | fi
156 |
157 | # Collect all arguments for the java command, stacking in reverse order:
158 | # * args from the command line
159 | # * the main class name
160 | # * -classpath
161 | # * -D...appname settings
162 | # * --module-path (only if needed)
163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
164 |
165 | # For Cygwin or MSYS, switch paths to Windows format before running java
166 | if "$cygwin" || "$msys" ; then
167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
169 |
170 | JAVACMD=$( cygpath --unix "$JAVACMD" )
171 |
172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
173 | for arg do
174 | if
175 | case $arg in #(
176 | -*) false ;; # don't mess with options #(
177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
178 | [ -e "$t" ] ;; #(
179 | *) false ;;
180 | esac
181 | then
182 | arg=$( cygpath --path --ignore --mixed "$arg" )
183 | fi
184 | # Roll the args list around exactly as many times as the number of
185 | # args, so each arg winds up back in the position where it started, but
186 | # possibly modified.
187 | #
188 | # NB: a `for` loop captures its iteration list before it begins, so
189 | # changing the positional parameters here affects neither the number of
190 | # iterations, nor the values presented in `arg`.
191 | shift # remove old arg
192 | set -- "$@" "$arg" # push replacement arg
193 | done
194 | fi
195 |
196 | # Collect all arguments for the java command;
197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
198 | # shell script including quotes and variable substitutions, so put them in
199 | # double quotes to make sure that they get re-expanded; and
200 | # * put everything else in single quotes, so that it's not re-expanded.
201 |
202 | set -- \
203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
204 | -classpath "$CLASSPATH" \
205 | org.gradle.wrapper.GradleWrapperMain \
206 | "$@"
207 |
208 | # Use "xargs" to parse quoted args.
209 | #
210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
211 | #
212 | # In Bash we could simply go:
213 | #
214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
215 | # set -- "${ARGS[@]}" "$@"
216 | #
217 | # but POSIX shell has neither arrays nor command substitution, so instead we
218 | # post-process each arg (as a line of input to sed) to backslash-escape any
219 | # character that might be a shell metacharacter, then use eval to reverse
220 | # that process (while maintaining the separation between arguments), and wrap
221 | # the whole thing up as a single "set" statement.
222 | #
223 | # This will of course break if any of these variables contains a newline or
224 | # an unmatched quote.
225 | #
226 |
227 | eval "set -- $(
228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
229 | xargs -n1 |
230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
231 | tr '\n' ' '
232 | )" '"$@"'
233 |
234 | exec "$JAVACMD" "$@"
235 |
--------------------------------------------------------------------------------
/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/android/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':capacitor-android'
2 | project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
--------------------------------------------------------------------------------
/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.getcapacitor.android;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import android.content.Context;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 | import androidx.test.platform.app.InstrumentationRegistry;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * @see Testing documentation
15 | */
16 | @RunWith(AndroidJUnit4.class)
17 | public class ExampleInstrumentedTest {
18 |
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
23 |
24 | assertEquals("com.getcapacitor.android", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/android/src/main/java/com/pantrist/ml/CapacitorPluginMlKitTextRecognition.kt:
--------------------------------------------------------------------------------
1 | package com.pantrist.ml
2 |
3 | import android.util.Base64
4 | import com.getcapacitor.*
5 | import com.getcapacitor.annotation.CapacitorPlugin
6 | import java.io.IOException
7 | import android.graphics.BitmapFactory
8 | import android.graphics.Point
9 | import android.graphics.Rect
10 |
11 | import com.google.mlkit.vision.common.InputImage
12 | import com.google.mlkit.vision.text.TextRecognition
13 | import com.google.mlkit.vision.text.latin.TextRecognizerOptions
14 |
15 | @CapacitorPlugin
16 | class CapacitorPluginMlKitTextRecognition : Plugin() {
17 | @PluginMethod
18 | fun detectText(call: PluginCall) {
19 | val recognizer = TextRecognition.getClient(TextRecognizerOptions.DEFAULT_OPTIONS)
20 |
21 | val encodedImage = call.getString("base64Image")
22 | if (encodedImage == null) {
23 | call.reject("No image is given!")
24 | return
25 | }
26 | val rotation = call.getInt("rotation") ?: 0
27 |
28 | val image: InputImage
29 | try {
30 | val decodedString: ByteArray = Base64.decode(encodedImage, Base64.DEFAULT);
31 | val decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.size)
32 | if (decodedByte == null) {
33 | call.reject("Decoded image is null")
34 | return
35 | }
36 | image = InputImage.fromBitmap(decodedByte, rotation)
37 | } catch (e: IOException) {
38 | call.reject("Unable to parse image")
39 | return
40 | }
41 |
42 | recognizer.process(image)
43 | .addOnSuccessListener { visionText ->
44 | val ret = JSObject()
45 | ret.put("text", visionText.text)
46 |
47 | val textBlocks = JSArray()
48 | visionText.textBlocks.forEach { block ->
49 | val blockObject = JSObject();
50 | blockObject.put("text", block.text)
51 | blockObject.put("boundingBox", parseRectToJsObject(block.boundingBox))
52 | blockObject.put("recognizedLanguage", block.recognizedLanguage)
53 | blockObject.put("cornerPoints", parseCornerPointsToJsObject(block.cornerPoints))
54 |
55 | val linesArray = JSArray()
56 | block.lines.forEach { line ->
57 | val lineObject = JSObject()
58 | lineObject.put("text", line.text)
59 | lineObject.put("boundingBox", parseRectToJsObject(line.boundingBox))
60 | lineObject.put("recognizedLanguage", line.recognizedLanguage)
61 | lineObject.put("cornerPoints", parseCornerPointsToJsObject(line.cornerPoints))
62 |
63 | val elementArray = JSArray()
64 | line.elements.forEach { element ->
65 | val elementObject = JSObject()
66 | elementObject.put("text", element.text)
67 | elementObject.put("boundingBox", parseRectToJsObject(element.boundingBox))
68 | elementObject.put("recognizedLanguage", line.recognizedLanguage)
69 | elementObject.put("cornerPoints", parseCornerPointsToJsObject(element.cornerPoints))
70 | elementArray.put(elementObject)
71 | }
72 | lineObject.put("elements", elementArray)
73 | linesArray.put(lineObject)
74 | }
75 | blockObject.put("lines", linesArray)
76 | textBlocks.put(blockObject)
77 | };
78 | ret.put("blocks", textBlocks)
79 |
80 | call.resolve(ret)
81 | }
82 | .addOnFailureListener { e ->
83 | call.reject("Unable process image!", e)
84 | }
85 | }
86 |
87 | private fun parseRectToJsObject(rect: Rect?): JSObject? {
88 | if (rect == null) {
89 | return null
90 | }
91 |
92 | val returnObject = JSObject();
93 | returnObject.put("left", rect.left)
94 | returnObject.put("top", rect.top)
95 | returnObject.put("right", rect.right)
96 | returnObject.put("bottom", rect.bottom)
97 | return returnObject;
98 | }
99 |
100 | private fun parseCornerPointsToJsObject(cornerPoints: Array?): JSObject? {
101 | if (cornerPoints == null || cornerPoints.size != 4) {
102 | return null;
103 | }
104 | val res = JSObject();
105 | res.put("topLeft", pointToJsObject(cornerPoints[0]));
106 | res.put("topRight", pointToJsObject(cornerPoints[1]));
107 | res.put("bottomRight", pointToJsObject(cornerPoints[2]));
108 | res.put("bottomLeft", pointToJsObject(cornerPoints[3]));
109 | return res;
110 | }
111 |
112 | private fun pointToJsObject(pt: Point): JSObject {
113 | val res = JSObject();
114 | res.put("x", pt.x.toDouble());
115 | res.put("y", pt.y.toDouble());
116 | return res;
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/android/src/main/res/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/72460516ea40b1e87f28939be74291d037255d1c/android/src/main/res/.gitkeep
--------------------------------------------------------------------------------
/android/src/test/java/com/getcapacitor/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.getcapacitor;
2 |
3 | import static org.junit.Assert.*;
4 |
5 | import org.junit.Test;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 |
14 | @Test
15 | public void addition_isCorrect() throws Exception {
16 | assertEquals(4, 2 + 2);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/ios/Plugin.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 48;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 03FC29A292ACC40490383A1F /* Pods_Plugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B2A61DA5A1F2DD4F959604D /* Pods_Plugin.framework */; };
11 | 20C0B05DCFC8E3958A738AF2 /* Pods_PluginTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F6753A823D3815DB436415E3 /* Pods_PluginTests.framework */; };
12 | 50ADFF92201F53D600D50D53 /* Plugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50ADFF88201F53D600D50D53 /* Plugin.framework */; };
13 | 50ADFF97201F53D600D50D53 /* CapacitorPluginMlKitTextRecognitionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50ADFF96201F53D600D50D53 /* CapacitorPluginMlKitTextRecognitionTests.swift */; };
14 | 50ADFFA42020D75100D50D53 /* Capacitor.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50ADFFA52020D75100D50D53 /* Capacitor.framework */; };
15 | 50E1A94820377CB70090CE1A /* CapacitorPluginMlKitTextRecognitionPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50E1A94720377CB70090CE1A /* CapacitorPluginMlKitTextRecognitionPlugin.swift */; };
16 | /* End PBXBuildFile section */
17 |
18 | /* Begin PBXContainerItemProxy section */
19 | 50ADFF93201F53D600D50D53 /* PBXContainerItemProxy */ = {
20 | isa = PBXContainerItemProxy;
21 | containerPortal = 50ADFF7F201F53D600D50D53 /* Project object */;
22 | proxyType = 1;
23 | remoteGlobalIDString = 50ADFF87201F53D600D50D53;
24 | remoteInfo = Plugin;
25 | };
26 | /* End PBXContainerItemProxy section */
27 |
28 | /* Begin PBXFileReference section */
29 | 3B2A61DA5A1F2DD4F959604D /* Pods_Plugin.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Plugin.framework; sourceTree = BUILT_PRODUCTS_DIR; };
30 | 50ADFF88201F53D600D50D53 /* Plugin.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Plugin.framework; sourceTree = BUILT_PRODUCTS_DIR; };
31 | 50ADFF8C201F53D600D50D53 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
32 | 50ADFF91201F53D600D50D53 /* PluginTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PluginTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
33 | 50ADFF96201F53D600D50D53 /* CapacitorPluginMlKitTextRecognitionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CapacitorPluginMlKitTextRecognitionTests.swift; sourceTree = ""; };
34 | 50ADFF98201F53D600D50D53 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
35 | 50ADFFA52020D75100D50D53 /* Capacitor.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Capacitor.framework; sourceTree = BUILT_PRODUCTS_DIR; };
36 | 50E1A94720377CB70090CE1A /* CapacitorPluginMlKitTextRecognitionPlugin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CapacitorPluginMlKitTextRecognitionPlugin.swift; sourceTree = ""; };
37 | 5E23F77F099397094342571A /* Pods-Plugin.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Plugin.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Plugin/Pods-Plugin.debug.xcconfig"; sourceTree = ""; };
38 | 91781294A431A2A7CC6EB714 /* Pods-Plugin.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Plugin.release.xcconfig"; path = "Pods/Target Support Files/Pods-Plugin/Pods-Plugin.release.xcconfig"; sourceTree = ""; };
39 | 96ED1B6440D6672E406C8D19 /* Pods-PluginTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PluginTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.debug.xcconfig"; sourceTree = ""; };
40 | F65BB2953ECE002E1EF3E424 /* Pods-PluginTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PluginTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.release.xcconfig"; sourceTree = ""; };
41 | F6753A823D3815DB436415E3 /* Pods_PluginTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PluginTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
42 | /* End PBXFileReference section */
43 |
44 | /* Begin PBXFrameworksBuildPhase section */
45 | 50ADFF84201F53D600D50D53 /* Frameworks */ = {
46 | isa = PBXFrameworksBuildPhase;
47 | buildActionMask = 2147483647;
48 | files = (
49 | 50ADFFA42020D75100D50D53 /* Capacitor.framework in Frameworks */,
50 | 03FC29A292ACC40490383A1F /* Pods_Plugin.framework in Frameworks */,
51 | );
52 | runOnlyForDeploymentPostprocessing = 0;
53 | };
54 | 50ADFF8E201F53D600D50D53 /* Frameworks */ = {
55 | isa = PBXFrameworksBuildPhase;
56 | buildActionMask = 2147483647;
57 | files = (
58 | 50ADFF92201F53D600D50D53 /* Plugin.framework in Frameworks */,
59 | 20C0B05DCFC8E3958A738AF2 /* Pods_PluginTests.framework in Frameworks */,
60 | );
61 | runOnlyForDeploymentPostprocessing = 0;
62 | };
63 | /* End PBXFrameworksBuildPhase section */
64 |
65 | /* Begin PBXGroup section */
66 | 50ADFF7E201F53D600D50D53 = {
67 | isa = PBXGroup;
68 | children = (
69 | 50ADFF8A201F53D600D50D53 /* Plugin */,
70 | 50ADFF95201F53D600D50D53 /* PluginTests */,
71 | 50ADFF89201F53D600D50D53 /* Products */,
72 | 8C8E7744173064A9F6D438E3 /* Pods */,
73 | A797B9EFA3DCEFEA1FBB66A9 /* Frameworks */,
74 | );
75 | sourceTree = "";
76 | };
77 | 50ADFF89201F53D600D50D53 /* Products */ = {
78 | isa = PBXGroup;
79 | children = (
80 | 50ADFF88201F53D600D50D53 /* Plugin.framework */,
81 | 50ADFF91201F53D600D50D53 /* PluginTests.xctest */,
82 | );
83 | name = Products;
84 | sourceTree = "";
85 | };
86 | 50ADFF8A201F53D600D50D53 /* Plugin */ = {
87 | isa = PBXGroup;
88 | children = (
89 | 50E1A94720377CB70090CE1A /* CapacitorPluginMlKitTextRecognitionPlugin.swift */,
90 | 50ADFF8C201F53D600D50D53 /* Info.plist */,
91 | );
92 | path = Plugin;
93 | sourceTree = "";
94 | };
95 | 50ADFF95201F53D600D50D53 /* PluginTests */ = {
96 | isa = PBXGroup;
97 | children = (
98 | 50ADFF96201F53D600D50D53 /* CapacitorPluginMlKitTextRecognitionTests.swift */,
99 | 50ADFF98201F53D600D50D53 /* Info.plist */,
100 | );
101 | path = PluginTests;
102 | sourceTree = "";
103 | };
104 | 8C8E7744173064A9F6D438E3 /* Pods */ = {
105 | isa = PBXGroup;
106 | children = (
107 | 5E23F77F099397094342571A /* Pods-Plugin.debug.xcconfig */,
108 | 91781294A431A2A7CC6EB714 /* Pods-Plugin.release.xcconfig */,
109 | 96ED1B6440D6672E406C8D19 /* Pods-PluginTests.debug.xcconfig */,
110 | F65BB2953ECE002E1EF3E424 /* Pods-PluginTests.release.xcconfig */,
111 | );
112 | name = Pods;
113 | sourceTree = "";
114 | };
115 | A797B9EFA3DCEFEA1FBB66A9 /* Frameworks */ = {
116 | isa = PBXGroup;
117 | children = (
118 | 50ADFFA52020D75100D50D53 /* Capacitor.framework */,
119 | 3B2A61DA5A1F2DD4F959604D /* Pods_Plugin.framework */,
120 | F6753A823D3815DB436415E3 /* Pods_PluginTests.framework */,
121 | );
122 | name = Frameworks;
123 | sourceTree = "";
124 | };
125 | /* End PBXGroup section */
126 |
127 | /* Begin PBXHeadersBuildPhase section */
128 | 50ADFF85201F53D600D50D53 /* Headers */ = {
129 | isa = PBXHeadersBuildPhase;
130 | buildActionMask = 2147483647;
131 | files = (
132 | );
133 | runOnlyForDeploymentPostprocessing = 0;
134 | };
135 | /* End PBXHeadersBuildPhase section */
136 |
137 | /* Begin PBXNativeTarget section */
138 | 50ADFF87201F53D600D50D53 /* Plugin */ = {
139 | isa = PBXNativeTarget;
140 | buildConfigurationList = 50ADFF9C201F53D600D50D53 /* Build configuration list for PBXNativeTarget "Plugin" */;
141 | buildPhases = (
142 | AB5B3E54B4E897F32C2279DA /* [CP] Check Pods Manifest.lock */,
143 | 50ADFF83201F53D600D50D53 /* Sources */,
144 | 50ADFF84201F53D600D50D53 /* Frameworks */,
145 | 50ADFF85201F53D600D50D53 /* Headers */,
146 | 50ADFF86201F53D600D50D53 /* Resources */,
147 | 6CF15141A406277E41E168EC /* [CP] Copy Pods Resources */,
148 | );
149 | buildRules = (
150 | );
151 | dependencies = (
152 | );
153 | name = Plugin;
154 | productName = Plugin;
155 | productReference = 50ADFF88201F53D600D50D53 /* Plugin.framework */;
156 | productType = "com.apple.product-type.framework";
157 | };
158 | 50ADFF90201F53D600D50D53 /* PluginTests */ = {
159 | isa = PBXNativeTarget;
160 | buildConfigurationList = 50ADFF9F201F53D600D50D53 /* Build configuration list for PBXNativeTarget "PluginTests" */;
161 | buildPhases = (
162 | 0596884F929ED6F1DE134961 /* [CP] Check Pods Manifest.lock */,
163 | 50ADFF8D201F53D600D50D53 /* Sources */,
164 | 50ADFF8E201F53D600D50D53 /* Frameworks */,
165 | 50ADFF8F201F53D600D50D53 /* Resources */,
166 | 8E97F58B69A94C6503FC9C85 /* [CP] Embed Pods Frameworks */,
167 | A858649DF00389A4CFF68A0A /* [CP] Copy Pods Resources */,
168 | );
169 | buildRules = (
170 | );
171 | dependencies = (
172 | 50ADFF94201F53D600D50D53 /* PBXTargetDependency */,
173 | );
174 | name = PluginTests;
175 | productName = PluginTests;
176 | productReference = 50ADFF91201F53D600D50D53 /* PluginTests.xctest */;
177 | productType = "com.apple.product-type.bundle.unit-test";
178 | };
179 | /* End PBXNativeTarget section */
180 |
181 | /* Begin PBXProject section */
182 | 50ADFF7F201F53D600D50D53 /* Project object */ = {
183 | isa = PBXProject;
184 | attributes = {
185 | LastSwiftUpdateCheck = 0920;
186 | LastUpgradeCheck = 1160;
187 | ORGANIZATIONNAME = "Max Lynch";
188 | TargetAttributes = {
189 | 50ADFF87201F53D600D50D53 = {
190 | CreatedOnToolsVersion = 9.2;
191 | LastSwiftMigration = 1100;
192 | ProvisioningStyle = Automatic;
193 | };
194 | 50ADFF90201F53D600D50D53 = {
195 | CreatedOnToolsVersion = 9.2;
196 | LastSwiftMigration = 1100;
197 | ProvisioningStyle = Automatic;
198 | };
199 | };
200 | };
201 | buildConfigurationList = 50ADFF82201F53D600D50D53 /* Build configuration list for PBXProject "Plugin" */;
202 | compatibilityVersion = "Xcode 8.0";
203 | developmentRegion = en;
204 | hasScannedForEncodings = 0;
205 | knownRegions = (
206 | en,
207 | Base,
208 | );
209 | mainGroup = 50ADFF7E201F53D600D50D53;
210 | productRefGroup = 50ADFF89201F53D600D50D53 /* Products */;
211 | projectDirPath = "";
212 | projectRoot = "";
213 | targets = (
214 | 50ADFF87201F53D600D50D53 /* Plugin */,
215 | 50ADFF90201F53D600D50D53 /* PluginTests */,
216 | );
217 | };
218 | /* End PBXProject section */
219 |
220 | /* Begin PBXResourcesBuildPhase section */
221 | 50ADFF86201F53D600D50D53 /* Resources */ = {
222 | isa = PBXResourcesBuildPhase;
223 | buildActionMask = 2147483647;
224 | files = (
225 | );
226 | runOnlyForDeploymentPostprocessing = 0;
227 | };
228 | 50ADFF8F201F53D600D50D53 /* Resources */ = {
229 | isa = PBXResourcesBuildPhase;
230 | buildActionMask = 2147483647;
231 | files = (
232 | );
233 | runOnlyForDeploymentPostprocessing = 0;
234 | };
235 | /* End PBXResourcesBuildPhase section */
236 |
237 | /* Begin PBXShellScriptBuildPhase section */
238 | 0596884F929ED6F1DE134961 /* [CP] Check Pods Manifest.lock */ = {
239 | isa = PBXShellScriptBuildPhase;
240 | buildActionMask = 2147483647;
241 | files = (
242 | );
243 | inputPaths = (
244 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
245 | "${PODS_ROOT}/Manifest.lock",
246 | );
247 | name = "[CP] Check Pods Manifest.lock";
248 | outputPaths = (
249 | "$(DERIVED_FILE_DIR)/Pods-PluginTests-checkManifestLockResult.txt",
250 | );
251 | runOnlyForDeploymentPostprocessing = 0;
252 | shellPath = /bin/sh;
253 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
254 | showEnvVarsInLog = 0;
255 | };
256 | 6CF15141A406277E41E168EC /* [CP] Copy Pods Resources */ = {
257 | isa = PBXShellScriptBuildPhase;
258 | buildActionMask = 2147483647;
259 | files = (
260 | );
261 | inputPaths = (
262 | "${PODS_ROOT}/Target Support Files/Pods-Plugin/Pods-Plugin-resources.sh",
263 | "${PODS_CONFIGURATION_BUILD_DIR}/MLKitTextRecognition/LatinOCRResources.bundle",
264 | );
265 | name = "[CP] Copy Pods Resources";
266 | outputPaths = (
267 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/LatinOCRResources.bundle",
268 | );
269 | runOnlyForDeploymentPostprocessing = 0;
270 | shellPath = /bin/sh;
271 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Plugin/Pods-Plugin-resources.sh\"\n";
272 | showEnvVarsInLog = 0;
273 | };
274 | 8E97F58B69A94C6503FC9C85 /* [CP] Embed Pods Frameworks */ = {
275 | isa = PBXShellScriptBuildPhase;
276 | buildActionMask = 2147483647;
277 | files = (
278 | );
279 | inputPaths = (
280 | "${PODS_ROOT}/Target Support Files/Pods-PluginTests/Pods-PluginTests-frameworks.sh",
281 | "${BUILT_PRODUCTS_DIR}/Capacitor/Capacitor.framework",
282 | "${BUILT_PRODUCTS_DIR}/CapacitorCordova/Cordova.framework",
283 | "${BUILT_PRODUCTS_DIR}/GTMSessionFetcher/GTMSessionFetcher.framework",
284 | "${BUILT_PRODUCTS_DIR}/GoogleDataTransport/GoogleDataTransport.framework",
285 | "${BUILT_PRODUCTS_DIR}/GoogleToolboxForMac/GoogleToolboxForMac.framework",
286 | "${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework",
287 | "${BUILT_PRODUCTS_DIR}/PromisesObjC/FBLPromises.framework",
288 | "${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework",
289 | );
290 | name = "[CP] Embed Pods Frameworks";
291 | outputPaths = (
292 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Capacitor.framework",
293 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cordova.framework",
294 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GTMSessionFetcher.framework",
295 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleDataTransport.framework",
296 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleToolboxForMac.framework",
297 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework",
298 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBLPromises.framework",
299 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework",
300 | );
301 | runOnlyForDeploymentPostprocessing = 0;
302 | shellPath = /bin/sh;
303 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-PluginTests/Pods-PluginTests-frameworks.sh\"\n";
304 | showEnvVarsInLog = 0;
305 | };
306 | A858649DF00389A4CFF68A0A /* [CP] Copy Pods Resources */ = {
307 | isa = PBXShellScriptBuildPhase;
308 | buildActionMask = 2147483647;
309 | files = (
310 | );
311 | inputPaths = (
312 | "${PODS_ROOT}/Target Support Files/Pods-PluginTests/Pods-PluginTests-resources.sh",
313 | "${PODS_CONFIGURATION_BUILD_DIR}/MLKitTextRecognition/LatinOCRResources.bundle",
314 | );
315 | name = "[CP] Copy Pods Resources";
316 | outputPaths = (
317 | "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/LatinOCRResources.bundle",
318 | );
319 | runOnlyForDeploymentPostprocessing = 0;
320 | shellPath = /bin/sh;
321 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-PluginTests/Pods-PluginTests-resources.sh\"\n";
322 | showEnvVarsInLog = 0;
323 | };
324 | AB5B3E54B4E897F32C2279DA /* [CP] Check Pods Manifest.lock */ = {
325 | isa = PBXShellScriptBuildPhase;
326 | buildActionMask = 2147483647;
327 | files = (
328 | );
329 | inputPaths = (
330 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
331 | "${PODS_ROOT}/Manifest.lock",
332 | );
333 | name = "[CP] Check Pods Manifest.lock";
334 | outputPaths = (
335 | "$(DERIVED_FILE_DIR)/Pods-Plugin-checkManifestLockResult.txt",
336 | );
337 | runOnlyForDeploymentPostprocessing = 0;
338 | shellPath = /bin/sh;
339 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
340 | showEnvVarsInLog = 0;
341 | };
342 | /* End PBXShellScriptBuildPhase section */
343 |
344 | /* Begin PBXSourcesBuildPhase section */
345 | 50ADFF83201F53D600D50D53 /* Sources */ = {
346 | isa = PBXSourcesBuildPhase;
347 | buildActionMask = 2147483647;
348 | files = (
349 | 50E1A94820377CB70090CE1A /* CapacitorPluginMlKitTextRecognitionPlugin.swift in Sources */,
350 | );
351 | runOnlyForDeploymentPostprocessing = 0;
352 | };
353 | 50ADFF8D201F53D600D50D53 /* Sources */ = {
354 | isa = PBXSourcesBuildPhase;
355 | buildActionMask = 2147483647;
356 | files = (
357 | 50ADFF97201F53D600D50D53 /* CapacitorPluginMlKitTextRecognitionTests.swift in Sources */,
358 | );
359 | runOnlyForDeploymentPostprocessing = 0;
360 | };
361 | /* End PBXSourcesBuildPhase section */
362 |
363 | /* Begin PBXTargetDependency section */
364 | 50ADFF94201F53D600D50D53 /* PBXTargetDependency */ = {
365 | isa = PBXTargetDependency;
366 | target = 50ADFF87201F53D600D50D53 /* Plugin */;
367 | targetProxy = 50ADFF93201F53D600D50D53 /* PBXContainerItemProxy */;
368 | };
369 | /* End PBXTargetDependency section */
370 |
371 | /* Begin XCBuildConfiguration section */
372 | 50ADFF9A201F53D600D50D53 /* Debug */ = {
373 | isa = XCBuildConfiguration;
374 | buildSettings = {
375 | ALWAYS_SEARCH_USER_PATHS = NO;
376 | CLANG_ANALYZER_NONNULL = YES;
377 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
378 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
379 | CLANG_CXX_LIBRARY = "libc++";
380 | CLANG_ENABLE_MODULES = YES;
381 | CLANG_ENABLE_OBJC_ARC = YES;
382 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
383 | CLANG_WARN_BOOL_CONVERSION = YES;
384 | CLANG_WARN_COMMA = YES;
385 | CLANG_WARN_CONSTANT_CONVERSION = YES;
386 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
387 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
388 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
389 | CLANG_WARN_EMPTY_BODY = YES;
390 | CLANG_WARN_ENUM_CONVERSION = YES;
391 | CLANG_WARN_INFINITE_RECURSION = YES;
392 | CLANG_WARN_INT_CONVERSION = YES;
393 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
394 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
395 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
396 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
397 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
398 | CLANG_WARN_STRICT_PROTOTYPES = YES;
399 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
400 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
401 | CLANG_WARN_UNREACHABLE_CODE = YES;
402 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
403 | CODE_SIGN_IDENTITY = "iPhone Developer";
404 | COPY_PHASE_STRIP = NO;
405 | CURRENT_PROJECT_VERSION = 1;
406 | DEBUG_INFORMATION_FORMAT = dwarf;
407 | ENABLE_STRICT_OBJC_MSGSEND = YES;
408 | ENABLE_TESTABILITY = YES;
409 | FRAMEWORK_SEARCH_PATHS = (
410 | "\"${BUILT_PRODUCTS_DIR}/Capacitor\"",
411 | "\"${BUILT_PRODUCTS_DIR}/CapacitorCordova\"",
412 | );
413 | GCC_C_LANGUAGE_STANDARD = gnu11;
414 | GCC_DYNAMIC_NO_PIC = NO;
415 | GCC_NO_COMMON_BLOCKS = YES;
416 | GCC_OPTIMIZATION_LEVEL = 0;
417 | GCC_PREPROCESSOR_DEFINITIONS = (
418 | "DEBUG=1",
419 | "$(inherited)",
420 | );
421 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
422 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
423 | GCC_WARN_UNDECLARED_SELECTOR = YES;
424 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
425 | GCC_WARN_UNUSED_FUNCTION = YES;
426 | GCC_WARN_UNUSED_VARIABLE = YES;
427 | IPHONEOS_DEPLOYMENT_TARGET = 13.0;
428 | MTL_ENABLE_DEBUG_INFO = YES;
429 | ONLY_ACTIVE_ARCH = YES;
430 | SDKROOT = iphoneos;
431 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
432 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
433 | VERSIONING_SYSTEM = "apple-generic";
434 | VERSION_INFO_PREFIX = "";
435 | };
436 | name = Debug;
437 | };
438 | 50ADFF9B201F53D600D50D53 /* Release */ = {
439 | isa = XCBuildConfiguration;
440 | buildSettings = {
441 | ALWAYS_SEARCH_USER_PATHS = NO;
442 | CLANG_ANALYZER_NONNULL = YES;
443 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
444 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
445 | CLANG_CXX_LIBRARY = "libc++";
446 | CLANG_ENABLE_MODULES = YES;
447 | CLANG_ENABLE_OBJC_ARC = YES;
448 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
449 | CLANG_WARN_BOOL_CONVERSION = YES;
450 | CLANG_WARN_COMMA = YES;
451 | CLANG_WARN_CONSTANT_CONVERSION = YES;
452 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
453 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
454 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
455 | CLANG_WARN_EMPTY_BODY = YES;
456 | CLANG_WARN_ENUM_CONVERSION = YES;
457 | CLANG_WARN_INFINITE_RECURSION = YES;
458 | CLANG_WARN_INT_CONVERSION = YES;
459 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
460 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
461 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
462 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
463 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
464 | CLANG_WARN_STRICT_PROTOTYPES = YES;
465 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
466 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
467 | CLANG_WARN_UNREACHABLE_CODE = YES;
468 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
469 | CODE_SIGN_IDENTITY = "iPhone Developer";
470 | COPY_PHASE_STRIP = NO;
471 | CURRENT_PROJECT_VERSION = 1;
472 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
473 | ENABLE_NS_ASSERTIONS = NO;
474 | ENABLE_STRICT_OBJC_MSGSEND = YES;
475 | FRAMEWORK_SEARCH_PATHS = (
476 | "\"${BUILT_PRODUCTS_DIR}/Capacitor\"",
477 | "\"${BUILT_PRODUCTS_DIR}/CapacitorCordova\"",
478 | );
479 | GCC_C_LANGUAGE_STANDARD = gnu11;
480 | GCC_NO_COMMON_BLOCKS = YES;
481 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
482 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
483 | GCC_WARN_UNDECLARED_SELECTOR = YES;
484 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
485 | GCC_WARN_UNUSED_FUNCTION = YES;
486 | GCC_WARN_UNUSED_VARIABLE = YES;
487 | IPHONEOS_DEPLOYMENT_TARGET = 13.0;
488 | MTL_ENABLE_DEBUG_INFO = NO;
489 | SDKROOT = iphoneos;
490 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
491 | VALIDATE_PRODUCT = YES;
492 | VERSIONING_SYSTEM = "apple-generic";
493 | VERSION_INFO_PREFIX = "";
494 | };
495 | name = Release;
496 | };
497 | 50ADFF9D201F53D600D50D53 /* Debug */ = {
498 | isa = XCBuildConfiguration;
499 | baseConfigurationReference = 5E23F77F099397094342571A /* Pods-Plugin.debug.xcconfig */;
500 | buildSettings = {
501 | CLANG_ENABLE_MODULES = YES;
502 | CODE_SIGN_IDENTITY = "";
503 | CODE_SIGN_STYLE = Automatic;
504 | DEFINES_MODULE = YES;
505 | DYLIB_COMPATIBILITY_VERSION = 1;
506 | DYLIB_CURRENT_VERSION = 1;
507 | DYLIB_INSTALL_NAME_BASE = "@rpath";
508 | INFOPLIST_FILE = Plugin/Info.plist;
509 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
510 | IPHONEOS_DEPLOYMENT_TARGET = 13.0;
511 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)\n$(FRAMEWORK_SEARCH_PATHS)\n$(FRAMEWORK_SEARCH_PATHS)";
512 | ONLY_ACTIVE_ARCH = YES;
513 | PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.Plugin;
514 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
515 | SKIP_INSTALL = YES;
516 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
517 | SWIFT_VERSION = 5.0;
518 | TARGETED_DEVICE_FAMILY = "1,2";
519 | };
520 | name = Debug;
521 | };
522 | 50ADFF9E201F53D600D50D53 /* Release */ = {
523 | isa = XCBuildConfiguration;
524 | baseConfigurationReference = 91781294A431A2A7CC6EB714 /* Pods-Plugin.release.xcconfig */;
525 | buildSettings = {
526 | CLANG_ENABLE_MODULES = YES;
527 | CODE_SIGN_IDENTITY = "";
528 | CODE_SIGN_STYLE = Automatic;
529 | DEFINES_MODULE = YES;
530 | DYLIB_COMPATIBILITY_VERSION = 1;
531 | DYLIB_CURRENT_VERSION = 1;
532 | DYLIB_INSTALL_NAME_BASE = "@rpath";
533 | INFOPLIST_FILE = Plugin/Info.plist;
534 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
535 | IPHONEOS_DEPLOYMENT_TARGET = 13.0;
536 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)";
537 | ONLY_ACTIVE_ARCH = NO;
538 | PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.Plugin;
539 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
540 | SKIP_INSTALL = YES;
541 | SWIFT_VERSION = 5.0;
542 | TARGETED_DEVICE_FAMILY = "1,2";
543 | };
544 | name = Release;
545 | };
546 | 50ADFFA0201F53D600D50D53 /* Debug */ = {
547 | isa = XCBuildConfiguration;
548 | baseConfigurationReference = 96ED1B6440D6672E406C8D19 /* Pods-PluginTests.debug.xcconfig */;
549 | buildSettings = {
550 | CODE_SIGN_STYLE = Automatic;
551 | INFOPLIST_FILE = PluginTests/Info.plist;
552 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
553 | PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.PluginTests;
554 | PRODUCT_NAME = "$(TARGET_NAME)";
555 | SWIFT_VERSION = 5.0;
556 | TARGETED_DEVICE_FAMILY = "1,2";
557 | };
558 | name = Debug;
559 | };
560 | 50ADFFA1201F53D600D50D53 /* Release */ = {
561 | isa = XCBuildConfiguration;
562 | baseConfigurationReference = F65BB2953ECE002E1EF3E424 /* Pods-PluginTests.release.xcconfig */;
563 | buildSettings = {
564 | CODE_SIGN_STYLE = Automatic;
565 | INFOPLIST_FILE = PluginTests/Info.plist;
566 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
567 | PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.PluginTests;
568 | PRODUCT_NAME = "$(TARGET_NAME)";
569 | SWIFT_VERSION = 5.0;
570 | TARGETED_DEVICE_FAMILY = "1,2";
571 | };
572 | name = Release;
573 | };
574 | /* End XCBuildConfiguration section */
575 |
576 | /* Begin XCConfigurationList section */
577 | 50ADFF82201F53D600D50D53 /* Build configuration list for PBXProject "Plugin" */ = {
578 | isa = XCConfigurationList;
579 | buildConfigurations = (
580 | 50ADFF9A201F53D600D50D53 /* Debug */,
581 | 50ADFF9B201F53D600D50D53 /* Release */,
582 | );
583 | defaultConfigurationIsVisible = 0;
584 | defaultConfigurationName = Release;
585 | };
586 | 50ADFF9C201F53D600D50D53 /* Build configuration list for PBXNativeTarget "Plugin" */ = {
587 | isa = XCConfigurationList;
588 | buildConfigurations = (
589 | 50ADFF9D201F53D600D50D53 /* Debug */,
590 | 50ADFF9E201F53D600D50D53 /* Release */,
591 | );
592 | defaultConfigurationIsVisible = 0;
593 | defaultConfigurationName = Release;
594 | };
595 | 50ADFF9F201F53D600D50D53 /* Build configuration list for PBXNativeTarget "PluginTests" */ = {
596 | isa = XCConfigurationList;
597 | buildConfigurations = (
598 | 50ADFFA0201F53D600D50D53 /* Debug */,
599 | 50ADFFA1201F53D600D50D53 /* Release */,
600 | );
601 | defaultConfigurationIsVisible = 0;
602 | defaultConfigurationName = Release;
603 | };
604 | /* End XCConfigurationList section */
605 | };
606 | rootObject = 50ADFF7F201F53D600D50D53 /* Project object */;
607 | }
608 |
--------------------------------------------------------------------------------
/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Plugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Plugin.xcodeproj/xcshareddata/xcschemes/Plugin.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
54 |
60 |
61 |
67 |
68 |
69 |
70 |
72 |
73 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/ios/Plugin.xcodeproj/xcshareddata/xcschemes/PluginTests.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
54 |
60 |
61 |
63 |
64 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/ios/Plugin.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Plugin/CapacitorPluginMlKitTextRecognitionPlugin.swift:
--------------------------------------------------------------------------------
1 | import Foundation
2 | import Capacitor
3 | import MLKitVision
4 | import MLKitTextRecognition
5 | /**
6 | * Please read the Capacitor iOS Plugin Development Guide
7 | * here: https://capacitorjs.com/docs/plugins/ios
8 | */
9 | @objc(CapacitorPluginMlKitTextRecognitionPlugin)
10 | public class CapacitorPluginMlKitTextRecognitionPlugin: CAPPlugin, CAPBridgedPlugin {
11 | public let identifier = "CapacitorPluginMlKitTextRecognitionPlugin"
12 | public let jsName = "CapacitorPluginMlKitTextRecognition"
13 | public let pluginMethods: [CAPPluginMethod] = [
14 | CAPPluginMethod(name: "detectText", returnType: CAPPluginReturnPromise),
15 | ]
16 | func parseCornerPointsToJsObject(cornerPoints: [NSValue]) -> Dictionary {
17 | // let res = NSMutableArray();
18 | // res.add(
19 | return [
20 | "topLeft": [
21 | "x": cornerPoints[0].cgPointValue.x,
22 | "y": cornerPoints[0].cgPointValue.y,
23 | ],
24 | "topRight": [
25 | "x": cornerPoints[1].cgPointValue.x,
26 | "y": cornerPoints[1].cgPointValue.y,
27 | ],
28 | "bottomRight": [
29 | "x": cornerPoints[2].cgPointValue.x,
30 | "y": cornerPoints[2].cgPointValue.y,
31 | ],
32 | "bottomLeft": [
33 | "x": cornerPoints[0].cgPointValue.x,
34 | "y": cornerPoints[0].cgPointValue.y,
35 | ]
36 | ];
37 | // ]);
38 | // return res;
39 | }
40 |
41 | @objc func detectText(_ call: CAPPluginCall) {
42 | guard let encodedImage = call.getString("base64Image") else {
43 | call.reject("No image is given!")
44 | return
45 | }
46 | let rotation = call.getInt("rotation") ?? 0
47 |
48 | let dataDecoded : Data = Data(base64Encoded: encodedImage, options: .ignoreUnknownCharacters)!
49 | guard let image = UIImage(data: dataDecoded) else {
50 | call.reject("Unable to parse image")
51 | return
52 | }
53 |
54 | let latinOptions = TextRecognizerOptions()
55 | let textRecognizer = TextRecognizer.textRecognizer(options: latinOptions)
56 | let visionImage = VisionImage(image: image)
57 | visionImage.orientation = visionImageOrientation(rotation: rotation)
58 |
59 | textRecognizer.process(visionImage) { result, error in
60 | guard error == nil, let result = result else {
61 | // Error handling
62 | call.reject("Error on processing image")
63 | return
64 | }
65 |
66 | let textBlocks = NSMutableArray()
67 | for textBlock: TextBlock in result.blocks {
68 | let lines = NSMutableArray()
69 | for line: TextLine in textBlock.lines {
70 | let elements = NSMutableArray()
71 | for element: TextElement in line.elements {
72 | elements.add([
73 | "text": element.text,
74 | "boundingBox": [
75 | "left": element.frame.minX,
76 | "top": element.frame.maxY,
77 | "right": element.frame.maxX,
78 | "bottom": element.frame.minY,
79 | ],
80 | "recognizedLanguage": element.recognizedLanguages.first?.languageCode ?? "",
81 | "cornerPoints": self.parseCornerPointsToJsObject(cornerPoints: element.cornerPoints)
82 | ])
83 | }
84 |
85 | lines.add([
86 | "text": line.text,
87 | "boundingBox": [
88 | "left": line.frame.minX,
89 | "top": line.frame.maxY,
90 | "right": line.frame.maxX,
91 | "bottom": line.frame.minY,
92 | ],
93 | "recognizedLanguage": line.recognizedLanguages.first?.languageCode ?? "",
94 | "cornerPoints": self.parseCornerPointsToJsObject(cornerPoints: line.cornerPoints),
95 | "elements": elements
96 | ])
97 | }
98 |
99 | textBlocks.add([
100 | "text": textBlock.text,
101 | "boundingBox": [
102 | "left": textBlock.frame.minX,
103 | "top": textBlock.frame.maxY,
104 | "right": textBlock.frame.maxX,
105 | "bottom": textBlock.frame.minY,
106 | ],
107 | "recognizedLanguage": textBlock.recognizedLanguages.first?.languageCode ?? "",
108 | "cornerPoints": self.parseCornerPointsToJsObject(cornerPoints: textBlock.cornerPoints),
109 | "lines": lines
110 | ])
111 | }
112 |
113 | call.resolve([
114 | "text": result.text,
115 | "blocks": textBlocks
116 | ])
117 | }
118 | }
119 |
120 | public func visionImageOrientation(rotation: Int) -> UIImage.Orientation {
121 | switch rotation {
122 | case 0:
123 | return .up
124 | case 90:
125 | return .left
126 | case 180:
127 | return .down
128 | case 270:
129 | return .right
130 | default:
131 | return .up
132 | }
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/ios/Plugin/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | $(CURRENT_PROJECT_VERSION)
21 | NSPrincipalClass
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/ios/PluginTests/CapacitorPluginMlKitTextRecognitionTests.swift:
--------------------------------------------------------------------------------
1 | import XCTest
2 | @testable import Plugin
3 |
4 | class CapacitorPluginMlKitTextRecognitionTests: XCTestCase {
5 | override func setUp() {
6 | super.setUp()
7 | // Put setup code here. This method is called before the invocation of each test method in the class.
8 | }
9 |
10 | override func tearDown() {
11 | // Put teardown code here. This method is called after the invocation of each test method in the class.
12 | super.tearDown()
13 | }
14 |
15 | func testEcho() {
16 | // This is an example of a functional test case for a plugin.
17 | // Use XCTAssert and related functions to verify your tests produce the correct results.
18 |
19 | let implementation = CapacitorPluginMlKitTextRecognition()
20 | let value = "Hello, World!"
21 | let result = implementation.echo(value)
22 |
23 | XCTAssertEqual(value, result)
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/ios/PluginTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | platform :ios, '15.5'
2 |
3 | def capacitor_pods
4 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
5 | use_frameworks!
6 | pod 'Capacitor', :path => '../node_modules/@capacitor/ios'
7 | pod 'CapacitorCordova', :path => '../node_modules/@capacitor/ios'
8 | pod 'GoogleMLKit/TextRecognition', '7.0.0'
9 | end
10 |
11 | target 'Plugin' do
12 | capacitor_pods
13 | end
14 |
15 | target 'PluginTests' do
16 | capacitor_pods
17 | end
18 |
19 | post_install do |installer|
20 | installer.pods_project.targets.each do |target|
21 | target.build_configurations.each do |config|
22 | # Build for all architectures
23 | config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
24 | # Exclude arm64 architecture for the iOS simulator
25 | config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
26 | end
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@pantrist/capacitor-plugin-ml-kit-text-recognition",
3 | "version": "7.0.0",
4 | "description": "Capacitor Wrapper for TextRecognition of Gogoles ML-Kit",
5 | "main": "dist/plugin.cjs.js",
6 | "module": "dist/esm/index.js",
7 | "types": "dist/esm/index.d.ts",
8 | "unpkg": "dist/plugin.js",
9 | "files": [
10 | "android/src/main/",
11 | "android/build.gradle",
12 | "dist/",
13 | "ios/Plugin/",
14 | "PantristCapacitorPluginMlKitTextRecognition.podspec"
15 | ],
16 | "author": "Nico Lueg (nicolueg@gmx.de)",
17 | "license": "MIT",
18 | "repository": {
19 | "type": "git",
20 | "url": "git+https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition.git"
21 | },
22 | "bugs": {
23 | "url": "https://github.com/Pantrist-dev/capacitor-plugin-ml-kit-text-recognition/issues"
24 | },
25 | "keywords": [
26 | "capacitor",
27 | "plugin",
28 | "native",
29 | "ml-kit",
30 | "text-recognition"
31 | ],
32 | "scripts": {
33 | "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
34 | "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..",
35 | "verify:android": "cd android && ./gradlew clean build test && cd ..",
36 | "verify:web": "npm run build",
37 | "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
38 | "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
39 | "eslint": "eslint . --ext ts",
40 | "prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
41 | "swiftlint": "node-swiftlint",
42 | "docgen": "docgen --api CapacitorPluginMlKitTextRecognitionPlugin --output-readme README.md --output-json dist/docs.json",
43 | "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
44 | "ios:spm:install": "cd ios && swift package resolve && cd ..",
45 | "clean": "rimraf ./dist",
46 | "watch": "tsc --watch",
47 | "prepublishOnly": "npm run build",
48 | "release": "standard-version"
49 | },
50 | "devDependencies": {
51 | "@capacitor/android": "^7.0.0",
52 | "@capacitor/cli": "^7.0.0",
53 | "@capacitor/core": "^7.0.0",
54 | "@capacitor/docgen": "^0.3.0",
55 | "@capacitor/ios": "^7.0.0",
56 | "@ionic/eslint-config": "^0.4.0",
57 | "@ionic/prettier-config": "^4.0.0",
58 | "@ionic/swiftlint-config": "^2.0.0",
59 | "eslint": "^8.57.0",
60 | "prettier": "^3.4.2",
61 | "prettier-plugin-java": "^2.6.6",
62 | "rimraf": "^6.0.1",
63 | "rollup": "^4.30.1",
64 | "standard-version": "^9.5.0",
65 | "swiftlint": "^2.0.0",
66 | "typescript": "~4.6.4"
67 | },
68 | "peerDependencies": {
69 | "@capacitor/core": ">=7.0.0"
70 | },
71 | "prettier": "@ionic/prettier-config",
72 | "swiftlint": "@ionic/swiftlint-config",
73 | "eslintConfig": {
74 | "extends": "@ionic/eslint-config/recommended"
75 | },
76 | "capacitor": {
77 | "ios": {
78 | "src": "ios"
79 | },
80 | "android": {
81 | "src": "android"
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/rollup.config.mjs:
--------------------------------------------------------------------------------
1 | export default {
2 | input: 'dist/esm/index.js',
3 | output: [
4 | {
5 | file: 'dist/plugin.js',
6 | format: 'iife',
7 | name: 'capacitorCapacitorPluginMlKitTextRecognition',
8 | globals: {
9 | '@capacitor/core': 'capacitorExports',
10 | },
11 | sourcemap: true,
12 | inlineDynamicImports: true,
13 | },
14 | {
15 | file: 'dist/plugin.cjs.js',
16 | format: 'cjs',
17 | sourcemap: true,
18 | inlineDynamicImports: true,
19 | },
20 | ],
21 | external: ['@capacitor/core'],
22 | };
23 |
--------------------------------------------------------------------------------
/src/definitions.ts:
--------------------------------------------------------------------------------
1 | export interface CapacitorPluginMlKitTextRecognitionPlugin {
2 | /**
3 | * Tries to detect text from the given image
4 | * @param options Options for the text detection
5 | * @returns Resolved texts
6 | */
7 | detectText(options: DetectImageOptions): Promise;
8 | }
9 |
10 | export interface DetectImageOptions {
11 | /**
12 | * The image to detect texts from
13 | */
14 | base64Image: string;
15 | /**
16 | * The image's counter-clockwise orientation degrees. Only 0, 90, 180, 270 are supported. Default 0
17 | */
18 | rotation?: number;
19 | }
20 |
21 | export interface TextDetectionResult {
22 | /**
23 | * Found text
24 | */
25 | text: string;
26 | /**
27 | * Parsed text by lines
28 | */
29 | blocks: Block[]
30 | }
31 |
32 | export interface Block extends TextBase {
33 | lines: Line[];
34 | }
35 |
36 | export interface Line extends TextBase {
37 | elements: Element[];
38 | }
39 |
40 | export interface Element extends TextBase {}
41 |
42 | export interface TextBase {
43 | text: string;
44 | boundingBox: BoundingBox;
45 | recognizedLanguage: string;
46 | cornerPoints: CornersPoints | null;
47 | }
48 |
49 | export interface BoundingBox {
50 | left: number;
51 | top: number;
52 | right: number;
53 | bottom: number;
54 | }
55 |
56 | export interface CornersPoints {
57 | topLeft: Point;
58 | topRight: Point;
59 | bottomRight: Point;
60 | bottomLeft: Point;
61 | }
62 |
63 | export interface Point {
64 | x : number;
65 | y : number;
66 | }
67 |
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
1 | import { registerPlugin } from '@capacitor/core';
2 |
3 | import type { CapacitorPluginMlKitTextRecognitionPlugin } from './definitions';
4 |
5 | const CapacitorPluginMlKitTextRecognition = registerPlugin('CapacitorPluginMlKitTextRecognition', {
6 | web: () => import('./web').then(m => new m.CapacitorPluginMlKitTextRecognitionWeb()),
7 | });
8 |
9 | export * from './definitions';
10 | export { CapacitorPluginMlKitTextRecognition };
11 |
--------------------------------------------------------------------------------
/src/web.ts:
--------------------------------------------------------------------------------
1 | import { WebPlugin } from '@capacitor/core';
2 |
3 | import type { CapacitorPluginMlKitTextRecognitionPlugin, DetectImageOptions, TextDetectionResult } from './definitions';
4 |
5 | export class CapacitorPluginMlKitTextRecognitionWeb extends WebPlugin implements CapacitorPluginMlKitTextRecognitionPlugin {
6 | // @ts-ignore
7 | detectText(options: DetectImageOptions): Promise {
8 | return Promise.reject("Web Plugin Not implemented");
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "allowUnreachableCode": false,
4 | "declaration": true,
5 | "esModuleInterop": true,
6 | "inlineSources": true,
7 | "lib": ["dom", "es2017"],
8 | "module": "esnext",
9 | "moduleResolution": "node",
10 | "noFallthroughCasesInSwitch": true,
11 | "noUnusedLocals": true,
12 | "noUnusedParameters": true,
13 | "outDir": "dist/esm",
14 | "pretty": true,
15 | "sourceMap": true,
16 | "strict": true,
17 | "target": "es2017"
18 | },
19 | "files": ["src/index.ts"]
20 | }
21 |
--------------------------------------------------------------------------------