From ba419afdb47bba8a70c3a86d6539c67793df1260 Mon Sep 17 00:00:00 2001 From: kmmiio99o Date: Sat, 25 Jul 2026 09:16:39 +0000 Subject: [PATCH] deploy: ddcef7c85b80dee903745cd0c56fac33ca543c60 --- ServerDrawer/index.js | 2 +- ServerDrawer/manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ServerDrawer/index.js b/ServerDrawer/index.js index f841e72..d4d84b6 100644 --- a/ServerDrawer/index.js +++ b/ServerDrawer/index.js @@ -1 +1 @@ -(function(L,s,k,n,o,Q,ne){"use strict";const Me="[ServerDrawer]";function Qe(e){const t=s.findByProps("useIsMobileQuestDockRendered");if(!t?.useIsMobileQuestDockRendered)return console.log(Me,"WARN: useIsMobileQuestDockRendered not found"),!1;const r=t.useIsMobileQuestDockRendered;return t.useIsMobileQuestDockRendered=function(...i){return r.apply(this,i),!0},e.push(function(){t.useIsMobileQuestDockRendered=r}),!0}const Te="[ServerDrawer]";function Ve(e){const t=s.findByProps("useIsMobileQuestDockRenderedBase");if(!t?.useIsMobileQuestDockRenderedBase)return console.log(Te,"WARN: useIsMobileQuestDockRenderedBase not found"),!1;const r=t.useIsMobileQuestDockRenderedBase;return t.useIsMobileQuestDockRenderedBase=function(...i){return r.apply(this,i),!0},e.push(function(){t.useIsMobileQuestDockRenderedBase=r}),!0}const Fe="[ServerDrawer]";function Ge(e){const t=s.findByProps("useMobileQuestDock");if(!t.useMobileQuestDock)return console.log(Fe,"WARN: useMobileQuestDock not found"),!1;const r=t.useMobileQuestDock;return t.useMobileQuestDock=function(...i){return r.apply(this,i)||{id:"server-drawer",config:{quest_content_type:0,assets:{questBarHeroVideo:null,questBarHero:null},features:[]},userStatus:{enrolledAt:"2099-01-01",claimedAt:null},benefits:{rewards:[]},guildId:"0",tasks:[]}},e.push(function(){t.useMobileQuestDock=r}),!0}const He="[ServerDrawer]";function We(e){const t=s.findByProps("getQuestAsset");if(!t?.getQuestAsset)return console.log(He,"WARN: getQuestAsset not found"),!1;const r=t.getQuestAsset;return t.getQuestAsset=function(...i){try{return r.apply(this,i)}catch{return{url:null,isAnimated:!1}}},e.push(function(){t.getQuestAsset=r}),!0}const Le=s.findByStoreName("GuildStore"),Oe=s.findByProps("colors","unsafe_rawColors")?.colors;function oe({id:e,size:t=48}){const r=Le?.getGuild(e);if(!r)return null;const i=t>=40?16:8;return r.icon?n.createElement(o.Image,{source:{uri:`https://cdn.discordapp.com/icons/${r.id}/${r.icon}.png?size=${t*2}`},style:{width:t,height:t,borderRadius:i}}):n.createElement(o.View,{style:[re.fallback,{width:t,height:t,borderRadius:i,backgroundColor:Oe?.BG_ACCENT??"#5865f2"}]},n.createElement(o.Text,{style:[re.letter,{fontSize:Math.max(10,t*.4)}]},r.name?.split(" ").map(function(l){return l[0]}).join("").slice(0,2).toUpperCase()||"?"))}const re=o.StyleSheet.create({fallback:{alignItems:"center",justifyContent:"center"},letter:{color:"#fff",fontWeight:"700"}}),se=s.findByProps("TextStyleSheet")?.TextStyleSheet,_e=s.findByStoreName("ThemeStore"),ie=s.findByProps("colors","unsafe_rawColors"),je=ie?.internal??ie?.meta,le=s.findByProps("triggerHapticFeedback","HapticFeedbackTypes");function T(e){const t=_e?.theme;return e&&je?.resolveSemanticColor(t,e)||"#000000"}const w=12,O=12,ue=42,_=220,ae=4,P=16,V=20,de={tension:200,friction:20};function ze({visible:e,items:t,title:r,anchorX:i,anchorY:l,onClose:d}){const{width:c,height:S}=o.Dimensions.get("window"),E=(r?O+20+ae:0)+t.length*ue;let g=i,f=l+48+10;g+_>c-w&&(g=c-_-w),gS-w&&(f=l-E-10),f0?n.createElement(o.View,{style:I.outline},n.createElement(o.View,{style:I.badge},n.createElement(o.Text,{style:I.text},t>99?"99+":String(t)))):r?n.createElement(o.View,{style:I.dotOutline},n.createElement(o.View,{style:I.dot})):null}function pe({node:e,onPick:t}){const r=n.useRef(null),i=n.useRef(new o.Animated.Value(1)).current,l=function(){return o.Animated.spring(i,{toValue:.85,useNativeDriver:!0}).start()},d=function(){return o.Animated.spring(i,{toValue:1,useNativeDriver:!0}).start()},[c,S]=n.useState({visible:!1,items:[],title:"",x:0,y:0}),E=n.useCallback(function(){const C=e.id,u=Ue?.getGuild?.(C),h=s.find(function(p){return p?.default?.name==="getGuildsBarGuildMenuItems"})?.default??s.find(function(p){return typeof p?.default=="function"&&p.default.length<=2&&/guild/i.test(p.default.name??"")})?.default;if(!u||!h)return;const v=qe?.getGuildsTree?.()?.version,R=h(C,v);if(!R?.length)return;const B=r.current;B?.measure&&B.measure(function(p,N,$,A,M,m){S({visible:!0,items:R.map(function(y){return{label:y.label??y.title??"Unknown",action:y.action,danger:y.variant==="destructive",iconSource:y.iconSource,IconComponent:y.IconComponent}}),title:u.name,x:M,y:m})})},[e.id]),g=n.useCallback(function(){fe?.triggerHapticFeedback?.(fe.HapticFeedbackTypes.IMPACT_MEDIUM),E()},[E]),f=e.id;return n.createElement(n.Fragment,null,n.createElement(o.Pressable,{onPressIn:l,onPressOut:d,onPress:function(){return t(f)},onLongPress:g,delayLongPress:500},n.createElement(o.View,{ref:r,style:ge.outer,collapsable:!1},n.createElement(o.Animated.View,{style:[ge.icon,{transform:[{scale:i}]}]},n.createElement(oe,{id:f})),n.createElement(Ke,{guildId:f}))),n.createElement(ze,{visible:c.visible,items:c.items,title:c.title,anchorX:c.x,anchorY:c.y,onClose:function(){return S(function(C){return{...C,visible:!1}})}}))}const ge=o.StyleSheet.create({outer:{width:F,height:F},icon:{width:F,height:F,borderRadius:16,overflow:"hidden"}}),I=o.StyleSheet.create({outline:{position:"absolute",bottom:-3,right:-3,minWidth:23,minHeight:23,borderRadius:12,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},badge:{minWidth:19,height:19,borderRadius:9,backgroundColor:"#ed4245",alignItems:"center",justifyContent:"center",paddingHorizontal:5},text:{color:"#fff",fontSize:10,fontWeight:"700",lineHeight:19},dotOutline:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},dot:{width:10,height:10,borderRadius:5,backgroundColor:"#ed4245"}}),Xe=s.findByProps("useStateFromStores");s.findByProps("colors","unsafe_rawColors")?.colors;const he=s.findByStoreName("ExpandedGuildFolderStore");function Ye(e){return Xe?.useStateFromStores?.([he],function(){const t=he?.getExpandedFolders?.();return t instanceof Set?t.has(e):!1},[e])??!1}const Je=s.findByProps("toggleGuildFolderExpand"),Ze=s.findByProps("useStateFromStores"),me=s.findByStoreName("GuildReadStateStore"),D=48,z=16,ve=[{top:6,left:6},{top:6,right:6},{bottom:6,left:6},{bottom:6,right:6}],Ne=ne.getAssetIDByName("FolderIcon");function ye(e){return e==null?"#5865f2":`#${e.toString(16).padStart(6,"0")}`}function $e({node:e}){const t=Ze?.useStateFromStores?.([me],function(){let r=0;for(const i of e.children)r+=me?.getMentionCount?.(i.id)??0;return r},[e.children])??0;return t>0?n.createElement(o.View,{style:q.outline},n.createElement(o.View,{style:q.badge},n.createElement(o.Text,{style:q.text},t>99?"99+":String(t)))):null}function et({node:e}){const t=ye(e.color);return n.createElement(o.View,{style:U.outer},n.createElement(o.View,{style:[U.icon,{backgroundColor:t}]},e.children.slice(0,4).map(function(r,i){return n.createElement(o.View,{key:r.id,style:[U.cell,ve[i]]},n.createElement(oe,{id:r.id,size:z}))})),n.createElement($e,{node:e}))}const U=o.StyleSheet.create({outer:{width:D,height:D},icon:{width:D,height:D,borderRadius:16,overflow:"hidden"},cell:{position:"absolute",width:z,height:z,borderRadius:8,overflow:"hidden"}});function tt({children:e}){const t=n.useRef(new o.Animated.Value(0)).current;return n.useEffect(function(){o.Animated.timing(t,{toValue:1,duration:180,useNativeDriver:!0}).start()},[]),n.createElement(o.Animated.View,{style:{opacity:t}},e)}function nt({node:e,onPick:t}){const r=Ye(e.id),i=function(){Je?.toggleGuildFolderExpand?.(e.id)};return r?n.createElement(n.Fragment,null,n.createElement(o.Pressable,{onPress:i},n.createElement(o.View,{style:[be.openIcon,{backgroundColor:ye(e.color)}]},n.createElement(o.Image,{source:Ne,style:be.folderImg,tintColor:"#fff"}))),e.children.map(function(l){return n.createElement(tt,{key:l.id},n.createElement(pe,{node:l,onPick:t}))})):n.createElement(o.Pressable,{onPress:i},n.createElement(et,{node:e}))}const be=o.StyleSheet.create({openIcon:{width:D,height:D,borderRadius:16,alignItems:"center",justifyContent:"center"},folderImg:{width:24,height:24}}),q=o.StyleSheet.create({outline:{position:"absolute",bottom:-3,right:-3,minWidth:23,minHeight:23,borderRadius:12,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},badge:{minWidth:19,height:19,borderRadius:9,backgroundColor:"#ed4245",alignItems:"center",justifyContent:"center",paddingHorizontal:5},text:{color:"#fff",fontSize:10,fontWeight:"700",lineHeight:19}}),ot=s.findByStoreName("SortedGuildStore"),rt=s.findByProps("getRootNavigationRef"),Se=s.findByProps("triggerHapticFeedback","HapticFeedbackTypes"),Ee=s.findByProps("transitionToGuild"),st=s.find(function(e){return e?.QuestDockExternalCoordinationContext}),Ce=st?.QuestDockExternalCoordinationContext,ke=s.find(function(e){return e?.QuestDockMode?.COLLAPSED!=null})?.QuestDockMode,we=48,H=6,it=12;function Re({gestureContext:e}){const t=n.useCallback(function(u){Se?.triggerHapticFeedback(Se.HapticFeedbackTypes.SOFT),Ee?.transitionToGuild?Ee.transitionToGuild(u,null):rt?.getRootNavigationRef()?.navigate("guilds",{guildId:u})},[]),r=n.useMemo(function(){return(ot?.getGuildsTree()?.root?.children||[]).filter(function(u){return u.type!=="root"})},[]),i=e?n.useContext(e):null,l=i?.minExpandedContentHeight,d=n.useCallback(function(u){if(!l)return;const h=u.nativeEvent.layout.height;l.get()!==h&&l.set(h)},[l]),c=(Ce?n.useContext(Ce):null)?.setRestingQuestDockMode,S=i?.questDockWrapperSpecs;n.useEffect(function(){if(!c||!ke||!S)return;const u=o.BackHandler.addEventListener("hardwareBackPress",function(){return(S.get()?.height??56)>80?(c(ke.COLLAPSED),!0):!1});return function(){return u.remove()}},[c,S]);const{width:E}=o.Dimensions.get("window"),g=Math.max(3,Math.floor((E-it*2+H)/(we+H))),f=g*we+(g-1)*H,C=Math.max(0,(E-f)/2);return n.createElement(o.View,{style:Be.alignTop},n.createElement(o.View,{style:[Be.grid,{paddingHorizontal:C,gap:H}],onLayout:d},r.map(function(u){return u.type==="folder"?n.createElement(nt,{key:u.id,node:u,onPick:t}):n.createElement(pe,{key:u.id,node:u,onPick:t})})))}const Be=o.StyleSheet.create({alignTop:{flex:1,justifyContent:"flex-start",alignItems:"flex-start"},grid:{flexDirection:"row",flexWrap:"wrap",paddingTop:4,paddingBottom:16}}),K=new Map;let b=null,W=!1;function De(e,t,r){K.set(e,{replacement:t,extraProps:r})}function lt(e){if(W)return;if(b=k.React.createElement,!b){console.warn("[ServerDrawer] React.createElement is null, skipping patch");return}const t=function(r,i,...l){if(!b)return k.React.createElement(r,i,...l);const d=K.get(r);if(d){const c=d.extraProps?{...i,...d.extraProps}:i;return b.call(k.React,d.replacement,c,...l)}return b.call(k.React,r,i,...l)};Object.assign(t,b),k.React.createElement=t,W=!0,e.push(function(){W&&b&&(k.React.createElement=b,W=!1),K.clear()})}const X="[ServerDrawer]",Pe=s.find(function(e){return e?.QuestDockGestureContext})?.QuestDockGestureContext;function ut(e){const t=s.find(function(i){return i?.type?.displayName==="QuestDockContentExpanded"||i?.type?.name==="QuestDockContentExpanded"});if(!t?.type)return console.log(X,"WARN: QuestDockContentExpanded not found"),!1;const r=t.type;return De(r,Re,{gestureContext:Pe}),t.type=function(){return k.React.createElement(Re,{gestureContext:Pe})},e.push(function(){t.type=r}),console.log(X,"PATCH: QuestDockContentExpanded replaced"),!0}function x(e,t){const r=s.find(function(d){return d?.type?.displayName===e||d?.type?.name===e});if(!r?.type)return console.log(X,`WARN: ${e} not found`),!1;const i=r.type,l=i;return r.type=function(){return null},l&&(Object.defineProperties(r.type,Object.getOwnPropertyDescriptors(l)),r.type.displayName=e),t.push(function(){r.type=i}),!0}const at="[ServerDrawer]",dt=ne.getAssetIDByName("ChatIcon"),Ie=s.findByProps("triggerHapticFeedback","HapticFeedbackTypes"),xe=s.findByProps("selectPrivateChannel"),ct=s.findByName("SelectedChannelStore"),ft=s.findByProps("useStateFromStores"),pt=ft?.useStateFromStores,Y=s.findByProps("getGuildId"),J=s.findByProps("colors","unsafe_rawColors")?.colors,gt=s.findByProps("ME"),ht=gt?.ME??"/channels/@me";function mt(){if(Ie?.triggerHapticFeedback(Ie.HapticFeedbackTypes.SOFT),xe?.selectPrivateChannel){const e=ct?.getLastSelectedChannelId?.();xe.selectPrivateChannel(e)}}function yt(){try{return Y?pt([Y],function(){const e=Y?.getGuildId?.();return e==null||e===ht}):!1}catch{return!1}}function Ae(){const e=yt(),t=e?J?.WHITE??"#fff":J?.INTERACTIVE_NORMAL??"#80848e";return n.createElement(o.Pressable,{onPress:mt,style:{flex:1,alignItems:"center",justifyContent:"center"}},e?n.createElement(o.View,{style:{position:"absolute",left:0,top:"25%",width:4,height:"50%",borderRadius:2,backgroundColor:J?.WHITE??"#fff"}}):null,n.createElement(o.Image,{source:dt,style:{width:28,height:28,tintColor:t}}))}function bt(){const e=s.findByName("GuildsBar");if(e)return{default:e};let t=s.find(function(r){try{return r?.default?.type?.name==="GuildsBar"}catch{return!1}});return t?.default||(t=s.find(function(r){try{return r?.default?.displayName==="GuildsBar"}catch{return!1}}),t?.default)?t:null}function St(e){const t=bt();if(!t?.default)return console.log(at,"WARN: GuildsBar not found"),!1;const r=t.default;return De(r,Ae),t.default=function(){return n.createElement(Ae)},t.default.displayName="GuildsBar",e.push(function(){t.default=r}),!0}const Z="[ServerDrawer]",a=[];var Et={onLoad(){console.log(Z,"onLoad");let e=0;lt(a),e++,Qe(a)&&e++,Ve(a)&&e++,Ge(a)&&e++,We(a)&&e++,ut(a)&&e++,x("QuestDockContentCollapsed",a)&&e++,x("QuestDockEnrolledHeader",a)&&e++,x("QuestDockUnenrolledHeader",a)&&e++,x("QuestDockEnrolledBody",a)&&e++,x("QuestDockUnenrolledBody",a)&&e++,St(a)&&e++,console.log(Z,`onLoad done \u2014 ${e} patches applied, ${a.length} cleanups`)},onUnload(){console.log(Z,"onUnload");for(const e of a)e();a.length=0}};return L.default=Et,Object.defineProperty(L,"__esModule",{value:!0}),L})({},vendetta.metro,vendetta.metro.common,window.React,vendetta.metro.common.ReactNative,vendetta.ui,vendetta.ui.assets); +(function(L,s,k,n,o,Q,ne){"use strict";const Qe="[ServerDrawer]";function Me(e){const t=s.findByProps("useIsMobileQuestDockRendered");if(!t?.useIsMobileQuestDockRendered)return console.log(Qe,"WARN: useIsMobileQuestDockRendered not found"),!1;const r=t.useIsMobileQuestDockRendered;return t.useIsMobileQuestDockRendered=function(...i){return r.apply(this,i),!0},e.push(function(){t.useIsMobileQuestDockRendered=r}),!0}const Fe="[ServerDrawer]";function Ve(e){const t=s.findByProps("useIsMobileQuestDockRenderedBase");if(!t?.useIsMobileQuestDockRenderedBase)return console.log(Fe,"WARN: useIsMobileQuestDockRenderedBase not found"),!1;const r=t.useIsMobileQuestDockRenderedBase;return t.useIsMobileQuestDockRenderedBase=function(...i){return r.apply(this,i),!0},e.push(function(){t.useIsMobileQuestDockRenderedBase=r}),!0}const Ge="[ServerDrawer]";function He(e){const t=s.findByProps("useMobileQuestDock");if(!t.useMobileQuestDock)return console.log(Ge,"WARN: useMobileQuestDock not found"),!1;const r=t.useMobileQuestDock;return t.useMobileQuestDock=function(...i){return r.apply(this,i)||{id:"server-drawer",config:{quest_content_type:0,assets:{questBarHeroVideo:null,questBarHero:null},features:[]},userStatus:{enrolledAt:"2099-01-01",claimedAt:null},benefits:{rewards:[]},guildId:"0",tasks:[]}},e.push(function(){t.useMobileQuestDock=r}),!0}const We="[ServerDrawer]";function Le(e){const t=s.findByProps("getQuestAsset");if(!t?.getQuestAsset)return console.log(We,"WARN: getQuestAsset not found"),!1;const r=t.getQuestAsset;return t.getQuestAsset=function(...i){try{return r.apply(this,i)}catch{return{url:null,isAnimated:!1}}},e.push(function(){t.getQuestAsset=r}),!0}const Oe=s.findByStoreName("GuildStore"),_e=s.findByProps("colors","unsafe_rawColors")?.colors;function oe({id:e,size:t=48}){const r=Oe?.getGuild(e);if(!r)return null;const i=t>=40?16:8;return r.icon?n.createElement(o.Image,{source:{uri:`https://cdn.discordapp.com/icons/${r.id}/${r.icon}.png?size=${t*2}`},style:{width:t,height:t,borderRadius:i}}):n.createElement(o.View,{style:[re.fallback,{width:t,height:t,borderRadius:i,backgroundColor:_e?.BG_ACCENT??"#5865f2"}]},n.createElement(o.Text,{style:[re.letter,{fontSize:Math.max(10,t*.4)}]},r.name?.split(" ").map(function(l){return l[0]}).join("").slice(0,2).toUpperCase()||"?"))}const re=o.StyleSheet.create({fallback:{alignItems:"center",justifyContent:"center"},letter:{color:"#fff",fontWeight:"700"}}),se=s.findByProps("TextStyleSheet")?.TextStyleSheet,je=s.findByStoreName("ThemeStore"),ie=s.findByProps("colors","unsafe_rawColors"),ze=ie?.internal??ie?.meta,le=s.findByProps("triggerHapticFeedback","HapticFeedbackTypes");function M(e){const t=je?.theme;return e&&ze?.resolveSemanticColor(t,e)||"#000000"}const w=12,O=12,ue=42,_=220,ae=4,P=16,F=20,de={tension:200,friction:20};function Ue({visible:e,items:t,title:r,anchorX:i,anchorY:l,onClose:d}){const{width:c,height:S}=o.Dimensions.get("window"),E=(r?O+20+ae:0)+t.length*ue;let g=i,f=l+48+10;g+_>c-w&&(g=c-_-w),gS-w&&(f=l-E-10),f0?n.createElement(o.View,{style:I.outline},n.createElement(o.View,{style:I.badge},n.createElement(o.Text,{style:I.text},t>99?"99+":String(t)))):r?n.createElement(o.View,{style:I.dotOutline},n.createElement(o.View,{style:I.dot})):null}function pe({node:e,onPick:t}){const r=n.useRef(null),i=n.useRef(new o.Animated.Value(1)).current,l=function(){return o.Animated.spring(i,{toValue:.85,useNativeDriver:!0}).start()},d=function(){return o.Animated.spring(i,{toValue:1,useNativeDriver:!0}).start()},[c,S]=n.useState({visible:!1,items:[],title:"",x:0,y:0}),E=n.useCallback(function(){const C=e.id,u=qe?.getGuild?.(C),h=s.find(function(p){return p?.default?.name==="getGuildsBarGuildMenuItems"})?.default??s.find(function(p){return typeof p?.default=="function"&&p.default.length<=2&&/guild/i.test(p.default.name??"")})?.default;if(!u||!h)return;const Z=Ke?.getGuildsTree?.()?.version,R=h(C,Z);if(!R?.length)return;const B=r.current;B?.measure&&B.measure(function(p,N,$,A,T,m){S({visible:!0,items:R.map(function(y){return{label:y.label??y.title??"Unknown",action:y.action,danger:y.variant==="destructive",iconSource:y.iconSource,IconComponent:y.IconComponent}}),title:u.name,x:T,y:m})})},[e.id]),g=n.useCallback(function(){fe?.triggerHapticFeedback?.(fe.HapticFeedbackTypes.IMPACT_MEDIUM),E()},[E]),f=e.id;return n.createElement(n.Fragment,null,n.createElement(o.Pressable,{onPressIn:l,onPressOut:d,onPress:function(){return t(f)},onLongPress:g,delayLongPress:500},n.createElement(o.View,{ref:r,style:ge.outer,collapsable:!1},n.createElement(o.Animated.View,{style:[ge.icon,{transform:[{scale:i}]}]},n.createElement(oe,{id:f})),n.createElement(Xe,{guildId:f}))),n.createElement(Ue,{visible:c.visible,items:c.items,title:c.title,anchorX:c.x,anchorY:c.y,onClose:function(){return S(function(C){return{...C,visible:!1}})}}))}const ge=o.StyleSheet.create({outer:{width:V,height:V},icon:{width:V,height:V,borderRadius:16,overflow:"hidden"}}),I=o.StyleSheet.create({outline:{position:"absolute",bottom:-3,right:-3,minWidth:23,minHeight:23,borderRadius:12,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},badge:{minWidth:19,height:19,borderRadius:9,backgroundColor:"#ed4245",alignItems:"center",justifyContent:"center",paddingHorizontal:5},text:{color:"#fff",fontSize:10,fontWeight:"700",lineHeight:19},dotOutline:{position:"absolute",bottom:-2,right:-2,width:14,height:14,borderRadius:7,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},dot:{width:10,height:10,borderRadius:5,backgroundColor:"#ed4245"}}),Ye=s.findByProps("useStateFromStores");s.findByProps("colors","unsafe_rawColors")?.colors;const he=s.findByStoreName("ExpandedGuildFolderStore");function ve(e){return Ye?.useStateFromStores?.([he],function(){const t=he?.getExpandedFolders?.();return t instanceof Set?t.has(e):!1},[e])??!1}const Je=s.findByProps("toggleGuildFolderExpand"),Ze=s.findByProps("useStateFromStores"),me=s.findByStoreName("GuildReadStateStore"),D=48,z=16,Ne=[{top:6,left:6},{top:6,right:6},{bottom:6,left:6},{bottom:6,right:6}],$e=ne.getAssetIDByName("FolderIcon");function ye(e){return e==null?"#5865f2":`#${e.toString(16).padStart(6,"0")}`}function et({node:e}){const t=Ze?.useStateFromStores?.([me],function(){let r=0;for(const i of e.children)r+=me?.getMentionCount?.(i.id)??0;return r},[e.children])??0;return t>0?n.createElement(o.View,{style:q.outline},n.createElement(o.View,{style:q.badge},n.createElement(o.Text,{style:q.text},t>99?"99+":String(t)))):null}function tt({node:e}){const t=ye(e.color);return n.createElement(o.View,{style:U.outer},n.createElement(o.View,{style:[U.icon,{backgroundColor:t}]},e.children.slice(0,4).map(function(r,i){return n.createElement(o.View,{key:r.id,style:[U.cell,Ne[i]]},n.createElement(oe,{id:r.id,size:z}))})),n.createElement(et,{node:e}))}const U=o.StyleSheet.create({outer:{width:D,height:D},icon:{width:D,height:D,borderRadius:16,overflow:"hidden"},cell:{position:"absolute",width:z,height:z,borderRadius:8,overflow:"hidden"}});function nt({children:e}){const t=n.useRef(new o.Animated.Value(0)).current;return n.useEffect(function(){o.Animated.timing(t,{toValue:1,duration:180,useNativeDriver:!0}).start()},[]),n.createElement(o.Animated.View,{style:{opacity:t}},e)}function ot({node:e,onPick:t}){const r=ve(e.id),i=function(){Je?.toggleGuildFolderExpand?.(e.id)};return r?n.createElement(n.Fragment,null,n.createElement(o.Pressable,{onPress:i},n.createElement(o.View,{style:[be.openIcon,{backgroundColor:ye(e.color)}]},n.createElement(o.Image,{source:$e,style:be.folderImg,tintColor:"#fff"}))),e.children.map(function(l){return n.createElement(nt,{key:l.id},n.createElement(pe,{node:l,onPick:t}))})):n.createElement(o.Pressable,{onPress:i},n.createElement(tt,{node:e}))}const be=o.StyleSheet.create({openIcon:{width:D,height:D,borderRadius:16,alignItems:"center",justifyContent:"center"},folderImg:{width:24,height:24}}),q=o.StyleSheet.create({outline:{position:"absolute",bottom:-3,right:-3,minWidth:23,minHeight:23,borderRadius:12,backgroundColor:"#1a1a2e",alignItems:"center",justifyContent:"center"},badge:{minWidth:19,height:19,borderRadius:9,backgroundColor:"#ed4245",alignItems:"center",justifyContent:"center",paddingHorizontal:5},text:{color:"#fff",fontSize:10,fontWeight:"700",lineHeight:19}}),rt=s.findByProps("useStateFromStores"),Se=s.findByStoreName("SortedGuildStore"),st=s.findByProps("getRootNavigationRef"),Ee=s.findByProps("triggerHapticFeedback","HapticFeedbackTypes"),Ce=s.findByProps("transitionToGuild"),it=s.find(function(e){return e?.QuestDockExternalCoordinationContext}),ke=it?.QuestDockExternalCoordinationContext,we=s.find(function(e){return e?.QuestDockMode?.COLLAPSED!=null})?.QuestDockMode,Re=48,H=6,lt=12;function Be({gestureContext:e}){const t=n.useCallback(function(u){Ee?.triggerHapticFeedback(Ee.HapticFeedbackTypes.SOFT),Ce?.transitionToGuild?Ce.transitionToGuild(u,null):st?.getRootNavigationRef()?.navigate("guilds",{guildId:u})},[]),r=rt?.useStateFromStores?.([Se],function(){return(Se?.getGuildsTree()?.root?.children||[]).filter(function(u){return u.type!=="root"})})??[],i=e?n.useContext(e):null,l=i?.minExpandedContentHeight,d=n.useCallback(function(u){if(!l)return;const h=u.nativeEvent.layout.height;l.get()!==h&&l.set(h)},[l]),c=(ke?n.useContext(ke):null)?.setRestingQuestDockMode,S=i?.questDockWrapperSpecs;n.useEffect(function(){if(!c||!we||!S)return;const u=o.BackHandler.addEventListener("hardwareBackPress",function(){return(S.get()?.height??56)>80?(c(we.COLLAPSED),!0):!1});return function(){return u.remove()}},[c,S]);const{width:E}=o.Dimensions.get("window"),g=Math.max(3,Math.floor((E-lt*2+H)/(Re+H))),f=g*Re+(g-1)*H,C=Math.max(0,(E-f)/2);return n.createElement(o.View,{style:De.alignTop},n.createElement(o.View,{style:[De.grid,{paddingHorizontal:C,gap:H}],onLayout:d},r.map(function(u){return u.type==="folder"?n.createElement(ot,{key:u.id,node:u,onPick:t}):n.createElement(pe,{key:u.id,node:u,onPick:t})})))}const De=o.StyleSheet.create({alignTop:{flex:1,justifyContent:"flex-start",alignItems:"flex-start"},grid:{flexDirection:"row",flexWrap:"wrap",paddingTop:4,paddingBottom:16}}),K=new Map;let b=null,W=!1;function Pe(e,t,r){K.set(e,{replacement:t,extraProps:r})}function ut(e){if(W)return;if(b=k.React.createElement,!b){console.warn("[ServerDrawer] React.createElement is null, skipping patch");return}const t=function(r,i,...l){if(!b)return k.React.createElement(r,i,...l);const d=K.get(r);if(d){const c=d.extraProps?{...i,...d.extraProps}:i;return b.call(k.React,d.replacement,c,...l)}return b.call(k.React,r,i,...l)};Object.assign(t,b),k.React.createElement=t,W=!0,e.push(function(){W&&b&&(k.React.createElement=b,W=!1),K.clear()})}const X="[ServerDrawer]",Ie=s.find(function(e){return e?.QuestDockGestureContext})?.QuestDockGestureContext;function at(e){const t=s.find(function(i){return i?.type?.displayName==="QuestDockContentExpanded"||i?.type?.name==="QuestDockContentExpanded"});if(!t?.type)return console.log(X,"WARN: QuestDockContentExpanded not found"),!1;const r=t.type;return Pe(r,Be,{gestureContext:Ie}),t.type=function(){return k.React.createElement(Be,{gestureContext:Ie})},e.push(function(){t.type=r}),console.log(X,"PATCH: QuestDockContentExpanded replaced"),!0}function x(e,t){const r=s.find(function(d){return d?.type?.displayName===e||d?.type?.name===e});if(!r?.type)return console.log(X,`WARN: ${e} not found`),!1;const i=r.type,l=i;return r.type=function(){return null},l&&(Object.defineProperties(r.type,Object.getOwnPropertyDescriptors(l)),r.type.displayName=e),t.push(function(){r.type=i}),!0}const dt="[ServerDrawer]",ct=ne.getAssetIDByName("ChatIcon"),xe=s.findByProps("triggerHapticFeedback","HapticFeedbackTypes"),Ae=s.findByProps("selectPrivateChannel"),ft=s.findByName("SelectedChannelStore"),pt=s.findByProps("useStateFromStores"),gt=pt?.useStateFromStores,Y=s.findByProps("getGuildId"),v=s.findByProps("colors","unsafe_rawColors")?.colors,ht=s.findByProps("ME"),mt=ht?.ME??"/channels/@me";function yt(){if(xe?.triggerHapticFeedback(xe.HapticFeedbackTypes.SOFT),Ae?.selectPrivateChannel){const e=ft?.getLastSelectedChannelId?.();Ae.selectPrivateChannel(e)}}function bt(){try{return Y?gt([Y],function(){const e=Y?.getGuildId?.();return e==null||e===mt}):!1}catch{return!1}}function Te(){const e=bt(),t=e?v?.WHITE??"#fff":v?.INTERACTIVE_NORMAL??"#80848e";return n.createElement(o.Pressable,{onPress:yt,style:{flex:1,alignItems:"center",justifyContent:"center"}},e?n.createElement(o.View,{style:{position:"absolute",left:0,top:"25%",width:4,height:"50%",borderRadius:2,backgroundColor:v?.WHITE??"#fff"}}):null,n.createElement(o.Image,{source:ct,style:{width:28,height:28,tintColor:t}}))}function St(){const e=s.findByName("GuildsBar");if(e)return{default:e};let t=s.find(function(r){try{return r?.default?.type?.name==="GuildsBar"}catch{return!1}});return t?.default||(t=s.find(function(r){try{return r?.default?.displayName==="GuildsBar"}catch{return!1}}),t?.default)?t:null}function Et(e){const t=St();if(!t?.default)return console.log(dt,"WARN: GuildsBar not found"),!1;const r=t.default;return Pe(r,Te),t.default=function(){return n.createElement(Te)},t.default.displayName="GuildsBar",e.push(function(){t.default=r}),!0}const J="[ServerDrawer]",a=[];var Ct={onLoad(){console.log(J,"onLoad");let e=0;ut(a),e++,Me(a)&&e++,Ve(a)&&e++,He(a)&&e++,Le(a)&&e++,at(a)&&e++,x("QuestDockContentCollapsed",a)&&e++,x("QuestDockEnrolledHeader",a)&&e++,x("QuestDockUnenrolledHeader",a)&&e++,x("QuestDockEnrolledBody",a)&&e++,x("QuestDockUnenrolledBody",a)&&e++,Et(a)&&e++,console.log(J,`onLoad done \u2014 ${e} patches applied, ${a.length} cleanups`)},onUnload(){console.log(J,"onUnload");for(const e of a)e();a.length=0}};return L.default=Ct,Object.defineProperty(L,"__esModule",{value:!0}),L})({},vendetta.metro,vendetta.metro.common,window.React,vendetta.metro.common.ReactNative,vendetta.ui,vendetta.ui.assets); diff --git a/ServerDrawer/manifest.json b/ServerDrawer/manifest.json index 8907a64..783e91d 100644 --- a/ServerDrawer/manifest.json +++ b/ServerDrawer/manifest.json @@ -1 +1 @@ -{"authors":[{"name":"kmmiio99o","id":"879393496627306587"}],"main":"index.js","vendetta":{"icon":"ServerIcon"},"name":"Server Drawer","description":"Server Drawer above the YouBar, manage your servers differently!","hash":"c181d503007e99e8f8320b6f5db5ef55f368f7c38fbf01022aaa4f6210126ff7"} \ No newline at end of file +{"authors":[{"name":"kmmiio99o","id":"879393496627306587"}],"main":"index.js","vendetta":{"icon":"ServerIcon"},"name":"Server Drawer","description":"Server Drawer above the YouBar, manage your servers differently!","hash":"031d452bf0e69f47af41060161f9b110f62d24bcae4b61b567cfb33dabd750bb"} \ No newline at end of file