admin.sign_up通知に対応

This commit is contained in:
tateisu 2022-04-17 14:56:57 +09:00
parent d0bc9b8726
commit 77be9f9396
9 changed files with 38 additions and 3 deletions

View File

@ -45,9 +45,11 @@ class TootNotification(parser: TootParser, src: JsonObject) : TimelineItem() {
// (Mastodon 3.5.0rc1)
const val TYPE_UPDATE = "update"
const val TYPE_ADMIN_SIGNUP = "admin.sign_up"
// (Fedibird beta)
const val TYPE_STATUS_REFERENCE = "status_reference"
}
val json: JsonObject

View File

@ -802,6 +802,7 @@ val appSettingRoot = AppSettingItem(null, SettingType.Section, R.string.app_sett
colorAlpha(PrefI.ipEventBgColorStatus, R.string.status)
colorAlpha(PrefI.ipEventBgColorUpdate, R.string.notification_type_update)
colorAlpha(PrefI.ipEventBgColorStatusReference, R.string.notification_type_status_reference)
colorAlpha(PrefI.ipEventBgColorSignUp, R.string.notification_type_signup)
colorAlpha(
PrefI.ipConversationMainTootBgColor,

View File

@ -259,6 +259,7 @@ fun Column.isFiltered(item: TootNotification): Boolean {
TootNotification.TYPE_FOLLOW_REQUEST,
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY,
TootNotification.TYPE_FOLLOW_REQUEST_ACCEPTED_MISSKEY,
TootNotification.TYPE_ADMIN_SIGNUP,
-> dontShowFollow
TootNotification.TYPE_MENTION,
@ -295,6 +296,7 @@ fun Column.isFiltered(item: TootNotification): Boolean {
TootNotification.TYPE_FOLLOW_REQUEST,
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY,
TootNotification.TYPE_FOLLOW_REQUEST_ACCEPTED_MISSKEY,
TootNotification.TYPE_ADMIN_SIGNUP,
-> quickFilter != Column.QUICK_FILTER_FOLLOW
TootNotification.TYPE_MENTION,
@ -355,6 +357,7 @@ fun Column.isFiltered(item: TootNotification): Boolean {
TootNotification.TYPE_FOLLOW_REQUEST,
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY,
TootNotification.TYPE_FOLLOW_REQUEST_ACCEPTED_MISSKEY,
TootNotification.TYPE_ADMIN_SIGNUP,
-> {
val who = item.account
if (who != null && favMuteSet?.contains(accessInfo.getFullAcct(who)) == true) {

View File

@ -34,6 +34,9 @@ fun ItemViewHolder.showNotification(n: TootNotification) {
TootNotification.TYPE_UNFOLLOW ->
showNotificationUnfollow(n, nAccountRef)
TootNotification.TYPE_ADMIN_SIGNUP ->
showNotificationSignup(n, nAccountRef)
TootNotification.TYPE_MENTION,
TootNotification.TYPE_REPLY,
-> showNotificationMention(n, nAccountRef, nStatus)
@ -108,6 +111,22 @@ private fun ItemViewHolder.showNotificationUnfollow(
}
}
private fun ItemViewHolder.showNotificationSignup(
n: TootNotification,
nAccountRef: TootAccountRef?,
) {
val colorBg = PrefI.ipEventBgColorSignUp(activity.pref)
colorBg.notZero()?.let { viewRoot.backgroundColor = it }
nAccountRef?.let {
showBoost(
it,
n.time_created_at,
R.drawable.ic_add,
R.string.display_name_signed_up
)
showAccount(it)
}
}
private fun ItemViewHolder.showNotificationFollowRequest(
n: TootNotification,
nAccountRef: TootAccountRef?,

View File

@ -152,6 +152,9 @@ class TaskRunner(
TootNotification.TYPE_UNFOLLOW ->
context.getString(R.string.display_name_unfollowed_by, name)
TootNotification.TYPE_ADMIN_SIGNUP ->
context.getString(R.string.display_name_signed_up, name)
TootNotification.TYPE_FAVOURITE ->
context.getString(R.string.display_name_favourited_by, name)
@ -600,6 +603,7 @@ class TaskRunner(
TootNotification.TYPE_FOLLOW,
TootNotification.TYPE_FOLLOW_REQUEST,
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY,
TootNotification.TYPE_ADMIN_SIGNUP,
-> {
val who = notification.account
if (who != null && favMuteSet.contains(account.getFullAcct(who))) {
@ -671,7 +675,7 @@ class TaskRunner(
@TargetApi(23)
private fun updateNotificationDivided(
notificationTag: String,
nt: NotificationTracking
nt: NotificationTracking,
) {
log.d("updateNotificationDivided[${account.acct.pretty}] creating notification(1)")
@ -758,7 +762,7 @@ class TaskRunner(
@TargetApi(25)
private fun setNotificationSound25(
builder: NotificationCompat.Builder,
item: NotificationData
item: NotificationData,
) {
var iv = 0
if (PrefB.bpNotificationSound(pref)) {

View File

@ -97,6 +97,7 @@ object PrefI {
val ipEventBgColorStatus = IntPref("EventBgColorStatus", 0)
val ipEventBgColorUpdate = IntPref("EventBgColorUpdate", 0)
val ipEventBgColorStatusReference = IntPref("EventBgColorStatusReference", 0)
val ipEventBgColorSignUp = IntPref("EventBgColorSignUp", 0)
val ipEventBgColorGap = IntPref("EventBgColorGap", 0)

View File

@ -111,7 +111,7 @@ class SavedAccount(
"lang",
"")
var notification_status_reference : Boolean by JsonProperty(
var notification_status_reference: Boolean by JsonProperty(
extraJson,
"notification_status_reference",
true)
@ -880,6 +880,7 @@ class SavedAccount(
TootNotification.TYPE_FOLLOW,
TootNotification.TYPE_UNFOLLOW,
TootNotification.TYPE_ADMIN_SIGNUP,
-> notification_follow
TootNotification.TYPE_FOLLOW_REQUEST,

View File

@ -214,6 +214,7 @@
<string name="display_name_mentioned_by">%1$sからのメンション</string>
<string name="display_name_unfollowed_by">%1$sにフォロー解除されました</string>
<string name="display_name_voted_by">%1$sが投票しました</string>
<string name="display_name_signed_up">%1$sがあなたのサーバに登録しました。</string>
<string name="display_replies_count">返信の数の表示</string>
<string name="display_boost_count">ブーストの数の表示</string>
<string name="display_favourite_count">お気に入りの数の表示</string>
@ -507,6 +508,7 @@
<string name="notification_type_update">投稿の更新</string>
<string name="notification_type_status_reference">投稿の参照</string>
<string name="notification_type_status_reference_fedibird">投稿の参照 (fedibird.com)</string>
<string name="notification_type_signup">(管理者用)ユーザ登録</string>
<string name="notifications">通知</string>
<string name="nsfw">NSFW</string>
<string name="ok">OK</string>

View File

@ -96,6 +96,7 @@
<string name="display_name_reaction_by">%1$s reactioned</string>
<string name="display_name_followed_by">%1$s is following you</string>
<string name="display_name_unfollowed_by">%1$s unfollowed you</string>
<string name="display_name_signed_up">%1$s signed up on your server.</string>
<string name="account">Account</string>
<string name="account_setting">Account settings</string>
<string name="setting">Settings</string>
@ -642,6 +643,7 @@
<string name="notification_type_update">post update</string>
<string name="notification_type_status_reference">post referenced</string>
<string name="notification_type_status_reference_fedibird">post referenced (fedibird.com)</string>
<string name="notification_type_signup">(admin)user signup</string>
<string name="dont_show_normal_toot">Don\'t show normal toot</string>
<string name="dont_show_non_public_toot">Don\'t show non-public toot</string>
<string name="set_focus_point">set focus point (Mastodon 2.3+)</string>