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.GET_ACCOUNTS" />
|
||||
|
||||
<uses-permission
|
||||
android:name="android.permission.USE_CREDENTIALS"
|
||||
android:maxSdkVersion="22" />
|
||||
|
||||
@@ -57,9 +57,8 @@ class PermissionsFragment : BaseFragment<FragmentOnboardingPermissionsBinding>()
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
// Headers are only visible if we are onboarding
|
||||
binding.title?.isVisible = args.isOnboarding
|
||||
binding.subtitle?.isVisible = args.isOnboarding
|
||||
binding.toolbar?.apply {
|
||||
binding.title.isVisible = args.isOnboarding
|
||||
binding.toolbar.apply {
|
||||
isVisible = !args.isOnboarding
|
||||
setNavigationOnClickListener { findNavController().navigateUp() }
|
||||
}
|
||||
|
||||
@@ -29,15 +29,14 @@ import android.os.Looper
|
||||
import android.util.Base64
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.aurora.extensions.hide
|
||||
import com.aurora.extensions.isMAndAbove
|
||||
import com.aurora.extensions.runOnUiThread
|
||||
import com.aurora.extensions.show
|
||||
import com.aurora.gplayapi.helpers.AuthHelper
|
||||
import com.aurora.store.R
|
||||
@@ -70,7 +69,7 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>() {
|
||||
if (!accountName.isNullOrBlank()) {
|
||||
requestAuthTokenForGoogle(accountName)
|
||||
} else {
|
||||
runOnUiThread { resetActions() }
|
||||
resetActions()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,14 +202,6 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>() {
|
||||
if (viewModel.authState.value != AuthState.Fetching) {
|
||||
binding.btnGoogle.updateProgress(true)
|
||||
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")
|
||||
val accountIntent = AccountManager.newChooseAccountIntent(
|
||||
null,
|
||||
@@ -225,6 +216,7 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>() {
|
||||
} else {
|
||||
findNavController().navigate(R.id.googleFragment)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -242,8 +234,7 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>() {
|
||||
}
|
||||
|
||||
private fun navigateToDefaultTab() {
|
||||
val defaultDestination =
|
||||
Preferences.getInteger(requireContext(), PREFERENCE_DEFAULT_SELECTED_TAB)
|
||||
val defaultDestination = Preferences.getInteger(requireContext(), PREFERENCE_DEFAULT_SELECTED_TAB)
|
||||
val directions =
|
||||
when (requireArguments().getInt("destinationId", defaultDestination)) {
|
||||
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) {
|
||||
try {
|
||||
AccountManager.get(requireContext())
|
||||
@@ -290,7 +276,7 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>() {
|
||||
{
|
||||
viewModel.buildGoogleAuthData(
|
||||
accountName,
|
||||
it.result.getString(AccountManager.KEY_AUTHTOKEN) ?: "",
|
||||
it.result.getString(AccountManager.KEY_AUTHTOKEN)!!,
|
||||
AuthHelper.Token.AUTH
|
||||
)
|
||||
},
|
||||
|
||||
@@ -20,43 +20,61 @@
|
||||
-->
|
||||
|
||||
<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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
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
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="true"
|
||||
android:text="@string/onboarding_title_permissions"
|
||||
android:textAlignment="textStart"
|
||||
android:textColor="?colorAccent"
|
||||
android:textSize="42sp" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/AuroraTextStyle.Subtitle.Alt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/onboarding_permission_select"
|
||||
android:textAlignment="textStart" />
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="true"
|
||||
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>
|
||||
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user