From 69521ee467706e78ef1ef560ea332a179473aa01 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 16 Apr 2020 17:41:20 +0300 Subject: [PATCH 1/4] Updated on 2026-08-14 --- .../DefaultSessionViewDelegate.kt | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) 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..8ace166ea2 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 @@ -1,10 +1,13 @@ package com.tangem.tangem_sdk_new import android.animation.ObjectAnimator +import android.app.Activity +import android.content.Intent +import android.provider.Settings import android.view.HapticFeedbackConstants import android.view.View import android.view.animation.DecelerateInterpolator -import androidx.fragment.app.FragmentActivity +import androidx.appcompat.app.AlertDialog import com.google.android.material.bottomsheet.BottomSheetDialog import com.tangem.Log import com.tangem.LoggerInterface @@ -14,7 +17,6 @@ import com.tangem.common.CompletionResult import com.tangem.tangem_sdk_new.extensions.hide import com.tangem.tangem_sdk_new.extensions.show import com.tangem.tangem_sdk_new.nfc.NfcReader -import com.tangem.tangem_sdk_new.ui.NfcEnableDialog import com.tangem.tangem_sdk_new.ui.TouchCardAnimation import kotlinx.android.synthetic.main.layout_touch_card.* import kotlinx.android.synthetic.main.nfc_bottom_sheet.* @@ -25,9 +27,8 @@ import kotlinx.android.synthetic.main.nfc_bottom_sheet.* */ class DefaultSessionViewDelegate(private val reader: NfcReader) : SessionViewDelegate { - lateinit var activity: FragmentActivity + lateinit var activity: Activity private var readingDialog: BottomSheetDialog? = null - private var nfcEnableDialog: NfcEnableDialog? = null init { setLogger() @@ -39,7 +40,7 @@ class DefaultSessionViewDelegate(private val reader: NfcReader) : SessionViewDel if (!reader.nfcEnabled) showNFCEnableDialog() } - private fun showReadingDialog(activity: FragmentActivity, cardId: String?, message: Message?) { + private fun showReadingDialog(activity: Activity, cardId: String?, message: Message?) { val dialogView = activity.layoutInflater.inflate(R.layout.nfc_bottom_sheet, null) readingDialog = BottomSheetDialog(activity) readingDialog?.setContentView(dialogView) @@ -70,8 +71,15 @@ class DefaultSessionViewDelegate(private val reader: NfcReader) : SessionViewDel } private fun showNFCEnableDialog() { - nfcEnableDialog = NfcEnableDialog() - activity.supportFragmentManager.let { nfcEnableDialog?.show(it, NfcEnableDialog.TAG) } + val builder = AlertDialog.Builder(activity) + .setCancelable(false) + .setIcon(R.drawable.ic_action_nfc_gray) + .setTitle(R.string.dialog_nfc_enable_title) + .setMessage(R.string.dialog_nfc_enable_text) + builder.setPositiveButton(R.string.general_ok) { _, _ -> + activity.startActivity(Intent(Settings.ACTION_NFC_SETTINGS)) + } + builder.create().show() } override fun onSecurityDelay(ms: Int, totalDurationSeconds: Int) { From 91a6e136f2bfeec80c1b128cafb7103a3d361ef8 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 16 Apr 2020 17:41:47 +0300 Subject: [PATCH 2/4] Updated on 2026-08-14 --- tangem-sdk-android-config/LICENSE | 21 +++++++++++++++++++++ tangem-sdk-android-config/README.md | 5 ++--- 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 tangem-sdk-android-config/LICENSE 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. From be6435e94cccbd9fd6c42a1b642d55f62eb8e003 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 16 Apr 2020 18:34:15 +0300 Subject: [PATCH 3/4] Updated on 2026-08-14 --- .../DefaultSessionViewDelegate.kt | 25 +++++-------------- .../tangem_sdk_new/ui/NfcEnableDialog.kt | 19 +++++--------- 2 files changed, 12 insertions(+), 32 deletions(-) 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 8ace166ea2..76a8fbb2ac 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 @@ -1,13 +1,10 @@ package com.tangem.tangem_sdk_new import android.animation.ObjectAnimator -import android.app.Activity -import android.content.Intent -import android.provider.Settings import android.view.HapticFeedbackConstants import android.view.View import android.view.animation.DecelerateInterpolator -import androidx.appcompat.app.AlertDialog +import androidx.fragment.app.FragmentActivity import com.google.android.material.bottomsheet.BottomSheetDialog import com.tangem.Log import com.tangem.LoggerInterface @@ -17,6 +14,7 @@ import com.tangem.common.CompletionResult import com.tangem.tangem_sdk_new.extensions.hide import com.tangem.tangem_sdk_new.extensions.show import com.tangem.tangem_sdk_new.nfc.NfcReader +import com.tangem.tangem_sdk_new.ui.NfcEnableDialog import com.tangem.tangem_sdk_new.ui.TouchCardAnimation import kotlinx.android.synthetic.main.layout_touch_card.* import kotlinx.android.synthetic.main.nfc_bottom_sheet.* @@ -27,8 +25,9 @@ import kotlinx.android.synthetic.main.nfc_bottom_sheet.* */ class DefaultSessionViewDelegate(private val reader: NfcReader) : SessionViewDelegate { - lateinit var activity: Activity + lateinit var activity: FragmentActivity private var readingDialog: BottomSheetDialog? = null + private var nfcEnableDialog: NfcEnableDialog? = null init { setLogger() @@ -37,10 +36,10 @@ 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: Activity, cardId: String?, message: Message?) { + private fun showReadingDialog(activity: FragmentActivity, cardId: String?, message: Message?) { val dialogView = activity.layoutInflater.inflate(R.layout.nfc_bottom_sheet, null) readingDialog = BottomSheetDialog(activity) readingDialog?.setContentView(dialogView) @@ -70,18 +69,6 @@ class DefaultSessionViewDelegate(private val reader: NfcReader) : SessionViewDel readingDialog?.show() } - private fun showNFCEnableDialog() { - val builder = AlertDialog.Builder(activity) - .setCancelable(false) - .setIcon(R.drawable.ic_action_nfc_gray) - .setTitle(R.string.dialog_nfc_enable_title) - .setMessage(R.string.dialog_nfc_enable_text) - builder.setPositiveButton(R.string.general_ok) { _, _ -> - activity.startActivity(Intent(Settings.ACTION_NFC_SETTINGS)) - } - builder.create().show() - } - 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 From a4844ff9ed9c4061fe581b6b9ff3c6ad65873435 Mon Sep 17 00:00:00 2001 From: Tangem Date: Thu, 16 Apr 2020 18:34:59 +0300 Subject: [PATCH 4/4] Updated on 2026-08-14 --- .../java/com/tangem/tangem_sdk_new/DefaultSessionViewDelegate.kt | 1 - 1 file changed, 1 deletion(-) 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 76a8fbb2ac..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()