1 line
5.2 KiB
JavaScript
1 line
5.2 KiB
JavaScript
(function(R,E,r,n,S,o){"use strict";const{ScrollView:O}=r.findByProps("ScrollView"),{TableRowGroup:f,TableRadioGroup:v,TableRadioRow:i,TableSwitchRow:U,Stack:V}=r.findByProps("TableRadioGroup","TableRadioRow","TableSwitchRow","TableRowGroup","Stack"),d=function(e,t){return S.plugin.storage[e]??t},p=function(e,t){S.plugin.storage[e]=t};function x(){const[,e]=n.React.useReducer(function(t){return~t},0);return n.React.createElement(O,{style:{flex:1}},n.React.createElement(V,{style:{padding:16},spacing:16},n.React.createElement(f,{title:"Press Action"},n.React.createElement(v,{value:d("pressAction","profile"),onChange:function(t){p("pressAction",t),e()}},n.React.createElement(i,{value:"profile",label:"Open Profile"}),n.React.createElement(i,{value:"server",label:"Open Account Sheet"}))),n.React.createElement(f,{title:"Long Press Action"},n.React.createElement(v,{value:d("longPressAction","server"),onChange:function(t){p("longPressAction",t),e()}},n.React.createElement(i,{value:"profile",label:"Open Profile"}),n.React.createElement(i,{value:"server",label:"Open Account Sheet"}))),n.React.createElement(f,{title:"Profile Type"},n.React.createElement(v,{value:d("profileType","server"),onChange:function(t){p("profileType",t),e()}},n.React.createElement(i,{value:"server",label:"Prefer Server Profile"}),n.React.createElement(i,{value:"main",label:"Prefer Main Profile"}))),n.React.createElement(f,{title:"Position"},n.React.createElement(v,{value:d("position","after_actions"),onChange:function(t){p("position",t),e()}},n.React.createElement(i,{value:"before_actions",label:"Before Action Buttons"}),n.React.createElement(i,{value:"after_actions",label:"After Action Buttons"}),n.React.createElement(i,{value:"near_send",label:"Near Send Button"}))),n.React.createElement(f,{title:"Status Icon"},n.React.createElement(v,{value:d("showStatusCutout",!0)?"true":"false",onChange:function(t){p("showStatusCutout",t==="true"),e()}},n.React.createElement(i,{value:"true",label:"Show"}),n.React.createElement(i,{value:"false",label:"Hide"}))),n.React.createElement(f,{title:"Visibility"},n.React.createElement(U,{label:"Show in DMs",value:d("showInDms",!0),onValueChange:function(t){p("showInDms",t),e()}}))))}const y=r.findByProps("useStateFromStores"),{Pressable:z,View:w}=n.ReactNative,b=r.find(function(e){return e?.type?.displayName==="ChatInputActions"})||r.findByName("ChatInputActions"),A=r.find(function(e){return e?.type?.displayName==="ChatInputSendButton"})||r.findByName("ChatInputSendButton"),C=r.findByProps("default","AvatarSizes","getStatusSize")?.default||r.findByProps("getStatusSize")?.default||r.findByName("Avatar"),B=r.findByStoreName("UserStore"),I=r.findByStoreName("SelectedChannelStore"),_=r.findByStoreName("ChannelStore"),T=r.findByStoreName("SelfPresenceStore"),P=r.findByName("showUserProfileActionSheet"),G=r.findByProps("showYouAccountActionSheet");function N(e,t){const a=G?.showYouAccountActionSheet;if(typeof a=="function")try{a(!0,!0);return}catch{}P?.({userId:e,channelId:t})}const c=function(e,t){return S.plugin.storage[e]??t};function h(){const e=y?.useStateFromStores?.([B],function(){return B?.getCurrentUser?.()}),t=y?.useStateFromStores?.([T],function(){return T?.getStatus?.()}),a=y?.useStateFromStores?.([I],function(){return I?.getCurrentlySelectedChannelId?.()}),l=y?.useStateFromStores?.([_],function(){return _?.getChannel?.(a)},[a]);if(!e||!C)return null;const s=c("pressAction","profile"),u=c("longPressAction","server"),M=c("showStatusCutout",!0),D=c("profileType","server"),Y=c("showInDms",!0);if((l?.type===1||l?.type===3)&&!Y)return null;const j=D==="server"?l?.guild_id:void 0,F=D==="server"?l?.id??a:void 0,k=function(){s==="server"?N(e.id,l?.id??a):P?.({userId:e.id,channelId:F})},H=function(){u==="server"?N(e.id,l?.id??a):P?.({userId:e.id,channelId:F})};return o.createElement(z,{onPress:k,onLongPress:H,style:{justifyContent:"center",alignItems:"center",marginHorizontal:4}},o.createElement(C,{user:e,guildId:j,status:M?t:void 0,avatarDecoration:e?.avatarDecoration,animate:!0}))}const g=[];var L={onLoad(){const e={pressAction:"profile",longPressAction:"server",showStatusCutout:!0,profileType:"server",showInDms:!0,position:"after_actions"};for(const l in e)S.plugin.storage[l]=S.plugin.storage[l]??e[l];const t=b?.type||b,a=A?.type||A;t&&t!==a&&g.push(E.after("render",t,function(l,s){const u=c("position","after_actions");return u==="near_send"?s:o.createElement(w,{style:{flexDirection:"row",alignItems:"center"}},u==="before_actions"&&o.createElement(h,null),s,u==="after_actions"&&o.createElement(h,null))})),a&&a!==t&&g.push(E.after("render",a,function(l,s){return c("position","after_actions")!=="near_send"?s:o.createElement(w,{style:{flexDirection:"row",alignItems:"center"}},o.createElement(h,null),s)})),t&&t===a&&g.push(E.after("render",t,function(l,s){const u=c("position","after_actions");return o.createElement(w,{style:{flexDirection:"row",alignItems:"center"}},u==="before_actions"&&o.createElement(h,null),s,(u==="after_actions"||u==="near_send")&&o.createElement(h,null))}))},onUnload(){for(const e of g)e?.();g.length=0},settings:x};return R.default=L,Object.defineProperty(R,"__esModule",{value:!0}),R})({},vendetta.patcher,vendetta.metro,vendetta.metro.common,vendetta,window.React);
|