Allow parsing app listing URLs
This commit is contained in:
@@ -55,17 +55,20 @@
|
|||||||
android:name=".AuroraApplication"
|
android:name=".AuroraApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:banner="@drawable/ic_launcher_background"
|
android:banner="@drawable/ic_launcher_background"
|
||||||
|
android:hardwareAccelerated="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:killAfterRestore="false"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:requestLegacyExternalStorage="true"
|
android:requestLegacyExternalStorage="true"
|
||||||
|
android:restoreAnyVersion="true"
|
||||||
|
android:restoreNeedsApplication="true"
|
||||||
android:roundIcon="@mipmap/ic_launcher_round"
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:usesCleartextTraffic="true"
|
android:usesCleartextTraffic="true"
|
||||||
tools:targetApi="m">
|
tools:targetApi="m">
|
||||||
|
|
||||||
<activity
|
<activity android:name=".view.ui.onboarding.OnboardingActivity">
|
||||||
android:name=".view.ui.onboarding.OnboardingActivity">
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
@@ -82,11 +85,35 @@
|
|||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:launchMode="singleTask" />
|
android:launchMode="singleTask" />
|
||||||
|
|
||||||
|
<activity android:name=".view.ui.details.AppDetailsActivity">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data android:scheme="http" />
|
||||||
|
<data android:scheme="https" />
|
||||||
|
<data android:host="market.android.com" />
|
||||||
|
<data android:path="/store/apps/details" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
|
<data android:scheme="http" />
|
||||||
|
<data android:scheme="https" />
|
||||||
|
<data android:host="play.google.com" />
|
||||||
|
<data android:path="/store/apps/details" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
<activity android:name=".view.ui.search.SearchSuggestionActivity" />
|
<activity android:name=".view.ui.search.SearchSuggestionActivity" />
|
||||||
<activity android:name=".view.ui.search.SearchResultsActivity" />
|
<activity android:name=".view.ui.search.SearchResultsActivity" />
|
||||||
<activity android:name=".view.ui.commons.StreamBrowseActivity" />
|
<activity android:name=".view.ui.commons.StreamBrowseActivity" />
|
||||||
<activity android:name=".view.ui.sale.AppSalesActivity" />
|
<activity android:name=".view.ui.sale.AppSalesActivity" />
|
||||||
<activity android:name=".view.ui.details.AppDetailsActivity" />
|
|
||||||
<activity android:name=".view.ui.details.ScreenshotActivity" />
|
<activity android:name=".view.ui.details.ScreenshotActivity" />
|
||||||
<activity android:name=".view.ui.all.AppsGamesActivity" />
|
<activity android:name=".view.ui.all.AppsGamesActivity" />
|
||||||
<activity android:name=".view.ui.commons.CategoryBrowseActivity" />
|
<activity android:name=".view.ui.commons.CategoryBrowseActivity" />
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import com.aurora.gplayapi.data.models.AuthData
|
|||||||
import com.aurora.gplayapi.data.models.File
|
import com.aurora.gplayapi.data.models.File
|
||||||
import com.aurora.gplayapi.helpers.AppDetailsHelper
|
import com.aurora.gplayapi.helpers.AppDetailsHelper
|
||||||
import com.aurora.gplayapi.helpers.PurchaseHelper
|
import com.aurora.gplayapi.helpers.PurchaseHelper
|
||||||
|
import com.aurora.store.MainActivity
|
||||||
import com.aurora.store.R
|
import com.aurora.store.R
|
||||||
import com.aurora.store.data.downloader.DownloadManager
|
import com.aurora.store.data.downloader.DownloadManager
|
||||||
import com.aurora.store.data.downloader.RequestBuilder
|
import com.aurora.store.data.downloader.RequestBuilder
|
||||||
@@ -70,6 +71,7 @@ class AppDetailsActivity : BaseDetailsActivity() {
|
|||||||
private lateinit var fetch: Fetch
|
private lateinit var fetch: Fetch
|
||||||
private lateinit var fetchGroupListener: FetchGroupListener
|
private lateinit var fetchGroupListener: FetchGroupListener
|
||||||
|
|
||||||
|
private var isExternal = false
|
||||||
private var isNone = false
|
private var isNone = false
|
||||||
private var status = Status.NONE
|
private var status = Status.NONE
|
||||||
private var isInstalled: Boolean = false
|
private var isInstalled: Boolean = false
|
||||||
@@ -119,6 +121,14 @@ class AppDetailsActivity : BaseDetailsActivity() {
|
|||||||
onNewIntent(intent)
|
onNewIntent(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onBackPressed() {
|
||||||
|
if (isExternal) {
|
||||||
|
open(MainActivity::class.java, true)
|
||||||
|
}
|
||||||
|
super.onBackPressed()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
if (!isLAndAbove()) {
|
if (!isLAndAbove()) {
|
||||||
checkAndSetupInstall()
|
checkAndSetupInstall()
|
||||||
@@ -128,16 +138,27 @@ class AppDetailsActivity : BaseDetailsActivity() {
|
|||||||
|
|
||||||
override fun onNewIntent(intent: Intent) {
|
override fun onNewIntent(intent: Intent) {
|
||||||
super.onNewIntent(intent)
|
super.onNewIntent(intent)
|
||||||
val itemRaw: String? = intent.getStringExtra(Constants.STRING_EXTRA)
|
|
||||||
if (itemRaw != null) {
|
|
||||||
app = gson.fromJson(itemRaw, App::class.java)
|
|
||||||
isInstalled = PackageUtil.isInstalled(this, app.packageName)
|
|
||||||
|
|
||||||
inflatePartialApp()
|
if (intent.scheme != null && (intent.scheme == "market" || intent.scheme == "http" || intent.scheme == "https")) {
|
||||||
|
val packageName = intent.data!!.getQueryParameter("id")
|
||||||
fetchCompleteApp()
|
if (packageName.isNullOrEmpty()) {
|
||||||
|
close()
|
||||||
|
} else {
|
||||||
|
isExternal = true
|
||||||
|
app = App(packageName)
|
||||||
|
fetchCompleteApp()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
close()
|
val rawApp: String? = intent.getStringExtra(Constants.STRING_EXTRA)
|
||||||
|
if (rawApp != null) {
|
||||||
|
app = gson.fromJson(rawApp, App::class.java)
|
||||||
|
isInstalled = PackageUtil.isInstalled(this, app.packageName)
|
||||||
|
|
||||||
|
inflatePartialApp()
|
||||||
|
fetchCompleteApp()
|
||||||
|
} else {
|
||||||
|
close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,6 +254,10 @@ class AppDetailsActivity : BaseDetailsActivity() {
|
|||||||
.using(HttpClient.getPreferredClient())
|
.using(HttpClient.getPreferredClient())
|
||||||
.getAppByPackageName(app.packageName)
|
.getAppByPackageName(app.packageName)
|
||||||
} successUi {
|
} successUi {
|
||||||
|
if (isExternal) {
|
||||||
|
app = it
|
||||||
|
inflatePartialApp()
|
||||||
|
}
|
||||||
inflateExtraDetails(it)
|
inflateExtraDetails(it)
|
||||||
} failUi {
|
} failUi {
|
||||||
toast("Failed to fetch app details")
|
toast("Failed to fetch app details")
|
||||||
@@ -240,12 +265,14 @@ class AppDetailsActivity : BaseDetailsActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun inflatePartialApp() {
|
private fun inflatePartialApp() {
|
||||||
attachWhiteListStatus()
|
if (::app.isInitialized) {
|
||||||
attachHeader()
|
attachWhiteListStatus()
|
||||||
attachToolbar()
|
attachHeader()
|
||||||
attachBottomSheet()
|
attachToolbar()
|
||||||
attachFetch()
|
attachBottomSheet()
|
||||||
attachActions()
|
attachFetch()
|
||||||
|
attachActions()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun attachHeader() {
|
private fun attachHeader() {
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ import nl.komponents.kovenant.ui.successUi
|
|||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
abstract class BaseDetailsActivity : BaseActivity() {
|
abstract class BaseDetailsActivity : BaseActivity() {
|
||||||
|
|
||||||
private val exodusBaseUrl = "https://reports.exodus-privacy.eu.org/api/search/"
|
private val exodusBaseUrl = "https://reports.exodus-privacy.eu.org/api/search/"
|
||||||
@@ -267,7 +268,7 @@ abstract class BaseDetailsActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
} failUi {
|
} failUi {
|
||||||
updateBetaActions(B, betaProgram.isSubscribed)
|
updateBetaActions(B, betaProgram.isSubscribed)
|
||||||
toast("Failed to update beta status")
|
toast(getString(R.string.details_beta_delay))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -286,8 +287,22 @@ abstract class BaseDetailsActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Helpers
|
//Helpers
|
||||||
|
|
||||||
|
open fun getIntentPackageName(intent: Intent): String? {
|
||||||
|
if (intent.hasExtra(Constants.STRING_EXTRA)) {
|
||||||
|
return intent.getStringExtra(Constants.STRING_EXTRA)
|
||||||
|
} else if (intent.scheme != null && (intent.scheme == "market" || intent.scheme == "http" || intent.scheme == "https")
|
||||||
|
) {
|
||||||
|
return intent.data!!.getQueryParameter("id")
|
||||||
|
} else if (intent.extras != null) {
|
||||||
|
val bundle = intent.extras
|
||||||
|
return bundle!!.getString(Constants.STRING_EXTRA)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun openScreenshotActivity(app: App, position: Int) {
|
private fun openScreenshotActivity(app: App, position: Int) {
|
||||||
val intent = Intent(
|
val intent = Intent(
|
||||||
this,
|
this,
|
||||||
|
|||||||
Reference in New Issue
Block a user