diff --git a/ChatboxAvatar/index.js b/ChatboxAvatar/index.js index 65820c5..3a6106e 100644 --- a/ChatboxAvatar/index.js +++ b/ChatboxAvatar/index.js @@ -1 +1 @@ -(function(s,d,t,v,a){"use strict";const o=t.findByProps("useStateFromStores"),{Pressable:B,View:l}=v.ReactNative,i=t.find(function(e){return e?.type?.displayName==="ChatInputActions"})||t.findByName("ChatInputActions"),f=t.findByProps("default","AvatarSizes","getStatusSize")?.default||t.findByProps("getStatusSize")?.default||t.findByName("Avatar"),S=t.findByStoreName("UserStore"),y=t.findByStoreName("SelectedChannelStore"),h=t.findByStoreName("ChannelStore"),m=t.findByStoreName("SelfPresenceStore"),g=t.findByName("showUserProfileActionSheet"),I=t.findByProps("showYouAccountActionSheet");function P(e,n){const r=I?.showYouAccountActionSheet;if(typeof r=="function")try{r(!0,!0);return}catch{}g?.({userId:e,channelId:n})}function p(){const e=o?.useStateFromStores?.([S],function(){return S?.getCurrentUser?.()}),n=o?.useStateFromStores?.([m],function(){return m?.getStatus?.()}),r=o?.useStateFromStores?.([y],function(){return y?.getCurrentlySelectedChannelId?.()}),c=o?.useStateFromStores?.([h],function(){return h?.getChannel?.(r)},[r]);return!e||!f?null:a.createElement(B,{onPress:function(){return g?.({userId:e.id,channelId:c?.id??r})},onLongPress:function(){return P(e.id,c?.id??r)},style:{justifyContent:"center",alignItems:"center",marginHorizontal:4}},a.createElement(f,{user:e,guildId:c?.guild_id,status:n,avatarDecoration:e?.avatarDecoration,animate:!0}))}const u=[];var A={onLoad(){i&&(i.type?u.push(d.after("render",i.type,function(e,n){return a.createElement(l,{style:{flexDirection:"row",alignItems:"center"}},n,a.createElement(p,null))})):u.push(d.after("render",i,function(e,n){return a.createElement(l,{style:{flexDirection:"row",alignItems:"center"}},n,a.createElement(p,null))})))},onUnload(){for(const e of u)e?.();u.length=0}};return s.default=A,Object.defineProperty(s,"__esModule",{value:!0}),s})({},vendetta.patcher,vendetta.metro,vendetta.metro.common,window.React); +(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); diff --git a/ChatboxAvatar/manifest.json b/ChatboxAvatar/manifest.json index 46a4a65..6081a7d 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":"4017f12d3af0cf9406b8fb2af52a4d940162b3fffee2e1fe799f09a1230fe09e"} \ 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":"d475de45cf47fa91d0b400461463712e7ed3c7a5d45376669986eeaaf2b4746c"} \ No newline at end of file