Skip to content

Commit

Permalink
remove some unused code (#4776)
Browse files Browse the repository at this point in the history
  • Loading branch information
connyduck authored Nov 28, 2024
1 parent bc397e9 commit fc52074
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 28 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/keylesspalace/tusky/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ class MainActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvider {

private fun fetchAnnouncements() {
lifecycleScope.launch {
mastodonApi.listAnnouncements(false)
mastodonApi.announcements()
.fold(
{ announcements ->
unreadAnnouncementsCount = announcements.count { !it.read }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ import com.keylesspalace.tusky.util.startActivityWithSlideInAnimation
import com.keylesspalace.tusky.util.viewBinding
import com.keylesspalace.tusky.util.visible
import com.keylesspalace.tusky.view.showMuteAccountDialog
import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
import com.mikepenz.iconics.utils.colorInt
import com.mikepenz.iconics.utils.sizeDp
import dagger.hilt.android.AndroidEntryPoint
import java.text.NumberFormat
import java.text.ParseException
Expand Down Expand Up @@ -854,13 +850,6 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvide
if (!viewModel.isSelf && followState != FollowState.FOLLOWING) {
menu.removeItem(R.id.action_add_or_remove_from_list)
}

menu.findItem(R.id.action_search)?.apply {
icon = IconicsDrawable(this@AccountActivity, GoogleMaterial.Icon.gmd_search).apply {
sizeDp = 20
colorInt = MaterialColors.getColor(binding.collapsingToolbar, android.R.attr.textColorPrimary)
}
}
}

private fun showFollowRequestPendingDialog() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import androidx.core.view.MenuProvider
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.google.android.material.color.MaterialColors
import com.keylesspalace.tusky.BottomSheetActivity
import com.keylesspalace.tusky.R
import com.keylesspalace.tusky.StatusListActivity
Expand All @@ -45,10 +44,6 @@ import com.keylesspalace.tusky.util.startActivityWithSlideInAnimation
import com.keylesspalace.tusky.util.unsafeLazy
import com.keylesspalace.tusky.util.viewBinding
import com.keylesspalace.tusky.view.EmojiPicker
import com.mikepenz.iconics.IconicsDrawable
import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial
import com.mikepenz.iconics.utils.colorInt
import com.mikepenz.iconics.utils.sizeDp
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch

Expand Down Expand Up @@ -152,12 +147,6 @@ class AnnouncementsActivity :

override fun onCreateMenu(menu: Menu, menuInflater: MenuInflater) {
menuInflater.inflate(R.menu.activity_announcements, menu)
menu.findItem(R.id.action_search)?.apply {
icon = IconicsDrawable(this@AnnouncementsActivity, GoogleMaterial.Icon.gmd_search).apply {
sizeDp = 20
colorInt = MaterialColors.getColor(binding.includedToolbar.toolbar, android.R.attr.textColorPrimary)
}
}
}

override fun onMenuItemSelected(menuItem: MenuItem): Boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class AnnouncementsViewModel @Inject constructor(
fun load() {
viewModelScope.launch {
_announcements.value = Loading()
mastodonApi.listAnnouncements()
mastodonApi.announcements()
.fold(
{
_announcements.value = Success(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -609,9 +609,7 @@ interface MastodonApi {
): NetworkResult<Poll>

@GET("api/v1/announcements")
suspend fun listAnnouncements(
@Query("with_dismissed") withDismissed: Boolean = true
): NetworkResult<List<Announcement>>
suspend fun announcements(): NetworkResult<List<Announcement>>

@POST("api/v1/announcements/{id}/dismiss")
suspend fun dismissAnnouncement(@Path("id") announcementId: String): NetworkResult<Unit>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class MainActivityTest {
activity.externalScope = TestScope()
activity.mastodonApi = mock {
onBlocking { accountVerifyCredentials() } doReturn NetworkResult.success(account)
onBlocking { listAnnouncements(false) } doReturn NetworkResult.success(emptyList())
onBlocking { announcements() } doReturn NetworkResult.success(emptyList())
}
activity.preferences = mock(defaultAnswer = {
when (it.method.returnType) {
Expand Down

0 comments on commit fc52074

Please sign in to comment.