diff --git a/app/src/main/java/com/tangem/tap/features/disclaimer/ui/DisclaimerFragment.kt b/app/src/main/java/com/tangem/tap/features/disclaimer/ui/DisclaimerFragment.kt index 633ef10d6a..93d93a8a2e 100644 --- a/app/src/main/java/com/tangem/tap/features/disclaimer/ui/DisclaimerFragment.kt +++ b/app/src/main/java/com/tangem/tap/features/disclaimer/ui/DisclaimerFragment.kt @@ -4,7 +4,6 @@ import android.os.Bundle import android.view.View import androidx.transition.TransitionInflater import by.kirich1409.viewbindingdelegate.viewBinding -import com.tangem.tap.common.extensions.configureSettings import com.tangem.tap.common.extensions.hide import com.tangem.tap.common.redux.AppState import com.tangem.tap.features.BaseFragment @@ -24,7 +23,11 @@ class DisclaimerFragment : BaseFragment(R.layout.fragment_disclaimer), StoreSubs super.onViewCreated(view, savedInstanceState) addBackPressHandler(handler = this) binding.toolbar.setNavigationOnClickListener { handleOnBackPressed() } - binding.webView.configureSettings() + binding.webView.apply { + settings.allowFileAccess = false + settings.javaScriptEnabled = false + webViewClient = DisclaimerWebViewClient + } } override fun onStart() { diff --git a/app/src/main/java/com/tangem/tap/features/disclaimer/ui/DisclaimerWebViewClient.kt b/app/src/main/java/com/tangem/tap/features/disclaimer/ui/DisclaimerWebViewClient.kt new file mode 100644 index 0000000000..c2c03a42cc --- /dev/null +++ b/app/src/main/java/com/tangem/tap/features/disclaimer/ui/DisclaimerWebViewClient.kt @@ -0,0 +1,100 @@ +package com.tangem.tap.features.disclaimer.ui + +import android.webkit.WebResourceError +import android.webkit.WebResourceRequest +import android.webkit.WebResourceResponse +import android.webkit.WebView +import android.webkit.WebViewClient + +object DisclaimerWebViewClient : WebViewClient() { + + private const val HTML_MIME_TYPE = "text/html" + private const val UTF8_ENCODING = "utf-8" + + override fun onReceivedError(view: WebView?, request: WebResourceRequest?, error: WebResourceError?) { + super.onReceivedError(view, request, error) + view?.loadLocalContent() + } + + override fun onReceivedHttpError( + view: WebView?, + request: WebResourceRequest?, + errorResponse: WebResourceResponse?, + ) { + super.onReceivedHttpError(view, request, errorResponse) + view?.loadLocalContent() + } + + private fun WebView?.loadLocalContent() { + this?.loadDataWithBaseURL(null, TERMS_OF_SERVICE_HTML, HTML_MIME_TYPE, UTF8_ENCODING, null) + } +} + +private const val TERMS_OF_SERVICE_HTML = + """ + + + + + + Legal Disclaimer + + + +

Legal Disclaimer

+

    1. Tangem application (Software)

+

    The Software is intended for usage only with Tangem hardware wallets (Cards) via NFC interface. The + Software DOES NOT:

+

    a) Generate, store, transmit, or have access to private (secret) cryptographic keys to + blockchain + wallets holding digital assets, including crypto-currency.

+

    b) Generate, store, transmit, or have access to secret keys, passwords, passphrases, recovery phrases + that can be used to restore or to copy private (secret) keys to blockchain wallets holding digital assets, including + crypto-currency.

+

    c) Provide exchange, trading, investment services on behalf of Tangem AG.

+

    2. Risks related to the use of Software

+

    Tangem will not be responsible for any losses, damages or claims arising from events falling within the + scope of the following five categories:

+

    a) Mistakes made by the user of any cryptocurrency-related software or service, e.g., forgotten + passwords, payments sent to wrong addresses, and accidental deletion of blockchain wallets on Cards.

+

    b) Problems of Software and/or any blockchain- or cryptocurrency- related software or service, e.g., + corrupted files, incorrectly constructed transactions, unsafe cryptographic libraries, malware.

+

    c) Technical failures in the hardware of the user, including Cards, of any cryptocurrency-related + software or service, e.g., data loss due to a faulty or damaged storage device.

+

    d) Security problems experienced by the user of any cryptocurrency-related software or + service, e.g., + unauthorized access to users' wallets and/or accounts.

+

    e) Actions or inactions of third parties and/or events experienced by third parties, e.g., bankruptcy + of service providers, information security attacks on service providers, and fraud conducted by third parties.

+

    3. Trading and Investment risks

+

    There is considerable exposure to risk in any crypto-currency or other digital asset exchange + transaction. Any transaction involving currencies involves risks including, but not limited to, the potential for + changing economic conditions that may substantially affect the price or liquidity of a currency. Investments in + crypto-currency exchange speculation may also be susceptible to sharp rises and falls as the relevant market values + fluctuate. It is for this reason that when speculating in such markets it is advisable to use only risk capital.

+

    4. Electronic Trading Risks

+

    Before you engage in transactions using an electronic system, you should carefully review the rules and + regulations of the exchanges offering the system and/or listing the instruments you intend to trade. Online trading + has inherent risk due to system response and access times that may vary due to market conditions, system + performance, and other factors. You should understand these and additional risks before trading.

+

    5. Compliance with tax obligations        

+

    The users of the Software are solely responsible to determinate what, if any, taxes apply to their + crypto-currency transactions. The owners of, or contributors to, the Software are NOT responsible for determining + the taxes that apply to crypto-currency transactions.        

+

    6. No warranties        

+

    The Software is provided on an "as is" basis without any warranties of any kind regarding the + Software and/or any content, data, materials and/or services provided on the Software.       +  

+

    7. Limitation of liability

+

    Unless otherwise required by law, in no event shall the owners of, or contributors to, the Software be + liable for any damages of any kind, including, but not limited to, loss of use, loss of profits, or loss of data + arising out of or in any way connected with the use of the Software. In no way are the owners of, or contributors + to, the Software responsible for the actions, decisions, or other behavior taken or not taken by you in reliance + upon the Software.

+

    8. Last amendment

+

    This disclaimer was amended for the last time on October 1st, 2020.

+ + + """ \ No newline at end of file