From 872b57e925c05f88cb34460a6bb0780f6be34ffe Mon Sep 17 00:00:00 2001 From: kmmiio99o Date: Sat, 1 Aug 2026 17:12:56 +0000 Subject: [PATCH] deploy: 7de79225791c3480e3859ce9297da38589a4fc37 --- 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 d4d84b6..10ec23d 100644 --- a/ServerDrawer/index.js +++ b/ServerDrawer/index.js @@ -1 +1 @@ -(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); +(function(j,s,k,n,o,F,ie){"use strict";const He="[ServerDrawer]";function Ge(e){const t=s.findByProps("useIsMobileQuestDockRendered");if(!t?.useIsMobileQuestDockRendered)return console.log(He,"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 We="[ServerDrawer]";function Oe(e){const t=s.findByProps("useIsMobileQuestDockRenderedBase");if(!t?.useIsMobileQuestDockRenderedBase)return console.log(We,"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 _e="[ServerDrawer]";function Le(e){const t=s.findByProps("useMobileQuestDock");if(!t.useMobileQuestDock)return console.log(_e,"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 je="[ServerDrawer]";function ze(e){const t=s.findByProps("getQuestAsset");if(!t?.getQuestAsset)return console.log(je,"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 Ue=s.findByStoreName("GuildStore"),qe=s.findByProps("colors","unsafe_rawColors")?.colors;function le({id:e,size:t=48}){const r=Ue?.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:[ue.fallback,{width:t,height:t,borderRadius:i,backgroundColor:qe?.BG_ACCENT??"#5865f2"}]},n.createElement(o.Text,{style:[ue.letter,{fontSize:Math.max(10,t*.4)}]},r.name?.split(" ").map(function(l){return l[0]}).join("").slice(0,2).toUpperCase()||"?"))}const ue=o.StyleSheet.create({fallback:{alignItems:"center",justifyContent:"center"},letter:{color:"#fff",fontWeight:"700"}}),ae=s.findByProps("TextStyleSheet")?.TextStyleSheet,Je=s.findByStoreName("ThemeStore"),ce=s.findByProps("colors","unsafe_rawColors"),Ke=ce?.internal??ce?.meta,de=s.findByProps("triggerHapticFeedback","HapticFeedbackTypes");function V(e){const t=Je?.theme;return e&&Ke?.resolveSemanticColor(t,e)||"#000000"}const w=12,z=12,fe=42,U=220,pe=4,P=16,Q=20,ge={tension:200,friction:20};function Xe({visible:e,items:t,title:r,anchorX:i,anchorY:l,onClose:c}){const{width:d,height:S}=o.Dimensions.get("window"),C=(r?z+20+pe:0)+t.length*fe;let g=i,f=l+48+10;g+U>d-w&&(g=d-U-w),gS-w&&(f=l-C-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 ye({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()},c=function(){return o.Animated.spring(i,{toValue:1,useNativeDriver:!0}).start()},[d,S]=n.useState({visible:!1,items:[],title:"",x:0,y:0}),C=n.useCallback(function(){const E=e.id,u=Ye?.getGuild?.(E),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 te=Ze?.getGuildsTree?.()?.version,R=h(E,te);if(!R?.length)return;const B=r.current;B?.measure&&B.measure(function(p,ne,oe,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(){me?.triggerHapticFeedback?.(me.HapticFeedbackTypes.IMPACT_MEDIUM),C()},[C]),f=e.id;return n.createElement(n.Fragment,null,n.createElement(o.Pressable,{onPressIn:l,onPressOut:c,onPress:function(){return t(f)},onLongPress:g,delayLongPress:500},n.createElement(o.View,{ref:r,style:be.outer,collapsable:!1},n.createElement(o.Animated.View,{style:[be.icon,{transform:[{scale:i}]}]},n.createElement(le,{id:f})),n.createElement(ve,{guildId:f}))),n.createElement(Xe,{visible:d.visible,items:d.items,title:d.title,anchorX:d.x,anchorY:d.y,onClose:function(){return S(function(E){return{...E,visible:!1}})}}))}const be=o.StyleSheet.create({outer:{width:M,height:M},icon:{width:M,height:M,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"}}),Ne=s.findByProps("useStateFromStores");s.findByProps("colors","unsafe_rawColors")?.colors;const Se=s.findByStoreName("ExpandedGuildFolderStore");function $e(e){return Ne?.useStateFromStores?.([Se],function(){const t=Se?.getExpandedFolders?.();return t instanceof Set?t.has(e):!1},[e])??!1}const et=s.findByProps("toggleGuildFolderExpand"),tt=s.findByProps("useStateFromStores"),Ce=s.findByStoreName("GuildReadStateStore"),D=48,J=16,nt=[{top:6,left:6},{top:6,right:6},{bottom:6,left:6},{bottom:6,right:6}],ot=ie.getAssetIDByName("FolderIcon");function Ee(e){return e==null?"#5865f2":`#${e.toString(16).padStart(6,"0")}`}function rt({node:e}){const t=tt?.useStateFromStores?.([Ce],function(){let r=0;for(const i of e.children)r+=Ce?.getMentionCount?.(i.id)??0;return r},[e.children])??0;return t>0?n.createElement(o.View,{style:X.outline},n.createElement(o.View,{style:X.badge},n.createElement(o.Text,{style:X.text},t>99?"99+":String(t)))):null}function st({node:e}){const t=Ee(e.color);return n.createElement(o.View,{style:K.outer},n.createElement(o.View,{style:[K.icon,{backgroundColor:t}]},e.children.slice(0,4).map(function(r,i){return n.createElement(o.View,{key:r.id,style:[K.cell,nt[i]]},n.createElement(le,{id:r.id,size:J}))})),n.createElement(rt,{node:e}))}const K=o.StyleSheet.create({outer:{width:D,height:D},icon:{width:D,height:D,borderRadius:16,overflow:"hidden"},cell:{position:"absolute",width:J,height:J,borderRadius:8,overflow:"hidden"}});function it({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 lt({node:e,onPick:t}){const r=$e(e.id),i=function(){et?.toggleGuildFolderExpand?.(e.id)};return r?n.createElement(n.Fragment,null,n.createElement(o.Pressable,{onPress:i},n.createElement(o.View,{style:[ke.openIcon,{backgroundColor:Ee(e.color)}]},n.createElement(o.Image,{source:ot,style:ke.folderImg,tintColor:"#fff"}))),e.children.map(function(l){return n.createElement(it,{key:l.id},n.createElement(ye,{node:l,onPick:t}))})):n.createElement(o.Pressable,{onPress:i},n.createElement(st,{node:e}))}const ke=o.StyleSheet.create({openIcon:{width:D,height:D,borderRadius:16,alignItems:"center",justifyContent:"center"},folderImg:{width:24,height:24}}),X=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}}),ut=s.findByProps("useStateFromStores"),we=s.findByStoreName("SortedGuildStore"),at=s.findByProps("getRootNavigationRef"),G=s.findByProps("triggerHapticFeedback","HapticFeedbackTypes"),Re=s.findByProps("transitionToGuild"),ct=s.find(function(e){return typeof e?.handleCreateJoinGuildPress=="function"}),Be=s.find(function(e){return e?.CirclePlusIcon})?.CirclePlusIcon,De=s.findByProps("colors","unsafe_rawColors")?.unsafe_rawColors,dt=De?.GREEN_360,Pe=De?.WHITE,ft=s.find(function(e){return e?.QuestDockExternalCoordinationContext}),Ie=ft?.QuestDockExternalCoordinationContext,xe=s.find(function(e){return e?.QuestDockMode?.COLLAPSED!=null})?.QuestDockMode,W=48,O=6,pt=12;function gt(){const e=n.useRef(new o.Animated.Value(1)).current,t=n.useCallback(function(){o.Animated.spring(e,{toValue:.9,useNativeDriver:!0}).start()},[e]),r=n.useCallback(function(){o.Animated.spring(e,{toValue:1,useNativeDriver:!0}).start()},[e]),i=n.useCallback(function(){G?.triggerHapticFeedback?.(G.HapticFeedbackTypes.SOFT),ct?.handleCreateJoinGuildPress?.()},[]);return n.createElement(o.Pressable,{onPress:i,onPressIn:t,onPressOut:r},n.createElement(o.Animated.View,{style:[_.createJoin,{transform:[{scale:e}]}]},Be?n.createElement(Be,{size:"md",color:Pe}):n.createElement(o.Text,{style:_.createJoinFallback},"+")))}function Ae({gestureContext:e}){const t=n.useCallback(function(u){G?.triggerHapticFeedback(G.HapticFeedbackTypes.SOFT),Re?.transitionToGuild?Re.transitionToGuild(u,null):at?.getRootNavigationRef()?.navigate("guilds",{guildId:u})},[]),r=ut?.useStateFromStores?.([we],function(){return(we?.getGuildsTree()?.root?.children||[]).filter(function(u){return u.type!=="root"})})??[],i=e?n.useContext(e):null,l=i?.minExpandedContentHeight,c=n.useCallback(function(u){if(!l)return;const h=u.nativeEvent.layout.height;l.get()!==h&&l.set(h)},[l]),d=(Ie?n.useContext(Ie):null)?.setRestingQuestDockMode,S=i?.questDockWrapperSpecs;n.useEffect(function(){if(!d||!xe||!S)return;const u=o.BackHandler.addEventListener("hardwareBackPress",function(){return(S.get()?.height??56)>80?(d(xe.COLLAPSED),!0):!1});return function(){return u.remove()}},[d,S]);const{width:C}=o.Dimensions.get("window"),g=Math.max(3,Math.floor((C-pt*2+O)/(W+O))),f=g*W+(g-1)*O,E=Math.max(0,(C-f)/2);return n.createElement(o.View,{style:_.alignTop},n.createElement(o.View,{style:[_.grid,{paddingHorizontal:E,gap:O}],onLayout:c},r.map(function(u){return u.type==="folder"?n.createElement(lt,{key:u.id,node:u,onPick:t}):n.createElement(ye,{key:u.id,node:u,onPick:t})}),n.createElement(gt,null)))}const _=o.StyleSheet.create({alignTop:{flex:1,justifyContent:"flex-start",alignItems:"flex-start"},grid:{flexDirection:"row",flexWrap:"wrap",paddingTop:4,paddingBottom:16},createJoin:{width:W,height:W,borderRadius:16,backgroundColor:dt,alignItems:"center",justifyContent:"center"},createJoinFallback:{color:Pe,fontSize:28,fontWeight:"700",lineHeight:30}}),Y=new Map;let b=null,L=!1;function Te(e,t,r){Y.set(e,{replacement:t,extraProps:r})}function ht(e){if(L)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 c=Y.get(r);if(c){const d=c.extraProps?{...i,...c.extraProps}:i;return b.call(k.React,c.replacement,d,...l)}return b.call(k.React,r,i,...l)};Object.assign(t,b),k.React.createElement=t,L=!0,e.push(function(){L&&b&&(k.React.createElement=b,L=!1),Y.clear()})}const Z="[ServerDrawer]";let v=null;function Fe(){return v||(v=s.find(function(e){return e?.QuestDockGestureContext})?.QuestDockGestureContext??null),v}function mt(e){const t=s.find(function(i){return i?.type?.displayName==="QuestDockContentExpanded"||i?.type?.name==="QuestDockContentExpanded"});if(!t?.type)return console.log(Z,"WARN: QuestDockContentExpanded not found (will retry)"),!1;const r=t.type;return Te(r,Ae,{gestureContext:Fe()}),t.type=function(){return k.React.createElement(Ae,{gestureContext:Fe()})},e.push(function(){t.type=r}),console.log(Z,"PATCH: QuestDockContentExpanded replaced"),!0}function x(e,t){const r=s.find(function(c){return c?.type?.displayName===e||c?.type?.name===e});if(!r?.type)return console.log(Z,`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 yt="[ServerDrawer]",bt=ie.getAssetIDByName("ChatIcon"),Ve=s.findByProps("triggerHapticFeedback","HapticFeedbackTypes"),Qe=s.findByProps("selectPrivateChannel"),St=s.findByName("SelectedChannelStore"),Ct=s.findByProps("useStateFromStores"),Et=Ct?.useStateFromStores,N=s.findByProps("getGuildId"),$=s.findByProps("colors","unsafe_rawColors")?.colors,kt=s.findByProps("ME"),wt=kt?.ME??"/channels/@me";function Rt(){if(Ve?.triggerHapticFeedback(Ve.HapticFeedbackTypes.SOFT),Qe?.selectPrivateChannel){const e=St?.getLastSelectedChannelId?.();Qe.selectPrivateChannel(e)}}function Bt(){try{return N?Et([N],function(){const e=N?.getGuildId?.();return e==null||e===wt}):!1}catch{return!1}}function Me(){const e=Bt(),t=e?$?.WHITE??"#fff":$?.INTERACTIVE_NORMAL??"#80848e";return n.createElement(o.Pressable,{onPress:Rt,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:$?.WHITE??"#fff"}}):null,n.createElement(o.Image,{source:bt,style:{width:28,height:28,tintColor:t}}))}function Dt(){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 Pt(e){const t=Dt();if(!t?.default)return console.log(yt,"WARN: GuildsBar not found"),!1;const r=t.default;return Te(r,Me),t.default=function(){return n.createElement(Me)},t.default.displayName="GuildsBar",e.push(function(){t.default=r}),!0}const ee="[ServerDrawer]",a=[];var It={onLoad(){console.log(ee,"onLoad");let e=0;ht(a),e++,Ge(a)&&e++,Oe(a)&&e++,Le(a)&&e++,ze(a)&&e++,mt(a)&&e++,x("QuestDockContentCollapsed",a)&&e++,x("QuestDockEnrolledHeader",a)&&e++,x("QuestDockUnenrolledHeader",a)&&e++,x("QuestDockEnrolledBody",a)&&e++,x("QuestDockUnenrolledBody",a)&&e++,Pt(a)&&e++,console.log(ee,`onLoad done \u2014 ${e} patches applied, ${a.length} cleanups`)},onUnload(){console.log(ee,"onUnload");for(const e of a)e();a.length=0}};return j.default=It,Object.defineProperty(j,"__esModule",{value:!0}),j})({},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 783e91d..99ab97d 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":"031d452bf0e69f47af41060161f9b110f62d24bcae4b61b567cfb33dabd750bb"} \ 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":"9ff0d0d73a13aeee36ab18791f18118d34d364dc7496b4148225747811648abd"} \ No newline at end of file