Commit 302df46d authored by Guilherme Gazzo's avatar Guilherme Gazzo Committed by GitHub

Sync develop on master (#275)

* Create LICENSE
parent 2c738571
{
"presets": ["react-native"],
"plugins": ["transform-decorators-legacy"]
"plugins": ["transform-decorators-legacy"],
"env": {
"production": {
"plugins": ["transform-remove-console"]
}
}
}
#!/bin/bash
git log --format="%cd" -n 14 --date=short | sort -u -r | while read DATE ; do
echo $DATE
GIT_PAGER=cat git log --no-merges --format="- %s" --since="$DATE 00:00:00" --until="$DATE 24:00:00"
echo
done
defaults: &defaults
working_directory: ~/repo
version: 2
jobs:
lint-testunit:
<<: *defaults
docker:
- image: circleci/node:8
environment:
CODECOV_TOKEN: caa771ab-3d45-4756-8e2a-e1f25996fef6
steps:
- checkout
- run:
name: Install NPM modules
command: |
npm install
# npm install codecov
- run:
name: Lint
command: |
npm run lint
- run:
name: Test
command: |
npm test
- run:
name: Codecov
command: |
npx codecov
android-build:
<<: *defaults
docker:
- image: circleci/android:api-26-alpha
environment:
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx4096m -XX:+HeapDumpOnOutOfMemoryError"
JVM_OPTS: -Xmx4096m
TERM: dumb
BASH_ENV: "~/.nvm/nvm.sh"
steps:
- checkout
- run:
name: Install Node 8
command: |
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
source ~/.nvm/nvm.sh
nvm install 8
- restore_cache:
key: node-modules-{{ checksum ".circleci/config.yml" }}-{{ checksum "package.json" }}
- run:
name: Install NPM modules
command: |
npm install
- restore_cache:
key: android-{{ checksum ".circleci/config.yml" }}-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}
- run:
name: Configure Gradle
command: |
cd android
echo -e "" > ./gradle.properties
if [[ $KEYSTORE ]]; then
echo $KEYSTORE_BASE64 | base64 --decode > ./app/$KEYSTORE
echo -e "KEYSTORE=$KEYSTORE" >> ./gradle.properties
echo -e "KEYSTORE_PASSWORD=$KEYSTORE_PASSWORD" >> ./gradle.properties
echo -e "KEY_ALIAS=$KEY_ALIAS" >> ./gradle.properties
echo -e "KEY_PASSWORD=$KEYSTORE_PASSWORD" >> ./gradle.properties
fi
echo -e "VERSIONCODE=$CIRCLE_BUILD_NUM" >> ./gradle.properties
echo -e "" > ./app/fabric.properties
echo -e "apiKey=$FABRIC_KEY" >> ./app/fabric.properties
echo -e "apiSecret=$FABRIC_SECRET" >> ./app/fabric.properties
- run:
name: Install Android Depedencies
command: |
cd android
./gradlew androidDependencies
- run:
name: Build Android App
command: |
cd android
if [[ $KEYSTORE ]]; then
./gradlew assembleRelease
else
./gradlew assembleDebug
fi
mkdir -p /tmp/build
mv app/build/outputs /tmp/build/
- store_artifacts:
path: /tmp/build/outputs
- save_cache:
key: node-modules-{{ checksum ".circleci/config.yml" }}-{{ checksum "package.json" }}
paths:
- ./node_modules
- save_cache:
key: android-{{ checksum ".circleci/config.yml" }}-{{ checksum "android/build.gradle" }}-{{ checksum "android/app/build.gradle" }}
paths:
- ~/.gradle
ios-build:
macos:
xcode: "9.0"
environment:
BASH_ENV: "~/.nvm/nvm.sh"
steps:
- checkout
- run:
name: Install Node 8
command: |
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
source ~/.nvm/nvm.sh
# https://github.com/creationix/nvm/issues/1394
set +e
nvm install 8
- run:
name: Update Fastlane
command: |
brew update
brew install ruby
sudo gem install fastlane
- run:
name: Install NPM modules
command: |
rm -rf node_modules
# npm install --save react-native@0.51
npm install
# npm install react-native
- run:
name: Fix known build error
command: |
# Fix error https://github.com/facebook/react-native/issues/14382
cd node_modules/react-native/scripts/
curl https://raw.githubusercontent.com/facebook/react-native/5c53f89dd86160301feee024bce4ce0c89e8c187/scripts/ios-configure-glog.sh > ios-configure-glog.sh
chmod +x ios-configure-glog.sh
- run:
name: Fastlane Build
no_output_timeout: 1200
command: |
cd ios
agvtool new-version -all $CIRCLE_BUILD_NUM
/usr/libexec/PlistBuddy -c "Set Fabric:APIKey $FABRIC_KEY" ./RocketChatRN/Info.plist
echo -e "./Fabric.framework/run $FABRIC_KEY $FABRIC_SECRET" > ./RocketChatRN/Fabric.sh
if [[ $MATCH_KEYCHAIN_NAME ]]; then
fastlane ios release
else
export MATCH_KEYCHAIN_NAME="temp"
export MATCH_KEYCHAIN_PASSWORD="temp"
fastlane ios build
fi
- store_artifacts:
path: ios/RocketChatRN.ipa
- persist_to_workspace:
root: .
paths:
- ios/*.ipa
- ios/fastlane/report.xml
ios-testflight:
macos:
xcode: "9.0"
steps:
- checkout
- attach_workspace:
at: ios
- run:
name: Update Fastlane
command: |
brew update
brew install ruby
sudo gem install fastlane
- run:
name: Fastlane Tesflight Upload
command: |
cd ios
fastlane pilot upload --ipa ios/RocketChatRN.ipa --changelog "$(sh ../.circleci/changelog.sh)"
workflows:
version: 2
build-and-test:
jobs:
- lint-testunit
- ios-build:
requires:
- lint-testunit
- ios-testflight:
requires:
- ios-build
filters:
branches:
only:
- develop
- master
# - ios-testflight:
# requires:
# - ios-hold-testflight
- android-build:
requires:
- lint-testunit
{
module.exports = {
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".ios.js", ".android.js"]
}
}
},
"parser": "babel-eslint",
"extends": "airbnb",
"parserOptions": {
......@@ -30,6 +37,7 @@
"react/no-unused-prop-types": [2, {
"skipShapeProps": true
}],
"react/no-did-mount-set-state": 0,
"react/no-multi-comp": [0],
"react/jsx-indent": [2, "tab"],
"react/jsx-indent-props": [2, "tab"],
......@@ -37,6 +45,7 @@
"jsx-quotes": [2, "prefer-single"],
"jsx-a11y/href-no-hash": 0,
"import/prefer-default-export": 0,
"camelcase": 0,
"no-underscore-dangle": 0,
"no-return-assign": 0,
"no-param-reassign": 0,
......@@ -115,9 +124,10 @@
"prefer-const": 2,
"object-shorthand": 2,
"consistent-return": 0,
"global-require": "off"
"global-require": "off",
"react/prop-types": [0, { skipUndeclared: true }]
},
"globals": {
"__DEV__": true
}
}
};
Before writing an issue, please make sure you're talking about the native application and not the Cordova one. If you are looking to open an issue to the Cordova application, go to this URL: https://github.com/RocketChat/Rocket.Chat.Cordova.
- Your Rocket.Chat.Android app version: ####
<!-- Make sure you are running the latest version (which can be found on the hostname screen or by opening the side menu and then clicking on the chevron alongside username -->
- Your Rocket.Chat.iOS app version: ####
<!-- Make sure you are running the latest version (which can be found on the hostname screen or by opening the side menu and then clicking on the chevron alongside username -->
- Your Rocket.Chat server version: ####
- Device model (or emulator) you're running with: ####
<!-- e.g. For android : Nexus 7 - Android 6.0.1 -->
<!-- e.g. For iOS : iPhone 6 - iOS 11.2
- Steps to reproduce:
<!-- Stack traces may help too. -->
**The app isn't connecting to your server?**
Make sure your server supports WebSocket. These are the minimum requirements for Apache 2.4 and Nginx 1.3 or greater.
<!-- INSTRUCTION: Keep the line below to notify all core developers about this new PR -->
@RocketChat/ReactNative
<!-- INSTRUCTION: Inform the issue number that this PR closes, or remove the line below -->
Closes #ISSUE_NUMBER
<!-- INSTRUCTION: Tell us more about your PR with screen shots if you can -->
......@@ -28,6 +28,7 @@ build/
.idea
.gradle
local.properties
fabric.properties
*.iml
# node.js
......@@ -55,3 +56,5 @@ fastlane/Preview.html
fastlane/screenshots
coverage
.vscode/
# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities.
version: v1.7.1
ignore: {}
# patches apply the minimum changes required to fix a vulnerability
patch:
'npm:debug:20170905':
- react-native > connect > debug:
patched: '2017-09-29T23:29:20.238Z'
- react-native > connect > express-session > debug:
patched: '2017-09-29T23:29:20.238Z'
- react-native > connect > finalhandler > debug:
patched: '2017-09-29T23:29:20.238Z'
- react-native > connect > morgan > debug:
patched: '2017-09-29T23:29:20.238Z'
- react-native > connect > serve-index > debug:
patched: '2017-09-29T23:29:20.238Z'
- react-native > connect > body-parser > debug:
patched: '2017-09-29T23:29:20.238Z'
- react-native > connect > compression > debug:
patched: '2017-09-29T23:29:20.238Z'
- react-native > connect > connect-timeout > debug:
patched: '2017-09-29T23:29:20.238Z'
- react-native > connect > serve-static > send > debug:
patched: '2017-09-29T23:29:20.238Z'
- realm > extract-zip > debug:
patched: '2017-09-29T23:29:20.238Z'
The MIT License (MIT)
Copyright (c) 2015-2018 Rocket.Chat Technologies Corp.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# Rocket.Chat React Native Mobile
[![Greenkeeper badge](https://badges.greenkeeper.io/RocketChat/Rocket.Chat.ReactNative.svg)](https://greenkeeper.io/)
[![Build Status](https://img.shields.io/travis/RocketChat/Rocket.Chat.ReactNative/master.svg)](https://travis-ci.org/RocketChat/Rocket.Chat.ReactNative)
[![Project Dependencies](https://david-dm.org/RocketChat/Rocket.Chat.ReactNative.svg)](https://david-dm.org/RocketChat/Rocket.Chat.ReactNative)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/bb15e2392a71473ea59d3f634f35c54e)](https://www.codacy.com/app/RocketChat/Rocket.Chat.ReactNative?utm_source=github.com&utm_medium=referral&utm_content=RocketChat/Rocket.Chat.ReactNative&utm_campaign=badger)
......@@ -10,74 +12,32 @@
**Supported Server Versions:** 0.58.0+ (We are working to support earlier versions)
# Installing Dependencies
# Installing dependencies
Follow the [React Native Getting Started Guide](https://facebook.github.io/react-native/docs/getting-started.html) for detailed instructions on setting up your local machine for development.
# Detailed configuration:
## Mac
- General requirements
- XCode 8.3
- Install required packages using homebrew:
```bash
$ brew install watchman
$ brew install yarn
```
- Clone repository and configure:
# How to run
- Clone repository and install dependencies:
```bash
$ git clone git@github.com:RocketChat/Rocket.Chat.ReactNative.git
$ cd Rocket.Chat.ReactNative
$ npm install
$ npm install -g react-native-cli
$ yarn
```
- Configuration
```bash
$ yarn fabric-ios --key="YOUR_API_KEY" --secret="YOUR_API_SECRET"
$ yarn fabric-android --key="YOUR_API_KEY" --secret="YOUR_API_SECRET"
```
- Run application
```bash
$ react-native run-ios
```
```bash
$ react-native run-android
$ yarn ios
```
## Linux:
- General requiriments:
- JDK 7 or greater
- Android SDK
- Virtualbox
- An Android emulator: Genymotion or Android emulator. If using genymotion ensure that it uses existing adb tools (Settings: "Use custom Android SDK Tools")
- Install watchman (do this globally):
```bash
$ git clone https://github.com/facebook/watchman.git
$ cd watchman
$ git checkout master
$ ./autogen.sh
$ ./configure make
$ sudo make install
```
Configure your kernel to accept a lot of file watches, using a command like:
```bash
$ sudo sysctl -w fs.inotify.max_user_watches=1048576
```
- Clone repository and configure:
```bash
$ git clone git@github.com:RocketChat/Rocket.Chat.ReactNative.git
$ cd Rocket.Chat.ReactNative
$ npm install
$ npm install -g react-native-cli
$ yarn android
```
- Run application
- Start emulator
- Start react packager: `$ react-native start`
- Run in emulator: `$ react-native run-android`
# Storybook
- General requirements
- Install storybook
......
import 'react-native';
import {View} from 'react-native';
import { Provider } from 'react-redux';
import { createStore, combineReducers } from 'redux';
const reducers = combineReducers({login:() => ({user: {}}), settings:() => ({})});
const store = createStore(reducers);
import React from 'react';
import RoomItem from '../app/components/RoomItem';
import RoomItem from '../app/presentation/RoomItem';
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';
const date = new Date(2017, 10, 10, 10);
jest.mock('react-native-img-cache', () => { return { CachedImage: 'View' } });
it('renders correctly', () => {
expect(renderer.create(<RoomItem type="d" name="name" />).toJSON()).toMatchSnapshot();
expect(renderer.create(<Provider store={store}><View><RoomItem type="d" _updatedAt={date} name="name" /></View></Provider>).toJSON()).toMatchSnapshot();
});
it('render unread', () => {
expect(renderer.create(<RoomItem type="d" name="name" unread={1} />).toJSON()).toMatchSnapshot();
expect(renderer.create(<Provider store={store}><View><RoomItem type="d" _updatedAt={date} name="name" unread={1} /></View></Provider>).toJSON()).toMatchSnapshot();
});
it('render unread +999', () => {
expect(renderer.create(<RoomItem type="d" name="name" unread={1000} />).toJSON()).toMatchSnapshot();
expect(renderer.create(<Provider store={store}><View><RoomItem type="d" _updatedAt={date} name="name" unread={1000} /></View></Provider>).toJSON()).toMatchSnapshot();
});
it('render no icon', () => {
expect(renderer.create(<RoomItem type="X" name="name" />).toJSON()).toMatchSnapshot();
expect(renderer.create(<Provider store={store}><View><RoomItem type="X" _updatedAt={date} name="name" /></View></Provider>).toJSON()).toMatchSnapshot();
});
it('render private group', () => {
expect(renderer.create(<RoomItem type="g" name="private-group" /> ).toJSON()).toMatchSnapshot();
expect(renderer.create(<Provider store={store}><View><RoomItem type="g" _updatedAt={date} name="private-group" /> </View></Provider>).toJSON()).toMatchSnapshot();
});
it('render channel', () => {
expect(renderer.create(<RoomItem type="c" name="general" />).toJSON()).toMatchSnapshot();
expect(renderer.create(<Provider store={store}><View><RoomItem type="c" _updatedAt={date} name="general" /></View></Provider>).toJSON()).toMatchSnapshot();
});
This diff is collapsed.
......@@ -45,12 +45,12 @@ android_library(
android_build_config(
name = "build_config",
package = "com.rocketchatrn",
package = "chat.rocket.reactnative",
)
android_resource(
name = "res",
package = "com.rocketchatrn",
package = "chat.rocket.reactnative",
res = "src/main/res",
)
......
......@@ -94,22 +94,22 @@ android {
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.rocketchatrn"
applicationId "chat.rocket.reactnative"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
versionCode VERSIONCODE as Integer
versionName "1.1"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
signingConfigs {
release {
if (project.hasProperty('ROCKETCHAT_RN_RELEASE_STORE_FILE')) {
storeFile file(ROCKETCHAT_RN_RELEASE_STORE_FILE)
storePassword ROCKETCHAT_RN_RELEASE_STORE_PASSWORD
keyAlias ROCKETCHAT_RN_RELEASE_KEY_ALIAS
keyPassword ROCKETCHAT_RN_RELEASE_KEY_PASSWORD
if (project.hasProperty('KEYSTORE')) {
storeFile file(KEYSTORE)
storePassword KEYSTORE_PASSWORD
keyAlias KEY_ALIAS
keyPassword KEY_PASSWORD
}
}
}
......@@ -143,17 +143,50 @@ android {
}
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// These docs use an open ended version so that our plugin
// can be updated quickly in response to Android tooling updates
// We recommend changing it to the latest version from our changelog:
// https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile project(':react-native-navigation')
compile project(':react-native-fabric')
compile project(':react-native-audio')
compile project(":reactnativekeyboardinput")
compile project(':react-native-splash-screen')
compile project(':react-native-video')
compile project(':react-native-push-notification')
compile project(':react-native-svg')
compile project(':react-native-image-picker')
compile project(':react-native-vector-icons')
compile project(':react-native-fetch-blob')
compile project(':react-native-zeroconf')
compile project(':react-native-toast')
compile project(':realm')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"