@@ -14,6 +14,7 @@ import androidx.work.Data
1414import androidx.work.ForegroundInfo
1515import androidx.work.WorkManager
1616import androidx.work.WorkerParameters
17+ import androidx.work.workDataOf
1718import kotlinx.coroutines.Dispatchers
1819import kotlinx.coroutines.async
1920import kotlinx.coroutines.awaitAll
@@ -192,24 +193,12 @@ sealed class SubscriptionImportInput : Parcelable {
192193 data class PreviousExportMode (val url : String ) : SubscriptionImportInput()
193194
194195 fun toData (): Data {
195- return when (this ) {
196- is ChannelUrlMode -> Data .Builder ()
197- .putInt(" mode" , CHANNEL_URL_MODE )
198- .putInt(" service_id" , serviceId)
199- .putString(" url" , url)
200- .build()
201- is InputStreamMode ->
202- Data .Builder ()
203- .putInt(" mode" , INPUT_STREAM_MODE )
204- .putInt(" service_id" , serviceId)
205- .putString(" url" , url)
206- .build()
207- is PreviousExportMode ->
208- Data .Builder ()
209- .putInt(" mode" , PREVIOUS_EXPORT_MODE )
210- .putString(" url" , url)
211- .build()
196+ val (mode, serviceId, url) = when (this ) {
197+ is ChannelUrlMode -> Triple (CHANNEL_URL_MODE , serviceId, url)
198+ is InputStreamMode -> Triple (INPUT_STREAM_MODE , serviceId, url)
199+ is PreviousExportMode -> Triple (PREVIOUS_EXPORT_MODE , null , url)
212200 }
201+ return workDataOf(" mode" to mode, " service_id" to serviceId, " url" to url)
213202 }
214203
215204 companion object {
0 commit comments