vd-plugins/NoAutoReplyMention/index.js
2025-07-24 14:28:37 +00:00

1 line
2.9 KiB
JavaScript

(function(s,y,R,c,e,b,u,m,g,l){"use strict";const f=R.findByStoreName("UserStore"),{FormInput:v,FormDivider:h,FormText:x,FormIcon:d,FormRow:p,FormSection:F,FormSwitchRow:I}=m.Forms,E=e.stylesheet.createThemedStyleSheet({avatar:{height:36,width:36,borderRadius:18},button:{marginRight:12}});function k({callback:n}){return e.React.createElement(l.TouchableOpacity,{onPress:n},e.React.createElement(x,{style:E.button},"ADD"))}function S({onFinish:n}){const[a,o]=g.useState(""),r=function(){!isNaN(parseInt(a))&&f.getUser(a)&&!t.exempted.includes(a)&&(t.exempted=[...t.exempted,a],o("")),n()};return e.React.createElement(p,{leading:e.React.createElement(d,{source:u.getAssetIDByName("ic_add_friend")}),label:e.React.createElement(v,{autoFocus:!0,title:"User ID",placeholder:"123456789012345678",value:a,keyboardType:"numeric",onChangeText:function(i){return o(i.replace(/[^0-9]/g,"").trim())},returnKeyType:"done"}),trailing:e.React.createElement(l.TouchableOpacity,{onPress:r},e.React.createElement(d,{source:u.getAssetIDByName("ic_add_24px")}))})}function w(){b.useProxy(t);const[n,a]=g.useState(!1),o=e.NavigationNative.useNavigation();return g.useEffect(function(){o.setOptions({headerRight:function(){return e.React.createElement(k,{callback:function(){return a(!0)}})}})},[]),e.React.createElement(l.ScrollView,null,e.React.createElement(I,{label:"Enable blacklist mode",subLabel:"If enabled, only users in the exempted list will be affected by the plugin.",leading:e.React.createElement(d,{source:u.getAssetIDByName("ic_block")}),value:t.isBlacklistMode,onValueChange:function(r){return t.isBlacklistMode=r}}),e.React.createElement(F,{title:"Exempted Users"},t.exempted?.length>0&&e.React.createElement(l.FlatList,{data:t.exempted,keyExtractor:function(r){return r},renderItem:function({item:r}){const i=f.getUser(r);if(!i)throw new Error("User not found/is not cached");return e.React.createElement(p,{label:i.username,leading:e.React.createElement(l.Image,{style:E.avatar,source:{uri:i.getAvatarURL()}}),trailing:e.React.createElement(l.TouchableOpacity,{onPress:function(){t.exempted=t.exempted.filter(function(U){return U!==r})}},e.React.createElement(d,{source:u.getAssetIDByName("Small"),disableColor:!0}))})},ItemSeparatorComponent:h}),n&&e.React.createElement(e.React.Fragment,null,e.React.createElement(h,null),e.React.createElement(S,{onFinish:function(){return a(!1)}}))))}c.storage.isBlacklistMode??=!1,c.storage.exempted??=[];const t=c.storage,B=R.findByProps("createPendingReply");var T={settings:w,onUnload:y.patcher.before("createPendingReply",B,function([n]){const a=c.storage.exempted.includes(n.message?.author?.id);n.shouldMention&&=c.storage.isBlacklistMode?!a:a})};return s.default=T,s.settings=t,Object.defineProperty(s,"__esModule",{value:!0}),s})({},vendetta,vendetta.metro,vendetta.plugin,vendetta.metro.common,vendetta.storage,vendetta.ui.assets,vendetta.ui.components,window.React,vendetta.metro.common.ReactNative);