Skip to content

Commit

Permalink
Merge pull request #1917 from pantasystem/feature/#1915/notify-mdoels
Browse files Browse the repository at this point in the history
ユーザの通知のON/OFFを切り替えられるようにした
  • Loading branch information
pantasystem authored Oct 8, 2023
2 parents cb39c68 + b91c9ef commit 806ed33
Show file tree
Hide file tree
Showing 26 changed files with 3,911 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.pantasystem.milktea.api.mastodon

import net.pantasystem.milktea.api.mastodon.accounts.FollowParamsRequest
import net.pantasystem.milktea.api.mastodon.accounts.MastodonAccountDTO
import net.pantasystem.milktea.api.mastodon.accounts.MastodonAccountRelationshipDTO
import net.pantasystem.milktea.api.mastodon.accounts.MuteAccountRequest
Expand Down Expand Up @@ -127,7 +128,7 @@ interface MastodonAPI {
): Response<List<MastodonAccountRelationshipDTO>>

@POST("api/v1/accounts/{accountId}/follow")
suspend fun follow(@Path("accountId") accountId: String): Response<MastodonAccountRelationshipDTO>
suspend fun follow(@Path("accountId") accountId: String, @Body params: FollowParamsRequest): Response<MastodonAccountRelationshipDTO>

@POST("api/v1/accounts/{accountId}/unfollow")
suspend fun unfollow(@Path("accountId") accountId: String): Response<MastodonAccountRelationshipDTO>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package net.pantasystem.milktea.api.mastodon.accounts

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class FollowParamsRequest(
@SerialName("reblogs") val reblogs: Boolean? = null,
@SerialName("notify") val notify: Boolean? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ import net.pantasystem.milktea.api.misskey.register.WebClientBaseRequest
import net.pantasystem.milktea.api.misskey.register.WebClientRegistries
import net.pantasystem.milktea.api.misskey.trend.HashtagTrend
import net.pantasystem.milktea.api.misskey.users.*
import net.pantasystem.milktea.api.misskey.users.follow.FollowUserRequest
import net.pantasystem.milktea.api.misskey.users.follow.UnFollowUserRequest
import net.pantasystem.milktea.api.misskey.users.follow.UpdateUserFollowRequest
import net.pantasystem.milktea.api.misskey.users.renote.mute.CreateRenoteMuteRequest
import net.pantasystem.milktea.api.misskey.users.renote.mute.DeleteRenoteMuteRequest
import net.pantasystem.milktea.api.misskey.users.renote.mute.RenoteMuteDTO
Expand Down Expand Up @@ -73,7 +76,6 @@ import net.pantasystem.milktea.api.misskey.v12_75_0.Show
import net.pantasystem.milktea.api.misskey.v12_75_0.UnLike
import net.pantasystem.milktea.api.misskey.v12_75_0.Update
import net.pantasystem.milktea.api.misskey.v13.EmojisResponse
import net.pantasystem.milktea.api.misskey.notes.Vote
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.Headers
Expand Down Expand Up @@ -131,10 +133,13 @@ interface MisskeyAPI {
suspend fun pullUserFromList(@Body listUserOperation: ListUserOperation): Response<Unit>

@POST("api/following/delete")
suspend fun unFollowUser(@Body requestUser: RequestUser): Response<UserDTO>
suspend fun unFollowUser(@Body requestUser: UnFollowUserRequest): Response<UserDTO>

@POST("api/following/create")
suspend fun followUser(@Body requestUser: RequestUser): Response<UserDTO>
suspend fun followUser(@Body requestUser: FollowUserRequest): Response<UserDTO>

@POST("api/following/update")
suspend fun updateFollowUser(@Body request: UpdateUserFollowRequest): Response<UserDTO>

@POST("api/following/requests/accept")
suspend fun acceptFollowRequest(@Body followRequest: AcceptFollowRequest) : Response<Unit>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ data class UserDTO(

@SerialName("avatarBlurhash")
val avatarBlurhash: String? = null,

@SerialName("notify")
val notifyState: String? = null,
) : Serializable {

@kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package net.pantasystem.milktea.api.misskey.users.follow

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
class FollowUserRequest(
@SerialName("i") val i: String,
@SerialName("userId") val userId: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package net.pantasystem.milktea.api.misskey.users.follow

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
class UnFollowUserRequest(
@SerialName("i") val i: String,
@SerialName("userId") val userId: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package net.pantasystem.milktea.api.misskey.users.follow

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
class UpdateUserFollowRequest(
@SerialName("i") val i: String,
@SerialName("userId") val userId: String,
@SerialName("notify") val notify: String? = null,
@SerialName("withReplies") val withReplies: Boolean? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@
<item
android:id="@+id/add_list"
android:title="@string/add_to_list"/>

<item
android:id="@+id/notify_about_new_posts"
android:title="@string/notify_about_new_posts" />

<item
android:id="@+id/stop_notify_about_new_posts"
android:title="@string/stop_notify_about_new_posts" />

<item
android:id="@+id/report_user"
android:title="@string/report"/>
Expand Down
2 changes: 2 additions & 0 deletions modules/common_resource/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,8 @@
<string name="alarm_permission_description_message">予約投稿はアラーム機能の仕組みを利用するため、設定からMilkteaにアラームの権限を付与する必要性があります。</string>
<string name="exclude_replies">Exclude replies</string>
<string name="exclude_reposts">Exclude reposts</string>
<string name="notify_about_new_posts">投稿の通知を受信する</string>
<string name="stop_notify_about_new_posts">投稿の通知をやめる</string>
<!-- User -->


Expand Down
2 changes: 2 additions & 0 deletions modules/common_resource/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,8 @@
<string name="alarm_permission_description_message">Scheduled posting uses the mechanism of the alarm function, so it is necessary to grant alarm permission to Milktea from the settings.</string>
<string name="exclude_replies">Exclude replies</string>
<string name="exclude_reposts">Exclude reposts</string>
<string name="notify_about_new_posts">Notify about new posts</string>
<string name="stop_notify_about_new_posts">Stop notify about new posts</string>
<!-- User -->

</resources>
2 changes: 2 additions & 0 deletions modules/common_resource/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,8 @@
<string name="alarm_permission_description_message">Scheduled posting uses the mechanism of the alarm function, so it is necessary to grant alarm permission to Milktea from the settings.</string>
<string name="exclude_replies">Exclude replies</string>
<string name="exclude_reposts">Exclude reposts</string>
<string name="notify_about_new_posts">Notify about new posts</string>
<string name="stop_notify_about_new_posts">Stop notify about new posts</string>
<!-- reaction-acceptance -->

</resources>
Loading

0 comments on commit 806ed33

Please sign in to comment.