diff --git a/index.js b/index.js index 112a7ee..00a52f5 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -(function(n,s,g,t,b,c,m){"use strict";function u(e,a){switch(a){case"calendar":return e.calendar();case"relative":return e.fromNow();case"custom":return e.format(t.storage.customFormat)}}const{ScrollView:h}=c.General,{FormSection:d,FormRow:y,FormDivider:R,FormSwitchRow:v}=c.Forms,w=s.findByName("RowCheckmark"),{ClearButtonVisibility:E,default:M}=s.findByProps("ClearButtonVisibility");function p(e){let{label:a,subLabel:o,selected:r,onPress:Y}=e;return React.createElement(y,{label:a,subLabel:o,trailing:React.createElement(w,{selected:r}),onPress:Y})}function C(e){let{value:a,onChangeText:o,placeholder:r}=e;return React.createElement(M,{value:a,onChangeText:o,placeholder:r,clearButtonVisibility:E.WITH_CONTENT,showBorder:!1,showTopContainer:!1,style:{paddingHorizontal:15,paddingVertical:13}})}let i=[{label:"Calendar",key:"calendar"},{label:"Relative",key:"relative"},{label:"Custom",key:"custom"}];function F(){return b.useProxy(t.storage),React.createElement(h,null,React.createElement(d,null,i.map(function(e,a){let{label:o,key:r}=e;return React.createElement(React.Fragment,null,React.createElement(p,{label:o,subLabel:u(g.moment(),r),selected:t.storage.selected===r,onPress:function(){return t.storage.selected=r}}),a!==i.length-1&&React.createElement(R,null))}),t.storage.selected==="custom"&&React.createElement(C,{value:t.storage.customFormat,onChangeText:function(e){return t.storage.customFormat=e},placeholder:"dddd, MMMM Do YYYY, h:mm:ss a"})),React.createElement(d,null,React.createElement(v,{label:"Separate messages",subLabel:"Always shows username, avatar and timestamp for each message",value:t.storage.separateMessages,onValueChange:function(e){t.storage.separateMessages=e}})))}const f=s.findByName("RowManager");let l=[];var T={onLoad:function(){t.storage.selected??="calendar",t.storage.customFormat??="dddd, MMMM Do YYYY, h:mm:ss a",l.push(m.before("generate",f.prototype,function(e){let[a]=e;a.rowType===1&&t.storage.separateMessages&&(a.isFirst=!0)})),l.push(m.after("generate",f.prototype,function(e,a){let[o]=e,{message:r}=a;o.rowType===1&&r.timestamp&&(r.timestamp=u(o.message.timestamp,t.storage.selected))}))},onUnload:function(){l.forEach(function(e){return e()})},settings:F};return n.default=T,Object.defineProperty(n,"__esModule",{value:!0}),n})({},vendetta.metro,vendetta.metro.common,vendetta.plugin,vendetta.storage,vendetta.ui.components,vendetta.patcher); +(function(o,n,f,t,h,c,m){"use strict";function u(e){switch(arguments.length>1&&arguments[1]!==void 0?arguments[1]:t.storage.selected){case"calendar":return e.calendar();case"relative":return e.fromNow();case"custom":return e.format(t.storage.customFormat)}}const{ScrollView:b}=c.General,{FormSection:i,FormRow:y,FormDivider:v,FormSwitchRow:R}=c.Forms,p=n.findByName("RowCheckmark"),{ClearButtonVisibility:w,default:E}=n.findByProps("ClearButtonVisibility");function T(e){let{label:a,subLabel:s,selected:r,onPress:_}=e;return React.createElement(y,{label:a,subLabel:s,trailing:React.createElement(p,{selected:r}),onPress:_})}function M(e){let{value:a,onChangeText:s,placeholder:r}=e;return React.createElement(E,{value:a,onChangeText:s,placeholder:r,clearButtonVisibility:w.WITH_CONTENT,showBorder:!1,showTopContainer:!1,style:{paddingHorizontal:15,paddingVertical:13}})}let d=[{label:"Calendar",key:"calendar"},{label:"Relative",key:"relative"},{label:"Custom",key:"custom"}];function C(){return h.useProxy(t.storage),React.createElement(b,null,React.createElement(i,null,d.map(function(e,a){let{label:s,key:r}=e;return React.createElement(React.Fragment,null,React.createElement(T,{label:s,subLabel:u(f.moment(),r),selected:t.storage.selected===r,onPress:function(){return t.storage.selected=r}}),a!==d.length-1&&React.createElement(v,null))}),t.storage.selected==="custom"&&React.createElement(M,{value:t.storage.customFormat,onChangeText:function(e){return t.storage.customFormat=e},placeholder:"dddd, MMMM Do YYYY, h:mm:ss a"})),React.createElement(i,null,React.createElement(R,{label:"Separate messages",subLabel:"Always shows username, avatar and timestamp for each message",value:t.storage.separateMessages,onValueChange:function(e){t.storage.separateMessages=e}})))}const g=n.findByName("RowManager");let l=[];var F={onLoad:function(){t.storage.selected??="calendar",t.storage.customFormat??="dddd, MMMM Do YYYY, h:mm:ss a",l.push(m.before("generate",g.prototype,function(e){let[a]=e;a.rowType===1&&(t.storage.separateMessages&&(a.isFirst=!0),a.message.__customTimestamp=u(a.message.timestamp))})),l.push(m.after("generate",g.prototype,function(e,a){let[s]=e,{message:r}=a;s.rowType===1&&s.message.__customTimestamp&&r.state==="SENT"&&r.timestamp&&(r.timestamp=s.message.__customTimestamp)}))},onUnload:function(){l.forEach(function(e){return e()})},settings:C};return o.default=F,Object.defineProperty(o,"__esModule",{value:!0}),o})({},vendetta.metro,vendetta.metro.common,vendetta.plugin,vendetta.storage,vendetta.ui.components,vendetta.patcher); diff --git a/manifest.json b/manifest.json index 6790db9..8b58197 100644 --- a/manifest.json +++ b/manifest.json @@ -1 +1 @@ -{"name":"Custom Timestamps","description":"Customize the format of timestamps in chat.","authors":[{"name":"Fiery","id":"890228870559698955"}],"main":"index.js","vendetta":{"icon":"clock"},"hash":"d6de80586e59eb8c058e24ae2fcd10da0bb355c5655db4b9793e28d490b33850"} \ No newline at end of file +{"name":"Custom Timestamps","description":"Customize the format of timestamps in chat.","authors":[{"name":"Fiery","id":"890228870559698955"}],"main":"index.js","vendetta":{"icon":"clock"},"hash":"72f8147109e2a8ae3c0bcc74d85bca9de68a6f996418955abc4b36931d3d0d78"} \ No newline at end of file