revenge-plugins/you-bar-plus/install/index.js
2026-08-02 01:31:21 +00:00

1 line
3.8 KiB
JavaScript

(function(l,h,n,f,e,R,b,u,p,E){"use strict";function S(t,a,r=100){let i=!1,o;const s=t();return s?(a(s),{cancel(){}}):(o=setInterval(function(){if(i)return;const B=t();B&&(i=!0,clearInterval(o),a(B))},r),{cancel(){i=!0,o&&clearInterval(o)}})}function I(t,a=!0){const r=window?.modules;if(r)for(const i in r){const o=r[i];if(o?.__filePath!==t)continue;if(!o.isInitialized)return;const s=o.publicModule?.exports;return s?a?s.default??s:s:void 0}}const{View:m,TouchableOpacity:y,Image:w}=e.ReactNative,D="modules/toast/native/ToastContainer.tsx";function M(){let t=function(){};const a=S(function(){return I(D,!0)},function(r){t=R.after("type",r,function(i,o){return e.React.createElement(e.React.Fragment,null,o,e.React.createElement(P,null))}),p.showToast("YouBar+ ready",u.getAssetIDByName("CheckmarkIcon"))});return function(){a.cancel(),t()}}function P(){if(b.useProxy(n.storage),!n.storage.showDMButton&&!n.storage.showSettingsButton)return null;const t=f.findByProps("openUserSettings"),a=f.findByProps("transitionToGuild"),r=u.getAssetIDByName("ChatIcon"),i=u.getAssetIDByName("SettingsIcon");return e.React.createElement(m,{pointerEvents:"box-none",style:c.container},n.storage.showDMButton&&e.React.createElement(y,{accessibilityLabel:"Direct Messages",onPress:function(){return a?.transitionToGuild?.("@me")},style:c.button},e.React.createElement(w,{source:r,style:c.icon})),n.storage.showSettingsButton&&e.React.createElement(y,{accessibilityLabel:"Settings",onPress:function(){return t?.openUserSettings?.()},style:c.button},e.React.createElement(w,{source:i,style:c.icon})))}const d=40,c={container:{position:"absolute",right:12,bottom:90,flexDirection:"row",alignItems:"center",gap:10,zIndex:999,elevation:999},button:{width:d,height:d,borderRadius:d/2,backgroundColor:"rgba(30,30,35,0.85)",alignItems:"center",justifyContent:"center"},icon:{width:20,height:20,tintColor:"white"}},{ScrollView:x,View:C}=e.ReactNative;function F({children:t}){return e.React.createElement(x,{style:{flex:1}},t,e.React.createElement(C,{style:{height:24}}))}const{View:T,Text:V}=e.ReactNative;function N({children:t,style:a}){return e.React.createElement(T,{style:[{marginHorizontal:16,marginVertical:8,padding:10,borderRadius:8,borderWidth:1,borderColor:"rgba(128,128,128,0.25)"},a]},e.React.createElement(V,{style:{fontSize:12.5,lineHeight:18,opacity:.75}},t))}const{FormSection:Y,FormSwitchRow:v}=E.Forms;function $(){return b.useProxy(n.storage),React.createElement(F,null,React.createElement(N,null,"Fork of Purple-EyeZ's YouBar+, rebuilt from scratch after the original approach (patching YouBar's own notification button directly) turned out to be unreliable on current Discord builds. These buttons now render as an independent floating overlay near the bottom-right of the screen instead of natively inside the YouBar row itself - not pixel-identical placement, but should appear reliably and update instantly when toggled, without needing a restart."),React.createElement(Y,{title:"Buttons"},React.createElement(v,{label:"Direct Messages button",subLabel:"Show a floating DM button",value:!!n.storage.showDMButton,onValueChange:function(t){n.storage.showDMButton=t}}),React.createElement(v,{label:"Settings button",subLabel:"Show a floating Settings button",value:!!n.storage.showSettingsButton,onValueChange:function(t){n.storage.showSettingsButton=t}})))}const L="youbar-plus-v2-toast-anchor";let g=function(){};var k={onLoad:function(){n.storage.showDMButton??=!1,n.storage.showSettingsButton??=!0,h.logger.log(`[YouBar+] loading (${L})`);try{g=M()}catch(t){h.logger.error(`[YouBar+] Failed to apply patches, buttons will not appear: ${t}`),g=function(){}}},onUnload:function(){return g()},settings:$};return l.default=k,Object.defineProperty(l,"__esModule",{value:!0}),l})({},vendetta,vendetta.plugin,vendetta.metro,vendetta.metro.common,vendetta.patcher,vendetta.storage,vendetta.ui.assets,vendetta.ui.toasts,vendetta.ui.components);