Skip to content

Commit

Permalink
WIP: Upgrading a few things
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaiwarner committed Dec 22, 2018
1 parent 42a9c09 commit b4eedcc
Show file tree
Hide file tree
Showing 29 changed files with 9,523 additions and 6,011 deletions.
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

36 changes: 36 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Built application files
*.apk
*.ap_

# Files for the Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# Intellij
*.iml
4 changes: 2 additions & 2 deletions android/app/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ android_library(

android_build_config(
name = "build_config",
package = "com.cabalmobile",
package = "chat.cabal.mobile",
)

android_resource(
name = "res",
package = "com.cabalmobile",
package = "chat.cabal.mobile",
res = "src/main/res",
)

Expand Down
25 changes: 16 additions & 9 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,22 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
compileSdkVersion 28
buildToolsVersion '28.0.3'

defaultConfig {
applicationId "com.cabalmobile"
minSdkVersion 16
targetSdkVersion 22
applicationId "chat.cabal.mobile"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"

externalNativeBuild {
cmake {
version "3.7.1"
}
}

ndk {
abiFilters "armeabi-v7a", "x86"
}
Expand Down Expand Up @@ -148,10 +155,10 @@ android {
}

dependencies {
compile project(':nodejs-mobile-react-native')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
implementation project(':nodejs-mobile-react-native')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.facebook.react:react-native:+" // From node_modules
}

// Run this once to be able to run the application with BUCK
Expand Down
3 changes: 2 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cabalmobile">
package="chat.cabal.mobile">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
Expand All @@ -9,6 +9,7 @@
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:usesCleartextTraffic="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
Expand Down
516 changes: 516 additions & 0 deletions android/app/src/main/assets/index.android.bundle

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.cabalmobile;
package chat.cabal.mobile;

import com.facebook.react.ReactActivity;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.cabalmobile;
package chat.cabal.mobile;

import android.app.Application;

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.android.tools.build:gradle:3.2.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -20,5 +25,9 @@ allprojects {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
3 changes: 2 additions & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Tue Nov 13 17:25:06 EST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
6 changes: 6 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = function (api) {
api.cache(true)
return {
'presets': ['module:metro-react-native-babel-preset']
}
}
24 changes: 18 additions & 6 deletions frontend/components/Avatar.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
import React from 'react'
import {View, StyleSheet} from 'react-native'
import strToColor from 'string-to-color'
import Blockies from 'blockies-bmp/react-native-component'
global.Buffer = require('buffer').Buffer // Import Buffer globally for the Blockies component

const styles = StyleSheet.create({
avatar: {
height: 20,
width: 20,
height: 40,
width: 40,
borderRadius: 3,
marginRight: 6
marginRight: 8
},
avatarImage: {
borderRadius: 3
}
})

export default class Avatar extends React.Component {
render () {
const {isHidden, message} = this.props
const hiddenStyle = isHidden ? {height: 0} : null
const colorStyle = {backgroundColor: strToColor(message.author)}
return <View style={[styles.avatar, hiddenStyle, colorStyle]} />
return (
<View style={[styles.avatar, hiddenStyle]}>
<Blockies
opts={{seed: message.author}}
size={40}
style={styles.avatarImage}
bgColor='#fff'
/>
</View>
)
}
}
6 changes: 4 additions & 2 deletions frontend/components/Bubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,13 @@ const styles = StyleSheet.create({
justifyContent: 'flex-end'
},
username: {
fontWeight: 'bold'
fontWeight: 'bold',
color: '#000'
},
time: {
textAlign: 'left',
fontSize: 12
fontSize: 14,
color: '#111'
},
timeContainer: {
marginLeft: 0,
Expand Down
22 changes: 14 additions & 8 deletions frontend/screens/ChatScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,18 @@ export default class ChatScreen extends React.Component {

includeMany (msgs) {
msgs.forEach(msg => {
if (msg.type === 'system') msg.system = true
if (msg.type !== 'chat/text' && msg.type !== 'system') { msg.text = JSON.stringify(msg) }
if (msg.author) msg.user = {_id: msg.authorId, name: msg.author}
if (!msg.createdAt) msg.createdAt = new Date()
if (msg.type === 'system') msg.system = true;
if (msg.type !== 'chat/text' && msg.type !== 'system')
msg.text = JSON.stringify(msg);
if (msg.author) msg.user = {_id: msg.authorId, name: msg.author};
if (!msg.createdAt) msg.createdAt = new Date();
});
console.log({msgs})
msgs.reverse();
// Remove duplicate messages
msgs = msgs.filter((msg, index) => {
return msgs.map(mapObj => mapObj._id).indexOf(msg._id) === index;
})
msgs.reverse()
this.setState(prev => ({
nick: prev.nick,
channel: prev.channel,
Expand Down Expand Up @@ -103,6 +109,6 @@ const styles = StyleSheet.create({
root: {
flex: 1,
alignItems: 'stretch',
backgroundColor: '#f5f5f5'
}
})
backgroundColor: '#fff',
},
});
2 changes: 1 addition & 1 deletion ios/cabalmobile/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>cabalmobile</string>
<string>Cabal</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand Down
2 changes: 1 addition & 1 deletion nodejs-assets/nodejs-project/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function sendChannels (err, channels) {
function sendMessages (err, msgs) {
if (err) return console.error(err)
const payload = msgs.filter(msg => msg.length > 0).map(msg => ({
_id: `${msg[0].feed}.${msg[0].seq}`,
_id: `${msg[0].feed}.${msg[0].seq}.${msg[0].value.time}`,
author: msg[0].value.author,
authorId: msg[0].feed,
type: msg[0].value.type,
Expand Down
Loading

0 comments on commit b4eedcc

Please sign in to comment.