Skip to content

Commit

Permalink
fix: always use the name/title from entity lookup api
Browse files Browse the repository at this point in the history
overwriting any provided title passed to the details screen from calling screen

fixes #1010
  • Loading branch information
lydavid committed Aug 7, 2024
1 parent 4460a38 commit debf0ab
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ internal class AreaPresenter(
LaunchedEffect(forceRefreshDetails) {
try {
val areaDetailsModel = repository.lookupArea(screen.id)
if (title.isEmpty()) {
title = areaDetailsModel.getNameWithDisambiguation()
}
title = areaDetailsModel.getNameWithDisambiguation()

area = areaDetailsModel
isError = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ internal class ArtistPresenter(
artistId = screen.id,
forceRefresh = forceRefreshDetails,
)
if (title.isEmpty()) {
title = artistDetailsModel.getNameWithDisambiguation()
}
title = artistDetailsModel.getNameWithDisambiguation()
artist = artistDetailsModel
isError = false
} catch (ex: Exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ internal class EventPresenter(
LaunchedEffect(forceRefreshDetails) {
try {
val eventListItemModel = repository.lookupEvent(screen.id)
if (title.isEmpty()) {
title = eventListItemModel.getNameWithDisambiguation()
}
title = eventListItemModel.getNameWithDisambiguation()
event = eventListItemModel
isError = false
} catch (ex: RecoverableNetworkException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ internal class GenrePresenter(
LaunchedEffect(forceRefreshDetails) {
try {
val genreListItemModel = musicBrainzApi.lookupGenre(screen.id)
if (title.isEmpty()) {
title = genreListItemModel.getNameWithDisambiguation()
}
title = genreListItemModel.getNameWithDisambiguation()
genre = genreListItemModel
isError = false
} catch (ex: RecoverableNetworkException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ internal class InstrumentPresenter(
LaunchedEffect(forceRefreshDetails) {
try {
val instrumentDetailsModel = repository.lookupInstrument(screen.id)
if (title.isEmpty()) {
title = instrumentDetailsModel.getNameWithDisambiguation()
}
title = instrumentDetailsModel.getNameWithDisambiguation()
instrument = instrumentDetailsModel
isError = false
} catch (ex: RecoverableNetworkException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ internal class LabelPresenter(
LaunchedEffect(forceRefreshDetails) {
try {
val labelDetailsModel = repository.lookupLabel(screen.id)
if (title.isEmpty()) {
title = labelDetailsModel.getNameWithDisambiguation()
}
title = labelDetailsModel.getNameWithDisambiguation()
label = labelDetailsModel
isError = false
} catch (ex: RecoverableNetworkException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ internal class PlacePresenter(
LaunchedEffect(forceRefreshDetails) {
try {
val placeDetailsModel = repository.lookupPlace(screen.id)
if (title.isEmpty()) {
title = placeDetailsModel.getNameWithDisambiguation()
}
title = placeDetailsModel.getNameWithDisambiguation()
place = placeDetailsModel
isError = false
} catch (ex: RecoverableNetworkException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ internal class RecordingPresenter(
LaunchedEffect(forceRefreshDetails) {
try {
val recordingDetailsModel = repository.lookupRecording(screen.id)
if (title.isEmpty()) {
title = recordingDetailsModel.getNameWithDisambiguation()
}
title = recordingDetailsModel.getNameWithDisambiguation()
subtitle = "Recording by ${recordingDetailsModel.artistCredits.getDisplayNames()}"
recording = recordingDetailsModel
isError = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ internal class ReleasePresenter(
LaunchedEffect(forceRefreshDetails) {
try {
val releaseDetailsModel = repository.lookupRelease(screen.id)
if (title.isEmpty()) {
title = releaseDetailsModel.getNameWithDisambiguation()
}
title = releaseDetailsModel.getNameWithDisambiguation()
subtitle = "Release by ${releaseDetailsModel.artistCredits.getDisplayNames()}"
release = releaseDetailsModel
imageUrl = fetchReleaseImage(releaseDetailsModel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ internal class ReleaseGroupPresenter(
LaunchedEffect(forceRefreshDetails) {
try {
val releaseGroupDetailsModel = repository.lookupReleaseGroup(screen.id)
if (title.isEmpty()) {
title = releaseGroupDetailsModel.getNameWithDisambiguation()
}
title = releaseGroupDetailsModel.getNameWithDisambiguation()
subtitle = "Release Group by ${releaseGroupDetailsModel.artistCredits.getDisplayNames()}"
releaseGroup = releaseGroupDetailsModel
imageUrl = fetchReleaseGroupImage(releaseGroupDetailsModel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ internal class SeriesPresenter(
LaunchedEffect(forceRefreshDetails) {
try {
val seriesDetailsModel = repository.lookupSeries(screen.id)
if (title.isEmpty()) {
title = seriesDetailsModel.getNameWithDisambiguation()
}
title = seriesDetailsModel.getNameWithDisambiguation()
series = seriesDetailsModel
isError = false
} catch (ex: RecoverableNetworkException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ internal class WorkPresenter(
LaunchedEffect(forceRefreshDetails) {
try {
val workDetailsModel = repository.lookupWork(screen.id)
if (title.isEmpty()) {
title = workDetailsModel.getNameWithDisambiguation()
}
title = workDetailsModel.getNameWithDisambiguation()
work = workDetailsModel
isError = false
} catch (ex: RecoverableNetworkException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,39 +79,39 @@ internal fun PreviewArtistCollaborationGraphUi() {
id = "b2de971f-b3d6-409f-9ed0-ecfc09e8b4e3",
name = "suis",
entity = MusicBrainzEntity.ARTIST,
radius = 13.0,
radius = 26.0,
x = -7.010541039928112,
y = 148.53020774179376,
),
GraphNode(
id = "80b3cb83-b7a3-4f79-ad42-8325cefb3626",
name = "キタニタツヤ",
entity = MusicBrainzEntity.ARTIST,
radius = 12.0,
radius = 25.0,
x = -87.41917955713517,
y = 120.97761778046068,
),
GraphNode(
id = "58576a03-f302-4f68-9a97-113a6afc753f",
name = "星めぐる詩",
entity = MusicBrainzEntity.RECORDING,
radius = 11.0,
radius = 24.0,
x = 34.442058589085114,
y = -98.70221015951988,
),
GraphNode(
id = "9a70f454-1da3-4570-b592-33e5f8713d28",
name = "ナイトルーティーン",
entity = MusicBrainzEntity.RECORDING,
radius = 12.0,
radius = 25.0,
x = 107.57529725372356,
y = -59.45777853885758,
),
GraphNode(
id = "d4a15774-05b7-4f58-97b1-2bdf4a10d8d5",
name = "ナイトルーティーン",
entity = MusicBrainzEntity.RECORDING,
radius = 12.0,
radius = 25.0,
x = -47.58660614527603,
y = -111.3471010505625,
),
Expand Down

0 comments on commit debf0ab

Please sign in to comment.