mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 19:32:16 +00:00
Reverts most changes to MainActivity and uses handleSpecialIntent instead. handleSpecialIntent now defers installer prompt to InstallerService by starting it again. SpecialIntent has been modified to accommodate extra data needed to handle these callbacks.
35 lines
1.2 KiB
Kotlin
35 lines
1.2 KiB
Kotlin
package com.looker.droidify
|
|
|
|
import android.content.Context
|
|
import android.content.Intent
|
|
import android.content.pm.PackageInstaller
|
|
import com.looker.droidify.ContextWrapperX.Companion.wrap
|
|
import com.looker.droidify.screen.ScreenActivity
|
|
|
|
class MainActivity : ScreenActivity() {
|
|
companion object {
|
|
const val ACTION_UPDATES = "${BuildConfig.APPLICATION_ID}.intent.action.UPDATES"
|
|
const val ACTION_INSTALL = "${BuildConfig.APPLICATION_ID}.intent.action.INSTALL"
|
|
const val EXTRA_CACHE_FILE_NAME =
|
|
"${BuildConfig.APPLICATION_ID}.intent.extra.CACHE_FILE_NAME"
|
|
}
|
|
|
|
override fun handleIntent(intent: Intent?) {
|
|
when (intent?.action) {
|
|
ACTION_UPDATES -> handleSpecialIntent(SpecialIntent.Updates)
|
|
ACTION_INSTALL -> handleSpecialIntent(
|
|
SpecialIntent.Install(
|
|
intent.packageName,
|
|
intent.getIntExtra(PackageInstaller.EXTRA_STATUS, -1),
|
|
intent.getParcelableExtra(Intent.EXTRA_INTENT)
|
|
)
|
|
)
|
|
else -> super.handleIntent(intent)
|
|
}
|
|
}
|
|
|
|
override fun attachBaseContext(newBase: Context) {
|
|
super.attachBaseContext(wrap(newBase))
|
|
}
|
|
}
|