diff --git a/App.js b/App.js index 802f139..59d64f4 100644 --- a/App.js +++ b/App.js @@ -176,7 +176,7 @@ class MainView extends React.Component { INCOMING REQUESTS - {[...client.users.values()].filter((x) => x.relationship === RelationshipStatus.Incoming).map(f => { + {[...client.users.values()].filter((x) => x.relationship === "Incoming").map(f => { return @@ -184,7 +184,7 @@ class MainView extends React.Component { OUTGOING REQUESTS - {[...client.users.values()].filter((x) => x.relationship === RelationshipStatus.Outgoing).map(f => { + {[...client.users.values()].filter((x) => x.relationship === "Outgoing").map(f => { return @@ -192,7 +192,7 @@ class MainView extends React.Component { FRIENDS - {[...client.users.values()].filter((x) => x.relationship === RelationshipStatus.Friend).map(f => { + {[...client.users.values()].filter((x) => x.relationship === "Friend").map(f => { return @@ -200,7 +200,7 @@ class MainView extends React.Component { BLOCKED - {[...client.users.values()].filter((x) => x.relationship === RelationshipStatus.Blocked).map(f => { + {[...client.users.values()].filter((x) => x.relationship === "Blocked").map(f => { return @@ -214,7 +214,7 @@ class MainView extends React.Component { - { + { this.state.currentChannel.channel_type == "DirectMessage" ? this.state.currentChannel.recipient?.username : this.state.currentChannel.channel_type == "SavedMessages" ? @@ -288,10 +288,10 @@ class MainView extends React.Component { {/* RVMob - { + { this.setState({emailInput: text}) }} value={this.state.emailInput} /> - { + { this.setState({passwordInput: text}) }} value={this.state.passwordInput} /> {this.state.logInError && {this.state.logInError.message}} @@ -316,7 +316,7 @@ class MainView extends React.Component { }} /> */} RVMob - { + { this.setState({tokenInput: text}) }} value={this.state.tokenInput} /> {this.state.logInError ? {this.state.logInError.message || this.state.logInError} : null} @@ -355,7 +355,7 @@ export const ChannelHeader = ({children}) => { return {app.openLeftMenu()}}> - + {children} diff --git a/android/app/build.gradle b/android/app/build.gradle index 7e6b787..22f79fa 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -158,6 +158,7 @@ android { buildTypes { debug { signingConfig signingConfigs.debug + applicationIdSuffix '.debug' } release { // Caution! In production, you need to generate your own keystore file. diff --git a/android/app/proguard-rules.pro b/android/app/proguard-rules.pro index 11b0257..7dab035 100644 --- a/android/app/proguard-rules.pro +++ b/android/app/proguard-rules.pro @@ -8,3 +8,5 @@ # http://developer.android.com/guide/developing/tools/proguard.html # Add any project specific keep options here: +-keep class com.facebook.hermes.unicode.** { *; } +-keep class com.facebook.jni.** { *; } diff --git a/android/app/src/debug/res/mipmap-hdpi/ic_launcher.png b/android/app/src/debug/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..a3b215c Binary files /dev/null and b/android/app/src/debug/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png b/android/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..a3b215c Binary files /dev/null and b/android/app/src/debug/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/android/app/src/debug/res/mipmap-mdpi/ic_launcher.png b/android/app/src/debug/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..7a3bb81 Binary files /dev/null and b/android/app/src/debug/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png b/android/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..7a3bb81 Binary files /dev/null and b/android/app/src/debug/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/android/app/src/debug/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/debug/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..16fea65 Binary files /dev/null and b/android/app/src/debug/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png b/android/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..16fea65 Binary files /dev/null and b/android/app/src/debug/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/android/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..3a45e57 Binary files /dev/null and b/android/app/src/debug/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png b/android/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..3a45e57 Binary files /dev/null and b/android/app/src/debug/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/android/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..f1f33f2 Binary files /dev/null and b/android/app/src/debug/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png b/android/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..f1f33f2 Binary files /dev/null and b/android/app/src/debug/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/android/app/src/debug/res/values/strings.xml b/android/app/src/debug/res/values/strings.xml new file mode 100644 index 0000000..dea8139 --- /dev/null +++ b/android/app/src/debug/res/values/strings.xml @@ -0,0 +1,3 @@ + + RVMob Canary + diff --git a/android/app/src/main/assets/index.android.bundle b/android/app/src/main/assets/index.android.bundle index 8a45a3f..a737ce3 100644 --- a/android/app/src/main/assets/index.android.bundle +++ b/android/app/src/main/assets/index.android.bundle @@ -402,7 +402,7 @@ __d(function(g,r,i,a,m,e,d){function t(n){if("function"!=typeof WeakMap)return n __d(function(g,r,i,a,m,_e,d){'use strict';function t(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}var n;n=(function(n){r(d[3])(o,n);var e,u,c=(e=o,u=t(),function(){var t,n=r(d[0])(e);if(u){var c=r(d[0])(this).constructor;t=Reflect.construct(n,arguments,c)}else t=n.apply(this,arguments);return r(d[1])(this,t)});function o(){return r(d[4])(this,o),c.apply(this,arguments)}return r(d[5])(o,[{key:"render",value:function(){return null}}],[{key:"ignoreWarnings",value:function(t){}},{key:"install",value:function(){}},{key:"uninstall",value:function(){}}]),o})(r(d[2]).Component),m.exports=n},396,[15,12,125,10,7,8]); __d(function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.DynamicColorIOS=void 0;e.DynamicColorIOS=function(o){throw new Error('DynamicColorIOS is not available on this platform.')}},397,[]); __d(function(g,r,i,a,m,e,d){'use strict';var n=r(d[0]).shape({x:r(d[0]).number,y:r(d[0]).number});m.exports=n},398,[139]); -__d(function(g,r,i,_a,_m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.default=void 0;var e=r(d[0])(r(d[1])),t=r(d[0])(r(d[2])),n=r(d[0])(r(d[3])),a=r(d[0])(r(d[4])),l=r(d[0])(r(d[5])),s=r(d[0])(r(d[6])),o=r(d[0])(r(d[7])),u=r(d[0])(r(d[8]));r(d[9]),r(d[10]);var c=r(d[0])(r(d[11])),f=(function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=w(t);if(n&&n.has(e))return n.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var o=l?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(a,s,o):a[s]=e[s]}a.default=e,n&&n.set(e,a);return a})(r(d[12])),m=r(d[0])(r(d[13])),h=r(d[0])(r(d[14])),p=r(d[0])(r(d[15])),y=r(d[0])(r(d[16]));function w(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(w=function(e){return e?n:t})(e)}function v(e){var t=E();return function(){var n,a=(0,o.default)(e);if(t){var l=(0,o.default)(this).constructor;n=Reflect.construct(a,arguments,l)}else n=a.apply(this,arguments);return(0,s.default)(this,n)}}function E(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}var b=m.default,x=new(r(d[17]).Client),M=!1,P=!1,k=function(e){var t=(0,u.default)({},e);return e.style||(t=(0,u.default)({style:{}},t)),t.style=(0,u.default)({color:_.textDefault.color},t.style),c.default.createElement(f.default.Text,t,t.children)},C=function(e){var t=(0,u.default)({},e);return e.styles||(t=(0,u.default)({styles:{}},t)),t.styles.text||(t.styles=(0,u.default)({text:{}},t.styles)),t.styles.text=(0,u.default)({color:_.textDefault.color},t.styles.text),e.rules||(t=(0,u.default)({rules:{}},t)),t.rules=(0,u.default)({image:{},refimage:{}},t.rules),c.default.createElement(r(d[18]).MarkdownView,t,t.children)},S=(function(t){(0,l.default)(o,t);var s=v(o);function o(e){var t;return(0,n.default)(this,o),(t=s.call(this,e)).state={username:null,loggedIn:!1,currentChannel:null,currentText:"",replyingMessages:[],leftMenuOpen:!1,rightMenuOpen:!1,contextMenuMessage:null,contextMenuUser:null,imageViewerImage:null},console.log("construct app"),t}return(0,a.default)(o,[{key:"componentDidMount",value:function(){var t=this;console.log("mount app"),x.on('ready',function(){return e.default.async(function(e){for(;;)switch(e.prev=e.next){case 0:t.setState(function(){return{loggedIn:!0}});case 1:case"end":return e.stop()}},null,null,null,Promise)}.bind(this)),x.useExistingSession({token:'vjHS49KziXDzDEWUR23ad8aWgShOdmAnMPH_FmDJ9bKNzw-MS0U6_pbyo9gWZrAl'})}},{key:"render",value:function(){var e,t,n,a,l,s,o,u=this;return this.state.loggedIn?c.default.createElement(f.View,{style:_.app},c.default.createElement(h.default,{openMenuOffset:f.Dimensions.get('window').width-50,menuPosition:"right",disableGestures:this.state.leftMenuOpen,edgeHitWidth:120,isOpen:this.state.rightMenuOpen,onChange:function(e){return u.setState({rightMenuOpen:e})},menu:c.default.createElement(T,null),style:_.app,bounceBackOnOverdraw:!1},c.default.createElement(h.default,{openMenuOffset:f.Dimensions.get('window').width-50,disableGestures:this.state.rightMenuOpen,edgeHitWidth:120,isOpen:this.state.leftMenuOpen,onChange:function(e){return u.setState({leftMenuOpen:e})},menu:c.default.createElement(U,{onChannelClick:function(e){return u.setState({currentChannel:e,leftMenuOpen:!1})},currentChannel:this.state.currentChannel}),style:_.app,bounceBackOnOverdraw:!1},c.default.createElement(f.View,{style:_.mainView},this.state.currentChannel?c.default.createElement(f.View,{style:{flex:1}},c.default.createElement(f.View,{style:_.channelHeader},c.default.createElement(f.TouchableOpacity,{style:_.headerIcon,onPress:function(){u.setState({leftMenuOpen:!u.state.leftMenuOpen})}},c.default.createElement(k,null,"\u2630")),c.default.createElement(k,{style:{flex:1}},"#",this.state.currentChannel.name)),c.default.createElement(R,{channel:this.state.currentChannel,onLongPress:function(e){u.setState({contextMenuMessage:e})},onUserPress:function(e){u.setState({contextMenuUser:e.author})},onImagePress:function(e){u.setState({imageViewerImage:e})}}),c.default.createElement(f.View,{style:_.messageBoxOuter},c.default.createElement(V,{channel:this.state.currentChannel}),this.state.replyingMessages&&this.state.replyingMessages.map(function(e){var t;return c.default.createElement(f.View,{key:e._id,style:_.repliedMessagePreview},c.default.createElement(k,null,"Replying to ",null==(t=e.author)?void 0:t.username))}),c.default.createElement(f.View,{style:_.messageBoxInner},c.default.createElement(f.TextInput,{placeholderTextColor:B.textTransparent,style:_.messageBox,placeholder:"Write your thoughts!",onChangeText:function(e){u.setState({currentText:e}),0==u.state.currentText.length?u.state.currentChannel.stopTyping():M||(M=!0,u.state.currentChannel.startTyping(),setTimeout(function(){return M=!1}.bind(u),2500))},value:this.state.currentText}),this.state.currentText.length>0&&c.default.createElement(f.TouchableOpacity,{style:_.sendButton,onPress:function(){u.state.currentChannel.sendMessage({content:u.state.currentText,replies:u.state.replyingMessages.map(function(e){return{id:e._id,mention:!1}})}),u.setState({currentText:"",replyingMessages:[]})}},c.default.createElement(k,null,"Send"))))):c.default.createElement(k,null,"No channel selected! Select one at the side!")))),c.default.createElement(f.Modal,{key:"messageMenu",animationType:"slide",transparent:!0,visible:!!this.state.contextMenuMessage,onRequestClose:function(){}},c.default.createElement(f.Pressable,{onPress:function(){return u.setState({contextMenuMessage:null})},style:{width:f.Dimensions.get("window").width,height:f.Dimensions.get("window").height,position:'absolute',backgroundColor:"#00000000"}}),c.default.createElement(f.View,{style:{width:"100%",height:"40%",top:"60%",backgroundColor:B.backgroundSecondary}},c.default.createElement(f.View,null,c.default.createElement(O,{message:this.state.contextMenuMessage,style:{margin:3,width:"100%"}}),c.default.createElement(f.Pressable,{style:_.actionTile,onPress:function(){return u.setState({contextMenuMessage:null})}},c.default.createElement(k,null,"Close")),c.default.createElement(f.Pressable,{style:_.actionTile,onPress:function(){var e=u.state.replyingMessages||[];e.length>=4||(e.push(u.state.contextMenuMessage),u.setState({replyingMessages:e,contextMenuMessage:null}))}},c.default.createElement(k,null,"Reply"))))),c.default.createElement(f.Modal,{key:"profileMenu",animationType:"slide",transparent:!0,visible:!!this.state.contextMenuUser,onRequestClose:function(){}},c.default.createElement(f.Pressable,{onPress:function(){return u.setState({contextMenuUser:null})},style:{width:f.Dimensions.get("window").width,height:f.Dimensions.get("window").height,position:'absolute',backgroundColor:"#00000000"}}),c.default.createElement(f.View,{style:{width:"100%",height:"75%",top:"25%",padding:15,backgroundColor:B.backgroundSecondary}},c.default.createElement(f.View,null,(null==(e=this.state.contextMenuUser)?void 0:e.generateAvatarURL)&&c.default.createElement(b,{style:{borderRadius:1e4,height:100,width:100},source:{uri:this.state.contextMenuUser.generateAvatarURL()}}),c.default.createElement(k,{style:{fontWeight:'bold',fontSize:30}},"@",null==(t=this.state.contextMenuUser)?void 0:t.username," ",(null==(n=this.state.contextMenuUser)?void 0:n.bot)&&c.default.createElement(f.View,{style:_.usernameBadge},c.default.createElement(k,{style:{color:B.accentColorForeground}},"BOT"))),!(null!=(a=this.state.contextMenuUser)&&a.bot)&&((null==(l=this.state.contextMenuUser)?void 0:l.relationship)==r(d[19]).RelationshipStatus.Friend?c.default.createElement(f.Pressable,{style:_.actionTile,onPress:function(){return u.setState({contextMenuUser:null})}},c.default.createElement(k,null,"Message (not impl.)")):c.default.createElement(f.Pressable,{style:_.actionTile,onPress:function(){var e;return null==(e=u.state.contextMenuUser)?void 0:e.addFriend()}},c.default.createElement(k,null,(null==(s=this.state.contextMenuUser)?void 0:s.relationship)==r(d[19]).RelationshipStatus.Incoming?"Accept Friend":"Add Friend")))))),c.default.createElement(f.Modal,{visible:!!this.state.imageViewerImage,transparent:!0},c.default.createElement(y.default,{imageUrls:null!=(o=this.state.imageViewerImage)&&o.metadata?[{url:x.generateFileURL(this.state.imageViewerImage),width:this.state.imageViewerImage.metadata.width,height:this.state.imageViewerImage.metadata.height}]:[{url:this.state.imageViewerImage}],renderHeader:function(){return c.default.createElement(f.View,{style:{height:50,width:"100%",justifyContent:'center',paddingLeft:10,paddingRight:10}},c.default.createElement(f.Pressable,{onPress:function(){var e;return f.Linking.openURL(null!=(e=u.state.imageViewerImage)&&e.metadata?x.generateFileURL(u.state.imageViewerImage):u.state.imageViewerImage)}},c.default.createElement(k,null,"Open URL")),c.default.createElement(f.View,{style:{marginLeft:20}}),c.default.createElement(f.Pressable,{onPress:function(){return u.setState({imageViewerImage:null})}},c.default.createElement(k,null,"Close")))},renderIndicator:function(e,t){return null},enableSwipeDown:!0,onCancel:function(){return u.setState({imageViewerImage:null})}}))):c.default.createElement(f.View,{style:_.app},c.default.createElement(f.View,{style:_.loggingInScreen},c.default.createElement(k,null,"Logging in...")))}}]),o})(c.default.Component),V=(0,r(d[20]).observer)(function(e){var t=e.channel;if(t){var n,a=t.typing.filter(function(e){return!!e});switch(a.length){case 1:n=a[0].username+" is typing...";break;case 2:n=a[0].username+" and "+a[1].username+" are typing...";break;case 3:n=a[0].username+", "+a[1].username+", and "+a[2].username+" are typing...";break;default:n="Several people are typing..."}if(a.length>0)return c.default.createElement(f.View,{style:_.typingBar},c.default.createElement(k,null,n))}return c.default.createElement(f.View,null)}),R=(function(s){(0,l.default)(u,s);var o=v(u);function u(e){var t;return(0,n.default)(this,u),(t=o.call(this,e)).state={messages:[],loading:!1},t}return(0,a.default)(u,[{key:"componentDidMount",value:function(){var t=this;console.log("mount component"),x.on('message',function(n){return e.default.async(function(e){for(;;)switch(e.prev=e.next){case 0:!t.props.loading&&t.props.channel&&t.props.channel._id==n.channel._id&&t.setState(function(e){var t=e.messages;return t.length>=50&&(t=t.slice(1)),t.push(n),{messages:t}});case 1:case"end":return e.stop()}},null,null,null,Promise)})}},{key:"componentDidUpdate",value:function(e){var n=this;console.log(this.props.channel,!e.channel,e.channel._id,this.props.channel._id),!this.props.channel||P&&e.channel._id==this.props.channel._id||(P=!0,this.setState({loading:!0}),requestAnimationFrame(function(){console.log("fetch messages");var e="";n.props.channel.fetchMessagesWithUsers({limit:50}).then(function(a){console.log("done fetching"),n.setState({messages:(0,t.default)(a.messages.reverse()).map(function(t){var a,l=c.default.createElement(I,{key:t._id,message:t,grouped:e==(null==(a=t.author)?void 0:a._id)&&!(t.reply_ids&&t.reply_ids.length>0),onLongPress:function(){return n.props.onLongPress(t)},onUserPress:function(){return n.props.onUserPress(t)},onImagePress:function(e){return n.props.onImagePress(e)}});return e=t.author?t.author._id:e,{rendered:l,message:t}}),loading:!1})})}))}},{key:"render",value:function(){var e=this;return this.props.loading?c.default.createElement(k,null,"Loading..."):c.default.createElement(f.View,{style:{flex:1}},c.default.createElement(f.ScrollView,{ref:function(t){e.scrollView=t},onContentSizeChange:function(){return e.scrollView.scrollToEnd({animated:!0})},style:_.messagesView},this.state.messages.map(function(e){return e.rendered}),c.default.createElement(f.View,{style:{marginTop:20}})))}}]),u})(c.default.Component),I=(function(e){(0,l.default)(s,e);var t=v(s);function s(e){return(0,n.default)(this,s),t.call(this,e)}return(0,a.default)(s,[{key:"render",value:function(){var e,t=this;return c.default.createElement(f.TouchableOpacity,{activeOpacity:.8,delayLongPress:1e3,onLongPress:this.props.onLongPress,style:null!==this.props.message.reply_ids?_.replyingWrapper:_.messageWrapper},null!==this.props.message.reply_ids&&c.default.createElement(f.View,{style:_.repliedMessagePreviews},this.props.message.reply_ids.map(function(e){return c.default.createElement(O,{key:e,message:x.messages.get(e)})})),c.default.createElement(f.View,{style:this.props.grouped?_.messageGrouped:_.message},this.props.message.author&&!this.props.grouped&&c.default.createElement(f.Pressable,{onPress:function(){return t.props.onUserPress()}},c.default.createElement(b,{source:{uri:this.props.message.author.generateAvatarURL()+"?max_side=128"},style:_.messageAvatar})),c.default.createElement(f.View,{style:_.messageInner},this.props.message.author&&!this.props.grouped&&c.default.createElement(f.View,{style:{flexDirection:'row'}},c.default.createElement(k,{style:_.messageUsername},this.props.message.author.username),c.default.createElement(k,{style:_.timestamp}," ",(0,p.default)((0,r(d[21]).decodeTime)(this.props.message._id)).format('YYYY-MM-DD hh:mm:ss A'))),c.default.createElement(C,{style:_.messageContent},this.props.message.content))),null==(e=this.props.message.attachments)?void 0:e.map(function(e){console.log(e);var n=e.metadata.width,a=e.metadata.width;if(n>f.Dimensions.get("screen").width){var l=f.Dimensions.get("screen").width/n;n*=l,a*=l}return"Image"==e.metadata.type&&c.default.createElement(f.Pressable,{onPress:function(){return t.props.onImagePress(e)}},c.default.createElement(b,{source:{uri:x.generateFileURL(e)},resizeMode:m.default.resizeMode.contain,style:{width:n,height:a,marginBottom:4,borderRadius:3}}))}))}}]),s})(c.default.PureComponent),O=(function(e){(0,l.default)(s,e);var t=v(s);function s(e){return(0,n.default)(this,s),t.call(this,e)}return(0,a.default)(s,[{key:"render",value:function(){return this.props.message?c.default.createElement(f.View,{style:_.replyMessage},c.default.createElement(k,{style:{marginLeft:15,marginRight:15}},"\u21b1"),this.props.message.author&&c.default.createElement(c.default.Fragment,null,c.default.createElement(b,{source:{uri:this.props.message.author.generateAvatarURL()+"?max_side=128"},style:_.messageAvatarReply}),c.default.createElement(k,{style:_.messageUsernameReply},this.props.message.author.username)),c.default.createElement(k,{style:_.messageContentReply},this.props.message.content.split("\n").join(" "))):c.default.createElement(c.default.Fragment,null)}}]),s})(c.default.PureComponent),U=(function(e){(0,l.default)(o,e);var s=v(o);function o(e){var t;return(0,n.default)(this,o),(t=s.call(this,e)).state={currentServer:null},t}return(0,a.default)(o,[{key:"render",value:function(){var e,n,a,l,s=this;return c.default.createElement(f.View,{style:_.leftView},c.default.createElement(f.ScrollView,{style:_.serverList},c.default.createElement(f.TouchableOpacity,{onPress:function(){s.setState({currentServer:null})},key:null==(e=x.user)?void 0:e._id,style:_.serverButton},null!=(n=x.user)&&n.generateAvatarURL?c.default.createElement(b,{source:{uri:(null==(a=x.user)?void 0:a.generateAvatarURL())+"?max_side=128"},style:_.serverIcon}):c.default.createElement(k,null,null==(l=x.user)?void 0:l.name)),(0,t.default)(x.servers.values()).map(function(e){var t=e.generateIconURL();return console.log(t),c.default.createElement(f.TouchableOpacity,{onPress:function(){s.setState({currentServer:e})},key:e._id,style:_.serverButton},t?c.default.createElement(b,{source:{uri:t+"?max_side=128"},style:_.serverIcon}):c.default.createElement(k,null,e.name))})),c.default.createElement(f.ScrollView,{style:_.channelList},(this.state.currentServer?this.state.currentServer.channels:(0,t.default)(x.channels.values()).filter(function(e){return"Group"==e.channel_type})).map(function(e){return c.default.createElement(f.TouchableOpacity,{onPress:function(){s.props.onChannelClick(e)},key:e._id,style:_.channelButton},c.default.createElement(k,null,e.name))})))}}]),o})(c.default.PureComponent),T=(function(e){(0,l.default)(s,e);var t=v(s);function s(e){var a;return(0,n.default)(this,s),(a=t.call(this,e)).state={currentServer:null},a}return(0,a.default)(s,[{key:"render",value:function(){return c.default.createElement(f.View,{style:_.rightView},c.default.createElement(k,null,"trollface"))}}]),s})(c.default.Component),L=(function(e){(0,l.default)(s,e);var t=v(s);function s(){return(0,n.default)(this,s),t.apply(this,arguments)}return(0,a.default)(s,[{key:"render",value:function(){return c.default.createElement(f.View,{style:_.outer},c.default.createElement(f.StatusBar,{animated:!0,backgroundColor:B.backgroundPrimary,barStyle:"light-content"}),c.default.createElement(S,null))}}]),s})(c.default.Component);_e.default=L;var _,B={backgroundPrimary:'#151515',backgroundSecondary:'#202020',textPrimary:'#dddddd',textSecondary:'#888888',textTransparent:'#ddddddaa',accentColor:'#4444ff',accentColorForeground:'#000000'};_=f.StyleSheet.create({outer:{flex:1,backgroundColor:B.backgroundPrimary},app:{flex:1,backgroundColor:B.backgroundPrimary},mainView:{flex:1,backgroundColor:B.backgroundPrimary},loggingInScreen:{flex:1,alignItems:'center',justifyContent:'center'},leftView:{flex:1,backgroundColor:B.backgroundSecondary,flexDirection:"row",justifyContent:'flex-start'},rightView:{flex:1,backgroundColor:B.backgroundSecondary},textDefault:{color:"#ddd"},message:{width:"100%",flex:1,flexDirection:"row"},messageContent:{marginTop:-6,marginBottom:4},messageGrouped:{paddingLeft:40,marginTop:-10,width:"100%"},messageInner:{flex:1,paddingLeft:10},messageAvatar:{width:40,height:40,borderRadius:1e5},messageAvatarReply:{width:15,height:15,borderRadius:1e5},messageUsernameReply:{marginLeft:3,marginRight:3},replyMessage:{alignItems:'center'},typingBar:{height:20,backgroundColor:B.backgroundSecondary,borderBottomColor:B.backgroundPrimary,borderBottomWidth:1},messageUsername:{fontWeight:'bold',marginBottom:-4,marginTop:2},serverButton:{borderRadius:5e3,width:48,height:48,margin:4,backgroundColor:B.backgroundPrimary,overflow:"hidden"},serverIcon:{width:48,height:48},serverList:{width:56,flexShrink:1},channelList:{flexGrow:1e3,flex:1e3},channelButton:{padding:8,margin:3,marginRight:5,borderRadius:3,backgroundColor:B.backgroundPrimary},messagesView:{padding:10,flex:1},messageBoxInner:{flexDirection:'row'},messageBoxOuter:{backgroundColor:B.backgroundSecondary,margin:5,borderRadius:3},sendButton:{margin:3,marginLeft:0,borderRadius:3,backgroundColor:B.backgroundPrimary,width:50,justifyContent:'center',alignItems:'center'},headerIcon:{margin:5,marginRight:10,justifyContent:'center',alignItems:'center'},messageBox:{color:B.textPrimary,paddingLeft:10,padding:6,flex:1},channelHeader:{height:50,backgroundColor:B.backgroundSecondary,alignItems:'center',paddingLeft:20,flexDirection:'row'},replyMessage:{flexDirection:'row'},messageContentReply:{height:20},actionTile:{height:40,width:"100%",justifyContent:'center',borderBottomColor:B.backgroundPrimary,borderBottomWidth:1,paddingLeft:10,paddingRight:10,margin:3},repliedMessagePreview:{paddingLeft:3,borderBottomColor:B.backgroundPrimary,borderBottomWidth:1},repliedMessagePreviews:{paddingTop:8},usernameBadge:{padding:2,borderRadius:3,backgroundColor:B.accentColor},timestamp:{fontSize:12,color:B.textSecondary,position:'relative',top:4,left:4}})},399,[3,275,35,7,8,10,12,15,29,400,402,125,1,591,592,594,595,603,660,670,671,642]); +__d(function(g,r,i,_a,_m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.default=void 0;var e=r(d[0])(r(d[1])),t=r(d[0])(r(d[2])),n=r(d[0])(r(d[3])),a=r(d[0])(r(d[4])),l=r(d[0])(r(d[5])),s=r(d[0])(r(d[6])),o=r(d[0])(r(d[7])),u=r(d[0])(r(d[8]));r(d[9]),r(d[10]);var c=r(d[0])(r(d[11])),f=(function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=w(t);if(n&&n.has(e))return n.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&Object.prototype.hasOwnProperty.call(e,s)){var o=l?Object.getOwnPropertyDescriptor(e,s):null;o&&(o.get||o.set)?Object.defineProperty(a,s,o):a[s]=e[s]}a.default=e,n&&n.set(e,a);return a})(r(d[12])),m=r(d[0])(r(d[13])),h=r(d[0])(r(d[14])),p=r(d[0])(r(d[15])),y=r(d[0])(r(d[16]));function w(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(w=function(e){return e?n:t})(e)}function v(e){var t=E();return function(){var n,a=(0,o.default)(e);if(t){var l=(0,o.default)(this).constructor;n=Reflect.construct(a,arguments,l)}else n=a.apply(this,arguments);return(0,s.default)(this,n)}}function E(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}var b=m.default,x=new(r(d[17]).Client),M=!1,P=!1,k=function(e){var t=(0,u.default)({},e);return e.style||(t=(0,u.default)({style:{}},t)),t.style=(0,u.default)({color:_.textDefault.color},t.style),c.default.createElement(f.default.Text,t,t.children)},C=function(e){var t=(0,u.default)({},e);return e.styles||(t=(0,u.default)({styles:{}},t)),t.styles.text||(t.styles=(0,u.default)({text:{}},t.styles)),t.styles.text=(0,u.default)({color:_.textDefault.color},t.styles.text),e.rules||(t=(0,u.default)({rules:{}},t)),t.rules=(0,u.default)({image:{},refimage:{}},t.rules),c.default.createElement(r(d[18]).MarkdownView,t,t.children)},S=(function(t){(0,l.default)(o,t);var s=v(o);function o(e){var t;return(0,n.default)(this,o),(t=s.call(this,e)).state={username:null,loggedIn:!1,currentChannel:null,currentText:"",replyingMessages:[],leftMenuOpen:!1,rightMenuOpen:!1,contextMenuMessage:null,contextMenuUser:null,imageViewerImage:null},console.log("construct app"),t}return(0,a.default)(o,[{key:"componentDidMount",value:function(){var t=this;console.log("mount app"),x.on('ready',function(){return e.default.async(function(e){for(;;)switch(e.prev=e.next){case 0:t.setState(function(){return{loggedIn:!0}});case 1:case"end":return e.stop()}},null,null,null,Promise)}.bind(this)),x.useExistingSession({token:'vjHS49KziXDzDEWUR23ad8aWgShOdmAnMPH_FmDJ9bKNzw-MS0U6_pbyo9gWZrAl'})}},{key:"render",value:function(){var e,t,n,a,l,s,o,u=this;return this.state.loggedIn?c.default.createElement(f.View,{style:_.app},c.default.createElement(h.default,{openMenuOffset:f.Dimensions.get('window').width-50,menuPosition:"right",disableGestures:this.state.leftMenuOpen,edgeHitWidth:120,isOpen:this.state.rightMenuOpen,onChange:function(e){return u.setState({rightMenuOpen:e})},menu:c.default.createElement(T,null),style:_.app,bounceBackOnOverdraw:!1},c.default.createElement(h.default,{openMenuOffset:f.Dimensions.get('window').width-50,disableGestures:this.state.rightMenuOpen,edgeHitWidth:120,isOpen:this.state.leftMenuOpen,onChange:function(e){return u.setState({leftMenuOpen:e})},menu:c.default.createElement(U,{onChannelClick:function(e){return u.setState({currentChannel:e,leftMenuOpen:!1})},currentChannel:this.state.currentChannel}),style:_.app,bounceBackOnOverdraw:!1},c.default.createElement(f.View,{style:_.mainView},this.state.currentChannel?c.default.createElement(f.View,{style:{flex:1}},c.default.createElement(f.View,{style:_.channelHeader},c.default.createElement(f.TouchableOpacity,{style:_.headerIcon,onPress:function(){u.setState({leftMenuOpen:!u.state.leftMenuOpen})}},c.default.createElement(k,null,"\u2630")),c.default.createElement(k,{style:{flex:1}},"#",this.state.currentChannel.name)),c.default.createElement(R,{channel:this.state.currentChannel,onLongPress:function(e){u.setState({contextMenuMessage:e})},onUserPress:function(e){u.setState({contextMenuUser:e.author})},onImagePress:function(e){u.setState({imageViewerImage:e})}}),c.default.createElement(f.View,{style:_.messageBoxOuter},c.default.createElement(V,{channel:this.state.currentChannel}),this.state.replyingMessages&&this.state.replyingMessages.map(function(e){var t;return c.default.createElement(f.View,{key:e._id,style:_.repliedMessagePreview},c.default.createElement(k,null,"Replying to ",null==(t=e.author)?void 0:t.username))}),c.default.createElement(f.View,{style:_.messageBoxInner},c.default.createElement(f.TextInput,{placeholderTextColor:B.textTransparent,style:_.messageBox,placeholder:"Write your thoughts!",onChangeText:function(e){u.setState({currentText:e}),0==u.state.currentText.length?u.state.currentChannel.stopTyping():M||(M=!0,u.state.currentChannel.startTyping(),setTimeout(function(){return M=!1}.bind(u),2500))},value:this.state.currentText}),this.state.currentText.length>0&&c.default.createElement(f.TouchableOpacity,{style:_.sendButton,onPress:function(){u.state.currentChannel.sendMessage({content:u.state.currentText,replies:u.state.replyingMessages.map(function(e){return{id:e._id,mention:!1}})}),u.setState({currentText:"",replyingMessages:[]})}},c.default.createElement(k,null,"Send"))))):c.default.createElement(k,null,"No channel selected! Select one at the side!")))),c.default.createElement(f.Modal,{key:"messageMenu",animationType:"slide",transparent:!0,visible:!!this.state.contextMenuMessage,onRequestClose:function(){}},c.default.createElement(f.Pressable,{onPress:function(){return u.setState({contextMenuMessage:null})},style:{width:f.Dimensions.get("window").width,height:f.Dimensions.get("window").height,position:'absolute',backgroundColor:"#00000000"}}),c.default.createElement(f.View,{style:{width:"100%",height:"40%",top:"60%",backgroundColor:B.backgroundSecondary}},c.default.createElement(f.View,null,c.default.createElement(O,{message:this.state.contextMenuMessage,style:{margin:3,width:"100%"}}),c.default.createElement(f.Pressable,{style:_.actionTile,onPress:function(){return u.setState({contextMenuMessage:null})}},c.default.createElement(k,null,"Close")),c.default.createElement(f.Pressable,{style:_.actionTile,onPress:function(){var e=u.state.replyingMessages||[];e.length>=4||(e.push(u.state.contextMenuMessage),u.setState({replyingMessages:e,contextMenuMessage:null}))}},c.default.createElement(k,null,"Reply"))))),c.default.createElement(f.Modal,{key:"profileMenu",animationType:"slide",transparent:!0,visible:!!this.state.contextMenuUser,onRequestClose:function(){}},c.default.createElement(f.Pressable,{onPress:function(){return u.setState({contextMenuUser:null})},style:{width:f.Dimensions.get("window").width,height:f.Dimensions.get("window").height,position:'absolute',backgroundColor:"#00000000"}}),c.default.createElement(f.View,{style:{width:"100%",height:"75%",top:"25%",padding:15,backgroundColor:B.backgroundSecondary}},c.default.createElement(f.View,null,(null==(e=this.state.contextMenuUser)?void 0:e.generateAvatarURL)&&c.default.createElement(b,{style:{borderRadius:1e4,height:100,width:100},source:{uri:this.state.contextMenuUser.generateAvatarURL()}}),c.default.createElement(k,{style:{fontWeight:'bold',fontSize:30}},"@",null==(t=this.state.contextMenuUser)?void 0:t.username," ",(null==(n=this.state.contextMenuUser)?void 0:n.bot)&&c.default.createElement(f.View,{style:_.usernameBadge},c.default.createElement(k,{style:{color:B.accentColorForeground}},"BOT"))),!(null!=(a=this.state.contextMenuUser)&&a.bot)&&((null==(l=this.state.contextMenuUser)?void 0:l.relationship)==r(d[19]).RelationshipStatus.Friend?c.default.createElement(f.Pressable,{style:_.actionTile,onPress:function(){return u.setState({contextMenuUser:null})}},c.default.createElement(k,null,"Message (not impl.)")):c.default.createElement(f.Pressable,{style:_.actionTile,onPress:function(){var e;return null==(e=u.state.contextMenuUser)?void 0:e.addFriend()}},c.default.createElement(k,null,(null==(s=this.state.contextMenuUser)?void 0:s.relationship)==r(d[19]).RelationshipStatus.Incoming?"Accept Friend":"Add Friend")))))),c.default.createElement(f.Modal,{visible:!!this.state.imageViewerImage,transparent:!0},c.default.createElement(y.default,{imageUrls:null!=(o=this.state.imageViewerImage)&&o.metadata?[{url:x.generateFileURL(this.state.imageViewerImage),width:this.state.imageViewerImage.metadata.width,height:this.state.imageViewerImage.metadata.height}]:[{url:this.state.imageViewerImage}],renderHeader:function(){return c.default.createElement(f.View,{style:{height:50,width:"100%",justifyContent:'center',paddingLeft:10,paddingRight:10}},c.default.createElement(f.Pressable,{onPress:function(){var e;return f.Linking.openURL(null!=(e=u.state.imageViewerImage)&&e.metadata?x.generateFileURL(u.state.imageViewerImage):u.state.imageViewerImage)}},c.default.createElement(k,null,"Open URL")),c.default.createElement(f.View,{style:{marginLeft:20}}),c.default.createElement(f.Pressable,{onPress:function(){return u.setState({imageViewerImage:null})}},c.default.createElement(k,null,"Close")))},renderIndicator:function(e,t){return null},enableSwipeDown:!0,onCancel:function(){return u.setState({imageViewerImage:null})}}))):c.default.createElement(f.View,{style:_.app},c.default.createElement(f.View,{style:_.loggingInScreen},c.default.createElement(k,null,"Logging in...")))}}]),o})(c.default.Component),V=(0,r(d[20]).observer)(function(e){var t=e.channel;if(t){var n,a=t.typing.filter(function(e){return!!e});switch(a.length){case 1:n=a[0].username+" is typing...";break;case 2:n=a[0].username+" and "+a[1].username+" are typing...";break;case 3:n=a[0].username+", "+a[1].username+", and "+a[2].username+" are typing...";break;default:n="Several people are typing..."}if(a.length>0)return c.default.createElement(f.View,{style:_.typingBar},c.default.createElement(k,null,n))}return c.default.createElement(f.View,null)}),R=(function(s){(0,l.default)(u,s);var o=v(u);function u(e){var t;return(0,n.default)(this,u),(t=o.call(this,e)).state={messages:[],loading:!1},t}return(0,a.default)(u,[{key:"componentDidMount",value:function(){var t=this;console.log("mount component"),x.on('message',function(n){return e.default.async(function(e){for(;;)switch(e.prev=e.next){case 0:!t.props.loading&&t.props.channel&&t.props.channel._id==n.channel._id&&t.setState(function(e){var t=e.messages;return t.length>=50&&(t=t.slice(1)),t.push(n),{messages:t}});case 1:case"end":return e.stop()}},null,null,null,Promise)})}},{key:"componentDidUpdate",value:function(e){var n=this;console.log(this.props.channel,!e.channel,e.channel._id,this.props.channel._id),!this.props.channel||P&&e.channel._id==this.props.channel._id||(P=!0,this.setState({loading:!0}),requestAnimationFrame(function(){console.log("fetch messages");var e="";n.props.channel.fetchMessagesWithUsers({limit:50}).then(function(a){console.log("done fetching"),n.setState({messages:(0,t.default)(a.messages.reverse()).map(function(t){var a,l=c.default.createElement(I,{key:t._id,message:t,grouped:e==(null==(a=t.author)?void 0:a._id)&&!(t.reply_ids&&t.reply_ids.length>0),onLongPress:function(){return n.props.onLongPress(t)},onUserPress:function(){return n.props.onUserPress(t)},onImagePress:function(e){return n.props.onImagePress(e)}});return e=t.author?t.author._id:e,{rendered:l,message:t}}),loading:!1})})}))}},{key:"render",value:function(){var e=this;return this.props.loading?c.default.createElement(k,null,"Loading..."):c.default.createElement(f.View,{style:{flex:1}},c.default.createElement(f.ScrollView,{ref:function(t){e.scrollView=t},onContentSizeChange:function(){return e.scrollView.scrollToEnd({animated:!0})},style:_.messagesView},this.state.messages.map(function(e){return e.rendered}),c.default.createElement(f.View,{style:{marginTop:20}})))}}]),u})(c.default.Component),I=(function(e){(0,l.default)(s,e);var t=v(s);function s(e){return(0,n.default)(this,s),t.call(this,e)}return(0,a.default)(s,[{key:"render",value:function(){var e,t=this;return c.default.createElement(f.TouchableOpacity,{activeOpacity:.8,delayLongPress:1e3,onLongPress:this.props.onLongPress,style:null!==this.props.message.reply_ids?_.replyingWrapper:_.messageWrapper},null!==this.props.message.reply_ids&&c.default.createElement(f.View,{style:_.repliedMessagePreviews},this.props.message.reply_ids.map(function(e){return c.default.createElement(O,{key:e,message:x.messages.get(e)})})),c.default.createElement(f.View,{style:this.props.grouped?_.messageGrouped:_.message},this.props.message.author&&!this.props.grouped&&c.default.createElement(f.Pressable,{onPress:function(){return t.props.onUserPress()}},c.default.createElement(b,{source:{uri:this.props.message.author.generateAvatarURL()+"?max_side=128"},style:_.messageAvatar})),c.default.createElement(f.View,{style:_.messageInner},this.props.message.author&&!this.props.grouped&&c.default.createElement(f.View,{style:{flexDirection:'row'}},c.default.createElement(k,{style:_.messageUsername},this.props.message.author.username),c.default.createElement(k,{style:_.timestamp}," ",(0,p.default)((0,r(d[21]).decodeTime)(this.props.message._id)).format('YYYY-MM-DD hh:mm:ss A'))),c.default.createElement(C,{style:_.messageContent},this.props.message.content))),null==(e=this.props.message.attachments)?void 0:e.map(function(e){console.log(e);var n=e.metadata.width,a=e.metadata.width;if(n>f.Dimensions.get("screen").width){var l=f.Dimensions.get("screen").width/n;n*=l,a*=l}return"Image"==e.metadata.type&&c.default.createElement(f.Pressable,{onPress:function(){return t.props.onImagePress(e)}},c.default.createElement(b,{source:{uri:x.generateFileURL(e)},resizeMode:m.default.resizeMode.contain,style:{width:n,height:a,marginBottom:4,borderRadius:3}}))}))}}]),s})(c.default.PureComponent),O=(function(e){(0,l.default)(s,e);var t=v(s);function s(e){return(0,n.default)(this,s),t.call(this,e)}return(0,a.default)(s,[{key:"render",value:function(){return this.props.message?c.default.createElement(f.View,{style:_.replyMessage},c.default.createElement(k,{style:{marginLeft:15,marginRight:15}},"\u21b1"),this.props.message.author&&c.default.createElement(c.default.Fragment,null,c.default.createElement(b,{source:{uri:this.props.message.author.generateAvatarURL()+"?max_side=128"},style:_.messageAvatarReply}),c.default.createElement(k,{style:_.messageUsernameReply},this.props.message.author.username)),c.default.createElement(k,{style:_.messageContentReply},this.props.message.content.split("\n").join(" "))):c.default.createElement(c.default.Fragment,null)}}]),s})(c.default.PureComponent),U=(function(e){(0,l.default)(o,e);var s=v(o);function o(e){var t;return(0,n.default)(this,o),(t=s.call(this,e)).state={currentServer:null},t}return(0,a.default)(o,[{key:"render",value:function(){var e,n,a,l,s=this;return c.default.createElement(f.View,{style:_.leftView},c.default.createElement(f.ScrollView,{style:_.serverList},c.default.createElement(f.TouchableOpacity,{onPress:function(){s.setState({currentServer:null})},key:null==(e=x.user)?void 0:e._id,style:_.serverButton},null!=(n=x.user)&&n.generateAvatarURL?c.default.createElement(b,{source:{uri:(null==(a=x.user)?void 0:a.generateAvatarURL())+"?max_side=128"},style:_.serverIcon}):c.default.createElement(k,null,null==(l=x.user)?void 0:l.name)),(0,t.default)(x.servers.values()).map(function(e){var t=e.generateIconURL();return console.log(t),c.default.createElement(f.TouchableOpacity,{onPress:function(){s.setState({currentServer:e})},key:e._id,style:_.serverButton},t?c.default.createElement(b,{source:{uri:t+"?max_side=128"},style:_.serverIcon}):c.default.createElement(k,null,e.name))})),c.default.createElement(f.ScrollView,{style:_.channelList},(this.state.currentServer?this.state.currentServer.channels:(0,t.default)(x.channels.values()).filter(function(e){return"Group"==e.channel_type})).map(function(e){return c.default.createElement(f.TouchableOpacity,{onPress:function(){s.props.onChannelClick(e)},key:e._id,style:_.channelButton},c.default.createElement(k,null,e.name))})))}}]),o})(c.default.PureComponent),T=(function(e){(0,l.default)(s,e);var t=v(s);function s(e){var a;return(0,n.default)(this,s),(a=t.call(this,e)).state={currentServer:null},a}return(0,a.default)(s,[{key:"render",value:function(){return c.default.createElement(f.View,{style:_.rightView},c.default.createElement(k,null,"trollface"))}}]),s})(c.default.Component),L=(function(e){(0,l.default)(s,e);var t=v(s);function s(){return(0,n.default)(this,s),t.apply(this,arguments)}return(0,a.default)(s,[{key:"render",value:function(){return c.default.createElement(f.View,{style:_.outer},c.default.createElement(f.StatusBar,{animated:!0,backgroundColor:B.backgroundPrimary,barStyle:"light-content"}),c.default.createElement(S,null))}}]),s})(c.default.Component);_e.default=L;var _,B={backgroundPrimary:'#151515',backgroundSecondary:'#202020',foregroundPrimary:'#dddddd',foregroundSecondary:'#888888',textTransparent:'#ddddddaa',accentColor:'#4444ff',accentColorForeground:'#000000'};_=f.StyleSheet.create({outer:{flex:1,backgroundColor:B.backgroundPrimary},app:{flex:1,backgroundColor:B.backgroundPrimary},mainView:{flex:1,backgroundColor:B.backgroundPrimary},loggingInScreen:{flex:1,alignItems:'center',justifyContent:'center'},leftView:{flex:1,backgroundColor:B.backgroundSecondary,flexDirection:"row",justifyContent:'flex-start'},rightView:{flex:1,backgroundColor:B.backgroundSecondary},textDefault:{color:"#ddd"},message:{width:"100%",flex:1,flexDirection:"row"},messageContent:{marginTop:-6,marginBottom:4},messageGrouped:{paddingLeft:40,marginTop:-10,width:"100%"},messageInner:{flex:1,paddingLeft:10},messageAvatar:{width:40,height:40,borderRadius:1e5},messageAvatarReply:{width:15,height:15,borderRadius:1e5},messageUsernameReply:{marginLeft:3,marginRight:3},replyMessage:{alignItems:'center'},typingBar:{height:20,backgroundColor:B.backgroundSecondary,borderBottomColor:B.backgroundPrimary,borderBottomWidth:1},messageUsername:{fontWeight:'bold',marginBottom:-4,marginTop:2},serverButton:{borderRadius:5e3,width:48,height:48,margin:4,backgroundColor:B.backgroundPrimary,overflow:"hidden"},serverIcon:{width:48,height:48},serverList:{width:56,flexShrink:1},channelList:{flexGrow:1e3,flex:1e3},channelButton:{padding:8,margin:3,marginRight:5,borderRadius:3,backgroundColor:B.backgroundPrimary},messagesView:{padding:10,flex:1},messageBoxInner:{flexDirection:'row'},messageBoxOuter:{backgroundColor:B.backgroundSecondary,margin:5,borderRadius:3},sendButton:{margin:3,marginLeft:0,borderRadius:3,backgroundColor:B.backgroundPrimary,width:50,justifyContent:'center',alignItems:'center'},headerIcon:{margin:5,marginRight:10,justifyContent:'center',alignItems:'center'},messageBox:{color:B.foregroundPrimary,paddingLeft:10,padding:6,flex:1},channelHeader:{height:50,backgroundColor:B.backgroundSecondary,alignItems:'center',paddingLeft:20,flexDirection:'row'},replyMessage:{flexDirection:'row'},messageContentReply:{height:20},actionTile:{height:40,width:"100%",justifyContent:'center',borderBottomColor:B.backgroundPrimary,borderBottomWidth:1,paddingLeft:10,paddingRight:10,margin:3},repliedMessagePreview:{paddingLeft:3,borderBottomColor:B.backgroundPrimary,borderBottomWidth:1},repliedMessagePreviews:{paddingTop:8},usernameBadge:{padding:2,borderRadius:3,backgroundColor:B.accentColor},timestamp:{fontSize:12,color:B.foregroundSecondary,position:'relative',top:4,left:4}})},399,[3,275,35,7,8,10,12,15,29,400,402,125,1,591,592,594,595,603,660,670,671,642]); __d(function(g,r,i,a,m,_e,d){function t(t){var e=n();return function(){var n,o=r(d[0])(t);if(e){var c=r(d[0])(this).constructor;n=Reflect.construct(o,arguments,c)}else n=o.apply(this,arguments);return r(d[1])(this,n)}}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}var e=r(d[2]).NativeModules,o=(function(n){"use strict";r(d[3])(o,n);var e=t(o);function o(){return r(d[4])(this,o),e.apply(this,arguments)}return o})(r(d[5])(Error)),c=(function(n){"use strict";r(d[3])(o,n);var e=t(o);function o(){return r(d[4])(this,o),e.apply(this,arguments)}return o})(r(d[5])(Error));function u(t){if(e.RNGetRandomValues)return e.RNGetRandomValues.getRandomBase64(t);if(e.ExpoRandom)return e.ExpoRandom.getRandomBase64String(t);throw new Error('Native module not found')}'object'!=typeof g.crypto&&(g.crypto={}),'function'!=typeof g.crypto.getRandomValues&&(g.crypto.getRandomValues=function(t){if(!(t instanceof Int8Array||t instanceof Uint8Array||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8ClampedArray))throw new o('Expected an integer array');if(t.byteLength>65536)throw new c('Can only request a maximum of 65536 bytes');return r(d[6])(u(t.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t})},400,[15,12,1,10,7,58,401]); __d(function(g,r,_i,a,m,e,d){'use strict';var t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,62,0,62,0,63,52,53,54,55,56,57,58,59,60,61,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,0,0,0,0,63,0,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];m.exports=function(o,c){for(var h,A=o.length,C='='===o[A-2]?2:'='===o[A-1]?1:0,n=0,f=A-C&4294967292,i=0;i>16&255,c[n++]=h>>8&255,c[n++]=255&h;1===C&&(h=t[o.charCodeAt(i)]<<10|t[o.charCodeAt(i+1)]<<4|t[o.charCodeAt(i+2)]>>2,c[n++]=h>>8&255,c[n++]=255&h),2===C&&(h=t[o.charCodeAt(i)]<<2|t[o.charCodeAt(i+1)]>>4,c[n++]=255&h)}},401,[]); __d(function(g,r,i,a,m,e,d){if('undefined'==typeof __dirname&&(g.__dirname='/'),'undefined'==typeof __filename&&(g.__filename=''),'undefined'==typeof process)g.process=r(d[0]);else{var f=r(d[0]);for(var n in f)n in process||(process[n]=f[n])}process.browser=!1,'undefined'==typeof Buffer&&(g.Buffer=r(d[1]).Buffer);process.env.NODE_ENV='production','undefined'!=typeof localStorage&&(localStorage.debug=''),r(d[2])},402,[403,404,407]); diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 32caf73..ab5df35 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -1,3 +1,3 @@ - RVMob + RVMob diff --git a/src/Generic.js b/src/Generic.js index 79f82f3..d6b76c0 100644 --- a/src/Generic.js +++ b/src/Generic.js @@ -159,7 +159,7 @@ export const client = new Client({ unreads: true }); export const Text = (props) => { let newProps = {...props} if (!props.style) newProps = Object.assign({style: {}}, newProps) - newProps.style = Object.assign({color: currentTheme.textPrimary, flexWrap: 'wrap', fontFamily: 'OpenSans'}, newProps.style) + newProps.style = Object.assign({color: currentTheme.foregroundPrimary, flexWrap: 'wrap', fontFamily: 'OpenSans'}, newProps.style) return ( {newProps.children} ) @@ -222,7 +222,7 @@ const spoilerStyle = { }, revealedSpoiler: { backgroundColor: currentTheme.backgroundSecondary, - color: currentTheme.textPrimary, + color: currentTheme.foregroundPrimary, }, }; @@ -290,19 +290,19 @@ export const MarkdownView = (props) => { if (!newProps.rules) newProps = Object.assign({rules: spoilerRule}, newProps) if (!newProps.style) newProps = Object.assign({style: {}}, newProps) if (!newProps.style.body) newProps.style = Object.assign({body: {}}, newProps.style) - newProps.style.body = Object.assign({color: currentTheme.textPrimary}, newProps.style.body) + newProps.style.body = Object.assign({color: currentTheme.foregroundPrimary}, newProps.style.body) if (!newProps.style.paragraph) newProps.style = Object.assign({paragraph: {}}, newProps.style) - newProps.style.paragraph = Object.assign({color: currentTheme.textPrimary, marginTop: -3, marginBottom: 2}, newProps.style.paragraph) + newProps.style.paragraph = Object.assign({color: currentTheme.foregroundPrimary, marginTop: -3, marginBottom: 2}, newProps.style.paragraph) if (!newProps.style.link) newProps.style = Object.assign({link: {}}, newProps.style) newProps.style.link = Object.assign({color: currentTheme.accentColor}, newProps.style.link) if (!newProps.style.code_inline) newProps.style = Object.assign({ code_inline: {} }, newProps.style) - newProps.style.code_inline = Object.assign({ color: currentTheme.textPrimary, backgroundColor: currentTheme.backgroundSecondary }, newProps.style.code_inline); + newProps.style.code_inline = Object.assign({ color: currentTheme.foregroundPrimary, backgroundColor: currentTheme.backgroundSecondary }, newProps.style.code_inline); if (!newProps.style.fence) newProps.style = Object.assign({fence: {}}, newProps.style); - newProps.style.fence = Object.assign({ color: currentTheme.textPrimary, backgroundColor: currentTheme.backgroundSecondary, borderWidth: 0 }, newProps.style.fence); + newProps.style.fence = Object.assign({ color: currentTheme.foregroundPrimary, backgroundColor: currentTheme.backgroundSecondary, borderWidth: 0 }, newProps.style.fence); if (!newProps.style.code_block) newProps.style = Object.assign({code_block: {}}, newProps.style); - newProps.style.code_block = Object.assign({ borderColor: currentTheme.textPrimary, color: currentTheme.textPrimary, backgroundColor: currentTheme.backgroundSecondary }, newProps.style.code_block); + newProps.style.code_block = Object.assign({ borderColor: currentTheme.foregroundPrimary, color: currentTheme.foregroundPrimary, backgroundColor: currentTheme.backgroundSecondary }, newProps.style.code_block); if (!newProps.style.blockquote) newProps.style = Object.assign({ blockquote: {} }, newProps.style) - newProps.style.blockquote = Object.assign({ borderColor: currentTheme.textPrimary, color: currentTheme.textPrimary, backgroundColor: currentTheme.blockQuoteBackground }, newProps.style.block_quote); + newProps.style.blockquote = Object.assign({ borderColor: currentTheme.foregroundPrimary, color: currentTheme.foregroundPrimary, backgroundColor: currentTheme.blockQuoteBackground }, newProps.style.block_quote); try { return ( {newProps.children} @@ -351,11 +351,11 @@ export const ServerList = observer(({ onServerPress, onServerLongPress, filter, let pings = s.getMentions().length; return {showUnread && s.getMentions().length > 0 ? - - {pings > 9 ? "9+" : pings} + + {pings > 9 ? "9+" : pings} : showUnread && s.isUnread() ? - + : null} {onServerPress(s)}} @@ -369,18 +369,23 @@ export const ServerList = observer(({ onServerPress, onServerLongPress, filter, }) export const ChannelButton = observer(({channel, onPress=()=>{}, onLongPress=()=>{}, delayLongPress, selected, showUnread=true}) => { - let color = showUnread && channel.unread ? currentTheme.textPrimary : currentTheme.textSecondary + let color = showUnread && channel.unread ? currentTheme.foregroundPrimary : currentTheme.foregroundTertiary let pings = channel.mentions?.length + let classes = [styles.channelButton] + if (selected) { + classes.push(styles.channelButtonSelected) + } + if (channel.channel_type == "DirectMessage" || channel.channel_type == "Group") { + classes.push({padding: 6}) + } else { + classes.push({padding: 8}) + } return onPress()} onLongPress={()=>onLongPress()} delayLongPress={delayLongPress} key={channel._id} - style={ - selected ? - [styles.channelButton, styles.channelButtonSelected] : - styles.channelButton - }> + style={classes}> {channel.channel_type == "DirectMessage" ? @@ -393,37 +398,37 @@ export const ChannelButton = observer(({channel, onPress=()=>{}, onLongPress=()= - {channel.name || channel} + {channel.name || channel} {showUnread && channel.mentions?.length > 0 ? - - {pings > 9 ? "9+" : pings} + + {pings > 9 ? "9+" : pings} : showUnread && channel.unread ? - + : null} } }) export const ChannelIcon = ({channel, showUnread=true}) => { - let color = showUnread && channel.unread ? currentTheme.textPrimary : currentTheme.textSecondary + let color = showUnread && channel.unread ? currentTheme.foregroundPrimary : currentTheme.foregroundSecondary return (channel.generateIconURL && channel.generateIconURL()) ? : + : channel == "Friends" ? - : + : channel == "Saved Notes" ? - : + : channel.channel_type == "DirectMessage" ? - + : channel.channel_type == "VoiceChannel" ? - + : - + } export const ChannelList = observer((props) => { @@ -431,6 +436,8 @@ export const ChannelList = observer((props) => { <> {!props.currentServer ? <> + Direct Messages + {props.onChannelClick(null)}} key={"home"} channel={"Home"} @@ -462,7 +469,7 @@ export const ChannelList = observer((props) => { let processedChannels = []; let res = props.currentServer.categories?.map(c => { return - {c.title?.toUpperCase()} + {c.title?.toUpperCase()} {c.channels.map((cid) => { processedChannels.push(cid) let c = client.channels.get(cid) @@ -507,7 +514,7 @@ export const ServerName = observer(({ server, size }) => { export const remarkStyle = { - color: currentTheme.textSecondary, + color: currentTheme.foregroundSecondary, textAlign: 'center', fontSize: 16, marginTop: 5 @@ -559,7 +566,7 @@ export function Input({value, onChangeText, placeholder, style, backgroundColor, value={value} onChangeText={onChangeText} placeholder={placeholder} - style={[{minWidth: "100%", borderRadius: 8, backgroundColor: currentTheme.backgroundSecondary, padding: 6, paddingLeft: 10, paddingRight: 10, color: currentTheme.textPrimary}, backgroundColor ? {backgroundColor} : {}, style]} + style={[{minWidth: "100%", borderRadius: 8, backgroundColor: currentTheme.backgroundSecondary, padding: 6, paddingLeft: 10, paddingRight: 10, color: currentTheme.foregroundPrimary}, backgroundColor ? {backgroundColor} : {}, style]} {...props} /> ) } @@ -572,10 +579,10 @@ export function InputWithButton({defaultValue, placeholder, buttonLabel, style, value={value} onChangeText={(v) => {setValue(v)}} placeholder={placeholder} - style={{flex: 1, borderRadius: 8, backgroundColor: backgroundColor || currentTheme.backgroundSecondary, padding: 6, paddingLeft: 10, paddingRight: 10, color: currentTheme.textPrimary}} + style={{flex: 1, borderRadius: 8, backgroundColor: backgroundColor || currentTheme.backgroundSecondary, padding: 6, paddingLeft: 10, paddingRight: 10, color: currentTheme.foregroundPrimary}} {...props} /> ) diff --git a/src/MessageBox.js b/src/MessageBox.js index ea42f1d..451a801 100644 --- a/src/MessageBox.js +++ b/src/MessageBox.js @@ -37,14 +37,14 @@ export const MessageBox = observer((props) => { setReplyingMessages(replyingMessages?.filter(m2 => m2.message._id != m.message._id)) }> - + { let replacing = [...replyingMessages] replacing[i].mentions = !replacing[i].mentions setReplyingMessages(replacing) }}> - @{m.mentions ? "ON" : "OFF"} + @{m.mentions ? "ON" : "OFF"} Replying to @@ -56,13 +56,13 @@ export const MessageBox = observer((props) => { setEditingMessage(null) setCurrentText("") }}> - + Editing message ) : null} - /* { + {/* { let res = await DocumentPicker.pickSingle({ type: [DocumentPicker.types.allFiles] }) @@ -70,9 +70,9 @@ export const MessageBox = observer((props) => { setAttachments([...attachments, res]) } }}> - - */ - { + + */} + { setCurrentText(text) if (currentText.length == 0) { props.channel.stopTyping(); @@ -120,7 +120,7 @@ export const MessageBox = observer((props) => { setReplyingMessages([]); } }}> - {editingMessage ? : } + {editingMessage ? : } : null} diff --git a/src/MessageView.js b/src/MessageView.js index 7bf79e7..8224f01 100644 --- a/src/MessageView.js +++ b/src/MessageView.js @@ -268,8 +268,8 @@ export const Message = observer((props) => { {(props.message.author && !props.grouped) ? props.onUserPress()}> : null} - {(props.grouped && props.message.edited) ? (edited) : null} - {(props.message.author && !props.grouped) ? {formatRelative(decodeTime(props.message._id), new Date())}{props.message.edited && (edited)} : null} + {(props.grouped && props.message.edited) ? (edited) : null} + {(props.message.author && !props.grouped) ? {formatRelative(decodeTime(props.message._id), new Date())}{props.message.edited && (edited)} : null} {parseRevoltNodes(props.message.content)} {props.message.attachments?.map((a) => { if (a.metadata?.type == "Image") { @@ -301,7 +301,7 @@ export const Message = observer((props) => { const MessageEmbed = observer(({embed: e}) => { if (e.type=="Website") return - {e.site_name ? {e.site_name} : null} + {e.site_name ? {e.site_name} : null} {e.title && e.url ? openUrl(e.url)}>{e.title} : {e.title}} {e.description ? {e.description} : null} diff --git a/src/Modals.js b/src/Modals.js index a5b1ca5..d2cc158 100644 --- a/src/Modals.js +++ b/src/Modals.js @@ -34,7 +34,12 @@ export class Modals extends React.Component { inviteBot: null } setFunction("openProfile", async (u, s) => { - this.setState({contextMenuUser: u || null, contextMenuUserProfile: u ? (await u.fetchProfile()) : null, contextMenuUserMutual: u ? (await u.fetchMutual()) : null, contextMenuUserServer: s || null, contextMenuUserSection: "Profile"}); + this.setState({ + contextMenuUser: u || null, + contextMenuUserProfile: u ? (await u.fetchProfile()) : null, + contextMenuUserMutual: u && u.relationship != "User" ? (await u.fetchMutual()) : null, + contextMenuUserServer: s || null, contextMenuUserSection: "Profile" + }); }) setFunction("openInvite", async (i) => { this.setState({inviteServer: (await client.fetchInvite(i).catch(e => e)), inviteServerCode: i}) @@ -76,7 +81,7 @@ export class Modals extends React.Component { onPress={() => this.setState({contextMenuMessage: null})} > - + Close @@ -96,7 +101,7 @@ export class Modals extends React.Component { }} > - + Reply @@ -106,7 +111,7 @@ export class Modals extends React.Component { }} > - + Copy content @@ -117,9 +122,9 @@ export class Modals extends React.Component { }} > - + - Copy ID ({this.state.contextMenuMessage?._id}) + Copy ID ({this.state.contextMenuMessage?._id}) : null} {this.state.contextMenuMessage?.channel.havePermission("ManageMessages") || this.state.contextMenuMessage?.author.relationship == "User" ? ( @@ -130,7 +135,7 @@ export class Modals extends React.Component { }} > - + Delete @@ -145,7 +150,7 @@ export class Modals extends React.Component { }} > - + Edit @@ -215,7 +220,7 @@ export class Modals extends React.Component { (this.state.contextMenuUser?.relationship == "Friend" ? {app.openProfile(null); this.setState({currentChannel: (await this.state.contextMenuUser.openDM()), messages: []})}}> - + Message @@ -224,13 +229,13 @@ export class Modals extends React.Component { <> {this.state.contextMenuUser?.addFriend(); this.setState({})}}> - + Accept Friend {this.state.contextMenuUser?.removeFriend(); this.setState({})}}> - + Reject Friend @@ -253,7 +258,7 @@ export class Modals extends React.Component { : - Unloaded user} + Unloaded user} } : @@ -274,14 +279,14 @@ export class Modals extends React.Component { {app.settings.get("Show developer tools") ? {Clipboard.setString(this.state.contextMenuUser._id)}}> - + - Copy ID ({this.state.contextMenuUser?._id}) + Copy ID ({this.state.contextMenuUser?._id}) : null} {this.state.contextMenuUser?.badges ? <> - BADGES + BADGES <> {Object.keys(Badges).map(b => { @@ -303,7 +308,7 @@ export class Modals extends React.Component { case "PlatformModeration": return default: - return [{b}] + return [{b}] }})()} } @@ -316,13 +321,13 @@ export class Modals extends React.Component { : null} - BIO + BIO {this.state.contextMenuUserProfile?.content ? {parseRevoltNodes(this.state.contextMenuUserProfile?.content)} : null} : this.state.contextMenuUserSection == "Mutual Servers" ? - MUTUAL SERVERS + MUTUAL SERVERS {this.state.contextMenuUserMutual.servers.map((s) => { s = client.servers.get(s); return {app.openServer(s); app.openProfile(null); app.openLeftMenu(true)}}> @@ -334,7 +339,7 @@ export class Modals extends React.Component { : this.state.contextMenuUserSection == "Mutual Friends" ? - MUTUAL FRIENDS + MUTUAL FRIENDS {this.state.contextMenuUserMutual.users.map((u) => { u = client.users.get(u); return {app.openProfile(u)}}> @@ -364,8 +369,8 @@ export class Modals extends React.Component { {this.setState({settingsOpen: false})}}> - - Close + + Close {this.state.settingsSection == null ? @@ -380,8 +385,8 @@ export class Modals extends React.Component { this.state.settingsSection == "App" ? <> {this.setState({settingsSection: null})}}> - - Back + + Back {Object.entries(app.settings).map(([k, v]) => { if (v.experimental && !app.settings.get("Show experimental features")) return null; @@ -395,7 +400,7 @@ export class Modals extends React.Component { width: 40, height: 40, borderRadius: 8, backgroundColor: app.settings.get(k) ? currentTheme.accentColor : currentTheme.backgroundSecondary, alignItems: 'center', justifyContent: 'center' - }} onPress={() => {app.settings.set(k, !app.settings.get(k)); rerender()}}>{app.settings.get(k) ? : null} + }} onPress={() => {app.settings.set(k, !app.settings.get(k)); rerender()}}>{app.settings.get(k) ? : null} } else if (v.type == "string" || v.type == "number") { return @@ -414,7 +419,7 @@ export class Modals extends React.Component { {v.experimental ? : null} {v.developer ? : null} {k} - {app.settings.set(k, v); rerender()}} /> + {app.settings.set(k, v); rerender()}} /> } } @@ -424,8 +429,8 @@ export class Modals extends React.Component { this.state.settingsSection == "Account" ? {this.setState({settingsSection: null})}}> - - Back + + Back Account : null @@ -438,16 +443,16 @@ export class Modals extends React.Component { {this.state.contextMenuServer?.icon ? : null} - {this.state.contextMenuServer?.name} - {this.state.contextMenuServer?.description ? {this.state.contextMenuServer?.description} : null} + {this.state.contextMenuServer?.name} + {this.state.contextMenuServer?.description ? {this.state.contextMenuServer?.description} : null} {app.settings.get("Show developer tools") ? {Clipboard.setString(this.state.contextMenuServer._id)}}> - + - Copy ID ({this.state.contextMenuServer?._id}) + Copy ID ({this.state.contextMenuServer?._id}) : null} diff --git a/src/Profile.js b/src/Profile.js index 2b78ba1..e3d8dad 100644 --- a/src/Profile.js +++ b/src/Profile.js @@ -81,8 +81,8 @@ export const MiniProfile = observer(({ user, scale, channel, server, color }) => return - - {user.online ? (user.status?.text || (user.status?.presence || "Online")) : "Offline"} + + {user.online ? (user.status?.text || (user.status?.presence || "Online")) : "Offline"} @@ -90,8 +90,8 @@ export const MiniProfile = observer(({ user, scale, channel, server, color }) => return - {channel.name} - {channel?.recipient_ids.length} members + {channel.name} + {channel?.recipient_ids.length} members }) @@ -115,7 +115,7 @@ export const RoleView = observer(({ server, user }) => { }}> - - + + ); diff --git a/src/Theme.js b/src/Theme.js index 893a360..75c62de 100644 --- a/src/Theme.js +++ b/src/Theme.js @@ -1,118 +1,124 @@ import { StyleSheet } from 'react-native'; export const themes = { "Light": { - backgroundPrimary: '#ffffff', - backgroundSecondary: '#d8d8d8', - blockQuoteBackground: '#11111111', - textPrimary: '#000000', - textSecondary: '#555555', - accentColor: '#1ad4b2', - accentColorForeground: '#000000', - contentType: 'dark', - buttonBorderWidth: 0, - messageBoxBorderWidth: 0, - generalBorderWidth: 0, - buttonBorderColorActive: "#3333ff", - statusOnline: "#3abf7e", - statusIdle: "#f39f00", - statusBusy: "#f84848", - statusStreaming: "#977eff", - statusOffline: "#a5a5a5", - statusInvisible: "#a5a5a5", - pingColor: "#f84848", - pingColorForeground: "#ffffff" - }, - "Dark": { - backgroundPrimary: '#151515', - backgroundSecondary: '#202020', + background: '#F6F6F6', + backgroundPrimary: '#FFFFFF', + backgroundSecondary: '#F1F1F1', + backgroundTertiary: '#4D4D4D', + foregroundPrimary: '#000000', + foregroundSecondary: '#F1F1F1', + foregroundTertiary: '#4D4D4D', + headerPrimary: '#F1F1F1', + headerSecondary: '#F1F1F1', + hover: '#0000002B', + messageBox: '#F1F1F1', blockQuoteBackground: '#11111166', - textPrimary: '#dddddd', - textSecondary: '#888888', - accentColor: '#1ad4b2', + accentColor: '#1AD4B2', accentColorForeground: '#000000', contentType: 'light', - buttonBorderWidth: 0, - messageBoxBorderWidth: 0, - generalBorderWidth: 0, - buttonBorderColorActive: "#3333ff", - statusOnline: "#3abf7e", - statusIdle: "#f39f00", - statusBusy: "#f84848", - statusStreaming: "#977eff", - statusOffline: "#a5a5a5", - statusInvisible: "#a5a5a5", - pingColor: "#f84848", - pingColorForeground: "#ffffff" + statusOnline: "#3ABF7E", + statusIdle: "#F39F00", + statusBusy: "#F84848", + statusStreaming: "#977EFF", + statusOffline: "#A5A5A5", + statusInvisible: "#A5A5A5", + error: "#ED4245", + pingColor: "#FBFF0050" }, - "Solarized": { - backgroundPrimary: '#001a20', - backgroundSecondary: '#05252d', + "Dark": { + background: '#191919', + backgroundPrimary: '#242424', + backgroundSecondary: '#1E1E1E', + backgroundTertiary: '#4D4D4D', + foregroundPrimary: '#F6F6F6', + foregroundSecondary: '#C8C8C8', + foregroundTertiary: '#848484', + headerPrimary: '#363636', + headerSecondary: '#2D2D2D', + hover: '#0000001A', + messageBox: '#363636', blockQuoteBackground: '#11111166', - textPrimary: '#dddddd', - textSecondary: '#888888', - accentColor: '#1ad4b2', + accentColor: '#1AD4B2', accentColorForeground: '#000000', contentType: 'light', - buttonBorderWidth: 0, - messageBoxBorderWidth: 0, - generalBorderWidth: 0, - buttonBorderColorActive: "#3333ff", - statusOnline: "#3abf7e", - statusIdle: "#f39f00", - statusBusy: "#f84848", - statusStreaming: "#977eff", - statusOffline: "#a5a5a5", - statusInvisible: "#a5a5a5", - pingColor: "#f84848", - pingColorForeground: "#ffffff" - }, - "Vibrant Pink": { - backgroundPrimary: '#f9bae9', - backgroundSecondary: '#e99cd6', - blockQuoteBackground: '#11111166', - textPrimary: '#000000', - textSecondary: '#555555', - accentColor: '#1ad4b2', - accentColorForeground: '#000000', - contentType: 'dark', - buttonBorderWidth: 0, - messageBoxBorderWidth: 0, - generalBorderWidth: 0, - buttonBorderColorActive: "#3333ff", - statusOnline: "#3abf7e", - statusIdle: "#f39f00", - statusBusy: "#f84848", - statusStreaming: "#977eff", - statusOffline: "#a5a5a5", - statusInvisible: "#a5a5a5", - pingColor: "#f84848", - pingColorForeground: "#ffffff" + statusOnline: "#3ABF7E", + statusIdle: "#F39F00", + statusBusy: "#F84848", + statusStreaming: "#977EFF", + statusOffline: "#A5A5A5", + statusInvisible: "#A5A5A5", + error: "#ED4245", + pingColor: "#FBFF000F" }, - "AMOLED": { - backgroundPrimary: '#000000', - backgroundSecondary: '#000000', - blockQuoteBackground: '#111111', - textPrimary: '#dddddd', - textSecondary: '#888888', - accentColor: '#1ad4b2', - accentColorForeground: '#000000', - contentType: 'light', - buttonBorderColor: "#ffffff99", - buttonBorderWidth: 1, - messageBoxBorderColor: "#ffffff99", - messageBoxBorderWidth: 1, - generalBorderColor: "#ffffff22", - generalBorderWidth: 1, - buttonBorderColorActive: "#3333ff", - statusOnline: "#3abf7e", - statusIdle: "#f39f00", - statusBusy: "#f84848", - statusStreaming: "#977eff", - statusOffline: "#a5a5a5", - statusInvisible: "#a5a5a5", - pingColor: "#f84848", - pingColorForeground: "#ffffff" - } + // "Solarized": { + // backgroundPrimary: '#001a20', + // backgroundSecondary: '#05252d', + // blockQuoteBackground: '#11111166', + // textPrimary: '#dddddd', + // textSecondary: '#888888', + // accentColor: '#1ad4b2', + // accentColorForeground: '#000000', + // contentType: 'light', + // buttonBorderWidth: 0, + // messageBoxBorderWidth: 0, + // generalBorderWidth: 0, + // buttonBorderColorActive: "#3333ff", + // statusOnline: "#3abf7e", + // statusIdle: "#f39f00", + // statusBusy: "#f84848", + // statusStreaming: "#977eff", + // statusOffline: "#a5a5a5", + // statusInvisible: "#a5a5a5", + // pingColor: "#f84848", + // pingColorForeground: "#ffffff" + // }, + // "Vibrant Pink": { + // backgroundPrimary: '#f9bae9', + // backgroundSecondary: '#e99cd6', + // blockQuoteBackground: '#11111166', + // textPrimary: '#000000', + // textSecondary: '#555555', + // accentColor: '#1ad4b2', + // accentColorForeground: '#000000', + // contentType: 'dark', + // buttonBorderWidth: 0, + // messageBoxBorderWidth: 0, + // generalBorderWidth: 0, + // buttonBorderColorActive: "#3333ff", + // statusOnline: "#3abf7e", + // statusIdle: "#f39f00", + // statusBusy: "#f84848", + // statusStreaming: "#977eff", + // statusOffline: "#a5a5a5", + // statusInvisible: "#a5a5a5", + // pingColor: "#f84848", + // pingColorForeground: "#ffffff" + // }, + // "AMOLED": { + // backgroundPrimary: '#000000', + // backgroundSecondary: '#000000', + // blockQuoteBackground: '#111111', + // textPrimary: '#dddddd', + // textSecondary: '#888888', + // accentColor: '#1ad4b2', + // accentColorForeground: '#000000', + // contentType: 'light', + // buttonBorderColor: "#ffffff99", + // buttonBorderWidth: 1, + // messageBoxBorderColor: "#ffffff99", + // messageBoxBorderWidth: 1, + // generalBorderColor: "#ffffff22", + // generalBorderWidth: 1, + // buttonBorderColorActive: "#3333ff", + // statusOnline: "#3abf7e", + // statusIdle: "#f39f00", + // statusBusy: "#f84848", + // statusStreaming: "#977eff", + // statusOffline: "#a5a5a5", + // statusInvisible: "#a5a5a5", + // pingColor: "#f84848", + // pingColorForeground: "#ffffff" + // } } export var currentTheme = themes["Dark"] export var currentThemeName = "Dark" @@ -148,7 +154,7 @@ function refreshStyles() { backgroundColor: currentTheme.backgroundSecondary }, textDefault: { - color: currentTheme.textPrimary + color: currentTheme.foregroundPrimary }, message: { width: "100%", @@ -202,60 +208,54 @@ function refreshStyles() { height: 48 }, serverList: { - width: 56, - flexShrink: 1 + width: 60, + flexShrink: 1, + backgroundColor: currentTheme.background, + paddingTop: 4, + paddingBottom: 4, }, channelList: { flexGrow: 1000, flex: 1000 }, channelButton: { - padding: 10 - currentTheme.generalBorderWidth, - paddingTop: 12 - currentTheme.generalBorderWidth, - paddingBottom: 12 - currentTheme.generalBorderWidth, marginLeft: 8, marginRight: 8, borderRadius: 8, flexDirection: 'row', alignItems: 'center', - borderWidth: currentTheme.buttonBorderWidth, - borderColor: currentTheme.buttonBorderColor }, button: { - padding: 10 - currentTheme.generalBorderWidth, - paddingLeft: 16 - currentTheme.generalBorderWidth, - paddingRight: 16 - currentTheme.generalBorderWidth, + padding: 10, + paddingLeft: 16, + paddingRight: 16, borderRadius: 8, - backgroundColor: currentTheme.backgroundSecondary, + backgroundColor: currentTheme.headerSecondary, margin: 5, justifyContent: 'center', alignItems: 'center', - flexDirection: 'row', - borderWidth: currentTheme.buttonBorderWidth, - borderColor: currentTheme.buttonBorderColor + flexDirection: 'row' }, buttonSecondary: { - padding: 10 - currentTheme.generalBorderWidth, - paddingLeft: 16 - currentTheme.generalBorderWidth, - paddingRight: 16 - currentTheme.generalBorderWidth, + padding: 10, + paddingLeft: 16, + paddingRight: 16, borderRadius: 8, backgroundColor: currentTheme.backgroundPrimary, margin: 5, justifyContent: 'center', alignItems: 'center', - flexDirection: 'row', - borderWidth: currentTheme.buttonBorderWidth, - borderColor: currentTheme.buttonBorderColor + flexDirection: 'row' }, channelButtonSelected: { - backgroundColor: currentTheme.backgroundPrimary + backgroundColor: currentTheme.hover }, iconContainer: { alignItems: 'center', justifyContent: 'center', - width: 20, - height: 20, - marginRight: 5 + width: 30, + height: 30, + marginRight: 8 }, messagesView: { padding: 10, @@ -269,10 +269,8 @@ function refreshStyles() { paddingRight: 8 }, messageBoxOuter: { - backgroundColor: currentTheme.backgroundSecondary, - overflow: "hidden", - borderColor: currentTheme.messageBoxBorderColor, - borderWidth: currentTheme.messageBoxBorderWidth + backgroundColor: currentTheme.messageBox, + overflow: "hidden" }, sendButton: { margin: 3, @@ -286,14 +284,14 @@ function refreshStyles() { alignItems: 'center' }, messageBox: { - color: currentTheme.textPrimary, + color: currentTheme.foregroundPrimary, paddingLeft: 10, padding: 6, flex: 1 }, channelHeader: { height: 50, - backgroundColor: currentTheme.backgroundSecondary, + backgroundColor: currentTheme.headerPrimary, alignItems: 'center', paddingLeft: 20, flexDirection: 'row' @@ -324,7 +322,7 @@ function refreshStyles() { }, timestamp: { fontSize: 12, - color: currentTheme.textSecondary, + color: currentTheme.foregroundTertiary, position: 'relative', top: 2, left: 2