diff options
9 files changed, 27 insertions, 30 deletions
diff --git a/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/SmsFragment.kt b/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/SmsFragment.kt index 413f472..2c35309 100644 --- a/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/SmsFragment.kt +++ b/anastasis-ui/src/main/java/org/gnu/anastasis/ui/authentication/SmsFragment.kt @@ -25,7 +25,7 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.annotation.RequiresPermission -import androidx.core.content.ContextCompat +import androidx.core.content.ContextCompat.checkSelfPermission import androidx.core.content.getSystemService import androidx.fragment.app.Fragment import androidx.fragment.app.activityViewModels @@ -35,7 +35,6 @@ import com.google.android.material.transition.MaterialContainerTransform.FADE_MO import org.gnu.anastasis.ui.MainViewModel import org.gnu.anastasis.ui.PERMISSION_REQUEST_CODE import org.gnu.anastasis.ui.R -import org.gnu.anastasis.ui.databinding.FragmentSecurityQuestionBinding import org.gnu.anastasis.ui.databinding.FragmentSmsBinding private const val PERMISSION = Manifest.permission.READ_PHONE_STATE @@ -52,7 +51,7 @@ class SmsFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View? { _binding = FragmentSmsBinding.inflate(inflater, container, false) sharedElementEnterTransition = MaterialContainerTransform().apply { @@ -79,8 +78,7 @@ class SmsFragment : Fragment() { } private fun checkPerm() = when { - ContextCompat.checkSelfPermission(requireContext(), PERMISSION) - == PERMISSION_GRANTED -> { + checkSelfPermission(requireContext(), PERMISSION) == PERMISSION_GRANTED -> { // You can use the API that requires the permission. fillPhoneNumber() } @@ -99,7 +97,7 @@ class SmsFragment : Fragment() { override fun onRequestPermissionsResult( requestCode: Int, permissions: Array<String>, - grantResults: IntArray + grantResults: IntArray, ) { if (requestCode == PERMISSION_REQUEST_CODE && grantResults.isNotEmpty() && grantResults[0] == PERMISSION_GRANTED diff --git a/cashier/build.gradle b/cashier/build.gradle index ea59f23..ab495a4 100644 --- a/cashier/build.gradle +++ b/cashier/build.gradle @@ -22,14 +22,14 @@ plugins { } android { - compileSdkVersion 31 + compileSdkVersion 32 //noinspection GradleDependency buildToolsVersion "$build_tools_version" defaultConfig { applicationId "net.taler.cashier" minSdkVersion 23 - targetSdkVersion 30 + targetSdkVersion 32 versionCode 1 versionName "0.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/cashier/src/main/AndroidManifest.xml b/cashier/src/main/AndroidManifest.xml index 37f941c..36a3b72 100644 --- a/cashier/src/main/AndroidManifest.xml +++ b/cashier/src/main/AndroidManifest.xml @@ -3,6 +3,7 @@ xmlns:tools="http://schemas.android.com/tools"> <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.NFC" /> <application @@ -18,6 +19,7 @@ <activity android:name=".MainActivity" + android:exported="true" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar"> <intent-filter> diff --git a/cashier/src/main/java/net/taler/cashier/AboutDialogFragment.kt b/cashier/src/main/java/net/taler/cashier/AboutDialogFragment.kt index 3da49d2..90becbd 100644 --- a/cashier/src/main/java/net/taler/cashier/AboutDialogFragment.kt +++ b/cashier/src/main/java/net/taler/cashier/AboutDialogFragment.kt @@ -17,19 +17,13 @@ package net.taler.cashier import android.os.Bundle -import android.os.Handler import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.view.WindowManager -import android.widget.Button -import androidx.appcompat.app.AppCompatActivity import androidx.fragment.app.DialogFragment -import androidx.fragment.app.Fragment import net.taler.cashier.BuildConfig.VERSION_NAME import net.taler.cashier.config.VERSION_BANK import net.taler.cashier.databinding.FragmentAboutDialogBinding -import net.taler.cashier.databinding.FragmentBalanceBinding import net.taler.common.Version class AboutDialogFragment : DialogFragment() { @@ -39,8 +33,8 @@ class AboutDialogFragment : DialogFragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? - ): View? { + savedInstanceState: Bundle?, + ): View { ui = FragmentAboutDialogBinding.inflate(layoutInflater, container, false) return ui.root } @@ -50,8 +44,10 @@ class AboutDialogFragment : DialogFragment() { ui.versionView.text = getString(R.string.about_version, VERSION_NAME) ui.bankVersionView.text = getString(R.string.about_supported_bank_api, VERSION_BANK.str()) - ui.licenseView.text = getString(R.string.about_license, getString(R.string.about_license_content)) - ui.copyrightView.text = getString(R.string.about_copyright, getString(R.string.about_copyright_holder)) + ui.licenseView.text = + getString(R.string.about_license, getString(R.string.about_license_content)) + ui.copyrightView.text = + getString(R.string.about_copyright, getString(R.string.about_copyright_holder)) ui.button.setOnClickListener { dismiss() } } diff --git a/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigFetcherFragment.kt b/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigFetcherFragment.kt index 87004d8..b5b7be7 100644 --- a/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigFetcherFragment.kt +++ b/merchant-terminal/src/main/java/net/taler/merchantpos/config/ConfigFetcherFragment.kt @@ -40,8 +40,8 @@ class ConfigFetcherFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? - ): View? { + savedInstanceState: Bundle?, + ): View { ui = FragmentConfigFetcherBinding.inflate(inflater) return ui.root } diff --git a/taler-kotlin-android/src/main/java/net/taler/common/AndroidUtils.kt b/taler-kotlin-android/src/main/java/net/taler/common/AndroidUtils.kt index 5b57320..7dde872 100644 --- a/taler-kotlin-android/src/main/java/net/taler/common/AndroidUtils.kt +++ b/taler-kotlin-android/src/main/java/net/taler/common/AndroidUtils.kt @@ -16,6 +16,7 @@ package net.taler.common +import android.Manifest.permission.ACCESS_NETWORK_STATE import android.content.ActivityNotFoundException import android.content.Context import android.content.Context.CONNECTIVITY_SERVICE @@ -40,6 +41,7 @@ import android.view.View import android.view.View.INVISIBLE import android.view.View.VISIBLE import android.view.inputmethod.InputMethodManager +import androidx.annotation.RequiresPermission import androidx.annotation.StringRes import androidx.core.content.ContextCompat.getSystemService import androidx.fragment.app.Fragment @@ -82,6 +84,7 @@ fun assertUiThread() { val <T> T.exhaustive: T get() = this +@RequiresPermission(ACCESS_NETWORK_STATE) fun Context.isOnline(): Boolean { val cm = getSystemService(CONNECTIVITY_SERVICE) as ConnectivityManager return if (SDK_INT < 29) { diff --git a/wallet/src/main/AndroidManifest.xml b/wallet/src/main/AndroidManifest.xml index 61191b6..70d2c4f 100644 --- a/wallet/src/main/AndroidManifest.xml +++ b/wallet/src/main/AndroidManifest.xml @@ -17,6 +17,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> diff --git a/wallet/src/main/res/values-fr/strings.xml b/wallet/src/main/res/values-fr/strings.xml index 0394a81..7d260a6 100644 --- a/wallet/src/main/res/values-fr/strings.xml +++ b/wallet/src/main/res/values-fr/strings.xml @@ -7,10 +7,6 @@ \n \nhttps://bank.demo.taler.net</string> <string name="withdraw_error_message">Pour l\'instant il n\'est pas possible de retirer. Veuillez réessayer plus tard !</string> - <plurals name="exchange_fee_coin"> - <item quantity="one">Monnaie : %s (utilisée %d fois)</item> - <item quantity="other">Monnaie : %s (utilisée %d fois)</item> - </plurals> <string name="settings_dev_mode">Mode développeur</string> <string name="menu_settings">Réglages</string> <string name="settings_reset">Réinitialiser le portefeuille (dangereux!)</string> diff --git a/wallet/src/test/java/net/taler/wallet/withdraw/WithdrawManagerKtTest.kt b/wallet/src/test/java/net/taler/wallet/withdraw/WithdrawManagerKtTest.kt index 519082c..b75e8bf 100644 --- a/wallet/src/test/java/net/taler/wallet/withdraw/WithdrawManagerKtTest.kt +++ b/wallet/src/test/java/net/taler/wallet/withdraw/WithdrawManagerKtTest.kt @@ -16,8 +16,7 @@ package net.taler.wallet.withdraw -import android.net.Uri -import net.taler.common.Amount +import Bech32.Companion.generateFakeSegwitAddress import org.junit.Assert import org.junit.Test @@ -25,7 +24,8 @@ class WithdrawManagerKtTest { @Test fun generateMainnet() { - val (addr1, addr2) = generateFakeSegwitAddress("54ZN9AMVN1R0YZ68ZPVHHQA4KZE1V037M05FNMYH4JQ596YAKJEG", "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq") + val (addr1, addr2) = generateFakeSegwitAddress("54ZN9AMVN1R0YZ68ZPVHHQA4KZE1V037M05FNMYH4JQ596YAKJEG", + "bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq") Assert.assertEquals(addr1, "bc1q9yl4f23f8a224xagwq8hej8akuvd63yl8nyedj") Assert.assertEquals(addr2, "bc1q4yl4f2kurkqx0gq2ltfazf9w2jdu48yaqlghnp") @@ -33,7 +33,8 @@ class WithdrawManagerKtTest { @Test fun generateTestnet() { - val (addr1, addr2) = generateFakeSegwitAddress("54ZN9AMVN1R0YZ68ZPVHHQA4KZE1V037M05FNMYH4JQ596YAKJEG", "tb1qhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v") + val (addr1, addr2) = generateFakeSegwitAddress("54ZN9AMVN1R0YZ68ZPVHHQA4KZE1V037M05FNMYH4JQ596YAKJEG", + "tb1qhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v") Assert.assertEquals(addr1, "tb1q9yl4f23f8a224xagwq8hej8akuvd63yld4l2kp") Assert.assertEquals(addr2, "tb1q4yl4f2kurkqx0gq2ltfazf9w2jdu48ya2enygj") @@ -41,10 +42,10 @@ class WithdrawManagerKtTest { @Test fun generateRegnet() { - val (addr1, addr2) = generateFakeSegwitAddress("54ZN9AMVN1R0YZ68ZPVHHQA4KZE1V037M05FNMYH4JQ596YAKJEG", "bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v") + val (addr1, addr2) = generateFakeSegwitAddress("54ZN9AMVN1R0YZ68ZPVHHQA4KZE1V037M05FNMYH4JQ596YAKJEG", + "bcrtqhxrhccqexg0dv4nltgkuw4fg2ce7muplmjsn0v") Assert.assertEquals(addr1, "bcrt1q9yl4f23f8a224xagwq8hej8akuvd63yl0ux8pg") Assert.assertEquals(addr2, "bcrt1q4yl4f2kurkqx0gq2ltfazf9w2jdu48yags2flm") - } } |