diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 8c66a5958..c68aec025 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -55,17 +55,20 @@ android:name=".AuroraApplication" android:allowBackup="true" android:banner="@drawable/ic_launcher_background" + android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" + android:killAfterRestore="false" android:label="@string/app_name" android:requestLegacyExternalStorage="true" + android:restoreAnyVersion="true" + android:restoreNeedsApplication="true" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme" android:usesCleartextTraffic="true" tools:targetApi="m"> - + @@ -82,11 +85,35 @@ android:name=".MainActivity" android:launchMode="singleTask" /> + + + + + + + + + + + + + + + + + + + + + + + + + - diff --git a/app/src/main/java/com/aurora/store/view/ui/details/AppDetailsActivity.kt b/app/src/main/java/com/aurora/store/view/ui/details/AppDetailsActivity.kt index 778a74e3a..4c6a871a4 100644 --- a/app/src/main/java/com/aurora/store/view/ui/details/AppDetailsActivity.kt +++ b/app/src/main/java/com/aurora/store/view/ui/details/AppDetailsActivity.kt @@ -34,6 +34,7 @@ import com.aurora.gplayapi.data.models.AuthData import com.aurora.gplayapi.data.models.File import com.aurora.gplayapi.helpers.AppDetailsHelper import com.aurora.gplayapi.helpers.PurchaseHelper +import com.aurora.store.MainActivity import com.aurora.store.R import com.aurora.store.data.downloader.DownloadManager import com.aurora.store.data.downloader.RequestBuilder @@ -70,6 +71,7 @@ class AppDetailsActivity : BaseDetailsActivity() { private lateinit var fetch: Fetch private lateinit var fetchGroupListener: FetchGroupListener + private var isExternal = false private var isNone = false private var status = Status.NONE private var isInstalled: Boolean = false @@ -119,6 +121,14 @@ class AppDetailsActivity : BaseDetailsActivity() { onNewIntent(intent) } + override fun onBackPressed() { + if (isExternal) { + open(MainActivity::class.java, true) + } + super.onBackPressed() + + } + override fun onResume() { if (!isLAndAbove()) { checkAndSetupInstall() @@ -128,16 +138,27 @@ class AppDetailsActivity : BaseDetailsActivity() { override fun onNewIntent(intent: 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() - - fetchCompleteApp() + if (intent.scheme != null && (intent.scheme == "market" || intent.scheme == "http" || intent.scheme == "https")) { + val packageName = intent.data!!.getQueryParameter("id") + if (packageName.isNullOrEmpty()) { + close() + } else { + isExternal = true + app = App(packageName) + fetchCompleteApp() + } } 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()) .getAppByPackageName(app.packageName) } successUi { + if (isExternal) { + app = it + inflatePartialApp() + } inflateExtraDetails(it) } failUi { toast("Failed to fetch app details") @@ -240,12 +265,14 @@ class AppDetailsActivity : BaseDetailsActivity() { } private fun inflatePartialApp() { - attachWhiteListStatus() - attachHeader() - attachToolbar() - attachBottomSheet() - attachFetch() - attachActions() + if (::app.isInitialized) { + attachWhiteListStatus() + attachHeader() + attachToolbar() + attachBottomSheet() + attachFetch() + attachActions() + } } private fun attachHeader() { diff --git a/app/src/main/java/com/aurora/store/view/ui/details/BaseDetailsActivity.kt b/app/src/main/java/com/aurora/store/view/ui/details/BaseDetailsActivity.kt index 6933a1e56..2b47640cb 100644 --- a/app/src/main/java/com/aurora/store/view/ui/details/BaseDetailsActivity.kt +++ b/app/src/main/java/com/aurora/store/view/ui/details/BaseDetailsActivity.kt @@ -55,6 +55,7 @@ import nl.komponents.kovenant.ui.successUi import org.json.JSONObject import java.util.* + abstract class BaseDetailsActivity : BaseActivity() { private val exodusBaseUrl = "https://reports.exodus-privacy.eu.org/api/search/" @@ -267,7 +268,7 @@ abstract class BaseDetailsActivity : BaseActivity() { } } failUi { updateBetaActions(B, betaProgram.isSubscribed) - toast("Failed to update beta status") + toast(getString(R.string.details_beta_delay)) } } } else { @@ -286,8 +287,22 @@ abstract class BaseDetailsActivity : BaseActivity() { } } - //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) { val intent = Intent( this,