mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-05 23:14:03 -05:00
Added install implementation
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.topjohnwu.magisk.model.events
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.karumi.dexter.Dexter
|
||||
import com.karumi.dexter.MultiplePermissionsReport
|
||||
@@ -96,3 +97,20 @@ class RecreateEvent : ViewEvent(), ActivityExecutor {
|
||||
activity.recreate()
|
||||
}
|
||||
}
|
||||
|
||||
class RequestFileEvent : ViewEvent(), ActivityExecutor {
|
||||
override fun invoke(activity: AppCompatActivity) {
|
||||
Intent(Intent.ACTION_GET_CONTENT)
|
||||
.setType("*/*")
|
||||
.addCategory(Intent.CATEGORY_OPENABLE)
|
||||
.also { activity.startActivityForResult(it, REQUEST_CODE) }
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val REQUEST_CODE = 10
|
||||
fun resolve(requestCode: Int, resultCode: Int, data: Intent?) = data
|
||||
?.takeIf { resultCode == Activity.RESULT_OK }
|
||||
?.takeIf { requestCode == REQUEST_CODE }
|
||||
?.data
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user