Updated on 2026-08-14
This commit is contained in:
commit
0e84f35ba5
4 changed files with 30 additions and 23 deletions
21
tangem-sdk-android-config/LICENSE
Normal file
21
tangem-sdk-android-config/LICENSE
Normal file
|
|
@ -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.
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
[]
|
||||
|
||||

|
||||
[](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.
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue