Skip to content

Commit

Permalink
add faceid testing
Browse files Browse the repository at this point in the history
  • Loading branch information
thedevtoni committed Mar 10, 2022
1 parent 61c3fd5 commit b49e9c3
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 6 deletions.
4 changes: 3 additions & 1 deletion ios/App/App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>semmie-poc</string>
<string>semmie-poc</string>
<key>NSFaceIDUsageDescription</key>
<string>Privacy - Face ID Usage Description</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand Down
4 changes: 4 additions & 0 deletions ios/App/App/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@
<widget version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<access origin="*" />

<feature name="Fingerprint">
<param name="ios-package" value="Fingerprint"/>
</feature>


</widget>
1 change: 1 addition & 0 deletions ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def capacitor_pods
pod 'CapacitorHaptics', :path => '../../node_modules/@capacitor/haptics'
pod 'CapacitorKeyboard', :path => '../../node_modules/@capacitor/keyboard'
pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'
pod 'CordovaPlugins', :path => '../capacitor-cordova-ios-plugins'
end

target 'App' do
Expand Down
63 changes: 63 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
"@capacitor/status-bar": "1.0.8",
"@datorama/akita": "^7.1.1",
"@datorama/akita-ngdevtools": "^7.0.0",
"@ionic-native/fingerprint-aio": "^5.36.0",
"@ionic/angular": "^6.0.0",
"chart.js": "^3.7.1",
"cordova-plugin-fingerprint-aio": "^5.0.1",
"rxjs": "~6.6.0",
"tslib": "^2.2.0",
"zone.js": "~0.11.4"
Expand Down
6 changes: 4 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { registerLocaleData } from '@angular/common';
import {
HttpClient,
HttpClientModule,
HTTP_INTERCEPTORS,
} from '@angular/common/http';
import localeNL from '@angular/common/locales/nl';
import {
APP_INITIALIZER,
DEFAULT_CURRENCY_CODE,
Expand All @@ -12,6 +14,7 @@ import {
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { AkitaNgDevtools } from '@datorama/akita-ngdevtools';
import { FingerprintAIO } from '@ionic-native/fingerprint-aio/ngx';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { EMPTY } from 'rxjs';
import { catchError, take, tap } from 'rxjs/operators';
Expand All @@ -23,8 +26,6 @@ import { AuthInterceptor } from './interceptor';
import { User } from './models';
import { UserStore } from './store/user';
import { API_ROOT_URL } from './tokens';
import localeNL from '@angular/common/locales/nl';
import { registerLocaleData } from '@angular/common';

registerLocaleData(localeNL, 'nl');

Expand Down Expand Up @@ -71,6 +72,7 @@ function getUser(http: HttpClient, userStore: UserStore) {
provide: LOCALE_ID,
useValue: 'nl',
},
FingerprintAIO,
{ provide: DEFAULT_CURRENCY_CODE, useValue: 'EUR' },
],
bootstrap: [AppComponent],
Expand Down
8 changes: 8 additions & 0 deletions src/app/modules/tab2/tab2.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,12 @@
<ion-label slot="start">5</ion-label>
<ion-label slot="end">2000</ion-label>
</ion-range>

<ion-button (click)="check()">
Check
</ion-button>

<ion-button (click)="show()">
Show
</ion-button>
</ion-content>
32 changes: 31 additions & 1 deletion src/app/modules/tab2/tab2.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { IonRouterOutlet, ModalController } from '@ionic/angular';
import { ModalWithNavigationPage } from 'src/app/components/modal-with-navigation/modal-with-navigation.component';
import { ModalContentPage } from 'src/app/pages/modal-content/modal-content.page';
import { Haptics } from '@capacitor/haptics';
import { FingerprintAIO } from '@ionic-native/fingerprint-aio/ngx';

@Component({
selector: 'app-tab2',
Expand All @@ -13,7 +14,7 @@ export class Tab2Page {
duration = 50;
constructor(
private modalController: ModalController,
private routerOutlet: IonRouterOutlet
public faio: FingerprintAIO
) {}

async openModal() {
Expand All @@ -33,4 +34,33 @@ export class Tab2Page {
vibrateHard() {
Haptics.vibrate({ duration: 1000 });
}

check() {
console.log('check');
this.faio
.isAvailable()
.then((result) => {
console.log(result);
})
.catch((err) => {
console.log(err);
});
}

show() {
console.log('show');
this.faio
.show({
disableBackup: true, // Only for Android(optional)
fallbackButtonTitle: 'Use Pin', // Only for iOS
cancelButtonTitle: 'Cancel', // Only for iOS
title: 'FaceId Test',
})
.then((result) => {
console.log(result);
})
.catch((err) => {
console.log(err);
});
}
}
3 changes: 1 addition & 2 deletions src/app/modules/tab4/tab4.page.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<ion-content class="ion-padding">
<ion-datetime class="w-full" value="2012-12-15T13:47:20.789"></ion-datetime>
</ion-content>

</ion-content>
1 change: 1 addition & 0 deletions src/app/modules/tab4/tab4.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '@angular/core';
import Chart from 'chart.js/auto';


@Component({
selector: 'app-tab4',
templateUrl: 'tab4.page.html',
Expand Down

0 comments on commit b49e9c3

Please sign in to comment.