Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -700,11 +700,6 @@ class ConnectViewModel : ViewModel() {
) {
val list = response?.data ?: emptyList()
_activeFriends.postValue(list)

prefs.edit {
putBoolean(Constants.ACTIVE_FRIENDS_FETCHED, true)
.putString(Constants.ACTIVE_FRIENDS_LIST, Gson().toJson(list))
}
}

override fun onError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,8 @@ fun FriendDetailScreenContent(
if (ghostModeResponse != null && isTogglingGhostMode) {
isTogglingGhostMode = false

val sharedPreferences =
context.getSharedPreferences(Constants.USER_INFO, Context.MODE_PRIVATE)

if (ghostModeResponse!!.success) {
val currentActiveFriends = activeFriends?.toMutableList() ?: mutableListOf<ActiveFriendItem>()
val gson = Gson()
val currentActiveFriends = activeFriends?.toMutableList() ?: mutableListOf()

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

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

val activeFriendsJson = gson.toJson(currentActiveFriends)
sharedPreferences.edit {
putString(Constants.ACTIVE_FRIENDS_LIST, activeFriendsJson)
}

Toast
.makeText(
context,
Expand Down Expand Up @@ -781,7 +772,7 @@ private fun DayScheduleContent(
) {
items(
items = periods,
key = { period -> "${period.courseCode}_${period.slot}" },
key = { period -> "${periods.indexOf(period)}${period.startTime}_${period.courseCode}_${period.slot}_${period.endTime}" },
) { period ->
FriendPeriodCard(
period = period,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ fun ConnectHeader(
horizontalArrangement = Arrangement.SpaceBetween,
) {
Row {
val options = listOf("Available", "View All")
val options = listOf("All", "Available")
options.forEachIndexed { index, label ->
FilterChip(
label = label,
Expand Down Expand Up @@ -384,8 +384,8 @@ fun ConnectTabContent(

val matchesFilter =
when (friendsFilter) {
0 -> friend.current_status?.status?.lowercase(Locale.ROOT) == "free"
else -> true
0 -> true
else -> friend.current_status?.status?.lowercase(Locale.ROOT) == "free"
}

matchesSearch && matchesFilter
Expand Down Expand Up @@ -433,19 +433,19 @@ fun ConnectTabContent(
"No friends found"
} else {
if (friendsFilter == 0) {
"No friends available"
} else {
"No friends added"
} else {
"No friends available"
}
},
subtitle =
if (searchQuery.isNotBlank()) {
"Try a different search term"
} else {
if (friendsFilter == 0) {
"Your friends are currently in class"
} else {
"Start connecting with your classmates"
} else {
"Your friends are currently in class"
}
},
icon = R.drawable.ic_community_outline,
Expand Down
Loading
Loading