Skip to content

Commit

Permalink
Add missing copyright header in number utils
Browse files Browse the repository at this point in the history
Signed-off-by: starry-shivam <[email protected]>
  • Loading branch information
starry-shivam committed May 22, 2024
1 parent dd66a91 commit b0314e6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
24 changes: 24 additions & 0 deletions app/src/main/java/com/starry/greenstash/utils/NumberUtils.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
/**
* MIT License
*
* Copyright (c) [2022 - Present] Stɑrry Shivɑm
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package com.starry.greenstash.utils

import java.math.RoundingMode
Expand Down
20 changes: 9 additions & 11 deletions app/src/main/java/com/starry/greenstash/utils/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,19 @@ object Utils {
NumberUtils.formatCurrency(amount, currencyCode)

/**
* Get the authenticators based on the Android version.
* Retrieves the appropriate authenticators based on the Android version.
*
* For Android 9 and 10, the authenticators are BIOMETRIC_WEAK and DEVICE_CREDENTIAL.
* - For Android 9 (Pie) and Android 10 (Q), the authenticators are `BIOMETRIC_WEAK` and `DEVICE_CREDENTIAL`.
* - For Android 11 (R) and above, the authenticators are `BIOMETRIC_STRONG` and `DEVICE_CREDENTIAL`.
* - For Android versions below 9, while the authenticators `BIOMETRIC_STRONG` and `DEVICE_CREDENTIAL` are not officially supported,
* using them does not result in an error unlike in Android 9 and 10.
*
* For Android 11 and above, the authenticators are BIOMETRIC_STRONG and DEVICE_CREDENTIAL.
* More details can be found in the
* [official documentation](https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setAllowedAuthenticators(int)).
*
* For Android versions below 9, the authenticators are BIOMETRIC_STRONG and DEVICE_CREDENTIAL although they are not supported,
* they don't result in any error unlike in Android 9 and 10.
*
* See https://developer.android.com/reference/androidx/biometric/BiometricPrompt.PromptInfo.Builder#setAllowedAuthenticators(int)
* for more information.
*
* @return The authenticators based on the Android version.
* @return The authenticators suitable for the current Android version.
*/
fun getAuthenticators() = if (Build.VERSION.SDK_INT == 28 || Build.VERSION.SDK_INT == 29) {
fun getAuthenticators() = if (Build.VERSION.SDK_INT in 28..29) {
BIOMETRIC_WEAK or DEVICE_CREDENTIAL
} else {
BIOMETRIC_STRONG or DEVICE_CREDENTIAL
Expand Down

0 comments on commit b0314e6

Please sign in to comment.