Compare commits
1 commit
85636bcbb8
...
92a85771a2
Author | SHA1 | Date | |
---|---|---|---|
92a85771a2 |
2 changed files with 13 additions and 14 deletions
|
@ -380,6 +380,16 @@ class EuiccChannelManagerService : LifecycleService(), OpenEuiccContextMarker {
|
|||
getString(R.string.task_profile_download_failure),
|
||||
R.drawable.ic_task_sim_card_download
|
||||
) {
|
||||
val callback = object : ProfileDownloadCallback {
|
||||
override fun onStateUpdate(state: ProfileDownloadCallback.DownloadState) {
|
||||
if (state.progress == 0) return
|
||||
foregroundTaskState.value = ForegroundTaskState.InProgress(state.progress)
|
||||
}
|
||||
|
||||
override fun onProfileMetadata(metadata: ProfileDownloadCallback.ProfileMetadata) {
|
||||
Log.d(TAG, "Received profile metadata: $metadata")
|
||||
}
|
||||
}
|
||||
euiccChannelManager.beginTrackedOperation(slotId, portId) {
|
||||
euiccChannelManager.withEuiccChannel(slotId, portId) { channel ->
|
||||
channel.lpa.downloadProfile(
|
||||
|
@ -387,13 +397,8 @@ class EuiccChannelManagerService : LifecycleService(), OpenEuiccContextMarker {
|
|||
matchingId,
|
||||
imei,
|
||||
confirmationCode,
|
||||
object : ProfileDownloadCallback {
|
||||
override fun onStateUpdate(state: ProfileDownloadCallback.DownloadState) {
|
||||
if (state.progress == 0) return
|
||||
foregroundTaskState.value =
|
||||
ForegroundTaskState.InProgress(state.progress)
|
||||
}
|
||||
})
|
||||
callback
|
||||
)
|
||||
}
|
||||
|
||||
preferenceRepository.notificationDownloadFlow.first()
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
package net.typeblog.lpac_jni
|
||||
|
||||
import android.util.Log
|
||||
|
||||
interface ProfileDownloadCallback {
|
||||
companion object {
|
||||
private const val TAG = "ProfileDownloadCallback"
|
||||
|
||||
fun lookupStateFromProgress(progress: Int): DownloadState = when (progress) {
|
||||
0 -> DownloadState.Preparing
|
||||
20 -> DownloadState.Connecting
|
||||
|
@ -35,7 +31,5 @@ interface ProfileDownloadCallback {
|
|||
|
||||
fun onStateUpdate(state: DownloadState)
|
||||
|
||||
fun onProfileMetadata(metadata: ProfileMetadata) {
|
||||
Log.d(TAG, "Received profile metadata: $metadata")
|
||||
}
|
||||
fun onProfileMetadata(metadata: ProfileMetadata)
|
||||
}
|
Loading…
Add table
Reference in a new issue