diff --git a/app/build.gradle b/app/build.gradle index bfd9c6b..ae2ce91 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -47,8 +47,8 @@ android { applicationId "io.musicorum.mobile" minSdk 28 targetSdk 34 - versionCode 71 - versionName "2.0.1" + versionCode 72 + versionName "2.0.2" //compileSdkPreview = "UpsideDownCake" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/app/src/main/java/io/musicorum/mobile/components/FriendActivity.kt b/app/src/main/java/io/musicorum/mobile/components/FriendActivity.kt index 77bcd15..72fc246 100644 --- a/app/src/main/java/io/musicorum/mobile/components/FriendActivity.kt +++ b/app/src/main/java/io/musicorum/mobile/components/FriendActivity.kt @@ -32,7 +32,9 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.rotate +import androidx.compose.ui.hapticfeedback.HapticFeedbackType import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.platform.LocalHapticFeedback import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp @@ -67,6 +69,7 @@ fun FriendActivity( val analytics = LocalAnalytics.current!! val nav = LocalNavigation.current val showSheet = remember { mutableStateOf(false) } + val haptic = LocalHapticFeedback.current if (showSheet.value) { val colors = ListItemDefaults.colors( @@ -130,7 +133,10 @@ fun FriendActivity( param(FirebaseAnalytics.Param.ITEM_NAME, "friend_activity_track") } }, - onLongClick = { showSheet.value = true } + onLongClick = { + haptic.performHapticFeedback(HapticFeedbackType.LongPress) + showSheet.value = true + } ) ) AsyncImage( diff --git a/app/src/main/java/io/musicorum/mobile/components/TrackCard.kt b/app/src/main/java/io/musicorum/mobile/components/TrackCard.kt index d573d7c..fbdbf05 100644 --- a/app/src/main/java/io/musicorum/mobile/components/TrackCard.kt +++ b/app/src/main/java/io/musicorum/mobile/components/TrackCard.kt @@ -31,6 +31,8 @@ import androidx.compose.ui.Alignment.Companion.CenterVertically import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.clip +import androidx.compose.ui.hapticfeedback.HapticFeedbackType +import androidx.compose.ui.platform.LocalHapticFeedback import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow @@ -58,8 +60,10 @@ fun TrackCard(track: Track, labelType: LabelType) { val navTrack = NavigationTrack(track.name.encodeURLPathPart(), track.artist.name) val dest = Json.encodeToString(navTrack) val showTrackSheet = remember { mutableStateOf(false) } + val haptic = LocalHapticFeedback.current if (showTrackSheet.value) { + haptic.performHapticFeedback(HapticFeedbackType.LongPress) TrackSheet(track = track, show = showTrackSheet) } diff --git a/app/src/main/java/io/musicorum/mobile/views/friendlist/FriendActivityViewModel.kt b/app/src/main/java/io/musicorum/mobile/views/friendlist/FriendActivityViewModel.kt index 58a8a3f..ad71f9d 100644 --- a/app/src/main/java/io/musicorum/mobile/views/friendlist/FriendActivityViewModel.kt +++ b/app/src/main/java/io/musicorum/mobile/views/friendlist/FriendActivityViewModel.kt @@ -1,8 +1,6 @@ package io.musicorum.mobile.views.friendlist import android.app.Application -import android.content.Intent -import android.net.Uri import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.viewModelScope import io.musicorum.mobile.ktor.endpoints.UserEndpoint @@ -23,7 +21,13 @@ class FriendActivityViewModel(application: Application) : AndroidViewModel(appli } val res = UserEndpoint.getRecentTracks(username, null, 1) res?.let { - val track = res.recentTracks.tracks.first() + val track = res.recentTracks.tracks.firstOrNull() + if (track == null) { + state.update { + it.copy(loading = false) + } + return@launch + } state.update { it.copy( track = track,