fix import from wizard
This commit is contained in:
parent
80c12a2c21
commit
76f1407d2c
2 changed files with 12 additions and 0 deletions
|
@ -21,6 +21,7 @@ import info.nightscout.androidaps.logging.AAPSLogger
|
|||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.formats.*
|
||||
import info.nightscout.androidaps.setupwizard.SetupWizardActivity
|
||||
import info.nightscout.androidaps.utils.AndroidPermission
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.ToastUtils
|
||||
|
@ -270,6 +271,8 @@ class ImportExportPrefs @Inject constructor(
|
|||
activity.callForPrefFile.launch(null)
|
||||
if (activity is MainActivity)
|
||||
activity.callForPrefFile.launch(null)
|
||||
if (activity is SetupWizardActivity)
|
||||
activity.callForPrefFile.launch(null)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
// this exception happens on some early implementations of ActivityResult contracts
|
||||
// when registered and called for the second time
|
||||
|
|
|
@ -14,6 +14,8 @@ import info.nightscout.androidaps.events.EventProfileNeedsUpdate
|
|||
import info.nightscout.androidaps.events.EventProfileStoreChanged
|
||||
import info.nightscout.androidaps.events.EventPumpStatusChanged
|
||||
import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefs
|
||||
import info.nightscout.androidaps.plugins.general.maintenance.PrefsFileContract
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientStatus
|
||||
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
|
||||
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
|
||||
|
@ -42,6 +44,7 @@ class SetupWizardActivity : NoSplashAppCompatActivity() {
|
|||
@Inject lateinit var resourceHelper: ResourceHelper
|
||||
@Inject lateinit var sp: SP
|
||||
@Inject lateinit var fabricPrivacy: FabricPrivacy
|
||||
@Inject lateinit var importExportPrefs: ImportExportPrefs
|
||||
|
||||
private val disposable = CompositeDisposable()
|
||||
private lateinit var screens: List<SWScreen>
|
||||
|
@ -49,6 +52,12 @@ class SetupWizardActivity : NoSplashAppCompatActivity() {
|
|||
|
||||
private val intentMessage = "WIZZARDPAGE"
|
||||
|
||||
val callForPrefFile = registerForActivityResult(PrefsFileContract()) {
|
||||
it?.let {
|
||||
importExportPrefs.importSharedPreferences(this, it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
update(applicationContext)
|
||||
|
|
Loading…
Reference in a new issue