mirror of
				https://github.com/recloudstream/cloudstream.git
				synced 2024-08-15 01:53:11 +00:00 
			
		
		
		
	merge with upstream #2
This commit is contained in:
		
							parent
							
								
									8ba2fb8046
								
							
						
					
					
						commit
						bbcf02487c
					
				
					 3 changed files with 5 additions and 9 deletions
				
			
		|  | @ -23,8 +23,10 @@ import com.lagradost.cloudstream3.ui.settings.Globals.PHONE | |||
| import com.lagradost.cloudstream3.ui.settings.Globals.TV | ||||
| import com.lagradost.cloudstream3.ui.settings.Globals.isLayout | ||||
| import com.lagradost.cloudstream3.utils.BiometricAuthenticator | ||||
| import com.lagradost.cloudstream3.utils.BiometricAuthenticator.biometricPrompt | ||||
| import com.lagradost.cloudstream3.utils.BiometricAuthenticator.deviceHasPasswordPinLock | ||||
| import com.lagradost.cloudstream3.utils.BiometricAuthenticator.isAuthEnabled | ||||
| import com.lagradost.cloudstream3.utils.BiometricAuthenticator.promptInfo | ||||
| import com.lagradost.cloudstream3.utils.BiometricAuthenticator.startBiometricAuthentication | ||||
| import com.lagradost.cloudstream3.utils.DataStoreHelper.accounts | ||||
| import com.lagradost.cloudstream3.utils.DataStoreHelper.selectedKeyIndex | ||||
|  | @ -64,8 +66,8 @@ class AccountSelectActivity : AppCompatActivity(), BiometricAuthenticator.Biomet | |||
|                         false | ||||
|                     ) | ||||
| 
 | ||||
|                     BiometricAuthenticator.promptInfo?.let { prompt -> | ||||
|                         BiometricAuthenticator.biometricPrompt?.authenticate(prompt) | ||||
|                     promptInfo?.let { prompt -> | ||||
|                         biometricPrompt?.authenticate(prompt) | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  |  | |||
|  | @ -298,7 +298,7 @@ class SettingsAccount : PreferenceFragmentCompat(), BiometricAuthenticator.Biome | |||
|         setPreferencesFromResource(R.xml.settings_account, rootKey) | ||||
|         // hide preference on tvs and emulators | ||||
|         if (!isLayout(PHONE)) { | ||||
|             getPref(R.string.biometric_key)?.isVisible = false | ||||
|             getPref(R.string.biometric_key)?.isEnabled = false | ||||
|         } | ||||
| 
 | ||||
|         getPref(R.string.biometric_key)?.setOnPreferenceClickListener { | ||||
|  |  | |||
|  | @ -37,7 +37,6 @@ object BiometricAuthenticator { | |||
|             activity as FragmentActivity, | ||||
|             executor, | ||||
|             object : BiometricPrompt.AuthenticationCallback() { | ||||
| 
 | ||||
|                 override fun onAuthenticationError(errorCode: Int, errString: CharSequence) { | ||||
|                     super.onAuthenticationError(errorCode, errString) | ||||
|                     showToast("$errString") | ||||
|  | @ -82,7 +81,6 @@ object BiometricAuthenticator { | |||
|                     .setDescription(description) | ||||
|                     .setAllowedAuthenticators(authFlag) | ||||
|                     .build() | ||||
| 
 | ||||
|             } else { | ||||
|                 // for apis < 30 | ||||
|                 promptInfo = BiometricPrompt.PromptInfo.Builder() | ||||
|  | @ -91,7 +89,6 @@ object BiometricAuthenticator { | |||
|                     .setDeviceCredentialAllowed(true) | ||||
|                     .build() | ||||
|             } | ||||
| 
 | ||||
|         } else { | ||||
|             // fallback for A12+ when both fingerprint & Face unlock is absent but PIN is set | ||||
|             promptInfo = BiometricPrompt.PromptInfo.Builder() | ||||
|  | @ -107,7 +104,6 @@ object BiometricAuthenticator { | |||
|         var result = false | ||||
| 
 | ||||
|         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { | ||||
| 
 | ||||
|             when (biometricManager?.canAuthenticate( | ||||
|                 DEVICE_CREDENTIAL or BIOMETRIC_STRONG or BIOMETRIC_WEAK | ||||
|             )) { | ||||
|  | @ -119,7 +115,6 @@ object BiometricAuthenticator { | |||
|                 BiometricManager.BIOMETRIC_ERROR_UNSUPPORTED -> result = true | ||||
|                 BiometricManager.BIOMETRIC_STATUS_UNKNOWN -> result = false | ||||
|             } | ||||
| 
 | ||||
|         } else { | ||||
|             @Suppress("DEPRECATION") | ||||
|             when (biometricManager?.canAuthenticate()) { | ||||
|  | @ -151,7 +146,6 @@ object BiometricAuthenticator { | |||
|             authCallback = activity as? BiometricAuthCallback | ||||
|             authenticationDialog(activity, title, setDeviceCred) | ||||
|             promptInfo?.let { biometricPrompt?.authenticate(it) } | ||||
| 
 | ||||
|         } else { | ||||
|             if (deviceHasPasswordPinLock(activity)) { | ||||
|                 authCallback = activity as? BiometricAuthCallback | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue