1 line
2.9 KiB
JavaScript
1 line
2.9 KiB
JavaScript
(function(l,B,n,d,t,R,h,b,v){"use strict";function w(e,r,o,i){try{return o()}catch(a){return i.error(`[${e}] Failed to apply the "${r}" patch, that surface will be skipped: ${a}`),function(){}}}function E(e,r,o){const i=Object.entries(o).map(function([a,f]){return w(e,a,f,r)});return function(){return i.forEach(function(a){return a()})}}let u=function(){};function S(){const e=d.findByTypeName("YouBarNotificationsButton"),r=d.findByProps("openUserSettings"),o=d.findByProps("transitionToGuild"),i=h.getAssetIDByName("SettingsIcon"),a=h.getAssetIDByName("ChatIcon");return e?R.instead("type",e,function(f,$){const[,C]=t.React.useReducer(function(L){return~L},0);u=function(){return C()};const s=$(...f);if(!s?.props?.children)return s;const y=s.props.children.type,c=s.props.children.props;return t.React.createElement(t.React.Fragment,null,n.storage.showDMButton&&t.React.createElement(y,{variant:c?.variant||"tertiary",size:c?.size||"sm",icon:a,onPress:function(){o?.transitionToGuild?.("@me")}}),n.storage.showSettingsButton&&t.React.createElement(y,{variant:c?.variant||"tertiary",size:c?.size||"sm",icon:i,onPress:function(){r?.openUserSettings?.()}}),s)}):function(){}}const{ScrollView:P,View:D}=t.ReactNative;function Y({children:e}){return t.React.createElement(P,{style:{flex:1}},e,t.React.createElement(D,{style:{height:24}}))}const{View:M,Text:V}=t.ReactNative;function z({children:e,style:r}){return t.React.createElement(M,{style:[{marginHorizontal:16,marginVertical:8,padding:10,borderRadius:8,borderWidth:1,borderColor:"rgba(128,128,128,0.25)"},r]},t.React.createElement(V,{style:{fontSize:12.5,lineHeight:18,opacity:.75}},e))}const{FormSection:F,FormSwitchRow:g}=v.Forms;function N(){return b.useProxy(n.storage),t.React.useEffect(function(){return function(){return u()}},[]),t.React.createElement(Y,null,t.React.createElement(z,null,"Fork of Purple-EyeZ's YouBar+, ported to Revenge's Vendetta-compat API. Like the original, this patches the YouBar the moment it loads - if you enable it while Discord's already running, you may need to restart once for the buttons to appear."),t.React.createElement(F,{title:"Buttons"},t.React.createElement(g,{label:"Direct Messages button",subLabel:"Show the DM button in the YouBar",value:!!n.storage.showDMButton,onValueChange:function(e){n.storage.showDMButton=e,u()}}),t.React.createElement(g,{label:"Settings button",subLabel:"Show the Settings button in the YouBar",value:!!n.storage.showSettingsButton,onValueChange:function(e){n.storage.showSettingsButton=e,u()}})))}let p=function(){};var I={onLoad:function(){n.storage.showDMButton??=!1,n.storage.showSettingsButton??=!0,p=E("YouBar+",B.logger,{"YouBar buttons":S})},onUnload:function(){return p()},settings:N};return l.default=I,Object.defineProperty(l,"__esModule",{value:!0}),l})({},vendetta,vendetta.plugin,vendetta.metro,vendetta.metro.common,vendetta.patcher,vendetta.ui.assets,vendetta.storage,vendetta.ui.components);
|