mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 02:47:38 +00:00
Show notification when stub is updated to full
This commit is contained in:
parent
3956cbe2d2
commit
77a275cbcd
@ -61,7 +61,6 @@ object Config : PreferenceModel, DBConfig {
|
||||
const val BOOT_ID = "boot_id"
|
||||
const val ASKED_HOME = "asked_home"
|
||||
const val DOH = "doh"
|
||||
const val SHOW_UPDATE_DONE = "update_done"
|
||||
}
|
||||
|
||||
object Value {
|
||||
@ -134,7 +133,6 @@ object Config : PreferenceModel, DBConfig {
|
||||
var suTapjack by preference(Key.SU_TAPJACK, true)
|
||||
var checkUpdate by preference(Key.CHECK_UPDATES, true)
|
||||
var doh by preference(Key.DOH, false)
|
||||
var showUpdateDone by preference(Key.SHOW_UPDATE_DONE, false)
|
||||
var showSystemApp by preference(Key.SHOW_SYSTEM_APP, false)
|
||||
|
||||
var customChannelUrl by preference(Key.CUSTOM_CHANNEL, "")
|
||||
|
@ -47,9 +47,10 @@ open class Receiver : BaseReceiver() {
|
||||
}
|
||||
Intent.ACTION_LOCALE_CHANGED -> Shortcuts.setupDynamic(context)
|
||||
Intent.ACTION_MY_PACKAGE_REPLACED -> {
|
||||
if (Config.showUpdateDone) {
|
||||
@Suppress("DEPRECATION")
|
||||
val installer = context.packageManager.getInstallerPackageName(context.packageName)
|
||||
if (installer == context.packageName) {
|
||||
Notifications.updateDone(context)
|
||||
Config.showUpdateDone = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -75,11 +75,6 @@ class DownloadService : NotificationService() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun APKInstall.Session.open(): OutputStream {
|
||||
Config.showUpdateDone = true
|
||||
return openStream(this@DownloadService)
|
||||
}
|
||||
|
||||
private suspend fun handleApp(stream: InputStream, subject: Subject.App) {
|
||||
fun writeTee(output: OutputStream) {
|
||||
val uri = MediaStoreUtils.getFile("${subject.title}.apk").uri
|
||||
@ -115,7 +110,7 @@ class DownloadService : NotificationService() {
|
||||
|
||||
// Install
|
||||
val session = APKInstall.startSession(this)
|
||||
patched.inputStream().copyAndClose(session.open())
|
||||
patched.inputStream().copyAndClose(session.openStream(this))
|
||||
subject.intent = session.waitIntent()
|
||||
|
||||
patched.delete()
|
||||
@ -137,7 +132,7 @@ class DownloadService : NotificationService() {
|
||||
}
|
||||
} else {
|
||||
val session = APKInstall.startSession(this)
|
||||
writeTee(session.open())
|
||||
writeTee(session.openStream(this))
|
||||
subject.intent = session.waitIntent()
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,6 @@ class MainActivity : BaseMainActivity<ActivityMainMd2Binding>() {
|
||||
setContentView()
|
||||
showUnsupportedMessage()
|
||||
askForHomeShortcut()
|
||||
Config.showUpdateDone = false
|
||||
|
||||
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE)
|
||||
|
||||
|
@ -52,6 +52,7 @@ object Notifications {
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
fun updateDone(context: Context) {
|
||||
setup(context)
|
||||
val flag = PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
|
||||
val pending = PendingIntent.getActivity(context, 0, selfLaunchIntent(context), flag)
|
||||
val builder = if (SDK_INT >= 26) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user