diff --git a/ChatboxAvatar/index.js b/ChatboxAvatar/index.js index 3a6106e..03d8f11 100644 --- a/ChatboxAvatar/index.js +++ b/ChatboxAvatar/index.js @@ -1 +1 @@ -(function(g,P,a,n,d,s){"use strict";const{ScrollView:F}=a.findByProps("ScrollView"),{TableRowGroup:u,TableRadioGroup:p,TableRadioRow:i,TableSwitchRow:z,Stack:O}=a.findByProps("TableRadioGroup","TableRadioRow","TableSwitchRow","TableRowGroup","Stack"),c=function(e,t){return d.plugin.storage[e]??t},f=function(e,t){d.plugin.storage[e]=t};function U(){const[,e]=n.React.useReducer(function(t){return~t},0);return n.React.createElement(F,{style:{flex:1}},n.React.createElement(O,{style:{padding:16},spacing:16},n.React.createElement(u,{title:"Press Action"},n.React.createElement(p,{value:c("pressAction","profile"),onChange:function(t){f("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(u,{title:"Long Press Action"},n.React.createElement(p,{value:c("longPressAction","server"),onChange:function(t){f("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(u,{title:"Profile Type"},n.React.createElement(p,{value:c("profileType","server"),onChange:function(t){f("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(u,{title:"Position"},n.React.createElement(p,{value:c("position","after_actions"),onChange:function(t){f("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(u,{title:"Status Icon"},n.React.createElement(p,{value:c("showStatusCutout",!0)?"true":"false",onChange:function(t){f("showStatusCutout",t==="true"),e()}},n.React.createElement(i,{value:"true",label:"Show"}),n.React.createElement(i,{value:"false",label:"Hide"}))),n.React.createElement(u,{title:"Visibility"},n.React.createElement(z,{label:"Show in DMs",value:c("showInDms",!0),onValueChange:function(t){f("showInDms",t),e()}}))))}const h=a.findByProps("useStateFromStores"),{Pressable:V,View:b}=n.ReactNative,y=a.find(function(e){return e?.type?.displayName==="ChatInputActions"})||a.findByName("ChatInputActions"),R=a.find(function(e){return e?.type?.displayName==="ChatInputSendButton"})||a.findByName("ChatInputSendButton"),A=a.findByProps("default","AvatarSizes","getStatusSize")?.default||a.findByProps("getStatusSize")?.default||a.findByName("Avatar"),C=a.findByStoreName("UserStore"),B=a.findByStoreName("SelectedChannelStore"),I=a.findByStoreName("ChannelStore"),N=a.findByStoreName("SelfPresenceStore"),E=a.findByName("showUserProfileActionSheet"),G=a.findByProps("showYouAccountActionSheet");function T(e,t){const l=G?.showYouAccountActionSheet;if(typeof l=="function")try{l(!0,!0);return}catch{}E?.({userId:e,channelId:t})}const o=function(e,t){return d.plugin.storage[e]??t};function w(){const e=h?.useStateFromStores?.([C],function(){return C?.getCurrentUser?.()}),t=h?.useStateFromStores?.([N],function(){return N?.getStatus?.()}),l=h?.useStateFromStores?.([B],function(){return B?.getCurrentlySelectedChannelId?.()}),r=h?.useStateFromStores?.([I],function(){return I?.getChannel?.(l)},[l]);if(!e||!A)return null;const S=o("pressAction","profile"),L=o("longPressAction","server"),M=o("showStatusCutout",!0),_=o("profileType","server"),Y=o("showInDms",!0);if((r?.type===1||r?.type===3)&&!Y)return null;const j=_==="server"?r?.guild_id:void 0,D=_==="server"?r?.id??l:void 0,k=function(){S==="server"?T(e.id,r?.id??l):E?.({userId:e.id,channelId:D})},H=function(){L==="server"?T(e.id,r?.id??l):E?.({userId:e.id,channelId:D})};return s.createElement(V,{onPress:k,onLongPress:H,style:{justifyContent:"center",alignItems:"center",marginHorizontal:4}},s.createElement(A,{user:e,guildId:j,status:M?t:void 0,avatarDecoration:e?.avatarDecoration,animate:!0}))}const v=[];var x={onLoad(){const e={pressAction:"profile",longPressAction:"server",showStatusCutout:!0,profileType:"server",showInDms:!0,position:"after_actions"};for(const t in e)d.plugin.storage[t]=d.plugin.storage[t]??e[t];if(y){const t=y.type||y;v.push(P.after("render",t,function(l,r){const S=o("position","after_actions");return S==="near_send"?r:s.createElement(b,{style:{flexDirection:"row",alignItems:"center"}},S==="before_actions"&&s.createElement(w,null),r,S==="after_actions"&&s.createElement(w,null))}))}if(R){const t=R.type||R;v.push(P.after("render",t,function(l,r){return o("position","after_actions")!=="near_send"?r:s.createElement(b,{style:{flexDirection:"row",alignItems:"center"}},s.createElement(w,null),r)}))}},onUnload(){for(const e of v)e?.();v.length=0},settings:U};return g.default=x,Object.defineProperty(g,"__esModule",{value:!0}),g})({},vendetta.patcher,vendetta.metro,vendetta.metro.common,vendetta,window.React); +(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); diff --git a/ChatboxAvatar/manifest.json b/ChatboxAvatar/manifest.json index 6081a7d..0bfd315 100644 --- a/ChatboxAvatar/manifest.json +++ b/ChatboxAvatar/manifest.json @@ -1 +1 @@ -{"authors":[{"name":"Cynosphere","id":"150745989836308480"},{"name":"kmmiio99o","id":"879393496627306587"}],"main":"index.js","vendetta":{"icon":"UserSquareIcon"},"name":"Chatbox Avatar","description":"Quickly view your profile from the chatbox.","hash":"d475de45cf47fa91d0b400461463712e7ed3c7a5d45376669986eeaaf2b4746c"} \ No newline at end of file +{"authors":[{"name":"Cynosphere","id":"150745989836308480"},{"name":"kmmiio99o","id":"879393496627306587"}],"main":"index.js","vendetta":{"icon":"UserSquareIcon"},"name":"Chatbox Avatar","description":"Quickly view your profile from the chatbox.","hash":"42243c6db02a5fdd0aa2656a40a0744cc96a7cdf8d5e3319af7643fef078cd31"} \ No newline at end of file