1 line
3.4 KiB
JavaScript
1 line
3.4 KiB
JavaScript
(function(d,v,i,h,n,B,p,R,b){"use strict";function S(t,e,o,r){try{return o()}catch(a){return r.error(`[${t}] Failed to apply the "${e}" patch, that surface will be skipped: ${a}`),function(){}}}function E(t,e,o){const r=Object.entries(o).map(function([a,u]){return S(t,a,u,e)});return function(){return r.forEach(function(a){return a()})}}function P(t,e,o=100){let r=!1,a;const u=t();return u?(e(u),{cancel(){}}):(a=setInterval(function(){if(r)return;const c=t();c&&(r=!0,clearInterval(a),e(c))},o),{cancel(){r=!0,a&&clearInterval(a)}})}function F(t){const e=window?.modules;if(e)for(const o in e){let r;try{r=window.__r(Number(o))}catch{continue}if(r)try{if(t(r))return r;if(r.default!=null&&t(r.default))return r.default}catch{}}}function I(t){return F(function(e){return e?.name===t||e?.displayName===t||e?.type?.name===t||e?.type?.displayName===t})}let l=function(){};function N(){let t=function(){};const e=P(function(){return I("YouBarNotificationsButton")},function(o){t=D(o)});return function(){e.cancel(),t()}}function D(t){const e=h.findByProps("openUserSettings"),o=h.findByProps("transitionToGuild"),r=p.getAssetIDByName("ChatIcon"),a=p.getAssetIDByName("SettingsIcon");return B.instead("type",t,function(u,c){try{const[,k]=n.React.useReducer(function(x){return~x},0);l=function(){return k()};const s=c(...u);if(!s?.props?.children)return s;const w=s.props.children.type,f=s.props.children.props;return n.React.createElement(n.React.Fragment,null,i.storage.showDMButton&&n.React.createElement(w,{variant:f?.variant||"tertiary",size:f?.size||"sm",icon:r,onPress:function(){return o?.transitionToGuild?.("@me")}}),i.storage.showSettingsButton&&n.React.createElement(w,{variant:f?.variant||"tertiary",size:f?.size||"sm",icon:a,onPress:function(){return e?.openUserSettings?.()}}),s)}catch{return c(...u)}})}const{ScrollView:M,View:V}=n.ReactNative;function Y({children:t}){return n.React.createElement(M,{style:{flex:1}},t,n.React.createElement(V,{style:{height:24}}))}const{View:m,Text:z}=n.ReactNative;function $({children:t,style:e}){return n.React.createElement(m,{style:[{marginHorizontal:16,marginVertical:8,padding:10,borderRadius:8,borderWidth:1,borderColor:"rgba(128,128,128,0.25)"},e]},n.React.createElement(z,{style:{fontSize:12.5,lineHeight:18,opacity:.75}},t))}const{FormSection:C,FormSwitchRow:y}=b.Forms;function T(){return R.useProxy(i.storage),n.React.useEffect(function(){return function(){return l()}},[]),n.React.createElement(Y,null,n.React.createElement($,null,"Fork of Purple-EyeZ's YouBar+, ported to Revenge's Vendetta-compat API with a fix for a startup race that could silently skip the button patch for an entire session."),n.React.createElement(C,{title:"Buttons"},n.React.createElement(y,{label:"Direct Messages button",subLabel:"Show the DM button in the YouBar",value:!!i.storage.showDMButton,onValueChange:function(t){i.storage.showDMButton=t,l()}}),n.React.createElement(y,{label:"Settings button",subLabel:"Show the Settings button in the YouBar",value:!!i.storage.showSettingsButton,onValueChange:function(t){i.storage.showSettingsButton=t,l()}})))}let g=function(){};var _={onLoad:function(){i.storage.showDMButton??=!1,i.storage.showSettingsButton??=!0,g=E("YouBar+",v.logger,{"YouBar buttons":N})},onUnload:function(){return g()},settings:T};return d.default=_,Object.defineProperty(d,"__esModule",{value:!0}),d})({},vendetta,vendetta.plugin,vendetta.metro,vendetta.metro.common,vendetta.patcher,vendetta.ui.assets,vendetta.storage,vendetta.ui.components);
|