├── .editorconfig
├── .github
└── FUNDING.yml
├── .gitignore
├── .travis.yml
├── CHANGELOG.md
├── LICENSE
├── README.md
├── RELEASING.md
├── app-kotlin
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── kotlin
│ └── pwittchen
│ │ └── github
│ │ └── com
│ │ └── rxbiometric
│ │ └── MainActivity.kt
│ └── res
│ ├── drawable-v24
│ └── ic_launcher_foreground.xml
│ ├── drawable
│ └── ic_launcher_background.xml
│ ├── layout
│ ├── activity_main.xml
│ └── content_main.xml
│ ├── mipmap-anydpi-v26
│ ├── ic_launcher.xml
│ └── ic_launcher_round.xml
│ ├── mipmap-hdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-mdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xxhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ ├── mipmap-xxxhdpi
│ ├── ic_launcher.png
│ └── ic_launcher_round.png
│ └── values
│ ├── colors.xml
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
├── build.gradle
├── config
├── quality.gradle
└── quality
│ ├── checkstyle
│ ├── checkstyle.xml
│ └── suppressions.xml
│ ├── findbugs
│ └── findbugs-filter.xml
│ ├── lint
│ └── lint.xml
│ └── pmd
│ └── pmd-ruleset.xml
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── library
├── .gitignore
├── build.gradle
├── detekt.yml
├── gradle.properties
├── proguard-rules.pro
└── src
│ ├── main
│ ├── AndroidManifest.xml
│ ├── kotlin
│ │ └── com
│ │ │ └── github
│ │ │ └── pwittchen
│ │ │ └── rxbiometric
│ │ │ └── library
│ │ │ ├── Authentication.kt
│ │ │ ├── RxBiometric.kt
│ │ │ ├── RxBiometricBuilder.kt
│ │ │ ├── throwable
│ │ │ ├── AuthenticationError.kt
│ │ │ ├── AuthenticationFail.kt
│ │ │ ├── AuthenticationHelp.kt
│ │ │ └── BiometricNotSupported.kt
│ │ │ └── validation
│ │ │ ├── Preconditions.kt
│ │ │ └── RxPreconditions.kt
│ └── res
│ │ └── values
│ │ └── strings.xml
│ └── test
│ └── kotlin
│ └── com
│ └── github
│ └── pwittchen
│ └── rxbiometric
│ └── library
│ └── AuthenticationTest.kt
├── logo.png
├── maven_push.gradle
├── oxylabs_logo.png
├── settings.gradle
└── update_javadocs.sh
/.editorconfig:
--------------------------------------------------------------------------------
1 | [*.{kt,kts}]
2 | # possible values: number (e.g. 2), "unset" (makes ktlint ignore indentation completely)
3 | indent_size=2
4 | # possible values: number (e.g. 2), "unset"
5 | continuation_indent_size=2
6 | # true (recommended) / false
7 | insert_final_newline=unset
8 | # possible values: number (e.g. 120) (package name, imports & comments are ignored), "off"
9 | # it's automatically set to 100 on `ktlint --android ...` (per Android Kotlin Style Guide)
10 | max_line_length=off
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: [pwittchen]
2 | custom: ['https://paypal.me/pwittchen']
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Built application files
2 | *.apk
3 | *.ap_
4 |
5 | # Files for the ART/Dalvik VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # Generated files
12 | bin/
13 | gen/
14 | out/
15 |
16 | # Gradle files
17 | .gradle/
18 | .gradletasknamecache
19 | build/
20 |
21 | # Local configuration file (sdk path, etc)
22 | local.properties
23 |
24 | # Proguard folder generated by Eclipse
25 | proguard/
26 |
27 | # Log Files
28 | *.log
29 |
30 | # Android Studio Navigation editor temp files
31 | .navigation/
32 |
33 | # Android Studio captures folder
34 | captures/
35 |
36 | # IntelliJ
37 | *.iml
38 | .idea/workspace.xml
39 | .idea/tasks.xml
40 | .idea/gradle.xml
41 | .idea/assetWizardSettings.xml
42 | .idea/dictionaries
43 | .idea/libraries
44 | .idea/caches
45 | .idea/codeStyles/Project.xml
46 | .idea/
47 |
48 | # Keystore files
49 | # Uncomment the following line if you do not want to check your keystore files in.
50 | #*.jks
51 |
52 | # External native build folder generated in Android Studio 2.2 and later
53 | .externalNativeBuild
54 |
55 | # Google Services (e.g. APIs or Firebase)
56 | google-services.json
57 |
58 | # Freeline
59 | freeline.py
60 | freeline/
61 | freeline_project_description.json
62 |
63 | # fastlane
64 | fastlane/report.xml
65 | fastlane/Preview.html
66 | fastlane/screenshots
67 | fastlane/test_output
68 | fastlane/readme.md
69 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: android
2 |
3 | android:
4 | components:
5 | - tools
6 | - tools
7 | - platform-tools
8 | - build-tools-28
9 | - android-28
10 | - extra-android-support
11 | - extra-android-m2repository
12 | licenses:
13 | - android-sdk-license-5be876d5
14 | - android-sdk-license-c81a61d9
15 | - 'android-sdk-preview-license-.+'
16 | - 'android-sdk-license-.+'
17 | - 'google-gdk-license-.+'
18 |
19 | install:
20 | - true
21 |
22 | before_install:
23 | - yes | sdkmanager "platforms;android-27"
24 |
25 | jdk: oraclejdk8
26 |
27 | script:
28 | - ./gradlew clean build test check
29 |
30 | cache:
31 | directories:
32 | - $HOME/.m2
33 |
34 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | CHANGELOG
2 | =========
3 |
4 | v. 0.1.0
5 | --------
6 | *28 Jan 2019*
7 |
8 | - used `androidx.biometrics` to support devices since Android 6 (Marshmallow) - issue #1, PR #9
9 | - removed `Preconditions#isAtLeastAndroidPie()` method
10 | - removed `Preconditions#canHandleBiometric(context)` method
11 | - removed `RxPreconditions#isAtLeastAndroidPie()` method
12 | - removed `RxPreconditions#canHandleBiometric(context)` method
13 |
14 | v. 0.0.1
15 | --------
16 | *23rd Aug 2018*
17 |
18 | The first release of the library.
19 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | RxBiometric [](https://travis-ci.org/pwittchen/RxBiometric)  [](https://android-arsenal.com/details/1/7245)
4 | ===========
5 | RxJava and RxKotlin bindings for Biometric Prompt (Fingerprint Scanner) on Android (added in Android 9 Pie, API Level 28+)
6 |
7 | *If your app is drawing its own fingerprint auth dialogs, you should switch to using the BiometricPrompt API as soon as possible.*
8 |
9 | It's an official statement from [Google Android Developers Blog](https://android-developers.googleblog.com/2018/08/introducing-android-9-pie.html). RxBiometric helps you to do that via RxJava stream!
10 |
11 | Contents
12 | --------
13 |
14 | - [Usage](#usage)
15 | - [Examples](#examples)
16 | - [Download](#download)
17 | - [Tests](#tests)
18 | - [Code style](#code-style)
19 | - [Static code analysis](#static-code-analysis)
20 | - [JavaDoc](#javadoc)
21 | - [Changelog](#changelog)
22 | - [Releasing](#releasing)
23 | - [Mentions](#mentions)
24 | - [References](#references)
25 | - [License](#license)
26 |
27 | Usage
28 | -----
29 |
30 | Simple library usage in **Kotlin** looks as follows:
31 |
32 | ```kotlin
33 | RxBiometric
34 | .title("title")
35 | .description("description")
36 | .negativeButtonText("cancel")
37 | .negativeButtonListener(DialogInterface.OnClickListener { _, _ ->
38 | showMessage("cancel")
39 | })
40 | .executor(mainExecutor)
41 | .build()
42 | .authenticate(context)
43 | .subscribeOn(Schedulers.io())
44 | .observeOn(AndroidSchedulers.mainThread())
45 | .subscribeBy(
46 | onComplete = { showMessage("authenticated!") },
47 | onError = { showMessage("error") }
48 | )
49 | ```
50 |
51 | Library also have validation method in the `Preconditions` class, which you can use to verify if you're able to use Biometric.
52 |
53 | ```kotlin
54 | Preconditions.hasBiometricSupport(context)
55 | ```
56 |
57 | There's also `RxPreconditions` class, which has the same method wrapped in RxJava `Single` type,
58 | which you can use to create fluent data flow like in the example below
59 |
60 | ```kotlin
61 | RxPreconditions
62 | .hasBiometricSupport(context)
63 | .flatMapCompletable {
64 | if (!it) Completable.error(BiometricNotSupported())
65 | else
66 | RxBiometric
67 | .title("title")
68 | .description("description")
69 | .negativeButtonText("cancel")
70 | .negativeButtonListener(DialogInterface.OnClickListener { _, _ ->
71 | showMessage("cancel")
72 | })
73 | .executor(mainExecutor)
74 | .build()
75 | .authenticate(context)
76 | }
77 | .subscribeOn(Schedulers.io())
78 | .observeOn(AndroidSchedulers.mainThread())
79 | .subscribeBy(
80 | onComplete = { showMessage("authenticated!") },
81 | onError = {
82 | when (it) {
83 | is AuthenticationError -> showMessage("error")
84 | is AuthenticationFail -> showMessage("fail")
85 | is AuthenticationHelp -> showMessage("help")
86 | is BiometricNotSupported -> showMessage("biometric not supported")
87 | else -> showMessage("other error")
88 | }
89 | }
90 | )
91 | ```
92 |
93 | If you want to create your own CryptoObject and use it during authentication, then you can call `authenticate(context, cryptoObject)` method instead of `authenticate(context)`.
94 |
95 | Of course, **don't forget to dispose** `Disposable` appropriately in the Activity Lifecycle.
96 |
97 | Library can be used in the **Java** projects as well. Idea is the same, just syntax will be a bit different.
98 |
99 | Examples
100 | --------
101 |
102 | Complete example of the working application can be found in the `kotlin-app` directory.
103 |
104 | Download
105 | --------
106 |
107 | You can depend on the library through Gradle:
108 |
109 | ```groovy
110 | dependencies {
111 | implementation 'com.github.pwittchen:rxbiometric:0.1.0'
112 | }
113 | ```
114 |
115 | Tests
116 | -----
117 |
118 | Tests are available in `library/src/test/kotlin/` directory and can be executed on JVM without any emulator or Android device from Android Studio or CLI with the following command:
119 |
120 | ```
121 | ./gradlew test
122 | ```
123 |
124 | Code style
125 | ----------
126 |
127 | Code style used in the project is called `SquareAndroid` from Java Code Styles repository by Square available at: https://github.com/square/java-code-styles.
128 |
129 | Static code analysis
130 | --------------------
131 |
132 | Static code analysis runs Checkstyle, PMD, Lint and Detekt. It can be executed with command:
133 |
134 | ```
135 | ./gradlew check
136 | ```
137 |
138 | Reports from analysis are generated in `library/build/reports/` directory.
139 |
140 | JavaDoc
141 | -------
142 |
143 | Documentation can be generated as follows:
144 |
145 | ```
146 | ./gradlew dokka
147 | ```
148 |
149 | Output will be generated in `library/build/javadoc`
150 |
151 | JavaDoc can be viewed on-line at https://pwittchen.github.io/RxBiometric/library/
152 |
153 | Changelog
154 | ---------
155 |
156 | See [CHANGELOG.md](https://github.com/pwittchen/RxBiometric/blob/master/CHANGELOG.md) file.
157 |
158 | Releasing
159 | ---------
160 |
161 | See [RELEASING.md](https://github.com/pwittchen/RxBiometric/blob/master/RELEASING.md) file.
162 |
163 | Mentions
164 | --------
165 | - [Android Weekly - issue #324](https://androidweekly.net/issues/issue-324)
166 | - [Android Weekly China - issue #194](https://androidweekly.cn/android-dev-weekly-issue-194/)
167 | - [30 summertime libraries which you don't want to miss in 2018](https://medium.com/@mmbialas/30-summertime-android-libraries-and-tools-which-you-dont-want-to-miss-in-2018-fab053d69503)
168 |
169 | References
170 | ----------
171 | - https://android-developers.googleblog.com/2018/08/introducing-android-9-pie.html
172 | - https://android-developers.googleblog.com/2018/06/better-biometrics-in-android-p.html
173 | - https://developer.android.com/reference/android/hardware/biometrics/BiometricPrompt
174 | - https://github.com/Kieun/android-biometricprompt
175 | - https://android-developers.googleblog.com/2019/10/one-biometric-api-over-all-android.html
176 |
177 | License
178 | -------
179 |
180 | Copyright 2018 Piotr Wittchen
181 |
182 | Licensed under the Apache License, Version 2.0 (the "License");
183 | you may not use this file except in compliance with the License.
184 | You may obtain a copy of the License at
185 |
186 | http://www.apache.org/licenses/LICENSE-2.0
187 |
188 | Unless required by applicable law or agreed to in writing, software
189 | distributed under the License is distributed on an "AS IS" BASIS,
190 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
191 | See the License for the specific language governing permissions and
192 | limitations under the License.
193 |
--------------------------------------------------------------------------------
/RELEASING.md:
--------------------------------------------------------------------------------
1 | Releasing Guidelines
2 | ====================
3 |
4 | In order to release new version of the library, we need to perform the following operations:
5 | - create new release issue on GitHub
6 | - prepare release notes and put them to the issue
7 | - checkout to the `master` branch
8 | - bump library version (`VERSION_NAME` and `VERSION_CODE`) in `gradle.properties` file
9 | - commit and push the changes
10 | - run command: `./gradlew uploadArchives`
11 | - go to the https://oss.sonatype.org website
12 | - log in to Sonatype
13 | - go to "Staging Repositories" and sort by last "Updated" date and time
14 | - close and release artifact
15 | - copy `library/build/docs/javadoc` directory
16 | - checkout to `gh-pages` branch
17 | - remove old JavaDoc and paste new, generated JavaDoc there
18 | - commit and push changes
19 | - wait for the Maven Sync (up to 48 hours)
20 | - when sync is done, checkout to the `master` branch
21 | - update `CHANGELOG.md` file with new release version, current date and release notes
22 | - bump library version in "Download" section in `README.md` file
23 | - create new tagged GitHub release with name the same as `VERSION_NAME` from `gradle.properties` and release notes
--------------------------------------------------------------------------------
/app-kotlin/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app-kotlin/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | android {
6 | compileSdkVersion rootProject.ext.compileSdkVersion
7 |
8 | defaultConfig {
9 | applicationId "pwittchen.github.com.rxbiometric"
10 | minSdkVersion rootProject.ext.minSdkVersion
11 | compileSdkVersion rootProject.ext.compileSdkVersion
12 | targetSdkVersion rootProject.ext.targetSdkVersion
13 | versionCode 1
14 | versionName "1.0"
15 | }
16 |
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 |
24 | sourceSets {
25 | androidTest.java.srcDirs += "src/androidTest/kotlin"
26 | main.java.srcDirs += "src/main/kotlin"
27 | test.java.srcDirs += "src/test/kotlin"
28 | }
29 |
30 | compileOptions {
31 | sourceCompatibility JavaVersion.VERSION_1_8
32 | targetCompatibility JavaVersion.VERSION_1_8
33 | }
34 | }
35 |
36 | dependencies {
37 | implementation project(':library')
38 | implementation deps.kotlinstdlib
39 | implementation deps.appcompat
40 | implementation deps.constraintlayout
41 | implementation deps.material
42 | }
43 |
44 | buildscript {
45 | repositories {
46 | mavenCentral()
47 | jcenter()
48 | google()
49 | maven {
50 | url 'https://plugins.gradle.org/m2/'
51 | }
52 | }
53 |
54 | dependencies {
55 | classpath deps.kotlingradleplugin
56 | classpath deps.kotlinx
57 | }
58 | }
--------------------------------------------------------------------------------
/app-kotlin/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 |
--------------------------------------------------------------------------------
/app-kotlin/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
14 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app-kotlin/src/main/kotlin/pwittchen/github/com/rxbiometric/MainActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Piotr Wittchen
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package pwittchen.github.com.rxbiometric
17 |
18 | import android.content.DialogInterface
19 | import android.os.Build
20 | import android.os.Bundle
21 | import android.widget.Toast
22 | import androidx.annotation.RequiresApi
23 | import androidx.appcompat.app.AppCompatActivity
24 | import androidx.core.app.ActivityCompat
25 | import com.github.pwittchen.rxbiometric.library.RxBiometric
26 | import com.github.pwittchen.rxbiometric.library.throwable.AuthenticationError
27 | import com.github.pwittchen.rxbiometric.library.throwable.AuthenticationFail
28 | import com.github.pwittchen.rxbiometric.library.throwable.BiometricNotSupported
29 | import com.github.pwittchen.rxbiometric.library.validation.RxPreconditions
30 | import io.reactivex.Completable
31 | import io.reactivex.android.schedulers.AndroidSchedulers
32 | import io.reactivex.disposables.Disposable
33 | import io.reactivex.rxkotlin.subscribeBy
34 | import kotlinx.android.synthetic.main.activity_main.toolbar
35 | import kotlinx.android.synthetic.main.content_main.button
36 |
37 | class MainActivity : AppCompatActivity() {
38 |
39 | private var disposable: Disposable? = null
40 |
41 | @RequiresApi(Build.VERSION_CODES.P)
42 | override fun onCreate(savedInstanceState: Bundle?) {
43 | super.onCreate(savedInstanceState)
44 | setContentView(R.layout.activity_main)
45 | setSupportActionBar(toolbar)
46 |
47 |
48 | button.setOnClickListener {
49 | disposable =
50 | RxPreconditions
51 | .hasBiometricSupport(this)
52 | .flatMapCompletable {
53 | if (!it) Completable.error(BiometricNotSupported())
54 | else
55 | RxBiometric
56 | .title("title")
57 | .description("description")
58 | .negativeButtonText("cancel")
59 | .negativeButtonListener(DialogInterface.OnClickListener { _, _ ->
60 | showMessage("cancel")
61 | })
62 | .executor(ActivityCompat.getMainExecutor(this@MainActivity))
63 | .build()
64 | .authenticate(this)
65 | }
66 | .observeOn(AndroidSchedulers.mainThread())
67 | .subscribeBy(
68 | onComplete = { showMessage("authenticated!") },
69 | onError = {
70 | when (it) {
71 | is AuthenticationError -> showMessage("error: ${it.errorCode} ${it.errorMessage}")
72 | is AuthenticationFail -> showMessage("fail")
73 | else -> {
74 | showMessage("other error")
75 | }
76 | }
77 | }
78 | )
79 | }
80 | }
81 |
82 | override fun onPause() {
83 | super.onPause()
84 | disposable?.let {
85 | if (!it.isDisposed) {
86 | it.dispose()
87 | }
88 | }
89 | }
90 |
91 | private fun showMessage(message: String) {
92 | Toast
93 | .makeText(
94 | this@MainActivity,
95 | message,
96 | Toast.LENGTH_SHORT
97 | )
98 | .show()
99 | }
100 | }
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
11 |
16 |
21 |
26 |
31 |
36 |
41 |
46 |
51 |
56 |
61 |
66 |
71 |
76 |
81 |
86 |
91 |
96 |
101 |
106 |
111 |
116 |
121 |
126 |
131 |
136 |
141 |
146 |
151 |
156 |
161 |
166 |
171 |
172 |
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
22 |
23 |
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pwittchen/RxBiometric/37626caae7992e63d96a73a63b3d9f54e45c7fc4/app-kotlin/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pwittchen/RxBiometric/37626caae7992e63d96a73a63b3d9f54e45c7fc4/app-kotlin/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pwittchen/RxBiometric/37626caae7992e63d96a73a63b3d9f54e45c7fc4/app-kotlin/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pwittchen/RxBiometric/37626caae7992e63d96a73a63b3d9f54e45c7fc4/app-kotlin/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pwittchen/RxBiometric/37626caae7992e63d96a73a63b3d9f54e45c7fc4/app-kotlin/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pwittchen/RxBiometric/37626caae7992e63d96a73a63b3d9f54e45c7fc4/app-kotlin/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pwittchen/RxBiometric/37626caae7992e63d96a73a63b3d9f54e45c7fc4/app-kotlin/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pwittchen/RxBiometric/37626caae7992e63d96a73a63b3d9f54e45c7fc4/app-kotlin/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pwittchen/RxBiometric/37626caae7992e63d96a73a63b3d9f54e45c7fc4/app-kotlin/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pwittchen/RxBiometric/37626caae7992e63d96a73a63b3d9f54e45c7fc4/app-kotlin/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 | 16dp
3 |
4 |
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RxBiometric
3 | MainActivity
4 | authenticate
5 |
6 |
--------------------------------------------------------------------------------
/app-kotlin/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | apply plugin: 'io.codearte.nexus-staging'
3 |
4 | ext {
5 | minSdkVersion = 14
6 | compileSdkVersion = 30
7 | targetSdkVersion = 30
8 | buildToolsVersion = '28.0.2'
9 | gradleVersion = '4.4.1'
10 | kotlinVersion = '1.4.0'
11 | detektVersion = '1.0.0.RC8'
12 | }
13 |
14 | ext.deps = [
15 | rxjava2 : 'io.reactivex.rxjava2:rxjava:2.2.19',
16 | rxandroid2 : 'io.reactivex.rxjava2:rxandroid:2.1.1',
17 | rxkotlin2 : 'io.reactivex.rxjava2:rxkotlin:2.3.0',
18 | annotations : 'androidx.annotation:annotation:1.1.0',
19 | appcompat : 'androidx.appcompat:appcompat:1.2.0',
20 | material : 'com.google.android.material:material:1.3.0-alpha02',
21 | design : 'com.android.support:design:28.0.0',
22 | constraintlayout : 'androidx.constraintlayout:constraintlayout:2.0.0-rc1',
23 | junit : 'junit:junit:4.13',
24 | truth : 'com.google.truth:truth:1.0.1',
25 | robolectric : 'org.robolectric:robolectric:4.3.1',
26 | mockitocore : 'org.mockito:mockito-core:3.5.2',
27 | dokka : 'org.jetbrains.dokka:dokka-gradle-plugin:0.10.1',
28 | detekt : "gradle.plugin.io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektVersion",
29 | kotlinx : "org.jetbrains.kotlin:kotlin-android-extensions:$kotlinVersion",
30 | kotlinstdlib : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion",
31 | kotlingradleplugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion",
32 | biometrics : "androidx.biometric:biometric:1.1.0"]
33 |
34 | buildscript {
35 | repositories {
36 | google()
37 | jcenter()
38 | mavenCentral()
39 | maven {
40 | url 'https://plugins.gradle.org/m2/'
41 | }
42 | }
43 |
44 | dependencies {
45 | classpath 'com.android.tools.build:gradle:4.0.1'
46 | classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.22.0"
47 | // NOTE: Do not place your application dependencies here; they belong
48 | // in the individual module build.gradle files
49 | }
50 | }
51 |
52 | allprojects {
53 | repositories {
54 | google()
55 | jcenter()
56 | mavenCentral()
57 | maven {
58 | url 'https://plugins.gradle.org/m2/'
59 | }
60 | }
61 | }
62 |
63 | def getRepositoryUsername() {
64 | return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
65 | }
66 |
67 | def getRepositoryPassword() {
68 | return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
69 | }
70 |
71 | nexusStaging {
72 | packageGroup = GROUP //optional if packageGroup == project.getGroup()
73 | stagingProfileId = "9add401d06ecc9" //when not defined will be got from server using "packageGroup"
74 | username = getRepositoryUsername()
75 | password = getRepositoryPassword()
76 | }
77 |
78 | task clean(type: Delete) {
79 | delete rootProject.buildDir
80 | }
--------------------------------------------------------------------------------
/config/quality.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'checkstyle'
2 | apply plugin: 'pmd'
3 |
4 | // Add dependencies to the 'check' gradle task.
5 | check.dependsOn 'checkstyle', 'pmd', 'lint', 'detektCheck'
6 |
7 | checkstyle {
8 | toolVersion = "6.0"
9 | }
10 |
11 | task checkstyle(type: Checkstyle) {
12 | configFile file("${project.rootDir}/config/quality/checkstyle/checkstyle.xml")
13 | configProperties.checkstyleSuppressionsPath = file("${project.rootDir}/config/quality/checkstyle/suppressions.xml").absolutePath
14 | source 'src'
15 | include '**/*.java'
16 | include '**/*.kt'
17 | exclude '**/gen/**'
18 | classpath = files()
19 | }
20 |
21 | task pmd(type: Pmd) {
22 | ignoreFailures = false
23 | ruleSetFiles = files("${project.rootDir}/config/quality/pmd/pmd-ruleset.xml")
24 | ruleSets = []
25 |
26 | source 'src'
27 | include '**/*.java'
28 | include '**/*.kt'
29 | exclude '**/gen/**'
30 |
31 | reports {
32 | xml.enabled = false
33 | html.enabled = true
34 | xml {
35 | destination file("$project.buildDir/reports/pmd/pmd.xml")
36 | }
37 | html {
38 | destination file("$project.buildDir/reports/pmd/pmd.html")
39 | }
40 | }
41 | }
42 |
43 | android {
44 | lintOptions {
45 | abortOnError false
46 | xmlReport false
47 | htmlReport true
48 | lintConfig file("${project.rootDir}/config/quality/lint/lint.xml")
49 | htmlOutput file("$project.buildDir/reports/lint/lint-result.html")
50 | xmlOutput file("$project.buildDir/reports/lint/lint-result.xml")
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/config/quality/checkstyle/checkstyle.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
--------------------------------------------------------------------------------
/config/quality/checkstyle/suppressions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/config/quality/findbugs/findbugs-filter.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/config/quality/lint/lint.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/config/quality/pmd/pmd-ruleset.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 | Custom ruleset for Android application
8 |
9 | .*/R.java
10 | .*/gen/.*
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | VERSION_NAME=0.1.0
2 | VERSION_CODE=2
3 | GROUP=com.github.pwittchen
4 |
5 | POM_DESCRIPTION=RxJava and RxKotlin bindings for Biometric Prompt on Android
6 | POM_URL=https://github.com/pwittchen/RxBiometric
7 | POM_SCM_URL=https://github.com/pwittchen/RxBiometric
8 | POM_SCM_CONNECTION=scm:git@github.com:pwittchen/RxBiometric.git
9 | POM_SCM_DEV_CONNECTION=scm:git@github.com:pwittchen/RxBiometric.git
10 | POM_LICENCE_NAME=The Apache Software License, Version 2.0
11 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
12 | POM_LICENCE_DIST=repo
13 | POM_DEVELOPER_ID=pwittchen
14 | POM_DEVELOPER_NAME=Piotr Wittchen
15 |
16 | org.gradle.daemon=true
17 | org.gradle.jvmargs=-XX:MaxPermSize=1024m -XX:+CMSClassUnloadingEnabled -XX:+HeapDumpOnOutOfMemoryError -Xmx4048m -XX:MaxHeapSize=4048
18 |
19 | android.useAndroidX=true
20 | android.enableJetifier=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pwittchen/RxBiometric/37626caae7992e63d96a73a63b3d9f54e45c7fc4/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or 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 UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 | # Determine the Java command to use to start the JVM.
86 | if [ -n "$JAVA_HOME" ] ; then
87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
88 | # IBM's JDK on AIX uses strange locations for the executables
89 | JAVACMD="$JAVA_HOME/jre/sh/java"
90 | else
91 | JAVACMD="$JAVA_HOME/bin/java"
92 | fi
93 | if [ ! -x "$JAVACMD" ] ; then
94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
95 |
96 | Please set the JAVA_HOME variable in your environment to match the
97 | location of your Java installation."
98 | fi
99 | else
100 | JAVACMD="java"
101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
102 |
103 | Please set the JAVA_HOME variable in your environment to match the
104 | location of your Java installation."
105 | fi
106 |
107 | # Increase the maximum file descriptors if we can.
108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
109 | MAX_FD_LIMIT=`ulimit -H -n`
110 | if [ $? -eq 0 ] ; then
111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
112 | MAX_FD="$MAX_FD_LIMIT"
113 | fi
114 | ulimit -n $MAX_FD
115 | if [ $? -ne 0 ] ; then
116 | warn "Could not set maximum file descriptor limit: $MAX_FD"
117 | fi
118 | else
119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
120 | fi
121 | fi
122 |
123 | # For Darwin, add options to specify how the application appears in the dock
124 | if $darwin; then
125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
126 | fi
127 |
128 | # For Cygwin or MSYS, switch paths to Windows format before running java
129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
132 | JAVACMD=`cygpath --unix "$JAVACMD"`
133 |
134 | # We build the pattern for arguments to be converted via cygpath
135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
136 | SEP=""
137 | for dir in $ROOTDIRSRAW ; do
138 | ROOTDIRS="$ROOTDIRS$SEP$dir"
139 | SEP="|"
140 | done
141 | OURCYGPATTERN="(^($ROOTDIRS))"
142 | # Add a user-defined pattern to the cygpath arguments
143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
145 | fi
146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
147 | i=0
148 | for arg in "$@" ; do
149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
151 |
152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
154 | else
155 | eval `echo args$i`="\"$arg\""
156 | fi
157 | i=`expr $i + 1`
158 | done
159 | case $i in
160 | 0) set -- ;;
161 | 1) set -- "$args0" ;;
162 | 2) set -- "$args0" "$args1" ;;
163 | 3) set -- "$args0" "$args1" "$args2" ;;
164 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170 | esac
171 | fi
172 |
173 | # Escape application args
174 | save () {
175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
176 | echo " "
177 | }
178 | APP_ARGS=`save "$@"`
179 |
180 | # Collect all arguments for the java command, following the shell quoting and substitution rules
181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
182 |
183 | exec "$JAVACMD" "$@"
184 |
--------------------------------------------------------------------------------
/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 init
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 init
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 | :init
68 | @rem Get command-line arguments, handling Windows variants
69 |
70 | if not "%OS%" == "Windows_NT" goto win9xME_args
71 |
72 | :win9xME_args
73 | @rem Slurp the command line arguments.
74 | set CMD_LINE_ARGS=
75 | set _SKIP=2
76 |
77 | :win9xME_args_slurp
78 | if "x%~1" == "x" goto execute
79 |
80 | set CMD_LINE_ARGS=%*
81 |
82 | :execute
83 | @rem Setup the command line
84 |
85 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
86 |
87 | @rem Execute Gradle
88 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
89 |
90 | :end
91 | @rem End local scope for the variables with windows NT shell
92 | if "%ERRORLEVEL%"=="0" goto mainEnd
93 |
94 | :fail
95 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
96 | rem the _cmd.exe /c_ return code!
97 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
98 | exit /b 1
99 |
100 | :mainEnd
101 | if "%OS%"=="Windows_NT" endlocal
102 |
103 | :omega
104 |
--------------------------------------------------------------------------------
/library/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'jacoco'
4 | apply plugin: 'kotlin-android'
5 | apply plugin: 'kotlin-android-extensions'
6 | apply plugin: 'io.gitlab.arturbosch.detekt'
7 | apply plugin: 'org.jetbrains.dokka'
8 | apply from: '../config/quality.gradle'
9 | apply from: '../maven_push.gradle'
10 |
11 | android {
12 | compileSdkVersion rootProject.ext.compileSdkVersion
13 |
14 | defaultConfig {
15 | minSdkVersion rootProject.ext.minSdkVersion
16 | targetSdkVersion rootProject.ext.compileSdkVersion
17 | versionCode 1
18 | versionName "1.0"
19 | }
20 |
21 | buildTypes {
22 | release {
23 | minifyEnabled false
24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
25 | }
26 |
27 | debug {
28 | minifyEnabled false
29 | testCoverageEnabled true
30 | }
31 | }
32 |
33 | sourceSets {
34 | androidTest.java.srcDirs += "src/androidTest/kotlin"
35 | main.java.srcDirs += "src/main/kotlin"
36 | test.java.srcDirs += "src/test/kotlin"
37 | }
38 |
39 | packagingOptions {
40 | exclude 'LICENSE.txt'
41 | exclude 'META-INF/LICENSE.txt'
42 | }
43 |
44 | testOptions {
45 | unitTests.all {
46 | jacoco {
47 | includeNoLocationClasses = true
48 | }
49 | }
50 | }
51 |
52 | lintOptions {
53 | abortOnError false
54 | }
55 |
56 | compileOptions {
57 | sourceCompatibility JavaVersion.VERSION_1_8
58 | targetCompatibility JavaVersion.VERSION_1_8
59 | }
60 | }
61 |
62 | detekt {
63 | version = rootProject.ext.detektVersion
64 | profile("main") {
65 | input = "$projectDir"
66 | config = "$projectDir/detekt.yml"
67 | filters = ".*test.*,.*/resources/.*,.*/tmp/.*"
68 | }
69 | }
70 |
71 | dokka {
72 | outputFormat = 'html'
73 | outputDirectory = "$buildDir/javadoc"
74 | }
75 |
76 | dependencies {
77 | api deps.rxjava2
78 | api deps.rxandroid2
79 | api deps.rxkotlin2
80 | implementation deps.annotations
81 | implementation deps.biometrics
82 | implementation deps.kotlinstdlib
83 | testImplementation deps.junit
84 | testImplementation deps.truth
85 | testImplementation deps.robolectric
86 | testImplementation deps.mockitocore
87 | }
88 |
89 | buildscript {
90 | repositories {
91 | mavenCentral()
92 | jcenter()
93 | google()
94 | maven {
95 | url 'https://plugins.gradle.org/m2/'
96 | }
97 | }
98 |
99 | dependencies {
100 | classpath deps.kotlingradleplugin
101 | classpath deps.detekt
102 | classpath deps.dokka
103 | }
104 | }
105 |
106 | repositories {
107 | mavenCentral()
108 | jcenter()
109 | google()
110 | maven {
111 | url 'https://plugins.gradle.org/m2/'
112 | }
113 | }
--------------------------------------------------------------------------------
/library/detekt.yml:
--------------------------------------------------------------------------------
1 | autoCorrect: true
2 | failFast: false
3 |
4 | test-pattern: # Configure exclusions for test sources
5 | active: true
6 | patterns: # Test file regexes
7 | - '.*/test/.*'
8 | - '.*Test.kt'
9 | - '.*Spec.kt'
10 | exclude-rule-sets:
11 | - 'comments'
12 | exclude-rules:
13 | - 'NamingRules'
14 | - 'WildcardImport'
15 | - 'MagicNumber'
16 | - 'MaxLineLength'
17 | - 'LateinitUsage'
18 | - 'StringLiteralDuplication'
19 | - 'SpreadOperator'
20 | - 'TooManyFunctions'
21 |
22 | build:
23 | warningThreshold: 5
24 | failThreshold: 10
25 | weights:
26 | complexity: 2
27 | formatting: 1
28 | LongParameterList: 1
29 | comments: 1
30 |
31 | processors:
32 | active: true
33 | exclude:
34 | # - 'FunctionCountProcessor'
35 | # - 'PropertyCountProcessor'
36 | # - 'ClassCountProcessor'
37 | # - 'PackageCountProcessor'
38 | # - 'KtFileCountProcessor'
39 |
40 | console-reports:
41 | active: true
42 | exclude:
43 | # - 'ProjectStatisticsReport'
44 | # - 'ComplexityReport'
45 | # - 'NotificationReport'
46 | # - 'FindingsReport'
47 | # - 'BuildFailureReport'
48 |
49 | output-reports:
50 | active: true
51 | exclude:
52 | # - 'PlainOutputReport'
53 | # - 'XmlOutputReport'
54 |
55 | comments:
56 | active: true
57 | CommentOverPrivateFunction:
58 | active: false
59 | CommentOverPrivateProperty:
60 | active: false
61 | UndocumentedPublicClass:
62 | active: false
63 | searchInNestedClass: true
64 | searchInInnerClass: true
65 | searchInInnerObject: true
66 | searchInInnerInterface: true
67 | UndocumentedPublicFunction:
68 | active: false
69 |
70 | complexity:
71 | active: true
72 | LongParameterList:
73 | active: true
74 | threshold: 5
75 | LongMethod:
76 | active: true
77 | threshold: 20
78 | LargeClass:
79 | active: true
80 | threshold: 150
81 | ComplexInterface:
82 | active: false
83 | threshold: 10
84 | includeStaticDeclarations: false
85 | ComplexMethod:
86 | active: true
87 | threshold: 10
88 | StringLiteralDuplication:
89 | active: false
90 | threshold: 2
91 | ignoreAnnotation: true
92 | excludeStringsWithLessThan5Characters: true
93 | ignoreStringsRegex: '$^'
94 | MethodOverloading:
95 | active: false
96 | threshold: 5
97 | NestedBlockDepth:
98 | active: true
99 | threshold: 3
100 | TooManyFunctions:
101 | active: true
102 | thresholdInFiles: 10
103 | thresholdInClasses: 10
104 | thresholdInInterfaces: 10
105 | thresholdInObjects: 10
106 | thresholdInEnums: 10
107 | ComplexCondition:
108 | active: true
109 | threshold: 3
110 | LabeledExpression:
111 | active: false
112 |
113 | empty-blocks:
114 | active: true
115 | EmptyCatchBlock:
116 | active: true
117 | EmptyClassBlock:
118 | active: true
119 | EmptyDefaultConstructor:
120 | active: true
121 | EmptyDoWhileBlock:
122 | active: true
123 | EmptyElseBlock:
124 | active: true
125 | EmptyFinallyBlock:
126 | active: true
127 | EmptyForBlock:
128 | active: true
129 | EmptyFunctionBlock:
130 | active: true
131 | EmptyIfBlock:
132 | active: true
133 | EmptyInitBlock:
134 | active: true
135 | EmptyKtFile:
136 | active: true
137 | EmptySecondaryConstructor:
138 | active: true
139 | EmptyWhenBlock:
140 | active: true
141 | EmptyWhileBlock:
142 | active: true
143 |
144 | exceptions:
145 | active: true
146 | TooGenericExceptionCaught:
147 | active: true
148 | exceptions:
149 | - ArrayIndexOutOfBoundsException
150 | - Error
151 | - Exception
152 | - IllegalMonitorStateException
153 | - NullPointerException
154 | - IndexOutOfBoundsException
155 | - RuntimeException
156 | - Throwable
157 | ExceptionRaisedInUnexpectedLocation:
158 | active: false
159 | methodNames: 'toString,hashCode,equals,finalize'
160 | TooGenericExceptionThrown:
161 | active: true
162 | exceptions:
163 | - Error
164 | - Exception
165 | - NullPointerException
166 | - Throwable
167 | - RuntimeException
168 | NotImplementedDeclaration:
169 | active: false
170 | PrintStackTrace:
171 | active: false
172 | InstanceOfCheckForException:
173 | active: false
174 | ThrowingExceptionsWithoutMessageOrCause:
175 | active: false
176 | exceptions: 'IllegalArgumentException,IllegalStateException,IOException'
177 | ReturnFromFinally:
178 | active: false
179 | ThrowingExceptionFromFinally:
180 | active: false
181 | ThrowingExceptionInMain:
182 | active: false
183 | RethrowCaughtException:
184 | active: false
185 | ThrowingNewInstanceOfSameException:
186 | active: false
187 | SwallowedException:
188 | active: false
189 |
190 | performance:
191 | active: true
192 | ForEachOnRange:
193 | active: true
194 | SpreadOperator:
195 | active: true
196 | UnnecessaryTemporaryInstantiation:
197 | active: true
198 |
199 | potential-bugs:
200 | active: true
201 | DuplicateCaseInWhenExpression:
202 | active: true
203 | EqualsAlwaysReturnsTrueOrFalse:
204 | active: false
205 | EqualsWithHashCodeExist:
206 | active: true
207 | IteratorNotThrowingNoSuchElementException:
208 | active: false
209 | IteratorHasNextCallsNextMethod:
210 | active: false
211 | UselessPostfixExpression:
212 | active: false
213 | InvalidLoopCondition:
214 | active: false
215 | WrongEqualsTypeParameter:
216 | active: false
217 | ExplicitGarbageCollectionCall:
218 | active: true
219 | LateinitUsage:
220 | active: false
221 | excludeAnnotatedProperties: ""
222 | ignoreOnClassesPattern: ""
223 | UnconditionalJumpStatementInLoop:
224 | active: false
225 | UnreachableCode:
226 | active: true
227 | UnsafeCallOnNullableType:
228 | active: false
229 | UnsafeCast:
230 | active: false
231 |
232 | style:
233 | active: true
234 | CollapsibleIfStatements:
235 | active: false
236 | ReturnCount:
237 | active: true
238 | max: 2
239 | excludedFunctions: "equals"
240 | ThrowsCount:
241 | active: true
242 | max: 2
243 | NewLineAtEndOfFile:
244 | active: false
245 | WildcardImport:
246 | active: true
247 | excludeImports: 'java.util.*,kotlinx.android.synthetic.*'
248 | MaxLineLength:
249 | active: true
250 | maxLineLength: 120
251 | excludePackageStatements: false
252 | excludeImportStatements: false
253 | EqualsNullCall:
254 | active: false
255 | ForbiddenComment:
256 | active: true
257 | values: 'TODO:,FIXME:,STOPSHIP:'
258 | ForbiddenImport:
259 | active: false
260 | imports: ''
261 | FunctionOnlyReturningConstant:
262 | active: false
263 | ignoreOverridableFunction: true
264 | excludedFunctions: 'describeContents'
265 | SpacingBetweenPackageAndImports:
266 | active: false
267 | LoopWithTooManyJumpStatements:
268 | active: false
269 | maxJumpCount: 1
270 | MemberNameEqualsClassName:
271 | active: false
272 | ignoreOverriddenFunction: true
273 | VariableNaming:
274 | active: true
275 | variablePattern: '[a-z][A-Za-z0-9]*'
276 | privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
277 | VariableMinLength:
278 | active: false
279 | minimumVariableNameLength: 1
280 | VariableMaxLength:
281 | active: false
282 | maximumVariableNameLength: 64
283 | TopLevelPropertyNaming:
284 | active: true
285 | constantPattern: '[A-Z][_A-Z0-9]*'
286 | propertyPattern: '[a-z][A-Za-z\d]*'
287 | privatePropertyPattern: '(_)?[a-z][A-Za-z0-9]*'
288 | ObjectPropertyNaming:
289 | active: true
290 | propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
291 | PackageNaming:
292 | active: true
293 | packagePattern: '^[a-z]+(\.[a-z][a-z0-9]*)*$'
294 | ClassNaming:
295 | active: true
296 | classPattern: '[A-Z$][a-zA-Z0-9$]*'
297 | EnumNaming:
298 | active: true
299 | enumEntryPattern: '^[A-Z$][a-zA-Z_$]*$'
300 | FunctionNaming:
301 | active: true
302 | functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$'
303 | FunctionMaxLength:
304 | active: false
305 | maximumFunctionNameLength: 30
306 | FunctionMinLength:
307 | active: false
308 | minimumFunctionNameLength: 3
309 | ForbiddenClassName:
310 | active: false
311 | forbiddenName: ''
312 | SafeCast:
313 | active: true
314 | UnnecessaryAbstractClass:
315 | active: false
316 | UnnecessaryParentheses:
317 | active: false
318 | UnnecessaryInheritance:
319 | active: false
320 | UtilityClassWithPublicConstructor:
321 | active: false
322 | OptionalAbstractKeyword:
323 | active: true
324 | OptionalWhenBraces:
325 | active: false
326 | OptionalReturnKeyword:
327 | active: false
328 | OptionalUnit:
329 | active: false
330 | ProtectedMemberInFinalClass:
331 | active: false
332 | SerialVersionUIDInSerializableClass:
333 | active: false
334 | MagicNumber:
335 | active: true
336 | ignoreNumbers: '-1,0,1,2'
337 | ignoreHashCodeFunction: false
338 | ignorePropertyDeclaration: false
339 | ignoreConstantDeclaration: true
340 | ignoreCompanionObjectPropertyDeclaration: true
341 | ignoreAnnotation: false
342 | ignoreNamedArgument: true
343 | ignoreEnums: false
344 | ModifierOrder:
345 | active: true
346 | DataClassContainsFunctions:
347 | active: false
348 | conversionFunctionPrefix: 'to'
349 | UseDataClass:
350 | active: false
351 | UnusedImports:
352 | active: false
353 | ExpressionBodySyntax:
354 | active: false
355 | NestedClassesVisibility:
356 | active: false
357 | RedundantVisibilityModifierRule:
358 | active: false
359 |
--------------------------------------------------------------------------------
/library/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_NAME=rxbiometric
2 | POM_ARTIFACT_ID=rxbiometric
3 | POM_PACKAGING=aar
--------------------------------------------------------------------------------
/library/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 |
--------------------------------------------------------------------------------
/library/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/library/src/main/kotlin/com/github/pwittchen/rxbiometric/library/Authentication.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Piotr Wittchen
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.github.pwittchen.rxbiometric.library
17 |
18 | import androidx.biometric.BiometricPrompt.AuthenticationCallback
19 | import androidx.biometric.BiometricPrompt.AuthenticationResult
20 | import com.github.pwittchen.rxbiometric.library.throwable.AuthenticationError
21 | import com.github.pwittchen.rxbiometric.library.throwable.AuthenticationFail
22 | import io.reactivex.CompletableEmitter
23 |
24 | open class Authentication {
25 | fun createAuthenticationCallback(it: CompletableEmitter): AuthenticationCallback {
26 | return object : AuthenticationCallback() {
27 | override fun onAuthenticationSucceeded(result: AuthenticationResult) {
28 | it.onComplete()
29 | }
30 |
31 | override fun onAuthenticationFailed() {
32 | it.tryOnError(AuthenticationFail())
33 | }
34 |
35 | override fun onAuthenticationError(
36 | errorCode: Int,
37 | errorMessage: CharSequence
38 | ) {
39 | it.tryOnError(AuthenticationError(errorCode, errorMessage))
40 | }
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/library/src/main/kotlin/com/github/pwittchen/rxbiometric/library/RxBiometric.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Piotr Wittchen
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.github.pwittchen.rxbiometric.library
17 |
18 | import android.content.DialogInterface
19 | import android.os.Build
20 | import androidx.annotation.IntDef
21 | import androidx.biometric.BiometricManager.Authenticators
22 | import androidx.biometric.BiometricPrompt
23 | import androidx.biometric.BiometricPrompt.AuthenticationCallback
24 | import androidx.biometric.BiometricPrompt.CryptoObject
25 | import androidx.fragment.app.FragmentActivity
26 | import io.reactivex.Completable
27 | import io.reactivex.CompletableEmitter
28 | import java.util.concurrent.Executor
29 |
30 | @IntDef(flag = true, value = [Authenticators.BIOMETRIC_STRONG, Authenticators.BIOMETRIC_WEAK, Authenticators.DEVICE_CREDENTIAL])
31 | internal annotation class AuthenticatorTypes
32 |
33 | class RxBiometric {
34 | companion object {
35 | private lateinit var title: String
36 | private lateinit var description: String
37 | private var negativeButtonText: String? = null
38 | private var deviceCredentialAllowed: Boolean? = null
39 | private var negativeButtonListener: DialogInterface.OnClickListener? = null
40 | private var confirmationRequired: Boolean = false
41 | private var allowedAuthenticators: Int? = null
42 | private lateinit var executor: Executor
43 | private lateinit var promptInfo: BiometricPrompt.PromptInfo
44 |
45 | @JvmStatic
46 | fun create(
47 | builder: RxBiometricBuilder
48 | ): Companion {
49 | this.title = builder.title
50 | this.description = builder.description
51 | this.negativeButtonText = builder.negativeButtonText
52 | this.negativeButtonListener = builder.negativeButtonListener
53 | this.deviceCredentialAllowed = builder.deviceCredentialAllowed
54 | this.allowedAuthenticators = builder.allowedAuthenticators
55 | this.confirmationRequired = builder.confirmationRequired
56 | this.executor = builder.executor
57 | val promptBuilder = BiometricPrompt.PromptInfo.Builder()
58 | .setConfirmationRequired(confirmationRequired)
59 | .setTitle(title)
60 | .setDescription(description)
61 |
62 | deviceCredentialAllowed?.let {
63 | promptBuilder.setDeviceCredentialAllowed(it)
64 | }
65 |
66 | allowedAuthenticators?.let {
67 | promptBuilder.setAllowedAuthenticators(it)
68 | }
69 |
70 | negativeButtonText?.let {
71 | promptBuilder.setNegativeButtonText(it)
72 | }
73 | this.promptInfo = promptBuilder.build()
74 | return this
75 | }
76 |
77 | @JvmStatic
78 | fun builder(): RxBiometricBuilder {
79 | return RxBiometricBuilder()
80 | }
81 |
82 | @JvmStatic
83 | fun title(title: String): RxBiometricBuilder {
84 | return builder().title(title)
85 | }
86 |
87 | @JvmStatic
88 | fun deviceCredentialAllowed(enable: Boolean): RxBiometricBuilder {
89 | if (Build.VERSION.SDK_INT < 30) return builder().deviceCredentialAllowed(enable)
90 | return builder()
91 | }
92 |
93 | @JvmStatic
94 | fun confirmationRequired(enable: Boolean): RxBiometricBuilder {
95 | return builder().confirmationRequired(enable)
96 | }
97 |
98 | @JvmStatic
99 | fun allowedAuthenticators(@AuthenticatorTypes value: Int): RxBiometricBuilder {
100 | if (Build.VERSION.SDK_INT >= 29) return builder().allowedAuthenticators(value)
101 | return builder()
102 | }
103 |
104 | @JvmStatic
105 | fun description(description: String): RxBiometricBuilder {
106 | return builder().description(description)
107 | }
108 |
109 | @JvmStatic
110 | fun negativeButtonText(text: String): RxBiometricBuilder {
111 | return builder().negativeButtonText(text)
112 | }
113 |
114 | @JvmStatic
115 | fun negativeButtonListener(listener: DialogInterface.OnClickListener): RxBiometricBuilder {
116 | return builder().negativeButtonListener(listener)
117 | }
118 |
119 | @JvmStatic
120 | fun executor(executor: Executor): RxBiometricBuilder {
121 | return builder().executor(executor)
122 | }
123 |
124 | @JvmStatic
125 | fun authenticate(activity: FragmentActivity): Completable {
126 | return Completable.create { emitter ->
127 | createPrompt(activity, emitter).authenticate(promptInfo)
128 | }
129 | }
130 |
131 | @JvmStatic
132 | fun authenticate(
133 | activity: FragmentActivity,
134 | cryptoObject: CryptoObject
135 | ): Completable {
136 | return Completable.create { emitter ->
137 | createPrompt(activity, emitter).authenticate(
138 | promptInfo,
139 | cryptoObject
140 | )
141 | }
142 | }
143 |
144 | fun createPrompt(activity: FragmentActivity, emitter: CompletableEmitter): BiometricPrompt {
145 | return BiometricPrompt(activity, executor, createAuthenticationCallback(emitter))
146 | }
147 |
148 | fun createAuthenticationCallback(emitter: CompletableEmitter): AuthenticationCallback {
149 | return Authentication().createAuthenticationCallback(emitter)
150 | }
151 | }
152 | }
--------------------------------------------------------------------------------
/library/src/main/kotlin/com/github/pwittchen/rxbiometric/library/RxBiometricBuilder.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Piotr Wittchen
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.github.pwittchen.rxbiometric.library
17 |
18 | import android.content.DialogInterface
19 | import android.os.Build
20 | import com.github.pwittchen.rxbiometric.library.RxBiometric.Companion
21 | import java.util.concurrent.Executor
22 |
23 | class RxBiometricBuilder {
24 | internal lateinit var title: String
25 | internal lateinit var description: String
26 | internal var negativeButtonText: String? = null
27 | internal var negativeButtonListener: DialogInterface.OnClickListener? = null
28 | internal lateinit var executor: Executor
29 | internal var deviceCredentialAllowed: Boolean? = null
30 | internal var confirmationRequired: Boolean = false
31 | internal var allowedAuthenticators: Int? = null
32 |
33 | fun deviceCredentialAllowed(enable: Boolean): RxBiometricBuilder {
34 | if (Build.VERSION.SDK_INT < 30) this.deviceCredentialAllowed = enable
35 | return this
36 | }
37 |
38 | fun confirmationRequired(enable: Boolean): RxBiometricBuilder {
39 | this.confirmationRequired = enable
40 | return this
41 | }
42 |
43 | fun allowedAuthenticators(@AuthenticatorTypes value: Int): RxBiometricBuilder {
44 | if (Build.VERSION.SDK_INT >= 29) this.allowedAuthenticators = value
45 | return this
46 | }
47 |
48 | fun title(title: String): RxBiometricBuilder {
49 | this.title = title
50 | return this
51 | }
52 |
53 | fun description(description: String): RxBiometricBuilder {
54 | this.description = description
55 | return this
56 | }
57 |
58 | fun negativeButtonText(negativeButtonText: String): RxBiometricBuilder {
59 | this.negativeButtonText = negativeButtonText
60 | return this
61 | }
62 |
63 | fun negativeButtonListener(negativeButtonListener: DialogInterface.OnClickListener): RxBiometricBuilder {
64 | this.negativeButtonListener = negativeButtonListener
65 | return this
66 | }
67 |
68 | fun executor(executor: Executor): RxBiometricBuilder {
69 | this.executor = executor
70 | return this
71 | }
72 |
73 | fun build(): Companion {
74 | return RxBiometric.create(this)
75 | }
76 | }
--------------------------------------------------------------------------------
/library/src/main/kotlin/com/github/pwittchen/rxbiometric/library/throwable/AuthenticationError.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Piotr Wittchen
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.github.pwittchen.rxbiometric.library.throwable
17 |
18 | data class AuthenticationError(
19 | val errorCode: Int,
20 | val errorMessage: CharSequence?
21 | ) : Throwable()
--------------------------------------------------------------------------------
/library/src/main/kotlin/com/github/pwittchen/rxbiometric/library/throwable/AuthenticationFail.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Piotr Wittchen
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.github.pwittchen.rxbiometric.library.throwable
17 |
18 | class AuthenticationFail : Throwable()
--------------------------------------------------------------------------------
/library/src/main/kotlin/com/github/pwittchen/rxbiometric/library/throwable/AuthenticationHelp.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Piotr Wittchen
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.github.pwittchen.rxbiometric.library.throwable
17 |
18 | data class AuthenticationHelp(
19 | val helpCode: Int,
20 | val helpMessage: CharSequence?
21 | ) : Throwable()
--------------------------------------------------------------------------------
/library/src/main/kotlin/com/github/pwittchen/rxbiometric/library/throwable/BiometricNotSupported.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Piotr Wittchen
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.github.pwittchen.rxbiometric.library.throwable
17 |
18 | class BiometricNotSupported : Throwable()
--------------------------------------------------------------------------------
/library/src/main/kotlin/com/github/pwittchen/rxbiometric/library/validation/Preconditions.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Piotr Wittchen
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.github.pwittchen.rxbiometric.library.validation
17 |
18 | import android.content.Context
19 | import android.content.pm.PackageManager
20 | import android.os.Build
21 | import android.os.Build.VERSION_CODES
22 | import androidx.biometric.BiometricManager
23 | import com.github.pwittchen.rxbiometric.library.AuthenticatorTypes
24 |
25 | class Preconditions {
26 | companion object {
27 | @JvmStatic fun hasBiometricSupport(context: Context): Boolean {
28 | if (Build.VERSION.SDK_INT >= VERSION_CODES.M) {
29 | return context.packageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)
30 | || context.packageManager.hasSystemFeature(PackageManager.FEATURE_FACE)
31 | || context.packageManager.hasSystemFeature(PackageManager.FEATURE_IRIS)
32 | }
33 | return context.packageManager.hasSystemFeature(PackageManager.FEATURE_FACE)
34 | || context.packageManager.hasSystemFeature(PackageManager.FEATURE_IRIS)
35 | }
36 |
37 | @JvmStatic fun canAuthenticateWith(context: Context, @AuthenticatorTypes authenticators: Int): Boolean {
38 | return BiometricManager.from(context).canAuthenticate(authenticators) == BiometricManager.BIOMETRIC_SUCCESS
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/library/src/main/kotlin/com/github/pwittchen/rxbiometric/library/validation/RxPreconditions.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Piotr Wittchen
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.github.pwittchen.rxbiometric.library.validation
17 |
18 | import android.content.Context
19 | import com.github.pwittchen.rxbiometric.library.AuthenticatorTypes
20 | import io.reactivex.Single
21 |
22 | class RxPreconditions {
23 | companion object {
24 | @JvmStatic fun hasBiometricSupport(context: Context): Single {
25 | return Single.just(Preconditions.hasBiometricSupport(context))
26 | }
27 |
28 | @JvmStatic fun canAuthenticateWith(context: Context, @AuthenticatorTypes authenticators: Int): Single {
29 | return Single.just(Preconditions.canAuthenticateWith(context, authenticators))
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/library/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | library
3 |
4 |
--------------------------------------------------------------------------------
/library/src/test/kotlin/com/github/pwittchen/rxbiometric/library/AuthenticationTest.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 Piotr Wittchen
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.github.pwittchen.rxbiometric.library
17 |
18 | import androidx.biometric.BiometricPrompt.AuthenticationCallback
19 | import androidx.biometric.BiometricPrompt.AuthenticationResult
20 | import com.github.pwittchen.rxbiometric.library.throwable.AuthenticationError
21 | import com.github.pwittchen.rxbiometric.library.throwable.AuthenticationFail
22 | import io.reactivex.CompletableEmitter
23 | import org.junit.Before
24 | import org.junit.Test
25 | import org.mockito.ArgumentMatchers.any
26 | import org.mockito.Mockito.mock
27 | import org.mockito.Mockito.spy
28 | import org.mockito.Mockito.verify
29 |
30 | class AuthenticationTest {
31 | private lateinit var emitter: CompletableEmitter
32 | private lateinit var authentication: Authentication
33 | private lateinit var callback: AuthenticationCallback
34 |
35 | @Before fun setUp() {
36 | emitter = mock(CompletableEmitter::class.java)
37 | authentication = spy(Authentication())
38 | callback = authentication.createAuthenticationCallback(emitter)
39 | }
40 |
41 | @Test fun shouldCompleteOnAuthenticationSucceeded() {
42 | // given
43 | val result: AuthenticationResult = mock(AuthenticationResult::class.java)
44 |
45 | // when
46 | callback.onAuthenticationSucceeded(result)
47 |
48 | // then
49 | verify(emitter).onComplete()
50 | }
51 |
52 | @Test fun shouldTryOnErrorOnAuthenticationFailed() {
53 | // when
54 | callback.onAuthenticationFailed()
55 |
56 | // then
57 | verify(emitter).tryOnError(any(AuthenticationFail::class.java))
58 | }
59 |
60 | @Test fun shouldTryOnErrorOnAuthenticationError() {
61 | // when
62 | callback.onAuthenticationError(1, "error occurred")
63 |
64 | // then
65 | verify(emitter).tryOnError(any(AuthenticationError::class.java))
66 | }
67 | }
--------------------------------------------------------------------------------
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pwittchen/RxBiometric/37626caae7992e63d96a73a63b3d9f54e45c7fc4/logo.png
--------------------------------------------------------------------------------
/maven_push.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Chris Banes
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'maven'
18 | apply plugin: 'signing'
19 |
20 | def isReleaseBuild() {
21 | return VERSION_NAME.contains("SNAPSHOT") == false
22 | }
23 |
24 | def getReleaseRepositoryUrl() {
25 | return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
26 | : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
27 | }
28 |
29 | def getSnapshotRepositoryUrl() {
30 | return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
31 | : "https://oss.sonatype.org/content/repositories/snapshots/"
32 | }
33 |
34 | def getRepositoryUsername() {
35 | return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
36 | }
37 |
38 | def getRepositoryPassword() {
39 | return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
40 | }
41 |
42 | afterEvaluate { project ->
43 | uploadArchives {
44 | repositories {
45 | mavenDeployer {
46 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
47 |
48 | pom.groupId = GROUP
49 | pom.artifactId = POM_ARTIFACT_ID
50 | pom.version = VERSION_NAME
51 |
52 | repository(url: getReleaseRepositoryUrl()) {
53 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
54 | }
55 | snapshotRepository(url: getSnapshotRepositoryUrl()) {
56 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
57 | }
58 |
59 | pom.project {
60 | name POM_NAME
61 | packaging POM_PACKAGING
62 | description POM_DESCRIPTION
63 | url POM_URL
64 |
65 | scm {
66 | url POM_SCM_URL
67 | connection POM_SCM_CONNECTION
68 | developerConnection POM_SCM_DEV_CONNECTION
69 | }
70 |
71 | licenses {
72 | license {
73 | name POM_LICENCE_NAME
74 | url POM_LICENCE_URL
75 | distribution POM_LICENCE_DIST
76 | }
77 | }
78 |
79 | developers {
80 | developer {
81 | id POM_DEVELOPER_ID
82 | name POM_DEVELOPER_NAME
83 | }
84 | }
85 | }
86 | }
87 | }
88 | }
89 |
90 | signing {
91 | required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
92 | sign configurations.archives
93 | }
94 |
95 | task androidJavadocs(type: Javadoc) {
96 | source = android.sourceSets.main.java.srcDirs
97 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
98 | failOnError = false
99 | }
100 |
101 | task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
102 | classifier = 'javadoc'
103 | from androidJavadocs.destinationDir
104 | }
105 |
106 | task androidSourcesJar(type: Jar) {
107 | classifier = 'sources'
108 | from android.sourceSets.main.java.sourceFiles
109 | }
110 |
111 | artifacts {
112 | archives androidSourcesJar
113 | archives androidJavadocsJar
114 | }
115 | }
--------------------------------------------------------------------------------
/oxylabs_logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/pwittchen/RxBiometric/37626caae7992e63d96a73a63b3d9f54e45c7fc4/oxylabs_logo.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app-kotlin', ':library'
2 |
--------------------------------------------------------------------------------
/update_javadocs.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | git checkout master
4 | ./gradlew dokka
5 | git checkout gh-pages
6 | cp -avr library/build/javadoc/* ./
7 | git add -A
8 | git commit -m "updating JavaDoc"
9 | rm -rf library/build/javadocs
10 | echo "JavaDoc updated"
11 |
--------------------------------------------------------------------------------