admin.report 通知に雑に対応

This commit is contained in:
tateisu 2023-02-05 06:12:06 +09:00
parent 6c804a2a5d
commit f8d04f0bcf
10 changed files with 40 additions and 5 deletions

View File

@ -52,7 +52,7 @@ class ActDrawableList : AsyncActivity(), CoroutineScope {
try {
val rePackageSpec = """.+/""".toRegex()
val reSkipName =
"""^(abc_|avd_|btn_checkbox_|btn_radio_|googleg_|ic_keyboard_arrow_|ic_menu_arrow_|notification_|common_|emj_|cpv_|design_|exo_|mtrl_|ic_mtrl_)"""
"""^(m3_|abc_|avd_|btn_checkbox_|btn_radio_|googleg_|ic_keyboard_arrow_|ic_menu_arrow_|notification_|common_|emj_|cpv_|design_|exo_|mtrl_|ic_mtrl_)"""
.asciiPattern()
val list = withContext(AppDispatchers.IO) {
R.drawable::class.java.fields

View File

@ -47,6 +47,9 @@ class TootNotification(parser: TootParser, src: JsonObject) : TimelineItem() {
const val TYPE_UPDATE = "update"
const val TYPE_ADMIN_SIGNUP = "admin.sign_up"
// (Mastodon 4.0)
const val TYPE_ADMIN_REPORT = "admin.report"
// (Fedibird beta)
const val TYPE_STATUS_REFERENCE = "status_reference"
}

View File

@ -831,6 +831,7 @@ val appSettingRoot = AppSettingItem(null, SettingType.Section, R.string.app_sett
R.string.notification_type_status_reference
)
colorAlpha(PrefI.ipEventBgColorSignUp, R.string.notification_type_signup)
colorAlpha(PrefI.ipEventBgColorReport, R.string.notification_type_report)
colorAlpha(
PrefI.ipConversationMainTootBgColor,

View File

@ -291,6 +291,7 @@ fun Column.isFiltered(item: TootNotification): Boolean {
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY,
TootNotification.TYPE_FOLLOW_REQUEST_ACCEPTED_MISSKEY,
TootNotification.TYPE_ADMIN_SIGNUP,
TootNotification.TYPE_ADMIN_REPORT,
-> dontShowFollow
TootNotification.TYPE_MENTION,
@ -328,6 +329,7 @@ fun Column.isFiltered(item: TootNotification): Boolean {
TootNotification.TYPE_FOLLOW_REQUEST_MISSKEY,
TootNotification.TYPE_FOLLOW_REQUEST_ACCEPTED_MISSKEY,
TootNotification.TYPE_ADMIN_SIGNUP,
TootNotification.TYPE_ADMIN_REPORT,
-> quickFilter != Column.QUICK_FILTER_FOLLOW
TootNotification.TYPE_MENTION,
@ -413,7 +415,6 @@ 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

@ -37,6 +37,10 @@ fun ItemViewHolder.showNotification(n: TootNotification) {
TootNotification.TYPE_ADMIN_SIGNUP ->
showNotificationSignup(n, nAccountRef)
TootNotification.TYPE_ADMIN_REPORT ->
showNotificationReport(n, nAccountRef)
TootNotification.TYPE_MENTION,
TootNotification.TYPE_REPLY,
-> showNotificationMention(n, nAccountRef, nStatus)
@ -127,6 +131,22 @@ private fun ItemViewHolder.showNotificationSignup(
showAccount(it)
}
}
private fun ItemViewHolder.showNotificationReport(
n: TootNotification,
nAccountRef: TootAccountRef?,
) {
val colorBg = PrefI.ipEventBgColorReport.value
colorBg.notZero()?.let { viewRoot.backgroundColor = it }
nAccountRef?.let {
showBoost(
it,
n.time_created_at,
R.drawable.ic_follow_wait,
R.string.display_name_report
)
showAccount(it)
}
}
private fun ItemViewHolder.showNotificationFollowRequest(
n: TootNotification,

View File

@ -139,6 +139,9 @@ class PollingChecker(
TootNotification.TYPE_ADMIN_SIGNUP,
-> context.getString(R.string.display_name_signed_up, name)
TootNotification.TYPE_ADMIN_REPORT,
-> context.getString(R.string.display_name_report, name)
TootNotification.TYPE_FAVOURITE,
-> context.getString(R.string.display_name_favourited_by, name)
@ -433,7 +436,6 @@ class PollingChecker(
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))) {

View File

@ -597,7 +597,11 @@ class PushSubscriptionHelper(
"update",
TootNotification.TYPE_ADMIN_SIGNUP,
-> false // ti.versionGE(TootInstance.VERSION_3_5_0_rc1)
-> ti.versionGE(TootInstance.VERSION_3_5_0_rc1)
TootNotification.TYPE_ADMIN_REPORT,
-> ti.versionGE(TootInstance.VERSION_4_0_0)
/*
2022年6月15日現在admin.sign_up update をalertsに指定しても意味がない
https://github.com/mastodon/mastodon/blob/main/app/controllers/api/v1/push/subscriptions_controller.rb#L55

View File

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

View File

@ -869,6 +869,7 @@ class SavedAccount(
TootNotification.TYPE_FOLLOW,
TootNotification.TYPE_UNFOLLOW,
TootNotification.TYPE_ADMIN_SIGNUP,
TootNotification.TYPE_ADMIN_REPORT,
-> notification_follow
TootNotification.TYPE_FOLLOW_REQUEST,

View File

@ -96,7 +96,8 @@
<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="display_name_signed_up">%1$s signed up on your server</string>
<string name="display_name_report">%1$s reported.</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_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="notification_type_report">(admin)report</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>