Add dialog to read TOS
This commit is contained in:
@@ -32,6 +32,7 @@ object Constants {
|
||||
const val EXODUS_BASE_URL = "https://reports.exodus-privacy.eu.org/api/search/"
|
||||
const val EXODUS_REPORT_URL = "https://reports.exodus-privacy.eu.org/reports/"
|
||||
const val SHARE_URL = "http://play.google.com/store/apps/details?id="
|
||||
const val TOS_URL = "https://gitlab.com/AuroraOSS/AuroraStore/-/raw/master/TermsOfService.md"
|
||||
const val UPDATE_URL = "https://gitlab.com/AuroraOSS/AuroraStore/raw/master/updates.json"
|
||||
|
||||
const val NOTIFICATION_CHANNEL_ALERT = "NOTIFICATION_CHANNEL_ALERT"
|
||||
|
||||
@@ -115,6 +115,10 @@ class MainActivity : BaseActivity() {
|
||||
attachDrawer()
|
||||
attachSearch()
|
||||
|
||||
if (!Preferences.getBoolean(this, Preferences.PREFERENCE_TOS_READ)) {
|
||||
askToReadTOS()
|
||||
}
|
||||
|
||||
/*Check only if download to external storage is enabled*/
|
||||
if (Preferences.getBoolean(this, Preferences.PREFERENCE_DOWNLOAD_EXTERNAL)) {
|
||||
checkExternalStorageAccessPermission()
|
||||
|
||||
@@ -46,6 +46,8 @@ object Preferences {
|
||||
const val PREFERENCE_DOWNLOAD_EXTERNAL = "PREFERENCE_DOWNLOAD_EXTERNAL"
|
||||
const val PREFERENCE_DOWNLOAD_WIFI = "PREFERENCE_DOWNLOAD_WIFI"
|
||||
|
||||
const val PREFERENCE_TOS_READ = "PREFERENCE_TOS_READ"
|
||||
|
||||
|
||||
private fun getPrefs(context: Context): SharedPreferences {
|
||||
return PreferenceManager.getDefaultSharedPreferences(context)
|
||||
|
||||
@@ -35,9 +35,13 @@ import com.aurora.store.util.Preferences.PREFERENCE_THEME_TYPE
|
||||
import com.aurora.store.view.ui.account.GoogleActivity
|
||||
import com.aurora.store.view.ui.details.*
|
||||
import com.aurora.store.view.ui.sheets.NetworkDialogSheet
|
||||
import com.aurora.store.view.ui.sheets.TOSSheet
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.GsonBuilder
|
||||
import nl.komponents.kovenant.task
|
||||
import nl.komponents.kovenant.ui.successUi
|
||||
import java.lang.reflect.Modifier
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
abstract class BaseActivity : AppCompatActivity(), NetworkProvider.NetworkListener {
|
||||
@@ -136,6 +140,15 @@ abstract class BaseActivity : AppCompatActivity(), NetworkProvider.NetworkListen
|
||||
)
|
||||
}
|
||||
|
||||
fun askToReadTOS() {
|
||||
task {
|
||||
TimeUnit.SECONDS.sleep(5)
|
||||
} successUi {
|
||||
TOSSheet.newInstance().show(supportFragmentManager, TOSSheet.TAG)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun showNetworkConnectivitySheet() {
|
||||
runOnUiThread {
|
||||
supportFragmentManager.beginTransaction()
|
||||
|
||||
@@ -26,6 +26,7 @@ import androidx.fragment.app.FragmentActivity
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
|
||||
import com.aurora.Constants
|
||||
import com.aurora.extensions.open
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.databinding.ActivityOnboardingBinding
|
||||
import com.aurora.store.util.Preferences
|
||||
@@ -39,7 +40,6 @@ import com.aurora.store.util.Preferences.PREFERENCE_INSTALLER_ID
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_INTRO
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_THEME_ACCENT
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_THEME_TYPE
|
||||
import com.aurora.extensions.open
|
||||
import com.aurora.store.util.save
|
||||
import com.aurora.store.view.ui.commons.BaseActivity
|
||||
import com.aurora.store.view.ui.splash.SplashActivity
|
||||
@@ -84,6 +84,10 @@ class OnboardingActivity : BaseActivity() {
|
||||
moveBackward()
|
||||
}
|
||||
|
||||
if (!Preferences.getBoolean(this, Preferences.PREFERENCE_TOS_READ)) {
|
||||
askToReadTOS()
|
||||
}
|
||||
|
||||
onNewIntent(intent)
|
||||
}
|
||||
|
||||
@@ -92,7 +96,6 @@ class OnboardingActivity : BaseActivity() {
|
||||
intent?.let {
|
||||
val pos = intent.getIntExtra(Constants.INT_EXTRA, 0)
|
||||
B.viewpager2.setCurrentItem(pos, false)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Aurora Store
|
||||
* Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
|
||||
*
|
||||
* Aurora Store is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Aurora Store is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.aurora.store.view.ui.sheets
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.aurora.Constants
|
||||
import com.aurora.extensions.browse
|
||||
import com.aurora.store.databinding.SheetTosBinding
|
||||
import com.aurora.store.util.Preferences
|
||||
|
||||
class TOSSheet : BaseBottomSheet() {
|
||||
|
||||
private lateinit var B: SheetTosBinding
|
||||
|
||||
companion object {
|
||||
|
||||
const val TAG = "TOSSheet"
|
||||
|
||||
@JvmStatic
|
||||
fun newInstance(): TOSSheet {
|
||||
return TOSSheet().apply {
|
||||
arguments = Bundle().apply {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateContentView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
B = SheetTosBinding.inflate(inflater, container, false)
|
||||
|
||||
attachAction()
|
||||
|
||||
return B.root
|
||||
}
|
||||
|
||||
override fun onContentViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
||||
}
|
||||
|
||||
private fun attachAction() {
|
||||
B.btnPrimary.setOnClickListener {
|
||||
requireContext().browse(Constants.TOS_URL)
|
||||
Preferences.putBoolean(requireContext(), Preferences.PREFERENCE_TOS_READ, true)
|
||||
}
|
||||
|
||||
B.btnSecondary.setOnClickListener {
|
||||
Preferences.putBoolean(requireContext(), Preferences.PREFERENCE_TOS_READ, true)
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user