Skip to content

Commit

Permalink
Fix remaining deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Isira-Seneviratne committed Aug 19, 2024
1 parent 952ef83 commit 3cd8773
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ import org.wikipedia.Constants
import org.wikipedia.dataclient.ServiceFactory
import org.wikipedia.descriptions.DescriptionEditActivity
import org.wikipedia.extensions.parcelable
import org.wikipedia.extensions.serializable
import org.wikipedia.suggestededits.PageSummaryForEdit
import org.wikipedia.util.Resource

class ImagePreviewViewModel(bundle: Bundle) : ViewModel() {

private val handler = CoroutineExceptionHandler { _, throwable ->
_uiState.value = Resource.Error(throwable)
}
var pageSummaryForEdit = bundle.parcelable<PageSummaryForEdit>(ImagePreviewDialog.ARG_SUMMARY)!!
var action = bundle.getSerializable(ImagePreviewDialog.ARG_ACTION) as DescriptionEditActivity.Action?
var action = bundle.serializable<DescriptionEditActivity.Action>(ImagePreviewDialog.ARG_ACTION)

private val _uiState = MutableStateFlow(Resource<FilePage>())
val uiState = _uiState.asStateFlow()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ import org.wikipedia.dataclient.ServiceFactory
import org.wikipedia.dataclient.WikiSite
import org.wikipedia.dataclient.mwapi.TemplateDataResponse
import org.wikipedia.extensions.parcelable
import org.wikipedia.extensions.serializable
import org.wikipedia.page.Namespace
import org.wikipedia.page.PageTitle
import org.wikipedia.settings.Prefs

class TemplatesSearchViewModel(bundle: Bundle) : ViewModel() {

val invokeSource = bundle.getSerializable(Constants.INTENT_EXTRA_INVOKE_SOURCE) as Constants.InvokeSource
val invokeSource = bundle.serializable<Constants.InvokeSource>(Constants.INTENT_EXTRA_INVOKE_SOURCE)
val wikiSite = bundle.parcelable<WikiSite>(Constants.ARG_WIKISITE)!!
val isFromDiff = bundle.getBoolean(TemplatesSearchActivity.EXTRA_FROM_DIFF, false)
var searchQuery: String? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.wikipedia.Constants
import org.wikipedia.dataclient.ServiceFactory
import org.wikipedia.dataclient.WikiSite
import org.wikipedia.extensions.parcelable
import org.wikipedia.extensions.serializable
import org.wikipedia.util.DateUtil
import org.wikipedia.util.Resource
import java.util.Calendar
Expand All @@ -25,7 +26,7 @@ class OnThisDayViewModel(bundle: Bundle) : ViewModel() {
val wikiSite = bundle.parcelable<WikiSite>(Constants.ARG_WIKISITE)!!
val age = bundle.getInt(OnThisDayActivity.EXTRA_AGE, 0)
val year = bundle.getInt(OnThisDayActivity.EXTRA_YEAR, 0)
val invokeSource = bundle.getSerializable(Constants.INTENT_EXTRA_INVOKE_SOURCE) as Constants.InvokeSource
val invokeSource = bundle.serializable<Constants.InvokeSource>(Constants.INTENT_EXTRA_INVOKE_SOURCE)
val date = DateUtil.getDefaultDateFor(age)

private val _uiState = MutableStateFlow(Resource<List<OnThisDay.Event>>())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import org.wikipedia.dataclient.ServiceFactory
import org.wikipedia.dataclient.WikiSite
import org.wikipedia.dataclient.mwapi.MwQueryPage
import org.wikipedia.descriptions.DescriptionEditActivity
import org.wikipedia.extensions.serializable
import org.wikipedia.page.Namespace
import org.wikipedia.page.PageTitle
import org.wikipedia.suggestededits.PageSummaryForEdit
Expand All @@ -22,9 +23,8 @@ import org.wikipedia.util.Resource
import org.wikipedia.util.StringUtil

class SuggestedEditsCardItemViewModel(bundle: Bundle) : ViewModel() {

val age = bundle.getInt(SuggestedEditsCardItemFragment.EXTRA_AGE)
var cardActionType = bundle.getSerializable(SuggestedEditsCardItemFragment.EXTRA_ACTION_TYPE) as DescriptionEditActivity.Action
var cardActionType = bundle.serializable<DescriptionEditActivity.Action>(SuggestedEditsCardItemFragment.EXTRA_ACTION_TYPE)
var sourceSummaryForEdit: PageSummaryForEdit? = null
var targetSummaryForEdit: PageSummaryForEdit? = null
var imageTagPage: MwQueryPage? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import org.wikipedia.WikipediaApp
import org.wikipedia.dataclient.ServiceFactory
import org.wikipedia.dataclient.mwapi.SiteMatrix
import org.wikipedia.descriptions.DescriptionEditActivity
import org.wikipedia.extensions.serializable
import org.wikipedia.util.Resource

class SuggestedEditsCardsViewModel(bundle: Bundle) : ViewModel() {

var langFromCode = WikipediaApp.instance.languageState.appLanguageCode
var langToCode = WikipediaApp.instance.languageState.appLanguageCodes.getOrElse(1) { "" }
var action = bundle.getSerializable(Constants.INTENT_EXTRA_ACTION) as DescriptionEditActivity.Action
var action = bundle.serializable<DescriptionEditActivity.Action>(Constants.INTENT_EXTRA_ACTION)

private val _uiState = MutableStateFlow(Resource<List<String>>())
val uiState = _uiState.asStateFlow()
Expand Down

0 comments on commit 3cd8773

Please sign in to comment.