Revert "Add promotional apps section on ForYou page"

This reverts commit 00e24e5125.
This commit is contained in:
Rahul Kumar Patel
2021-05-27 00:04:13 +05:30
parent b61c8a38b4
commit 4ad1fd3fb5
5 changed files with 29 additions and 74 deletions

View File

@@ -44,7 +44,7 @@ open class GenericCarouselController(private val callbacks: Callbacks) :
open fun applyFilter(streamBundle: StreamCluster): Boolean { open fun applyFilter(streamBundle: StreamCluster): Boolean {
return streamBundle.clusterTitle.isNotBlank() //Filter noisy cluster return streamBundle.clusterTitle.isNotBlank() //Filter noisy cluster
&& streamBundle.clusterAppList.isNotEmpty() //Filter empty clusters && streamBundle.clusterAppList.isNotEmpty() //Filter empty clusters
&& streamBundle.clusterAppList.count() >= 1 //Filter clusters with single apps (mostly promotions) && streamBundle.clusterAppList.count() > 1 //Filter clusters with single apps (mostly promotions)
} }
override fun buildModels(streamBundle: StreamBundle?) { override fun buildModels(streamBundle: StreamBundle?) {

View File

@@ -26,12 +26,12 @@ import com.airbnb.epoxy.CallbackProp
import com.airbnb.epoxy.ModelProp import com.airbnb.epoxy.ModelProp
import com.airbnb.epoxy.ModelView import com.airbnb.epoxy.ModelView
import com.airbnb.epoxy.OnViewRecycled import com.airbnb.epoxy.OnViewRecycled
import com.aurora.extensions.clear
import com.aurora.extensions.load
import com.aurora.extensions.px
import com.aurora.gplayapi.data.models.Artwork import com.aurora.gplayapi.data.models.Artwork
import com.aurora.store.R import com.aurora.store.R
import com.aurora.store.databinding.ViewScreenshotMiniBinding import com.aurora.store.databinding.ViewScreenshotMiniBinding
import com.aurora.extensions.clear
import com.aurora.extensions.load
import com.aurora.extensions.px
import com.aurora.store.view.epoxy.views.BaseView import com.aurora.store.view.epoxy.views.BaseView
import com.bumptech.glide.load.resource.bitmap.RoundedCorners import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
@@ -79,11 +79,7 @@ class MiniScreenshotView : RelativeLayout {
@ModelProp @ModelProp
fun artwork(artwork: Artwork) { fun artwork(artwork: Artwork) {
normalizeSize(artwork) normalizeSize(artwork)
val imgUrl = if (artwork.url.endsWith(".webp")) B.img.load("${artwork.url}=rw-w480-v1-e15", DrawableTransitionOptions.withCrossFade()) {
artwork.url
else
"${artwork.url}=rw-w480-v1-e15"
B.img.load(imgUrl, DrawableTransitionOptions.withCrossFade()) {
placeholder(R.drawable.bg_rounded) placeholder(R.drawable.bg_rounded)
transform(RoundedCorners(8.px.toInt())) transform(RoundedCorners(8.px.toInt()))
} }

View File

@@ -26,12 +26,12 @@ import com.airbnb.epoxy.CallbackProp
import com.airbnb.epoxy.ModelProp import com.airbnb.epoxy.ModelProp
import com.airbnb.epoxy.ModelView import com.airbnb.epoxy.ModelView
import com.airbnb.epoxy.OnViewRecycled import com.airbnb.epoxy.OnViewRecycled
import com.aurora.extensions.clear
import com.aurora.extensions.load
import com.aurora.extensions.px
import com.aurora.gplayapi.data.models.Artwork import com.aurora.gplayapi.data.models.Artwork
import com.aurora.store.R import com.aurora.store.R
import com.aurora.store.databinding.ViewScreenshotBinding import com.aurora.store.databinding.ViewScreenshotBinding
import com.aurora.extensions.clear
import com.aurora.extensions.load
import com.aurora.extensions.px
import com.aurora.store.view.epoxy.views.BaseView import com.aurora.store.view.epoxy.views.BaseView
import com.bumptech.glide.load.resource.bitmap.RoundedCorners import com.bumptech.glide.load.resource.bitmap.RoundedCorners
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
@@ -79,11 +79,7 @@ class ScreenshotView : RelativeLayout {
@ModelProp @ModelProp
fun artwork(artwork: Artwork) { fun artwork(artwork: Artwork) {
normalizeSize(artwork) normalizeSize(artwork)
val imgUrl = if (artwork.url.endsWith(".webp")) B.img.load("${artwork.url}=rw-w480-v1-e15", DrawableTransitionOptions.withCrossFade()) {
artwork.url
else
"${artwork.url}=rw-w480-v1-e15"
B.img.load(imgUrl, DrawableTransitionOptions.withCrossFade()) {
placeholder(R.drawable.bg_rounded) placeholder(R.drawable.bg_rounded)
transform(RoundedCorners(8.px.toInt())) transform(RoundedCorners(8.px.toInt()))
} }

View File

@@ -144,7 +144,6 @@ class AppDetailsActivity : BaseDetailsActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
B = ActivityDetailsBinding.inflate(layoutInflater) B = ActivityDetailsBinding.inflate(layoutInflater)
authData = AuthProvider.with(this).getAuthData()
setContentView(B.root) setContentView(B.root)
onNewIntent(intent) onNewIntent(intent)
@@ -175,9 +174,7 @@ class AppDetailsActivity : BaseDetailsActivity() {
} else { } else {
isExternal = true isExternal = true
app = App(packageName) app = App(packageName)
if (app.inPlayStore) { fetchCompleteApp()
fetchCompleteApp()
}
} }
} else { } else {
val rawApp: String? = intent.getStringExtra(Constants.STRING_EXTRA) val rawApp: String? = intent.getStringExtra(Constants.STRING_EXTRA)
@@ -186,11 +183,7 @@ class AppDetailsActivity : BaseDetailsActivity() {
isInstalled = PackageUtil.isInstalled(this, app.packageName) isInstalled = PackageUtil.isInstalled(this, app.packageName)
inflatePartialApp() inflatePartialApp()
if (app.inPlayStore) { fetchCompleteApp()
fetchCompleteApp()
} else {
inflateExtraDetails(app)
}
} else { } else {
close() close()
} }
@@ -324,6 +317,7 @@ class AppDetailsActivity : BaseDetailsActivity() {
private fun fetchCompleteApp() { private fun fetchCompleteApp() {
task { task {
authData = AuthProvider.with(this).getAuthData()
return@task AppDetailsHelper(authData) return@task AppDetailsHelper(authData)
.using(HttpClient.getPreferredClient()) .using(HttpClient.getPreferredClient())
.getAppByPackageName(app.packageName) .getAppByPackageName(app.packageName)
@@ -385,30 +379,23 @@ class AppDetailsActivity : BaseDetailsActivity() {
app?.let { app?.let {
B.viewFlipper.displayedChild = 1 B.viewFlipper.displayedChild = 1
inflateAppDescription(B.layoutDetailDescription, app) inflateAppDescription(B.layoutDetailDescription, app)
inflateAppRatingAndReviews(B.layoutDetailsReview, app)
inflateAppDevInfo(B.layoutDetailsDev, app) inflateAppDevInfo(B.layoutDetailsDev, app)
inflateAppPrivacy(B.layoutDetailsPrivacy, app) inflateAppPrivacy(B.layoutDetailsPrivacy, app)
inflateAppPermission(B.layoutDetailsPermissions, app) inflateAppPermission(B.layoutDetailsPermissions, app)
if (app.inPlayStore) { if (!authData.isAnonymous) {
inflateAppRatingAndReviews(B.layoutDetailsReview, app) app.testingProgram?.let {
if (!authData.isAnonymous) { if (it.isAvailable && it.isSubscribed) {
app.testingProgram?.let { B.layoutDetailsApp.txtLine1.text = it.displayName
if (it.isAvailable && it.isSubscribed) {
B.layoutDetailsApp.txtLine1.text = it.displayName
}
} }
inflateBetaSubscription(B.layoutDetailsBeta, app)
} }
if (Preferences.getBoolean(this, Preferences.PREFERENCE_SIMILAR)) { inflateBetaSubscription(B.layoutDetailsBeta, app)
inflateAppStream(B.epoxyRecyclerStream, app) }
}
} else { if (Preferences.getBoolean(this, Preferences.PREFERENCE_SIMILAR)) {
B.layoutDetailsReview.root.hide() inflateAppStream(B.epoxyRecyclerStream, app)
B.layoutDetailsBeta.root.hide()
B.epoxyRecyclerStream.hide()
} }
} }
} }
@@ -438,16 +425,13 @@ class AppDetailsActivity : BaseDetailsActivity() {
updateActionState(State.PROGRESS) updateActionState(State.PROGRESS)
task { task {
if (app.inPlayStore) { val authData = AuthProvider
PurchaseHelper(authData) .with(this)
.using(HttpClient.getPreferredClient()) .getAuthData()
.purchase(app.packageName, app.versionCode, app.offerType)
} else { PurchaseHelper(authData)
val metaFile = app.fileList[0] .using(HttpClient.getPreferredClient())
val fileList: MutableList<File> = mutableListOf() .purchase(app.packageName, app.versionCode, app.offerType)
fileList.add(metaFile)
fileList
}
} successUi { files -> } successUi { files ->
if (files.isNotEmpty()) { if (files.isNotEmpty()) {
var hasOBB = false var hasOBB = false

View File

@@ -45,9 +45,6 @@ abstract class BaseClusterViewModel(application: Application) : BaseAndroidViewM
val liveData: MutableLiveData<ViewState> = MutableLiveData() val liveData: MutableLiveData<ViewState> = MutableLiveData()
var streamBundle: StreamBundle = StreamBundle() var streamBundle: StreamBundle = StreamBundle()
/* Should certainly do it in a better way :(*/
var promotionsAdded: Boolean = false
lateinit var type: StreamHelper.Type lateinit var type: StreamHelper.Type
lateinit var category: StreamHelper.Category lateinit var category: StreamHelper.Category
@@ -75,13 +72,6 @@ abstract class BaseClusterViewModel(application: Application) : BaseAndroidViewM
type type
) )
//Add promotional cluster
if (!promotionsAdded) {
val promotionalCluster = promotionalCluster()
newBundle.streamClusters[promotionalCluster.id] = promotionalCluster
promotionsAdded = true
}
//Update old bundle //Update old bundle
streamBundle.apply { streamBundle.apply {
streamClusters.putAll(newBundle.streamClusters) streamClusters.putAll(newBundle.streamClusters)
@@ -128,15 +118,4 @@ abstract class BaseClusterViewModel(application: Application) : BaseAndroidViewM
clusterNextPageUrl = newCluster.clusterNextPageUrl clusterNextPageUrl = newCluster.clusterNextPageUrl
} }
} }
private fun promotionalCluster(): StreamCluster {
val response = HttpClient.getPreferredClient().get(
"https://promotions.auroraoss.com",
hashMapOf()
)
return if (response.isSuccessful)
gson.fromJson(String(response.responseBytes), StreamCluster::class.java)
else
StreamCluster()
}
} }