Merge branch 'dev'
This commit is contained in:
@@ -46,8 +46,6 @@
|
|||||||
|
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
|
||||||
|
|
||||||
<uses-permission
|
<uses-permission
|
||||||
android:name="android.permission.USE_CREDENTIALS"
|
android:name="android.permission.USE_CREDENTIALS"
|
||||||
android:maxSdkVersion="22" />
|
android:maxSdkVersion="22" />
|
||||||
|
|||||||
@@ -57,9 +57,8 @@ class PermissionsFragment : BaseFragment<FragmentOnboardingPermissionsBinding>()
|
|||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
// Headers are only visible if we are onboarding
|
// Headers are only visible if we are onboarding
|
||||||
binding.title?.isVisible = args.isOnboarding
|
binding.title.isVisible = args.isOnboarding
|
||||||
binding.subtitle?.isVisible = args.isOnboarding
|
binding.toolbar.apply {
|
||||||
binding.toolbar?.apply {
|
|
||||||
isVisible = !args.isOnboarding
|
isVisible = !args.isOnboarding
|
||||||
setNavigationOnClickListener { findNavController().navigateUp() }
|
setNavigationOnClickListener { findNavController().navigateUp() }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,15 +29,14 @@ import android.os.Looper
|
|||||||
import android.util.Base64
|
import android.util.Base64
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.core.view.isVisible
|
|
||||||
import androidx.fragment.app.activityViewModels
|
import androidx.fragment.app.activityViewModels
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import com.aurora.extensions.hide
|
import com.aurora.extensions.hide
|
||||||
import com.aurora.extensions.isMAndAbove
|
import com.aurora.extensions.isMAndAbove
|
||||||
import com.aurora.extensions.runOnUiThread
|
|
||||||
import com.aurora.extensions.show
|
import com.aurora.extensions.show
|
||||||
import com.aurora.gplayapi.helpers.AuthHelper
|
import com.aurora.gplayapi.helpers.AuthHelper
|
||||||
import com.aurora.store.R
|
import com.aurora.store.R
|
||||||
@@ -70,7 +69,7 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>() {
|
|||||||
if (!accountName.isNullOrBlank()) {
|
if (!accountName.isNullOrBlank()) {
|
||||||
requestAuthTokenForGoogle(accountName)
|
requestAuthTokenForGoogle(accountName)
|
||||||
} else {
|
} else {
|
||||||
runOnUiThread { resetActions() }
|
resetActions()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,14 +202,6 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>() {
|
|||||||
if (viewModel.authState.value != AuthState.Fetching) {
|
if (viewModel.authState.value != AuthState.Fetching) {
|
||||||
binding.btnGoogle.updateProgress(true)
|
binding.btnGoogle.updateProgress(true)
|
||||||
if (isMAndAbove && PackageUtil.hasSupportedMicroG(requireContext())) {
|
if (isMAndAbove && PackageUtil.hasSupportedMicroG(requireContext())) {
|
||||||
val accounts = fetchGoogleAccounts()
|
|
||||||
|
|
||||||
// Do not show selection dialog if there is only one account available
|
|
||||||
if (accounts.isNotEmpty() && accounts.size == 1) {
|
|
||||||
requestAuthTokenForGoogle(accounts.first().name)
|
|
||||||
return@addOnClickListener
|
|
||||||
}
|
|
||||||
|
|
||||||
Log.i(TAG, "Found supported microG, trying to request credentials")
|
Log.i(TAG, "Found supported microG, trying to request credentials")
|
||||||
val accountIntent = AccountManager.newChooseAccountIntent(
|
val accountIntent = AccountManager.newChooseAccountIntent(
|
||||||
null,
|
null,
|
||||||
@@ -225,6 +216,7 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>() {
|
|||||||
} else {
|
} else {
|
||||||
findNavController().navigate(R.id.googleFragment)
|
findNavController().navigate(R.id.googleFragment)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -242,8 +234,7 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun navigateToDefaultTab() {
|
private fun navigateToDefaultTab() {
|
||||||
val defaultDestination =
|
val defaultDestination = Preferences.getInteger(requireContext(), PREFERENCE_DEFAULT_SELECTED_TAB)
|
||||||
Preferences.getInteger(requireContext(), PREFERENCE_DEFAULT_SELECTED_TAB)
|
|
||||||
val directions =
|
val directions =
|
||||||
when (requireArguments().getInt("destinationId", defaultDestination)) {
|
when (requireArguments().getInt("destinationId", defaultDestination)) {
|
||||||
R.id.updatesFragment -> {
|
R.id.updatesFragment -> {
|
||||||
@@ -271,11 +262,6 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun fetchGoogleAccounts(): Array<Account> {
|
|
||||||
val accountManager = AccountManager.get(requireContext())
|
|
||||||
return accountManager.getAccountsByType(GOOGLE_ACCOUNT_TYPE)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun requestAuthTokenForGoogle(accountName: String) {
|
private fun requestAuthTokenForGoogle(accountName: String) {
|
||||||
try {
|
try {
|
||||||
AccountManager.get(requireContext())
|
AccountManager.get(requireContext())
|
||||||
@@ -290,7 +276,7 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>() {
|
|||||||
{
|
{
|
||||||
viewModel.buildGoogleAuthData(
|
viewModel.buildGoogleAuthData(
|
||||||
accountName,
|
accountName,
|
||||||
it.result.getString(AccountManager.KEY_AUTHTOKEN) ?: "",
|
it.result.getString(AccountManager.KEY_AUTHTOKEN)!!,
|
||||||
AuthHelper.Token.AUTH
|
AuthHelper.Token.AUTH
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -20,43 +20,61 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
android:showDividers="middle">
|
android:showDividers="middle">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:minHeight="?attr/actionBarSize"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:navigationIcon="@drawable/ic_arrow_back"
|
||||||
|
app:title="@string/onboarding_title_permissions" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content">
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:includeFontPadding="true"
|
android:layout_weight="1"
|
||||||
android:text="@string/onboarding_title_permissions"
|
android:gravity="center"
|
||||||
android:textAlignment="textStart"
|
android:orientation="vertical">
|
||||||
android:textColor="?colorAccent"
|
|
||||||
android:textSize="42sp" />
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatTextView
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
style="@style/AuroraTextStyle.Subtitle.Alt"
|
android:id="@+id/title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/onboarding_permission_select"
|
android:includeFontPadding="true"
|
||||||
android:textAlignment="textStart" />
|
android:text="@string/onboarding_title_permissions"
|
||||||
|
android:textAlignment="textStart"
|
||||||
|
android:textColor="?colorAccent"
|
||||||
|
android:textSize="42sp" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/subtitle"
|
||||||
|
style="@style/AuroraTextStyle.Subtitle.Alt"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/onboarding_permission_select"
|
||||||
|
android:textAlignment="textStart" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<com.airbnb.epoxy.EpoxyRecyclerView
|
||||||
|
android:id="@+id/epoxy_recycler"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:overScrollMode="never"
|
||||||
|
android:padding="@dimen/padding_medium"
|
||||||
|
android:scrollbars="none"
|
||||||
|
tools:listitem="@layout/view_permission" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
<com.airbnb.epoxy.EpoxyRecyclerView
|
|
||||||
android:id="@+id/epoxy_recycler"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:clipToPadding="false"
|
|
||||||
android:overScrollMode="never"
|
|
||||||
android:padding="@dimen/padding_medium"
|
|
||||||
android:scrollbars="none"
|
|
||||||
tools:listitem="@layout/view_permission" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user