Skip to content

Commit 01476b0

Browse files
authored
Merge pull request #66 from JothishKamal/v3
2 parents b19ce01 + 564d780 commit 01476b0

7 files changed

Lines changed: 111 additions & 134 deletions

File tree

app/src/main/java/com/dscvit/vitty/ui/connect/ConnectViewModel.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -700,11 +700,6 @@ class ConnectViewModel : ViewModel() {
700700
) {
701701
val list = response?.data ?: emptyList()
702702
_activeFriends.postValue(list)
703-
704-
prefs.edit {
705-
putBoolean(Constants.ACTIVE_FRIENDS_FETCHED, true)
706-
.putString(Constants.ACTIVE_FRIENDS_LIST, Gson().toJson(list))
707-
}
708703
}
709704

710705
override fun onError(

app/src/main/java/com/dscvit/vitty/ui/connect/FriendDetailScreenContent.kt

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,8 @@ fun FriendDetailScreenContent(
130130
if (ghostModeResponse != null && isTogglingGhostMode) {
131131
isTogglingGhostMode = false
132132

133-
val sharedPreferences =
134-
context.getSharedPreferences(Constants.USER_INFO, Context.MODE_PRIVATE)
135-
136133
if (ghostModeResponse!!.success) {
137-
val currentActiveFriends = activeFriends?.toMutableList() ?: mutableListOf<ActiveFriendItem>()
138-
val gson = Gson()
134+
val currentActiveFriends = activeFriends?.toMutableList() ?: mutableListOf()
139135

140136
val existingFriendIndex = currentActiveFriends.indexOfFirst { it.friend_username == friend.username }
141137

@@ -146,11 +142,6 @@ fun FriendDetailScreenContent(
146142
currentActiveFriends.add(ActiveFriendItem(friend_username = friend.username, hide = isFriendGhosted))
147143
}
148144

149-
val activeFriendsJson = gson.toJson(currentActiveFriends)
150-
sharedPreferences.edit {
151-
putString(Constants.ACTIVE_FRIENDS_LIST, activeFriendsJson)
152-
}
153-
154145
Toast
155146
.makeText(
156147
context,
@@ -781,7 +772,7 @@ private fun DayScheduleContent(
781772
) {
782773
items(
783774
items = periods,
784-
key = { period -> "${period.courseCode}_${period.slot}" },
775+
key = { period -> "${periods.indexOf(period)}${period.startTime}_${period.courseCode}_${period.slot}_${period.endTime}" },
785776
) { period ->
786777
FriendPeriodCard(
787778
period = period,

app/src/main/java/com/dscvit/vitty/ui/connect/components/ConnectScreenComponents.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ fun ConnectHeader(
221221
horizontalArrangement = Arrangement.SpaceBetween,
222222
) {
223223
Row {
224-
val options = listOf("Available", "View All")
224+
val options = listOf("All", "Available")
225225
options.forEachIndexed { index, label ->
226226
FilterChip(
227227
label = label,
@@ -384,8 +384,8 @@ fun ConnectTabContent(
384384

385385
val matchesFilter =
386386
when (friendsFilter) {
387-
0 -> friend.current_status?.status?.lowercase(Locale.ROOT) == "free"
388-
else -> true
387+
0 -> true
388+
else -> friend.current_status?.status?.lowercase(Locale.ROOT) == "free"
389389
}
390390

391391
matchesSearch && matchesFilter
@@ -433,19 +433,19 @@ fun ConnectTabContent(
433433
"No friends found"
434434
} else {
435435
if (friendsFilter == 0) {
436-
"No friends available"
437-
} else {
438436
"No friends added"
437+
} else {
438+
"No friends available"
439439
}
440440
},
441441
subtitle =
442442
if (searchQuery.isNotBlank()) {
443443
"Try a different search term"
444444
} else {
445445
if (friendsFilter == 0) {
446-
"Your friends are currently in class"
447-
} else {
448446
"Start connecting with your classmates"
447+
} else {
448+
"Your friends are currently in class"
449449
}
450450
},
451451
icon = R.drawable.ic_community_outline,

0 commit comments

Comments
 (0)