Skip to content

Commit

Permalink
feat(plugin): return available type instead of boolean (#10)
Browse files Browse the repository at this point in the history
* returning type instead of boolean

* update readme

* comment

* double quotes
  • Loading branch information
mkw2000 authored and danielsogl committed Nov 14, 2019
1 parent ed23017 commit c611f57
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ FaceId.isAvailable().then(checkResult => {

## API

| Method | Default | Type | Description |
| --------------------------------- | --------------------------------------------------- | ----------------------------- | ------------------------------------------ |
| isAvailable() | | `Promise<{ value: boolean }>` | Checks if Face ID or Touch ID is available |
| auth(options?: {reason?: string}) | options: {reason: "Access requires authentication"} | `Promise<void>` | Displays the Face ID or Touch ID screen |
| Method | Default | Type | Description |
| --------------------------------- | --------------------------------------------------- | ---------------------------- | ------------------------------------------------------------------- |
| isAvailable() | | `Promise<{ value: string }>` | Checks if Face ID or Touch ID is available, and returns type if so. |
| auth(options?: {reason?: string}) | options: {reason: "Access requires authentication"} | `Promise<void>` | Displays the Face ID or Touch ID screen |
8 changes: 4 additions & 4 deletions ios/Plugin/Plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ public class FaceId: CAPPlugin {
switch(authContext.biometryType) {
case .none:
call.success([
"value": false
"value": "None"
])
case .touchID:
call.success([
"value": true
"value": "TouchId"
])
case .faceID:
call.success([
"value": true
"value": "FaceId"
])
}
} else {
call.success([
"value": false
"value": "None"
])
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ declare module '@capacitor/core' {
}

export interface FaceIdPluginIsAvailableResult {
/** true if Face ID or Touch ID is available */
value: boolean;
/** Returns available biometric type or 'None' if unavailable */
value: string;
}

export interface FaceIdPluginAuthOptions {
Expand All @@ -19,7 +19,7 @@ export interface FaceIdPlugin {
/**
* check if Face ID or Touch ID is available
* @returns {Promise}
* @resolve {value: boolean}
* @resolve {value: string}
* @rejects PluginResultError
*/
isAvailable(): Promise<FaceIdPluginIsAvailableResult>;
Expand Down

0 comments on commit c611f57

Please # to comment.