This repository has been archived by the owner on Jul 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexander Lobastov
committed
Jun 3, 2020
1 parent
4a0df53
commit 45a87f9
Showing
102 changed files
with
9,874 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
.vscode | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# LICENSE | ||
|
||
## License Agreement for the ABBYY Mobile Capture Samples | ||
|
||
1. Subject to the terms and conditions hereof and in accordance with the ABBYY Mobile Capture License Agreement ABBYY grants You a limited, worldwide, non-exclusive, royalty-free license to study, reproduce, use, modify the ABBYY Mobile Capture Samples and integrate them into your Application. For the purposes hereof, “Application” means the software program, or a complex of software programs for mobile device, which is to be developed by You and which is to include parts of the ABBYY Mobile Capture Samples or otherwise interact with the ABBYY Mobile Capture Samples. | ||
|
||
2. ABBYY Mobile Capture Samples are licensed, not sold, to You. ABBYY reserves all copyright and other intellectual property rights to the ABBYY Mobile Capture Samples. | ||
|
||
3. You may include the Samples into the Application and modify them provided that You have a valid License to use ABBYY Mobile Capture. | ||
|
||
4. You may redistribute the Samples to end-users in binary code form or object code form only as the part of Your Application provided that the Your Application uses the Samples solely for the purpose of processing the results obtained with the ABBYY Mobile Capture. | ||
|
||
5. You may transfer to ABBYY the copyright and other intellectual property rights to the modifications made by You to the Samples. ABBYY may consider including such modifications into subsequent releases of the Samples. If You transfer to ABBYY the copyright and other intellectual property rights to Your modifications to the Samples, You may use these modifications as a part of the Samples under the terms hereof. | ||
|
||
6. If You disclose to ABBYY modifications made by You to the Samples by any means, the copyright and other intellectual property rights to such modifications shall be deemed to have been transferred to ABBYY. If You do not wish to transfer to ABBYY the copyright and other intellectual property rights to the modifications made by You to the Samples, You shall not disclose to ABBYY the source code of such modifications. | ||
|
||
7. You must retain, in the source code form of Your Application, all copyright, trademark, and attribution notices present in the ABBYY Mobile Capture Samples. | ||
|
||
8. THE ABBYY MOBILE CAPTURE SAMPLES ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL ABBYY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE PLUGIN OR THE USE OR OTHER DEALINGS IN THE PLUGIN. In particular, ABBYY cannot warrant the performance of any Application created by or for You by means of the ABBYY Mobile Capture Samples, nor does ABBYY make any representations or warranties with respect to the performance of the ABBYY Mobile Capture Samples integrated into the Application. ABBYY will not be liable for any direct or indirect damages resulting from errors or misprints in the ABBYY Mobile Capture Samples. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,222 @@ | ||
# How to add ABBYY Mobile Capture SDK to your Ionic app | ||
|
||
To start developing an Ionic-based app using ABBYY Mobile Capture SDK features, you need to add ABBYY Mobile Capture SDK Cordova Plugin, then add target platforms and the Cordova plugin to your project, and thereafter copy the ABBYY Mobile Capture SDK assets and native libraries for Android and iOS, as described below. | ||
|
||
## Adding Cordova Plugin | ||
Add the plugin to your project from npm. It is recommended to add the 1.0.16 [cordova-plugin-abbyy-rtr-sdk](https://www.npmjs.com/package/cordova-plugin-abbyy-rtr-sdk) version, as it supports all up-to-date changes. | ||
|
||
`npm install [email protected]` | ||
|
||
Run the next command to apply changes: | ||
|
||
`ionic cap sync` | ||
|
||
## Projects set-up | ||
|
||
### ABBYY MobileCapture environment setup | ||
1. Request ABBYY Mobile Capture trial version on the [ABBYY website](https://www.abbyy.com/mobile-capture-sdk/#request-demo) and add it to your project: | ||
|
||
* Copy iOS `assets` directory to the project into `../assets` folder | ||
* Copy your license into `../assets` with MobileCapture.License name | ||
* Copy Android `libs` directory to the project into `../libs/android` folder | ||
* Copy iOS `libs` directory to the project into `../libs/ios` folder | ||
|
||
2. Proceed setup depending on the platform: | ||
|
||
#### Android setup | ||
|
||
Edit the **android/build.gradle**: | ||
|
||
``` | ||
allprojects { | ||
repositories { | ||
flatDir { | ||
// Search path for Mobile Capture libs | ||
dirs '../../../libs/android' | ||
} | ||
google() | ||
jcenter() | ||
} | ||
} | ||
``` | ||
|
||
Add the following code to the same gradle file to fix Ionic and Cordova Java version conflict: | ||
|
||
``` | ||
subprojects { | ||
afterEvaluate { | ||
android { | ||
compileOptions { | ||
sourceCompatibility 1.8 | ||
targetCompatibility 1.8 | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
Edit the **android/app/build.gradle**: | ||
|
||
``` | ||
android { | ||
... | ||
sourceSets { | ||
main { | ||
// Mobile Capture assets | ||
assets.srcDirs += ['../../../assets'] | ||
} | ||
} | ||
} | ||
Add the libs to the application in the same gradle file: | ||
repositories { | ||
flatDir{ | ||
// Search path for Mobile Capture libs | ||
dirs '../../libs/android' | ||
} | ||
} | ||
``` | ||
|
||
Set minimum SDK version to '21' in the **android/variables.gradle**. | ||
|
||
#### iOS setup | ||
|
||
Add to the **ios/App/Podfile** file the paths to the lib files: | ||
|
||
``` | ||
post_install do |installer| | ||
installer.pods_project.targets.each do |target| | ||
target.build_configurations.each do |config| | ||
... | ||
# Settings to use Mobile Capture SDK. | ||
config.build_settings['ENABLE_BITCODE'] = "NO" | ||
config.build_settings['FRAMEWORK_SEARCH_PATHS'] = "$(inherited) ../../../../libs/ios" | ||
end | ||
end | ||
end | ||
``` | ||
|
||
To add the license file, the resource files and set up the copying rules, in **Build Phases** add one more Run Script phase. The **copy_assets.py** script, added to the phase, will automatically copy all resource files to corresponding destinations and add necessary dictionaries. | ||
|
||
``` | ||
python "${SRCROOT}/../../../assets/copy_assets.py" | ||
cp ../../../assets/MobileCapture.License" $TARGET_BUILD_DIR/$WRAPPER_NAME/" | ||
``` | ||
|
||
In **Build Phases**, add a new **Run Script** phase. Run the **copy_frameworks.sh** script that removes the frameworks for the non-active CPU architectures (the complete list depends on the project settings), and sign the resulting framework. This is a required step before uploading your application to App Store. | ||
|
||
``` | ||
/bin/sh "${SRCROOT}/../../../libs/ios/copy_frameworks.sh" | ||
``` | ||
|
||
Select your project in the **Target** group and open the **Build Settings** tab. In the **Search Paths** section add to the **Framework Search Paths** the following path: | ||
``` | ||
../../../libs/ios | ||
``` | ||
|
||
On the **Build Options** tab set **Enable Bitcode** option to **No**. | ||
|
||
In the **info.plist** file add permission for working with camera and gallery if necessary. | ||
|
||
Apply the settings: | ||
|
||
``` | ||
cd ios/App | ||
pod install | ||
``` | ||
|
||
Check that the built bundle of your app has the following structure: | ||
|
||
``` | ||
App.app/ | ||
bcr/ | ||
... | ||
dictionaries/ | ||
... | ||
patterns/ | ||
... | ||
... | ||
Frameworks/ | ||
AbbyyRtrSDK.framework | ||
... | ||
App | ||
MobileCapture.License | ||
``` | ||
|
||
**Important!** A certain folder structure is required for the setup. Make sure to change the paths if your folder structure differs from the following one: | ||
|
||
``` | ||
assets/ | ||
bcr/ | ||
... | ||
dictionaries/ | ||
... | ||
... | ||
MobileCapture.License | ||
libs/ | ||
android/ | ||
abbyy-rtr-sdk-1.0.aar | ||
abbyy-ui-1.0.aar | ||
ios/ | ||
AbbyyRtrSDK.framework | ||
AbbyyUI.framework | ||
... | ||
[APPLICATION_FOLDER]/ | ||
... | ||
``` | ||
|
||
## Code sample | ||
|
||
``` | ||
... | ||
declare let AbbyyRtrSdk: any; | ||
... | ||
const takePhoto = async () => { | ||
AbbyyRtrSdk.startImageCapture( (result: { images: { base64: any; }[]; resultInfo: { uriPrefix: any; }; }) => { | ||
if (result.images && result.images[0]) { | ||
setImage({ | ||
base64: result.resultInfo.uriPrefix + result.images[0].base64 | ||
}) | ||
} else { | ||
console.log(result.error); | ||
} | ||
}, { | ||
licenseFileName: "MobileCapture.License", | ||
destination: 'base64', | ||
isCaptureButtonVisible: true, | ||
requiredPageCount: 1, | ||
}); | ||
}; | ||
``` | ||
|
||
## How to run the sample from distributive | ||
|
||
1. Request ABBYY Mobile Capture trial version on the [ABBYY website](https://www.abbyy.com/mobile-capture-sdk/#request-demo) and add it to your project: | ||
|
||
* Copy iOS `assets` directory to the project into `../assets` folder | ||
* Copy your license into `../assets` with MobileCapture.License name | ||
* Copy Android `libs` directory to the project into `../libs/android` folder | ||
* Copy iOS `libs` directory to the project into `../libs/ios` folder | ||
|
||
2. Add the plugin, apply changes: | ||
|
||
``` | ||
npm install | ||
ionic cap sync | ||
``` | ||
|
||
3. To run application do the following: | ||
* Android: | ||
* **From console:** | ||
Execute `npx cap open android` from the sample root | ||
* **From Android Studio:** | ||
Click `Run app` button | ||
* iOS: | ||
* **From console:** | ||
Execute `npx cap open ios` from the sample root | ||
* **From Xcode:** | ||
Click `Run` button | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# NPM renames .gitignore to .npmignore | ||
# In order to prevent that, we remove the initial "." | ||
# And the CLI then renames it | ||
|
||
# Using Android gitignore template: https://github.com/github/gitignore/blob/master/Android.gitignore | ||
|
||
# Built application files | ||
*.apk | ||
*.ap_ | ||
*.aab | ||
|
||
# Files for the ART/Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Generated files | ||
bin/ | ||
gen/ | ||
out/ | ||
release/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Log Files | ||
*.log | ||
|
||
# Android Studio Navigation editor temp files | ||
.navigation/ | ||
|
||
# Android Studio captures folder | ||
captures/ | ||
|
||
# IntelliJ | ||
*.iml | ||
.idea/workspace.xml | ||
.idea/tasks.xml | ||
.idea/gradle.xml | ||
.idea/assetWizardSettings.xml | ||
.idea/dictionaries | ||
.idea/libraries | ||
# Android Studio 3 in .gitignore file. | ||
.idea/caches | ||
.idea/modules.xml | ||
# Comment next line if keeping position of elements in Navigation Editor is relevant for you | ||
.idea/navEditor.xml | ||
|
||
# Keystore files | ||
# Uncomment the following lines if you do not want to check your keystore files in. | ||
#*.jks | ||
#*.keystore | ||
|
||
# External native build folder generated in Android Studio 2.2 and later | ||
.externalNativeBuild | ||
|
||
# Freeline | ||
freeline.py | ||
freeline/ | ||
freeline_project_description.json | ||
|
||
# fastlane | ||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots | ||
fastlane/test_output | ||
fastlane/readme.md | ||
|
||
# Version control | ||
vcs.xml | ||
|
||
# lint | ||
lint/intermediates/ | ||
lint/generated/ | ||
lint/outputs/ | ||
lint/tmp/ | ||
# lint/reports/ | ||
|
||
# Cordova plugins for Capacitor | ||
capacitor-cordova-android-plugins | ||
|
||
# Copied web assets | ||
app/src/main/assets/public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/build/* | ||
!/build/.npmkeep |
Oops, something went wrong.