AndroidAPS/app/src/main/java/info/nightscout/androidaps/activities/RequestDexcomPermissionActivity.kt

22 lines
759 B
Kotlin
Raw Normal View History

2019-06-19 01:38:55 +02:00
package info.nightscout.androidaps.activities
import android.os.Bundle
2019-12-30 23:26:48 +01:00
import info.nightscout.androidaps.plugins.source.DexcomPlugin
import javax.inject.Inject
2019-06-19 01:38:55 +02:00
2020-01-26 18:17:00 +01:00
class RequestDexcomPermissionActivity : DialogAppCompatActivity() {
2019-12-30 23:26:48 +01:00
@Inject lateinit var dexcomPlugin: DexcomPlugin
2019-06-19 01:38:55 +02:00
2021-05-18 22:31:08 +02:00
private val requestCode = "AndroidAPS <3".map { it.code }.sum()
2019-06-19 01:38:55 +02:00
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
2020-01-10 23:14:58 +01:00
requestPermissions(arrayOf(DexcomPlugin.PERMISSION), requestCode)
2019-06-19 01:38:55 +02:00
}
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
2021-01-18 22:47:55 +01:00
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
2019-06-19 01:38:55 +02:00
finish()
}
}