Add dialog to read TOS
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "3",
|
"id": "3",
|
||||||
"title": "Privacy Policy",
|
"title": "Privacy policy",
|
||||||
"subtitle": "Find out if we have your nudes :p",
|
"subtitle": "Find out if we have your nudes :p",
|
||||||
"icon": "ic_privacy",
|
"icon": "ic_privacy",
|
||||||
"url": "https://gitlab.com/AuroraOSS/AuroraStore/-/raw/master/POLICY.md"
|
"url": "https://gitlab.com/AuroraOSS/AuroraStore/-/raw/master/POLICY.md"
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ object Constants {
|
|||||||
const val EXODUS_BASE_URL = "https://reports.exodus-privacy.eu.org/api/search/"
|
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 EXODUS_REPORT_URL = "https://reports.exodus-privacy.eu.org/reports/"
|
||||||
const val SHARE_URL = "http://play.google.com/store/apps/details?id="
|
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 UPDATE_URL = "https://gitlab.com/AuroraOSS/AuroraStore/raw/master/updates.json"
|
||||||
|
|
||||||
const val NOTIFICATION_CHANNEL_ALERT = "NOTIFICATION_CHANNEL_ALERT"
|
const val NOTIFICATION_CHANNEL_ALERT = "NOTIFICATION_CHANNEL_ALERT"
|
||||||
|
|||||||
@@ -115,6 +115,10 @@ class MainActivity : BaseActivity() {
|
|||||||
attachDrawer()
|
attachDrawer()
|
||||||
attachSearch()
|
attachSearch()
|
||||||
|
|
||||||
|
if (!Preferences.getBoolean(this, Preferences.PREFERENCE_TOS_READ)) {
|
||||||
|
askToReadTOS()
|
||||||
|
}
|
||||||
|
|
||||||
/*Check only if download to external storage is enabled*/
|
/*Check only if download to external storage is enabled*/
|
||||||
if (Preferences.getBoolean(this, Preferences.PREFERENCE_DOWNLOAD_EXTERNAL)) {
|
if (Preferences.getBoolean(this, Preferences.PREFERENCE_DOWNLOAD_EXTERNAL)) {
|
||||||
checkExternalStorageAccessPermission()
|
checkExternalStorageAccessPermission()
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ object Preferences {
|
|||||||
const val PREFERENCE_DOWNLOAD_EXTERNAL = "PREFERENCE_DOWNLOAD_EXTERNAL"
|
const val PREFERENCE_DOWNLOAD_EXTERNAL = "PREFERENCE_DOWNLOAD_EXTERNAL"
|
||||||
const val PREFERENCE_DOWNLOAD_WIFI = "PREFERENCE_DOWNLOAD_WIFI"
|
const val PREFERENCE_DOWNLOAD_WIFI = "PREFERENCE_DOWNLOAD_WIFI"
|
||||||
|
|
||||||
|
const val PREFERENCE_TOS_READ = "PREFERENCE_TOS_READ"
|
||||||
|
|
||||||
|
|
||||||
private fun getPrefs(context: Context): SharedPreferences {
|
private fun getPrefs(context: Context): SharedPreferences {
|
||||||
return PreferenceManager.getDefaultSharedPreferences(context)
|
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.account.GoogleActivity
|
||||||
import com.aurora.store.view.ui.details.*
|
import com.aurora.store.view.ui.details.*
|
||||||
import com.aurora.store.view.ui.sheets.NetworkDialogSheet
|
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.Gson
|
||||||
import com.google.gson.GsonBuilder
|
import com.google.gson.GsonBuilder
|
||||||
|
import nl.komponents.kovenant.task
|
||||||
|
import nl.komponents.kovenant.ui.successUi
|
||||||
import java.lang.reflect.Modifier
|
import java.lang.reflect.Modifier
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
|
|
||||||
abstract class BaseActivity : AppCompatActivity(), NetworkProvider.NetworkListener {
|
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() {
|
fun showNetworkConnectivitySheet() {
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
supportFragmentManager.beginTransaction()
|
supportFragmentManager.beginTransaction()
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import androidx.fragment.app.FragmentActivity
|
|||||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||||
import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
|
import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
|
||||||
import com.aurora.Constants
|
import com.aurora.Constants
|
||||||
|
import com.aurora.extensions.open
|
||||||
import com.aurora.store.R
|
import com.aurora.store.R
|
||||||
import com.aurora.store.databinding.ActivityOnboardingBinding
|
import com.aurora.store.databinding.ActivityOnboardingBinding
|
||||||
import com.aurora.store.util.Preferences
|
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_INTRO
|
||||||
import com.aurora.store.util.Preferences.PREFERENCE_THEME_ACCENT
|
import com.aurora.store.util.Preferences.PREFERENCE_THEME_ACCENT
|
||||||
import com.aurora.store.util.Preferences.PREFERENCE_THEME_TYPE
|
import com.aurora.store.util.Preferences.PREFERENCE_THEME_TYPE
|
||||||
import com.aurora.extensions.open
|
|
||||||
import com.aurora.store.util.save
|
import com.aurora.store.util.save
|
||||||
import com.aurora.store.view.ui.commons.BaseActivity
|
import com.aurora.store.view.ui.commons.BaseActivity
|
||||||
import com.aurora.store.view.ui.splash.SplashActivity
|
import com.aurora.store.view.ui.splash.SplashActivity
|
||||||
@@ -84,6 +84,10 @@ class OnboardingActivity : BaseActivity() {
|
|||||||
moveBackward()
|
moveBackward()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Preferences.getBoolean(this, Preferences.PREFERENCE_TOS_READ)) {
|
||||||
|
askToReadTOS()
|
||||||
|
}
|
||||||
|
|
||||||
onNewIntent(intent)
|
onNewIntent(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +96,6 @@ class OnboardingActivity : BaseActivity() {
|
|||||||
intent?.let {
|
intent?.let {
|
||||||
val pos = intent.getIntExtra(Constants.INT_EXTRA, 0)
|
val pos = intent.getIntExtra(Constants.INT_EXTRA, 0)
|
||||||
B.viewpager2.setCurrentItem(pos, false)
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
101
app/src/main/res/layout/sheet_tos.xml
Normal file
101
app/src/main/res/layout/sheet_tos.xml
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
|
~ 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/>.
|
||||||
|
~
|
||||||
|
-->
|
||||||
|
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:divider="@drawable/divider"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="@dimen/padding_large"
|
||||||
|
android:showDividers="middle">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/img_icon"
|
||||||
|
android:layout_width="@dimen/icon_size_category"
|
||||||
|
android:layout_height="@dimen/icon_size_category"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
app:srcCompat="@drawable/ic_logo" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txt_header"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="@dimen/margin_normal"
|
||||||
|
android:layout_marginBottom="@dimen/margin_normal"
|
||||||
|
android:layout_toEndOf="@id/img_icon"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="@string/app_name"
|
||||||
|
android:textAlignment="viewStart"
|
||||||
|
android:textAppearance="@style/TextAppearance.Aurora.SubTitle" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txt_line1"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:maxLines="3"
|
||||||
|
android:text="@string/onboarding_tos"
|
||||||
|
android:textAlignment="viewStart"
|
||||||
|
android:textAppearance="@style/TextAppearance.Aurora.Line1" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txt_line2"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:maxLines="10"
|
||||||
|
android:text="@string/onboarding_tos_desc"
|
||||||
|
android:textAlignment="viewStart"
|
||||||
|
android:textAppearance="@style/TextAppearance.Aurora.Line2" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:weightSum="2">
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btn_secondary"
|
||||||
|
style="@style/Widget.MaterialComponents.Button.TextButton.Dialog.Flush"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="@dimen/height_button"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/action_accept" />
|
||||||
|
|
||||||
|
<com.google.android.material.button.MaterialButton
|
||||||
|
android:id="@+id/btn_primary"
|
||||||
|
style="@style/Widget.MaterialComponents.Button.TextButton.Dialog.Flush"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="@dimen/height_button"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="@string/action_read_accept" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
@@ -45,6 +45,7 @@
|
|||||||
<string name="account_login_using">"Login using"</string>
|
<string name="account_login_using">"Login using"</string>
|
||||||
<string name="account_logout">"Logout from Aurora"</string>
|
<string name="account_logout">"Logout from Aurora"</string>
|
||||||
|
|
||||||
|
<string name="action_accept">"Accept"</string>
|
||||||
<string name="action_accounts">"Accounts"</string>
|
<string name="action_accounts">"Accounts"</string>
|
||||||
<string name="action_all_reviews">"All reviews"</string>
|
<string name="action_all_reviews">"All reviews"</string>
|
||||||
<string name="action_apply">"Apply"</string>
|
<string name="action_apply">"Apply"</string>
|
||||||
@@ -104,6 +105,7 @@
|
|||||||
<string name="action_post">"Post"</string>
|
<string name="action_post">"Post"</string>
|
||||||
<string name="action_previous">"Previous"</string>
|
<string name="action_previous">"Previous"</string>
|
||||||
<string name="action_purchase">"Purchase"</string>
|
<string name="action_purchase">"Purchase"</string>
|
||||||
|
<string name="action_read_accept">"Read & accept"</string>
|
||||||
<string name="action_resend">"Resend"</string>
|
<string name="action_resend">"Resend"</string>
|
||||||
<string name="action_restart">"Restart"</string>
|
<string name="action_restart">"Restart"</string>
|
||||||
<string name="action_resume">"Resume"</string>
|
<string name="action_resume">"Resume"</string>
|
||||||
@@ -238,7 +240,6 @@
|
|||||||
<string name="device_miui_description">"Please, disable MIUI optimizations to allow installations, otherwise you can choose Root or Services installer."</string>
|
<string name="device_miui_description">"Please, disable MIUI optimizations to allow installations, otherwise you can choose Root or Services installer."</string>
|
||||||
<string name="device_miui_extra">"Optionally you can choose Native installer, but then you can not install bundled (split) APKs, so choice is yours."</string>
|
<string name="device_miui_extra">"Optionally you can choose Native installer, but then you can not install bundled (split) APKs, so choice is yours."</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="dialog_title_self_update">"New update available"</string>
|
<string name="dialog_title_self_update">"New update available"</string>
|
||||||
<string name="dialog_desc_self_update">"Do you wish to update now ?"</string>
|
<string name="dialog_desc_self_update">"Do you wish to update now ?"</string>
|
||||||
<string name="list_update_all_txt_one">"update available"</string>
|
<string name="list_update_all_txt_one">"update available"</string>
|
||||||
@@ -255,6 +256,8 @@
|
|||||||
<string name="onboarding_title_permissions">"Permissions"</string>
|
<string name="onboarding_title_permissions">"Permissions"</string>
|
||||||
<string name="onboarding_title_theme">"Themes"</string>
|
<string name="onboarding_title_theme">"Themes"</string>
|
||||||
<string name="onboarding_title_welcome">"Welcome"</string>
|
<string name="onboarding_title_welcome">"Welcome"</string>
|
||||||
|
<string name="onboarding_tos">"Terms of services"</string>
|
||||||
|
<string name="onboarding_tos_desc">"Read our Terms of services and accept it before you continue to use Aurora Store."</string>
|
||||||
<string name="onboarding_welcome_select">"How you doing?"</string>
|
<string name="onboarding_welcome_select">"How you doing?"</string>
|
||||||
|
|
||||||
<string name="onboarding_permission_esa">"External Storage Access"</string>
|
<string name="onboarding_permission_esa">"External Storage Access"</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user