diff --git a/tangem-sdk-android-config/LICENSE b/tangem-sdk-android-config/LICENSE new file mode 100644 index 0000000000..c4391f1742 --- /dev/null +++ b/tangem-sdk-android-config/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Tangem + +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. \ No newline at end of file diff --git a/tangem-sdk-android-config/README.md b/tangem-sdk-android-config/README.md index e4037ddaae..5447c511bb 100644 --- a/tangem-sdk-android-config/README.md +++ b/tangem-sdk-android-config/README.md @@ -1,6 +1,5 @@ - -[![Release](https://jitpack.io/v/Tangem/tangem-sdk-android.svg)] - +![Release](https://jitpack.io/v/Tangem/tangem-sdk-android.svg) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) # Welcome to Tangem The Tangem card is a self-custodial hardware wallet for blockchain assets. The main functions of Tangem cards are to securely create and store a private key from a blockchain wallet and sign blockchain transactions. The Tangem card does not allow users to import/export, backup/restore private keys, thereby guaranteeing that the wallet is unique and unclonable. diff --git a/tangem-sdk/src/main/java/com/tangem/tangem_sdk_new/DefaultSessionViewDelegate.kt b/tangem-sdk/src/main/java/com/tangem/tangem_sdk_new/DefaultSessionViewDelegate.kt index d9cdf14304..158e4b7160 100644 --- a/tangem-sdk/src/main/java/com/tangem/tangem_sdk_new/DefaultSessionViewDelegate.kt +++ b/tangem-sdk/src/main/java/com/tangem/tangem_sdk_new/DefaultSessionViewDelegate.kt @@ -27,7 +27,6 @@ class DefaultSessionViewDelegate(private val reader: NfcReader) : SessionViewDel lateinit var activity: FragmentActivity private var readingDialog: BottomSheetDialog? = null - private var nfcEnableDialog: NfcEnableDialog? = null init { setLogger() @@ -36,7 +35,7 @@ class DefaultSessionViewDelegate(private val reader: NfcReader) : SessionViewDel override fun onNfcSessionStarted(cardId: String?, message: Message?) { reader.readingCancelled = false postUI { showReadingDialog(activity, cardId, message) } - if (!reader.nfcEnabled) showNFCEnableDialog() + if (!reader.nfcEnabled) NfcEnableDialog().show(activity) } private fun showReadingDialog(activity: FragmentActivity, cardId: String?, message: Message?) { @@ -69,11 +68,6 @@ class DefaultSessionViewDelegate(private val reader: NfcReader) : SessionViewDel readingDialog?.show() } - private fun showNFCEnableDialog() { - nfcEnableDialog = NfcEnableDialog() - activity.supportFragmentManager.let { nfcEnableDialog?.show(it, NfcEnableDialog.TAG) } - } - override fun onSecurityDelay(ms: Int, totalDurationSeconds: Int) { postUI { readingDialog?.lTouchCard?.hide() diff --git a/tangem-sdk/src/main/java/com/tangem/tangem_sdk_new/ui/NfcEnableDialog.kt b/tangem-sdk/src/main/java/com/tangem/tangem_sdk_new/ui/NfcEnableDialog.kt index a7d6c2689c..56c11f1bff 100644 --- a/tangem-sdk/src/main/java/com/tangem/tangem_sdk_new/ui/NfcEnableDialog.kt +++ b/tangem-sdk/src/main/java/com/tangem/tangem_sdk_new/ui/NfcEnableDialog.kt @@ -1,30 +1,23 @@ package com.tangem.tangem_sdk_new.ui -import android.app.Dialog +import android.app.Activity import android.content.Intent -import android.os.Bundle import android.provider.Settings - import androidx.appcompat.app.AlertDialog -import androidx.fragment.app.DialogFragment import com.tangem.tangem_sdk_new.R -class NfcEnableDialog : DialogFragment() { - companion object { - val TAG: String = NfcEnableDialog::class.java.simpleName - } +class NfcEnableDialog { - override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { - val builder = AlertDialog.Builder(requireContext()) + fun show(activity: Activity) { + val builder = AlertDialog.Builder(activity) builder.setCancelable(false) .setIcon(R.drawable.ic_action_nfc_gray) .setTitle(R.string.dialog_nfc_enable_title) .setMessage(R.string.dialog_nfc_enable_text) .setPositiveButton(R.string.general_ok ) { _, _ -> - activity?.startActivity(Intent(Settings.ACTION_NFC_SETTINGS)) + activity.startActivity(Intent(Settings.ACTION_NFC_SETTINGS)) } - return builder.create() + builder.create().show() } - } \ No newline at end of file