diff --git a/app/src/main/java/com/keylesspalace/tusky/TabData.kt b/app/src/main/java/com/keylesspalace/tusky/TabData.kt index e779dc47..5ef93ef7 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TabData.kt +++ b/app/src/main/java/com/keylesspalace/tusky/TabData.kt @@ -38,6 +38,7 @@ const val TRENDING_STATUSES = "TrendingStatuses" const val HASHTAG = "Hashtag" const val LIST = "List" const val BOOKMARKS = "Bookmarks" +const val AUTOGESTIONE = "Autogestione" data class TabData( val id: String, @@ -128,6 +129,14 @@ fun createTabDataFromId(id: String, arguments: List = emptyList()): TabD icon = R.drawable.ic_bookmark_active_24dp, fragment = { TimelineFragment.newInstance(TimelineViewModel.Kind.BOOKMARKS) } ) + AUTOGESTIONE -> TabData( + id = AUTOGESTIONE, + text = R.string.autogestione, + icon = R.drawable.ic_hashtag, + fragment = { args -> TimelineFragment.newInstance(TimelineViewModel.Kind.AUTOGESTIONE, args.getOrNull(0).orEmpty()) }, + arguments = arguments, + title = { arguments.getOrNull(1).orEmpty() } + ) else -> throw IllegalArgumentException("unknown tab type") } } diff --git a/app/src/main/java/com/keylesspalace/tusky/TabPreferenceActivity.kt b/app/src/main/java/com/keylesspalace/tusky/TabPreferenceActivity.kt index f830f397..7e1ba813 100644 --- a/app/src/main/java/com/keylesspalace/tusky/TabPreferenceActivity.kt +++ b/app/src/main/java/com/keylesspalace/tusky/TabPreferenceActivity.kt @@ -387,6 +387,7 @@ class TabPreferenceActivity : BaseActivity(), Injectable, ItemInteractionListene addableTabs.add(createTabDataFromId(HASHTAG)) addableTabs.add(createTabDataFromId(LIST)) + addableTabs.add(createTabDataFromId(AUTOGESTIONE)) addTabAdapter.updateData(addableTabs) currentTabsAdapter.setRemoveButtonVisible(currentTabs.size > MIN_TAB_COUNT) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt b/app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt index 40f8b7d2..b86b05e3 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/timeline/TimelineFragment.kt @@ -546,6 +546,7 @@ class TimelineFragment : TimelineViewModel.Kind.FAVOURITES, TimelineViewModel.Kind.LIST, TimelineViewModel.Kind.BOOKMARKS, + TimelineViewModel.Kind.AUTOGESTIONE, TimelineViewModel.Kind.USER_PINNED -> return } } diff --git a/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/NetworkTimelineViewModel.kt b/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/NetworkTimelineViewModel.kt index bb8c08c0..6a1aa2c3 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/NetworkTimelineViewModel.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/NetworkTimelineViewModel.kt @@ -291,6 +291,7 @@ class NetworkTimelineViewModel @Inject constructor( Kind.BOOKMARKS -> api.bookmarks(fromId, uptoId, limit) Kind.LIST -> api.listTimeline(id!!, fromId, uptoId, limit) Kind.PUBLIC_TRENDING_STATUSES -> api.trendingStatuses(limit = limit, offset = fromId) + Kind.AUTOGESTIONE -> api.autogestione(remote = false, only_media = false) } } diff --git a/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt b/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt index 88c5f1df..1c6435fa 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/timeline/viewmodel/TimelineViewModel.kt @@ -316,13 +316,14 @@ abstract class TimelineViewModel( } enum class Kind { - HOME, PUBLIC_LOCAL, PUBLIC_FEDERATED, TAG, USER, USER_PINNED, USER_WITH_REPLIES, FAVOURITES, LIST, BOOKMARKS, PUBLIC_TRENDING_STATUSES; + HOME, PUBLIC_LOCAL, PUBLIC_FEDERATED, TAG, USER, USER_PINNED, USER_WITH_REPLIES, FAVOURITES, LIST, BOOKMARKS, PUBLIC_TRENDING_STATUSES,AUTOGESTIONE; fun toFilterKind(): Filter.Kind { return when (valueOf(name)) { HOME, LIST -> Filter.Kind.HOME PUBLIC_FEDERATED, PUBLIC_LOCAL, TAG, FAVOURITES, PUBLIC_TRENDING_STATUSES -> Filter.Kind.PUBLIC USER, USER_WITH_REPLIES, USER_PINNED -> Filter.Kind.ACCOUNT + AUTOGESTIONE -> Filter.Kind.PUBLIC else -> Filter.Kind.PUBLIC } } diff --git a/app/src/main/java/com/keylesspalace/tusky/network/MastodonApi.kt b/app/src/main/java/com/keylesspalace/tusky/network/MastodonApi.kt index 1554aa6a..bd278ad8 100644 --- a/app/src/main/java/com/keylesspalace/tusky/network/MastodonApi.kt +++ b/app/src/main/java/com/keylesspalace/tusky/network/MastodonApi.kt @@ -860,4 +860,10 @@ interface MastodonApi { @Query("limit") limit: Int? = null, @Query("offset") offset: String? = null ): Response> + + @GET("/api/v1/timelines/autogestione?remote=false&only_media=false") + suspend fun autogestione( + @Query("remote") remote: Boolean? = false, + @Query("only_media") only_media: Boolean? = false + ): Response> } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a6d2541f..4774bbae 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -841,4 +841,5 @@ Members of the list Any followed user Show replies to + Autogestione\t\t\t