Skip to content

Commit

Permalink
-Channel Details Enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
KhubaibKhan4 committed Dec 1, 2024
1 parent 99b591b commit 7757595
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ fun ShortItem(
}
}

// Video Interaction Buttons
Column(
modifier = Modifier
.padding(top = 140.dp)
Expand Down Expand Up @@ -721,7 +720,6 @@ fun ShortItem(
tonalElevation = 8.dp,
scrimColor = Color.Transparent,
dragHandle = null,
//windowInsets = BottomSheetDefaults.windowInsets,
) {
Column(
modifier = Modifier.fillMaxWidth()
Expand Down Expand Up @@ -901,7 +899,7 @@ fun ShortItem(
fontSize = MaterialTheme.typography.bodyLarge.fontSize,
modifier = Modifier.fillMaxWidth().padding(
horizontal = 16.dp, vertical = 8.dp
), // Adjust padding as needed
),
maxLines = 1,
textAlign = TextAlign.Justify,
overflow = TextOverflow.Ellipsis,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class ChannelDetail(
}
Spacer(modifier = Modifier.height(16.dp))

//Description

Text(
text = "Description",
fontSize = MaterialTheme.typography.titleMedium.fontSize,
Expand All @@ -120,7 +120,7 @@ class ChannelDetail(

Spacer(modifier = Modifier.height(16.dp))

//Links

Text(
text = "Links",
fontSize = MaterialTheme.typography.titleMedium.fontSize,
Expand Down Expand Up @@ -148,7 +148,7 @@ class ChannelDetail(
text = "Follow",
fontSize = MaterialTheme.typography.titleSmall.fontSize,
)
// Use regular expressions to find social links

val socialLinks =
Regex("(?i)\\b(?:twitter|instagram|facebook|linkedin|youtube)\\b[\\w/@]+")
.findAll(description.toString())
Expand All @@ -167,7 +167,6 @@ class ChannelDetail(
}
Spacer(modifier = Modifier.height(16.dp))

//Links
Text(
text = "Categories",
fontSize = MaterialTheme.typography.titleMedium.fontSize,
Expand Down Expand Up @@ -204,7 +203,7 @@ class ChannelDetail(
}

Spacer(modifier = Modifier.height(16.dp))
//More Info

Text(
text = "More info",
fontSize = MaterialTheme.typography.titleMedium.fontSize,
Expand All @@ -218,7 +217,6 @@ class ChannelDetail(
Spacer(modifier = Modifier.height(8.dp))


// Channel Link
Row(
modifier = Modifier.fillMaxWidth()
.padding(start = 12.dp),
Expand All @@ -242,7 +240,6 @@ class ChannelDetail(
Spacer(modifier = Modifier.height(6.dp))
}

// Country
Row(
modifier = Modifier.fillMaxWidth()
.padding(start = 12.dp),
Expand All @@ -259,7 +256,6 @@ class ChannelDetail(
Spacer(modifier = Modifier.height(6.dp))
}

// View Info
Row(
modifier = Modifier.fillMaxWidth()
.padding(start = 12.dp),
Expand All @@ -276,7 +272,7 @@ class ChannelDetail(
}

Spacer(modifier = Modifier.height(16.dp))
//More Info

Text(
text = "Verification",
fontSize = MaterialTheme.typography.titleMedium.fontSize,
Expand All @@ -288,7 +284,7 @@ class ChannelDetail(
overflow = TextOverflow.Ellipsis
)
Spacer(modifier = Modifier.height(8.dp))
// Verification

Row(
modifier = Modifier.fillMaxWidth()
.padding(start = 12.dp),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class MainViewModel(
private val _channelBranding = MutableStateFlow<Channels>(ResultState.LOADING)
val channelBranding: StateFlow<Channels> = _channelBranding.asStateFlow()

private val _relevance_videos = MutableStateFlow<YouTube>(ResultState.LOADING)
val relevanceVideos: StateFlow<YouTube> = _relevance_videos.asStateFlow()
private val _relevanceVideos = MutableStateFlow<YouTube>(ResultState.LOADING)
val relevanceVideos: StateFlow<YouTube> = _relevanceVideos.asStateFlow()

private val _search = MutableStateFlow<Searches>(ResultState.LOADING)
val search: StateFlow<Searches> = _search.asStateFlow()
Expand Down Expand Up @@ -187,13 +187,13 @@ class MainViewModel(

fun getRelevanceVideos() {
viewModelScope.launch {
_relevance_videos.value = ResultState.LOADING
_relevanceVideos.value = ResultState.LOADING
try {
val response = repository.getRelevanceVideos()
_relevance_videos.value = ResultState.SUCCESS(response)
_relevanceVideos.value = ResultState.SUCCESS(response)
} catch (e: Exception) {
val error = e.message.toString()
_relevance_videos.value = ResultState.ERROR(error)
_relevanceVideos.value = ResultState.ERROR(error)
}

}
Expand Down Expand Up @@ -402,7 +402,7 @@ class MainViewModel(
try {
val exitingVideo =
database.youtubeEntityQueries.getVideoByTitle(title).executeAsOneOrNull()
if (exitingVideo == null || exitingVideo.id == null && !exitingVideo.title.contains(
if (exitingVideo == null || exitingVideo.id.toString().isBlank() && !exitingVideo.title.contains(
title
)
) {
Expand Down

0 comments on commit 7757595

Please sign in to comment.