1 line
2.1 KiB
JavaScript
1 line
2.1 KiB
JavaScript
(function(s,u,o){"use strict";function p(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function")}function h(n,t){for(var e=0;e<t.length;e++){var r=t[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}function w(n,t,e){return t&&h(n.prototype,t),e&&h(n,e),n}function m(n,t,e){return t in n?Object.defineProperty(n,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[t]=e,n}const y=o.findByProps("show","confirm","close"),v=o.findByProps("addRelationship"),b=o.findByProps("handleStartCall"),$=o.findByProps("hideActionSheet"),g=o.findByStoreName("UserStore");var C=new(function(){function n(){p(this,n),m(this,"patches",[])}return w(n,[{key:"onLoad",value:function(){var t=this;this.patches.push(u.patcher.instead("handleStartCall",b,function(e,r){const[{rawRecipients:[{username:i,discriminator:c},a]},f]=e,l=f?"video call":"call";y.show({title:a?`Start a group ${l}?`:`Start a ${l} with ${i}#${c}?`,body:a?"Are you sure you want to start the group call?":`Are you sure you want to ${l} ${i}#${c}?`,confirmText:"Yes",cancelText:"Cancel",confirmColor:"brand",onConfirm:function(){try{r(...e)}catch(d){u.logger.error("Failed to start call",d)}}})})),this.patches.push(u.patcher.instead("addRelationship",v,function(e,r){if(typeof e[0]!="object"||!e[0].userId)return r.apply(t,e);const{username:i,discriminator:c}=g.getUser(e[0].userId),a=setInterval(function(){return $.hideActionSheet()},100);setTimeout(function(){return clearInterval(a)},3e3);const f=e[0].type===2;return new Promise(function(l){y.show({title:`${f?"Block":"Friend"} ${i}#${c}?`,body:`Are you sure you want to ${f?"block":"friend"} ${i}#${c}?`,confirmText:"Yes",cancelText:"Cancel",confirmColor:"brand",onConfirm:function(){try{l(r.apply(t,e))}catch(d){u.logger.error("Failed to add relationship",d)}finally{clearInterval(a)}},onCancel:function(){return void clearInterval(a)}})})}))}},{key:"onUnload",value:function(){for(const t of this.patches)t()}}]),n}());return s.default=C,Object.defineProperty(s,"__esModule",{value:!0}),s})({},vendetta,vendetta.metro);
|