From 305c7b94ae196cd8ac7476f627c23d8f3e360324 Mon Sep 17 00:00:00 2001 From: Elizabeth Graham Date: Thu, 30 Jan 2020 10:21:41 -0500 Subject: [PATCH] Updated Gradle functionality to download AAR file for Android (#25) * Added plugin and native ionic code * Removed the cognitive services plugin .DS_Store file from gitignore, and added all .DS_Store files. * Renamed Native Ionic Folder. Updated Readme. * Added images for README * Renamed cognitiveservicesPlugin folder * Updated Android source to download aar file using gradle, rather than including aar file in code. * Remove vscode files. Co-authored-by: esgraham13 <40240082+esgraham13@users.noreply.github.com> --- .gitignore | 1 + README.md | 2 +- cognitiveservicesPlugin/README.md | 17 ++++++++++++++++- cognitiveservicesPlugin/plugin.xml | 1 - .../src/android/CognitiveServices.gradle | 4 ++++ 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index aa71c35..37ce13d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ cognitiveservicesPlugin/.gradle/ cognitiveservicesPlugin/platforms/ cognitiveservicesPlugin/src/ios/MicrosoftCognitiveServicesSpeech.framework/ cognitiveservicesPlugin/aar +.vscode/ diff --git a/README.md b/README.md index a7e9f52..76d7c33 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ npm i -g cordova To include the wrapper for the Cognitive Services plugin as an observable, run the following command: ```bash -cp -r ../cognitiveservices ../examples/ionic-angular/node_modules/@ionic-native/ +cp -r ../../cognitiveservices node_modules/@ionic-native/ ``` While this should install all components, there have been a few changes to diff --git a/cognitiveservicesPlugin/README.md b/cognitiveservicesPlugin/README.md index c4a043c..b7df3ad 100644 --- a/cognitiveservicesPlugin/README.md +++ b/cognitiveservicesPlugin/README.md @@ -156,6 +156,21 @@ changed. ## Ionic Usage +## app.module.ts + +```typescript +import { CognitiveServices } from '@ionic-native/cognitiveservices/ngx'; + +@NgModule({ + declarations: [AppComponent], + entryComponents: [], + imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule], + providers: [ + ... + CognitiveServices + ] +``` + ## app.component.ts ```typescript @@ -168,7 +183,7 @@ initializeApp() { this.platform.ready().then(() => { this.cognitiveServices.SetSubscription( environment.subscriptionKey, - environment.cogServices.serviceRegion).then( + environment.serviceRegion).then( () => { }, (error: any) => { alert(error); }); }); diff --git a/cognitiveservicesPlugin/plugin.xml b/cognitiveservicesPlugin/plugin.xml index e4c3946..3585cd0 100644 --- a/cognitiveservicesPlugin/plugin.xml +++ b/cognitiveservicesPlugin/plugin.xml @@ -33,7 +33,6 @@ - diff --git a/cognitiveservicesPlugin/src/android/CognitiveServices.gradle b/cognitiveservicesPlugin/src/android/CognitiveServices.gradle index 67f14e9..2f983fa 100644 --- a/cognitiveservicesPlugin/src/android/CognitiveServices.gradle +++ b/cognitiveservicesPlugin/src/android/CognitiveServices.gradle @@ -3,6 +3,10 @@ repositories{ flatDir { dirs 'src/main/libs' } + mavenCentral() + maven { + url "https://csspeechstorage.blob.core.windows.net/maven" + } } dependencies {