Skip to content

Commit

Permalink
WIP update everything and support kappacore based cabal-core
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaiwarner committed Dec 22, 2018
1 parent cdc0edb commit 791cf14
Show file tree
Hide file tree
Showing 24 changed files with 731,016 additions and 945 deletions.
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 = "chat.cabal.mobile",
package = "com.cabalmobile",
)

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

Expand Down
6 changes: 6 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ android {
versionCode 1
versionName "1.0"

aaptOptions {
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}

externalNativeBuild {
cmake {
version "3.7.1"
Expand Down Expand Up @@ -155,6 +159,8 @@ android {
}

dependencies {
implementation project(':react-native-gesture-handler')
implementation project(':nodejs-mobile-react-native')
implementation project(':nodejs-mobile-react-native')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:28.0.0"
Expand Down
2 changes: 1 addition & 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="chat.cabal.mobile">
package="com.cabalmobile">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
Expand Down
15 changes: 14 additions & 1 deletion android/app/src/main/java/com/cabalmobile/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package chat.cabal.mobile;
package com.cabalmobile;

import com.facebook.react.ReactActivity;
// import com.facebook.react.ReactActivityDelegate;
// import com.facebook.react.ReactRootView;
// import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;

public class MainActivity extends ReactActivity {

Expand All @@ -12,4 +15,14 @@ public class MainActivity extends ReactActivity {
protected String getMainComponentName() {
return "cabalmobile";
}

// @Override
// protected ReactActivityDelegate createReactActivityDelegate() {
// return new ReactActivityDelegate(this, getMainComponentName()) {
// @Override
// protected ReactRootView createRootView() {
// return new RNGestureHandlerEnabledRootView(MainActivity.this);
// }
// };
// }
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package chat.cabal.mobile;
package com.cabalmobile;

import android.app.Application;

Expand Down
4 changes: 4 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
rootProject.name = 'cabalmobile'
include ':react-native-gesture-handler'
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
include ':nodejs-mobile-react-native'
project(':nodejs-mobile-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/nodejs-mobile-react-native/android')
include ':nodejs-mobile-react-native'
project(':nodejs-mobile-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/nodejs-mobile-react-native/android')

Expand Down
4 changes: 2 additions & 2 deletions frontend/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createSwitchNavigator, createStackNavigator} from 'react-navigation'
import { createSwitchNavigator, createStackNavigator } from 'react-navigation'
import ChannelsList from './screens/ChannelsList'
import ChatScreen from './screens/ChatScreen'
import HomeScreen from './screens/HomeScreen'
Expand Down Expand Up @@ -50,7 +50,7 @@ export default createSwitchNavigator(
},
transitionConfig: () => ({
screenInterpolator: props => ({
transform: [{translateX: 0}, {translateY: 0}]
transform: [{ translateX: 0 }, { translateY: 0 }]
})
})
}
Expand Down
8 changes: 4 additions & 4 deletions frontend/components/Avatar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import {View, StyleSheet} from 'react-native'
import { View, StyleSheet } from 'react-native'
import Blockies from 'blockies-bmp/react-native-component'
global.Buffer = require('buffer').Buffer // Import Buffer globally for the Blockies component

Expand All @@ -17,12 +17,12 @@ const styles = StyleSheet.create({

export default class Avatar extends React.Component {
render () {
const {isHidden, message} = this.props
const hiddenStyle = isHidden ? {height: 0} : null
const { isHidden, message } = this.props
const hiddenStyle = isHidden ? { opacity: 0 } : null
return (
<View style={[styles.avatar, hiddenStyle]}>
<Blockies
opts={{seed: message.author}}
opts={{ seed: message.user.name }}
size={40}
style={styles.avatarImage}
bgColor='#fff'
Expand Down
14 changes: 7 additions & 7 deletions frontend/components/Bubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
View,
Platform
} from 'react-native'
import {MessageText, MessageImage, Time, utils} from 'react-native-gifted-chat'
import { MessageText, MessageImage, Time, utils } from 'react-native-gifted-chat'

const {isSameUser, isSameDay} = utils
const { isSameUser, isSameDay } = utils

export default class Bubble extends React.Component {
constructor (props) {
Expand All @@ -27,7 +27,7 @@ export default class Bubble extends React.Component {
this.context
.actionSheet()
.showActionSheetWithOptions(
{options, cancelButtonIndex},
{ options, cancelButtonIndex },
buttonIndex => {
if (buttonIndex === 0) {
Clipboard.setString(this.props.currentMessage.text)
Expand Down Expand Up @@ -67,7 +67,7 @@ export default class Bubble extends React.Component {

renderMessageImage () {
if (this.props.currentMessage.image) {
const {containerStyle, wrapperStyle, ...messageImageProps} = this.props
const { containerStyle, wrapperStyle, ...messageImageProps } = this.props
if (this.props.renderMessageImage) {
return this.props.renderMessageImage(messageImageProps)
}
Expand All @@ -84,7 +84,7 @@ export default class Bubble extends React.Component {
renderUsername () {
const username = this.props.currentMessage.user.name
if (username) {
const {containerStyle, wrapperStyle, ...usernameProps} = this.props
const { containerStyle, wrapperStyle, ...usernameProps } = this.props
if (this.props.renderUsername) {
return this.props.renderUsername(usernameProps)
}
Expand All @@ -106,14 +106,14 @@ export default class Bubble extends React.Component {

renderTime () {
if (this.props.currentMessage.createdAt) {
const {containerStyle, wrapperStyle, ...timeProps} = this.props
const { containerStyle, wrapperStyle, ...timeProps } = this.props
if (this.props.renderTime) {
return this.props.renderTime(timeProps)
}
return (
<Time
{...timeProps}
containerStyle={{left: [styles.timeContainer]}}
containerStyle={{ left: [styles.timeContainer] }}
textStyle={{
left: [
styles.standardFont,
Expand Down
18 changes: 7 additions & 11 deletions frontend/components/Message.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react'
import {View, StyleSheet} from 'react-native'
import {Day, utils} from 'react-native-gifted-chat'
import { View, StyleSheet } from 'react-native'
import { Day, utils } from 'react-native-gifted-chat'
import Bubble from './Bubble'
import Avatar from './Avatar'

const {isSameUser, isSameDay} = utils
const { isSameUser, isSameDay } = utils

export default class Message extends React.Component {
getInnerComponentProps () {
const {containerStyle, ...props} = this.props
const { containerStyle, ...props } = this.props
return {
...props,
position: 'left',
Expand All @@ -31,7 +31,7 @@ export default class Message extends React.Component {
}

renderAvatar () {
const {currentMessage, previousMessage} = this.props
const { currentMessage, previousMessage } = this.props
const isHidden =
isSameUser(currentMessage, previousMessage) &&
isSameDay(currentMessage, previousMessage)
Expand All @@ -43,16 +43,12 @@ export default class Message extends React.Component {
const marginBottom = isSameUser(
this.props.currentMessage,
this.props.nextMessage
)
? 2
: 10
) ? 2 : 10

return (
<View>
{this.renderDay()}
<View
style={[styles.container, {marginBottom}, this.props.containerStyle]}
>
<View style={[styles.container, { marginBottom }, this.props.containerStyle]}>
{this.renderAvatar()}
{this.renderBubble()}
</View>
Expand Down
Loading

0 comments on commit 791cf14

Please sign in to comment.