Use inline requires (#459)
* Update dependencies * Lint and test * Added react-native fork * rn 57 * Lint and tests updated * Update xcode on circleci * Use legacy build system * Update tests * Inline requires * Fix eslint and remove temp gradle * Unnecessary renders * Update isNotch and Readme * Tests updated
This commit is contained in:
parent
81c53acd60
commit
e18491f589
|
@ -2,3 +2,5 @@ __tests__
|
||||||
node_modules
|
node_modules
|
||||||
coverage
|
coverage
|
||||||
e2e
|
e2e
|
||||||
|
android
|
||||||
|
ios
|
|
@ -169,7 +169,7 @@ Readme will guide you on how to config.
|
||||||
| Channel Info screen -> Members | ✅ |
|
| Channel Info screen -> Members | ✅ |
|
||||||
| Channel Info screen -> Pinned | ✅ |
|
| Channel Info screen -> Pinned | ✅ |
|
||||||
| Channel Info screen -> Starred | ✅ |
|
| Channel Info screen -> Starred | ✅ |
|
||||||
| Channel Info screen -> Uploads | ❌ |
|
| Channel Info screen -> Uploads | ✅ |
|
||||||
| Star message | ✅ |
|
| Star message | ✅ |
|
||||||
| Unstar message | ✅ |
|
| Unstar message | ✅ |
|
||||||
| Channel Info screen -> Topic | ✅ |
|
| Channel Info screen -> Topic | ✅ |
|
||||||
|
@ -200,7 +200,7 @@ Readme will guide you on how to config.
|
||||||
| Deep links: Authentication | ✅ |
|
| Deep links: Authentication | ✅ |
|
||||||
| Deep links: Rooms | ✅ |
|
| Deep links: Rooms | ✅ |
|
||||||
| Draft per room | ❌ |
|
| Draft per room | ❌ |
|
||||||
| Localized in Portuguese (pt-BR) | ❌ |
|
| Localized in Portuguese (pt-BR) | ✅ |
|
||||||
| Localized in Russian | ✅ |
|
| Localized in Russian | ✅ |
|
||||||
| Localized in English | ✅ |
|
| Localized in English | ✅ |
|
||||||
| Full name setting | ✅ |
|
| Full name setting | ✅ |
|
||||||
|
|
|
@ -650,6 +650,9 @@ exports[`render unread +999 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -660,9 +663,6 @@ exports[`render unread +999 1`] = `
|
||||||
"width": 48,
|
"width": 48,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -912,6 +912,9 @@ exports[`render unread 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -922,9 +925,6 @@ exports[`render unread 1`] = `
|
||||||
"width": 48,
|
"width": 48,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -1174,6 +1174,9 @@ exports[`renders correctly 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -1184,9 +1187,6 @@ exports[`renders correctly 1`] = `
|
||||||
"width": 48,
|
"width": 48,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
|
@ -39,6 +39,9 @@ exports[`Storyshots Avatar avatar 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -49,9 +52,6 @@ exports[`Storyshots Avatar avatar 1`] = `
|
||||||
"width": 25,
|
"width": 25,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -111,6 +111,9 @@ exports[`Storyshots Avatar avatar 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -121,9 +124,6 @@ exports[`Storyshots Avatar avatar 1`] = `
|
||||||
"width": 40,
|
"width": 40,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -183,6 +183,9 @@ exports[`Storyshots Avatar avatar 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -193,9 +196,6 @@ exports[`Storyshots Avatar avatar 1`] = `
|
||||||
"width": 30,
|
"width": 30,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -255,6 +255,9 @@ exports[`Storyshots Avatar avatar 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -265,9 +268,6 @@ exports[`Storyshots Avatar avatar 1`] = `
|
||||||
"width": 25,
|
"width": 25,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -360,6 +360,9 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -370,9 +373,6 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
"width": 48,
|
"width": 48,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -591,6 +591,9 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -601,9 +604,6 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
"width": 48,
|
"width": 48,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -826,6 +826,9 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -836,9 +839,6 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
"width": 48,
|
"width": 48,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -1083,6 +1083,9 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -1093,9 +1096,6 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
"width": 48,
|
"width": 48,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -1344,6 +1344,9 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -1354,9 +1357,6 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
"width": 48,
|
"width": 48,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -1601,6 +1601,9 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -1611,9 +1614,6 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
"width": 48,
|
"width": 48,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -1858,6 +1858,9 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -1868,9 +1871,6 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
"width": 48,
|
"width": 48,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -2115,6 +2115,9 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -2125,9 +2128,6 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
"width": 48,
|
"width": 48,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -2372,6 +2372,9 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -2382,9 +2385,6 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
"width": 48,
|
"width": 48,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -2603,6 +2603,9 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -2613,9 +2616,6 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
"width": 48,
|
"width": 48,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
@ -2834,6 +2834,9 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
Array [
|
Array [
|
||||||
|
Object {
|
||||||
|
"overflow": "hidden",
|
||||||
|
},
|
||||||
Array [
|
Array [
|
||||||
Object {
|
Object {
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
|
@ -2844,9 +2847,6 @@ exports[`Storyshots Channel Cell Direct Messages 1`] = `
|
||||||
"width": 48,
|
"width": 48,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
Object {
|
|
||||||
"overflow": "hidden",
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|
|
@ -6,13 +6,10 @@ const prefix = isIOS ? 'ios' : 'md';
|
||||||
|
|
||||||
// icon name from provider: [ size of the uri, icon provider, name to be used later ]
|
// icon name from provider: [ size of the uri, icon provider, name to be used later ]
|
||||||
const icons = {
|
const icons = {
|
||||||
[`${ prefix }-search`]: [30, Ionicons, 'search'],
|
|
||||||
[`${ prefix }-menu`]: [30, Ionicons, 'menu'],
|
|
||||||
[`${ prefix }-star`]: [30, Ionicons, 'star'],
|
[`${ prefix }-star`]: [30, Ionicons, 'star'],
|
||||||
[`${ prefix }-star-outline`]: [30, Ionicons, 'starOutline'],
|
[`${ prefix }-star-outline`]: [30, Ionicons, 'starOutline'],
|
||||||
[isIOS ? 'ios-create' : 'md-create']: [30, Ionicons, 'create'],
|
|
||||||
[`${ prefix }-more`]: [30, Ionicons, 'more'],
|
[`${ prefix }-more`]: [30, Ionicons, 'more'],
|
||||||
[`${ prefix }-add`]: [30, Ionicons, 'add'],
|
[isIOS ? 'ios-create' : 'md-create']: [30, Ionicons, 'create'],
|
||||||
[`${ prefix }-close`]: [30, Ionicons, 'close']
|
[`${ prefix }-close`]: [30, Ionicons, 'close']
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,9 @@ async function loadMessagesForRoomRest({ rid: roomId, latest, t }) {
|
||||||
const { token, id } = this.ddp._login;
|
const { token, id } = this.ddp._login;
|
||||||
const server = this.ddp.url.replace('ws', 'http');
|
const server = this.ddp.url.replace('ws', 'http');
|
||||||
const data = await get({ token, id, server }, `${ types[t] }.history`, { roomId, latest });
|
const data = await get({ token, id, server }, `${ types[t] }.history`, { roomId, latest });
|
||||||
|
if (!data || data.status === 'error') {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
return data.messages;
|
return data.messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,9 @@ async function loadMissedMessagesRest({ rid: roomId, lastOpen: lastUpdate }) {
|
||||||
const server = this.ddp.url.replace('ws', 'http');
|
const server = this.ddp.url.replace('ws', 'http');
|
||||||
const { result } = await get({ token, id, server }, 'chat.syncMessages', { roomId, lastUpdate });
|
const { result } = await get({ token, id, server }, 'chat.syncMessages', { roomId, lastUpdate });
|
||||||
// TODO: api fix
|
// TODO: api fix
|
||||||
|
if (!result) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
return result.updated || result.messages;
|
return result.updated || result.messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { put, call, takeLatest } from 'redux-saga/effects';
|
import { put, call, takeLatest } from 'redux-saga/effects';
|
||||||
import { AsyncStorage } from 'react-native';
|
import { AsyncStorage } from 'react-native';
|
||||||
|
import { Navigation } from 'react-native-navigation';
|
||||||
|
import { Provider } from 'react-redux';
|
||||||
|
|
||||||
import { NavigationActions } from '../Navigation';
|
import { NavigationActions } from '../Navigation';
|
||||||
import { SERVER } from '../actions/actionsTypes';
|
import { SERVER } from '../actions/actionsTypes';
|
||||||
|
@ -10,6 +12,9 @@ import { setRoles } from '../actions/roles';
|
||||||
import RocketChat from '../lib/rocketchat';
|
import RocketChat from '../lib/rocketchat';
|
||||||
import database from '../lib/realm';
|
import database from '../lib/realm';
|
||||||
import log from '../utils/log';
|
import log from '../utils/log';
|
||||||
|
import store from '../lib/createStore';
|
||||||
|
|
||||||
|
let LoginSignupView = null;
|
||||||
|
|
||||||
const validate = function* validate(server) {
|
const validate = function* validate(server) {
|
||||||
return yield RocketChat.testServer(server);
|
return yield RocketChat.testServer(server);
|
||||||
|
@ -43,6 +48,11 @@ const handleSelectServer = function* handleSelectServer({ server }) {
|
||||||
|
|
||||||
const handleServerRequest = function* handleServerRequest({ server }) {
|
const handleServerRequest = function* handleServerRequest({ server }) {
|
||||||
try {
|
try {
|
||||||
|
if (LoginSignupView == null) {
|
||||||
|
LoginSignupView = require('../views/LoginSignupView').default;
|
||||||
|
Navigation.registerComponent('LoginSignupView', () => LoginSignupView, store, Provider);
|
||||||
|
}
|
||||||
|
|
||||||
yield call(validate, server);
|
yield call(validate, server);
|
||||||
yield call(NavigationActions.push, { screen: 'LoginSignupView', title: server, backButtonTitle: '' });
|
yield call(NavigationActions.push, { screen: 'LoginSignupView', title: server, backButtonTitle: '' });
|
||||||
database.databases.serversDB.write(() => {
|
database.databases.serversDB.write(() => {
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import DeviceInfo from 'react-native-device-info';
|
import DeviceInfo from 'react-native-device-info';
|
||||||
|
|
||||||
|
const NOTCH_DEVICES = ['iPhone X', 'iPhone XS', 'iPhone XS Max', 'iPhone XR'];
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
isNotch: () => DeviceInfo.getModel() === 'iPhone X',
|
isNotch: () => NOTCH_DEVICES.includes(DeviceInfo.getModel()),
|
||||||
getBrand: () => DeviceInfo.getBrand(),
|
getBrand: () => DeviceInfo.getBrand(),
|
||||||
getReadableVersion: () => DeviceInfo.getReadableVersion()
|
getReadableVersion: () => DeviceInfo.getReadableVersion()
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,8 @@ import PropTypes from 'prop-types';
|
||||||
import {
|
import {
|
||||||
Text, View, ScrollView, TouchableOpacity, LayoutAnimation, Image, StyleSheet, SafeAreaView
|
Text, View, ScrollView, TouchableOpacity, LayoutAnimation, Image, StyleSheet, SafeAreaView
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect, Provider } from 'react-redux';
|
||||||
|
import { Navigation } from 'react-native-navigation';
|
||||||
import Icon from 'react-native-vector-icons/FontAwesome';
|
import Icon from 'react-native-vector-icons/FontAwesome';
|
||||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import { Base64 } from 'js-base64';
|
import { Base64 } from 'js-base64';
|
||||||
|
@ -16,6 +17,7 @@ import random from '../utils/random';
|
||||||
import Button from '../containers/Button';
|
import Button from '../containers/Button';
|
||||||
import Loading from '../containers/Loading';
|
import Loading from '../containers/Loading';
|
||||||
import I18n from '../i18n';
|
import I18n from '../i18n';
|
||||||
|
import store from '../lib/createStore';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
|
@ -45,6 +47,10 @@ const styles = StyleSheet.create({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let OAuthView = null;
|
||||||
|
let LoginView = null;
|
||||||
|
let RegisterView = null;
|
||||||
|
|
||||||
@connect(state => ({
|
@connect(state => ({
|
||||||
server: state.server.server,
|
server: state.server.server,
|
||||||
isFetching: state.login.isFetching,
|
isFetching: state.login.isFetching,
|
||||||
|
@ -181,6 +187,11 @@ export default class LoginSignupView extends LoggedView {
|
||||||
}
|
}
|
||||||
|
|
||||||
openOAuth = (oAuthUrl) => {
|
openOAuth = (oAuthUrl) => {
|
||||||
|
if (OAuthView == null) {
|
||||||
|
OAuthView = require('./OAuthView').default;
|
||||||
|
Navigation.registerComponent('OAuthView', () => OAuthView, store, Provider);
|
||||||
|
}
|
||||||
|
|
||||||
const { navigator } = this.props;
|
const { navigator } = this.props;
|
||||||
navigator.showModal({
|
navigator.showModal({
|
||||||
screen: 'OAuthView',
|
screen: 'OAuthView',
|
||||||
|
@ -192,6 +203,11 @@ export default class LoginSignupView extends LoggedView {
|
||||||
}
|
}
|
||||||
|
|
||||||
login = () => {
|
login = () => {
|
||||||
|
if (LoginView == null) {
|
||||||
|
LoginView = require('./LoginView').default;
|
||||||
|
Navigation.registerComponent('LoginView', () => LoginView, store, Provider);
|
||||||
|
}
|
||||||
|
|
||||||
const { navigator, server } = this.props;
|
const { navigator, server } = this.props;
|
||||||
navigator.push({
|
navigator.push({
|
||||||
screen: 'LoginView',
|
screen: 'LoginView',
|
||||||
|
@ -201,6 +217,11 @@ export default class LoginSignupView extends LoggedView {
|
||||||
}
|
}
|
||||||
|
|
||||||
register = () => {
|
register = () => {
|
||||||
|
if (RegisterView == null) {
|
||||||
|
RegisterView = require('./RegisterView').default;
|
||||||
|
Navigation.registerComponent('RegisterView', () => RegisterView, store, Provider);
|
||||||
|
}
|
||||||
|
|
||||||
const { navigator, server } = this.props;
|
const { navigator, server } = this.props;
|
||||||
navigator.push({
|
navigator.push({
|
||||||
screen: 'RegisterView',
|
screen: 'RegisterView',
|
||||||
|
|
|
@ -3,7 +3,8 @@ import PropTypes from 'prop-types';
|
||||||
import {
|
import {
|
||||||
Keyboard, Text, ScrollView, View, SafeAreaView
|
Keyboard, Text, ScrollView, View, SafeAreaView
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect, Provider } from 'react-redux';
|
||||||
|
import { Navigation } from 'react-native-navigation';
|
||||||
import { Answers } from 'react-native-fabric';
|
import { Answers } from 'react-native-fabric';
|
||||||
|
|
||||||
import RocketChat from '../lib/rocketchat';
|
import RocketChat from '../lib/rocketchat';
|
||||||
|
@ -17,6 +18,10 @@ import { showToast } from '../utils/info';
|
||||||
import { COLOR_BUTTON_PRIMARY } from '../constants/colors';
|
import { COLOR_BUTTON_PRIMARY } from '../constants/colors';
|
||||||
import LoggedView from './View';
|
import LoggedView from './View';
|
||||||
import I18n from '../i18n';
|
import I18n from '../i18n';
|
||||||
|
import store from '../lib/createStore';
|
||||||
|
|
||||||
|
let RegisterView = null;
|
||||||
|
let ForgotPasswordView = null;
|
||||||
|
|
||||||
@connect(state => ({
|
@connect(state => ({
|
||||||
server: state.server.server,
|
server: state.server.server,
|
||||||
|
@ -69,6 +74,11 @@ export default class LoginView extends LoggedView {
|
||||||
}
|
}
|
||||||
|
|
||||||
register = () => {
|
register = () => {
|
||||||
|
if (RegisterView == null) {
|
||||||
|
RegisterView = require('./RegisterView').default;
|
||||||
|
Navigation.registerComponent('RegisterView', () => RegisterView, store, Provider);
|
||||||
|
}
|
||||||
|
|
||||||
const { navigator, server } = this.props;
|
const { navigator, server } = this.props;
|
||||||
navigator.push({
|
navigator.push({
|
||||||
screen: 'RegisterView',
|
screen: 'RegisterView',
|
||||||
|
@ -78,6 +88,11 @@ export default class LoginView extends LoggedView {
|
||||||
}
|
}
|
||||||
|
|
||||||
forgotPassword = () => {
|
forgotPassword = () => {
|
||||||
|
if (ForgotPasswordView == null) {
|
||||||
|
ForgotPasswordView = require('./ForgotPasswordView').default;
|
||||||
|
Navigation.registerComponent('ForgotPasswordView', () => ForgotPasswordView, store, Provider);
|
||||||
|
}
|
||||||
|
|
||||||
const { navigator } = this.props;
|
const { navigator } = this.props;
|
||||||
navigator.push({
|
navigator.push({
|
||||||
screen: 'ForgotPasswordView',
|
screen: 'ForgotPasswordView',
|
||||||
|
|
|
@ -3,7 +3,8 @@ import PropTypes from 'prop-types';
|
||||||
import {
|
import {
|
||||||
View, StyleSheet, SafeAreaView, FlatList, Text, Platform, Image
|
View, StyleSheet, SafeAreaView, FlatList, Text, Platform, Image
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect, Provider } from 'react-redux';
|
||||||
|
import { Navigation } from 'react-native-navigation';
|
||||||
|
|
||||||
import database from '../lib/realm';
|
import database from '../lib/realm';
|
||||||
import RocketChat from '../lib/rocketchat';
|
import RocketChat from '../lib/rocketchat';
|
||||||
|
@ -14,6 +15,7 @@ import sharedStyles from './Styles';
|
||||||
import I18n from '../i18n';
|
import I18n from '../i18n';
|
||||||
import Touch from '../utils/touch';
|
import Touch from '../utils/touch';
|
||||||
import SearchBox from '../containers/SearchBox';
|
import SearchBox from '../containers/SearchBox';
|
||||||
|
import store from '../lib/createStore';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
safeAreaView: {
|
safeAreaView: {
|
||||||
|
@ -43,6 +45,8 @@ const styles = StyleSheet.create({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let SelectedUsersView = null;
|
||||||
|
|
||||||
@connect(state => ({
|
@connect(state => ({
|
||||||
baseUrl: state.settings.Site_Url || state.server ? state.server.server : ''
|
baseUrl: state.settings.Site_Url || state.server ? state.server.server : ''
|
||||||
}))
|
}))
|
||||||
|
@ -110,6 +114,11 @@ export default class NewMessageView extends LoggedView {
|
||||||
}
|
}
|
||||||
|
|
||||||
createChannel = () => {
|
createChannel = () => {
|
||||||
|
if (SelectedUsersView == null) {
|
||||||
|
SelectedUsersView = require('./SelectedUsersView').default;
|
||||||
|
Navigation.registerComponent('SelectedUsersView', () => SelectedUsersView, store, Provider);
|
||||||
|
}
|
||||||
|
|
||||||
const { navigator } = this.props;
|
const { navigator } = this.props;
|
||||||
navigator.push({
|
navigator.push({
|
||||||
screen: 'SelectedUsersView',
|
screen: 'SelectedUsersView',
|
||||||
|
|
|
@ -4,7 +4,8 @@ import {
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import Icon from 'react-native-vector-icons/MaterialIcons';
|
import Icon from 'react-native-vector-icons/MaterialIcons';
|
||||||
import { connect } from 'react-redux';
|
import { connect, Provider } from 'react-redux';
|
||||||
|
import { Navigation } from 'react-native-navigation';
|
||||||
|
|
||||||
import { selectServerRequest, serverInitAdd, serverFinishAdd } from '../../actions/server';
|
import { selectServerRequest, serverInitAdd, serverFinishAdd } from '../../actions/server';
|
||||||
import I18n from '../../i18n';
|
import I18n from '../../i18n';
|
||||||
|
@ -13,6 +14,9 @@ import Button from './Button';
|
||||||
import styles from './styles';
|
import styles from './styles';
|
||||||
import LoggedView from '../View';
|
import LoggedView from '../View';
|
||||||
import DeviceInfo from '../../utils/deviceInfo';
|
import DeviceInfo from '../../utils/deviceInfo';
|
||||||
|
import store from '../../lib/createStore';
|
||||||
|
|
||||||
|
let NewServerView = null;
|
||||||
|
|
||||||
@connect(state => ({
|
@connect(state => ({
|
||||||
currentServer: state.server.server,
|
currentServer: state.server.server,
|
||||||
|
@ -63,6 +67,11 @@ export default class OnboardingView extends LoggedView {
|
||||||
}
|
}
|
||||||
|
|
||||||
connectServer = () => {
|
connectServer = () => {
|
||||||
|
if (NewServerView == null) {
|
||||||
|
NewServerView = require('../NewServerView').default;
|
||||||
|
Navigation.registerComponent('NewServerView', () => NewServerView, store, Provider);
|
||||||
|
}
|
||||||
|
|
||||||
const { navigator } = this.props;
|
const { navigator } = this.props;
|
||||||
navigator.push({
|
navigator.push({
|
||||||
screen: 'NewServerView',
|
screen: 'NewServerView',
|
||||||
|
@ -74,6 +83,11 @@ export default class OnboardingView extends LoggedView {
|
||||||
}
|
}
|
||||||
|
|
||||||
joinCommunity = () => {
|
joinCommunity = () => {
|
||||||
|
if (NewServerView == null) {
|
||||||
|
NewServerView = require('../NewServerView').default;
|
||||||
|
Navigation.registerComponent('NewServerView', () => NewServerView, store, Provider);
|
||||||
|
}
|
||||||
|
|
||||||
const { navigator } = this.props;
|
const { navigator } = this.props;
|
||||||
navigator.push({
|
navigator.push({
|
||||||
screen: 'NewServerView',
|
screen: 'NewServerView',
|
||||||
|
|
|
@ -3,7 +3,8 @@ import PropTypes from 'prop-types';
|
||||||
import {
|
import {
|
||||||
Keyboard, Text, View, ScrollView, SafeAreaView
|
Keyboard, Text, View, ScrollView, SafeAreaView
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect, Provider } from 'react-redux';
|
||||||
|
import { Navigation } from 'react-native-navigation';
|
||||||
|
|
||||||
import { registerSubmit as registerSubmitAction, setUsernameSubmit as setUsernameSubmitAction } from '../actions/login';
|
import { registerSubmit as registerSubmitAction, setUsernameSubmit as setUsernameSubmitAction } from '../actions/login';
|
||||||
import TextInput from '../containers/TextInput';
|
import TextInput from '../containers/TextInput';
|
||||||
|
@ -15,6 +16,10 @@ import { showToast } from '../utils/info';
|
||||||
import scrollPersistTaps from '../utils/scrollPersistTaps';
|
import scrollPersistTaps from '../utils/scrollPersistTaps';
|
||||||
import LoggedView from './View';
|
import LoggedView from './View';
|
||||||
import I18n from '../i18n';
|
import I18n from '../i18n';
|
||||||
|
import store from '../lib/createStore';
|
||||||
|
|
||||||
|
let TermsServiceView = null;
|
||||||
|
let PrivacyPolicyView = null;
|
||||||
|
|
||||||
@connect(state => ({
|
@connect(state => ({
|
||||||
server: state.server.server,
|
server: state.server.server,
|
||||||
|
@ -97,6 +102,11 @@ export default class RegisterView extends LoggedView {
|
||||||
}
|
}
|
||||||
|
|
||||||
termsService = () => {
|
termsService = () => {
|
||||||
|
if (TermsServiceView == null) {
|
||||||
|
TermsServiceView = require('./TermsServiceView').default;
|
||||||
|
Navigation.registerComponent('TermsServiceView', () => TermsServiceView, store, Provider);
|
||||||
|
}
|
||||||
|
|
||||||
const { navigator } = this.props;
|
const { navigator } = this.props;
|
||||||
navigator.push({
|
navigator.push({
|
||||||
screen: 'TermsServiceView',
|
screen: 'TermsServiceView',
|
||||||
|
@ -106,6 +116,11 @@ export default class RegisterView extends LoggedView {
|
||||||
}
|
}
|
||||||
|
|
||||||
privacyPolicy = () => {
|
privacyPolicy = () => {
|
||||||
|
if (PrivacyPolicyView == null) {
|
||||||
|
PrivacyPolicyView = require('./PrivacyPolicyView').default;
|
||||||
|
Navigation.registerComponent('PrivacyPolicyView', () => PrivacyPolicyView, store, Provider);
|
||||||
|
}
|
||||||
|
|
||||||
const { navigator } = this.props;
|
const { navigator } = this.props;
|
||||||
navigator.push({
|
navigator.push({
|
||||||
screen: 'PrivacyPolicyView',
|
screen: 'PrivacyPolicyView',
|
||||||
|
|
|
@ -5,7 +5,8 @@ import {
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import Icon from 'react-native-vector-icons/Ionicons';
|
import Icon from 'react-native-vector-icons/Ionicons';
|
||||||
import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
|
import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
|
||||||
import { connect } from 'react-redux';
|
import { connect, Provider } from 'react-redux';
|
||||||
|
import { Navigation } from 'react-native-navigation';
|
||||||
|
|
||||||
import { leaveRoom as leaveRoomAction } from '../../actions/room';
|
import { leaveRoom as leaveRoomAction } from '../../actions/room';
|
||||||
import LoggedView from '../View';
|
import LoggedView from '../View';
|
||||||
|
@ -20,9 +21,12 @@ import log from '../../utils/log';
|
||||||
import RoomTypeIcon from '../../containers/RoomTypeIcon';
|
import RoomTypeIcon from '../../containers/RoomTypeIcon';
|
||||||
import I18n from '../../i18n';
|
import I18n from '../../i18n';
|
||||||
import scrollPersistTaps from '../../utils/scrollPersistTaps';
|
import scrollPersistTaps from '../../utils/scrollPersistTaps';
|
||||||
|
import store from '../../lib/createStore';
|
||||||
|
|
||||||
const renderSeparator = () => <View style={styles.separator} />;
|
const renderSeparator = () => <View style={styles.separator} />;
|
||||||
|
|
||||||
|
const modules = {};
|
||||||
|
|
||||||
@connect(state => ({
|
@connect(state => ({
|
||||||
userId: state.login.user && state.login.user.id,
|
userId: state.login.user && state.login.user.id,
|
||||||
username: state.login.user && state.login.user.username,
|
username: state.login.user && state.login.user.username,
|
||||||
|
@ -68,6 +72,10 @@ export default class RoomActionsView extends LoggedView {
|
||||||
const { navigator } = this.props;
|
const { navigator } = this.props;
|
||||||
|
|
||||||
if (item.route) {
|
if (item.route) {
|
||||||
|
if (modules[item.route] == null) {
|
||||||
|
modules[item.route] = item.require();
|
||||||
|
Navigation.registerComponent(item.route, () => modules[item.route], store, Provider);
|
||||||
|
}
|
||||||
navigator.push({
|
navigator.push({
|
||||||
screen: item.route,
|
screen: item.route,
|
||||||
title: item.name,
|
title: item.name,
|
||||||
|
@ -80,7 +88,7 @@ export default class RoomActionsView extends LoggedView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get canAddUser() { // Invite user
|
get canAddUser() {
|
||||||
const {
|
const {
|
||||||
rid, t
|
rid, t
|
||||||
} = this.room;
|
} = this.room;
|
||||||
|
@ -128,7 +136,8 @@ export default class RoomActionsView extends LoggedView {
|
||||||
name: I18n.t('Room_Info'),
|
name: I18n.t('Room_Info'),
|
||||||
route: 'RoomInfoView',
|
route: 'RoomInfoView',
|
||||||
params: { rid },
|
params: { rid },
|
||||||
testID: 'room-actions-info'
|
testID: 'room-actions-info',
|
||||||
|
require: () => require('../RoomInfoView').default
|
||||||
}],
|
}],
|
||||||
renderItem: this.renderRoomInfo
|
renderItem: this.renderRoomInfo
|
||||||
}, {
|
}, {
|
||||||
|
@ -154,28 +163,32 @@ export default class RoomActionsView extends LoggedView {
|
||||||
name: I18n.t('Files'),
|
name: I18n.t('Files'),
|
||||||
route: 'RoomFilesView',
|
route: 'RoomFilesView',
|
||||||
params: { rid },
|
params: { rid },
|
||||||
testID: 'room-actions-files'
|
testID: 'room-actions-files',
|
||||||
|
require: () => require('../RoomFilesView').default
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'ios-at',
|
icon: 'ios-at',
|
||||||
name: I18n.t('Mentions'),
|
name: I18n.t('Mentions'),
|
||||||
route: 'MentionedMessagesView',
|
route: 'MentionedMessagesView',
|
||||||
params: { rid },
|
params: { rid },
|
||||||
testID: 'room-actions-mentioned'
|
testID: 'room-actions-mentioned',
|
||||||
|
require: () => require('../MentionedMessagesView').default
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'ios-star',
|
icon: 'ios-star',
|
||||||
name: I18n.t('Starred'),
|
name: I18n.t('Starred'),
|
||||||
route: 'StarredMessagesView',
|
route: 'StarredMessagesView',
|
||||||
params: { rid },
|
params: { rid },
|
||||||
testID: 'room-actions-starred'
|
testID: 'room-actions-starred',
|
||||||
|
require: () => require('../StarredMessagesView').default
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'ios-search',
|
icon: 'ios-search',
|
||||||
name: I18n.t('Search'),
|
name: I18n.t('Search'),
|
||||||
route: 'SearchMessagesView',
|
route: 'SearchMessagesView',
|
||||||
params: { rid },
|
params: { rid },
|
||||||
testID: 'room-actions-search'
|
testID: 'room-actions-search',
|
||||||
|
require: () => require('../SearchMessagesView').default
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'ios-share',
|
icon: 'ios-share',
|
||||||
|
@ -188,14 +201,16 @@ export default class RoomActionsView extends LoggedView {
|
||||||
name: I18n.t('Pinned'),
|
name: I18n.t('Pinned'),
|
||||||
route: 'PinnedMessagesView',
|
route: 'PinnedMessagesView',
|
||||||
params: { rid },
|
params: { rid },
|
||||||
testID: 'room-actions-pinned'
|
testID: 'room-actions-pinned',
|
||||||
|
require: () => require('../PinnedMessagesView').default
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'ios-code',
|
icon: 'ios-code',
|
||||||
name: I18n.t('Snippets'),
|
name: I18n.t('Snippets'),
|
||||||
route: 'SnippetedMessagesView',
|
route: 'SnippetedMessagesView',
|
||||||
params: { rid },
|
params: { rid },
|
||||||
testID: 'room-actions-snippeted'
|
testID: 'room-actions-snippeted',
|
||||||
|
require: () => require('../SnippetedMessagesView').default
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: `ios-notifications${ notifications ? '' : '-off' }`,
|
icon: `ios-notifications${ notifications ? '' : '-off' }`,
|
||||||
|
@ -232,7 +247,8 @@ export default class RoomActionsView extends LoggedView {
|
||||||
: I18n.t('N_online_members', { n: onlineMembers.length })),
|
: I18n.t('N_online_members', { n: onlineMembers.length })),
|
||||||
route: 'RoomMembersView',
|
route: 'RoomMembersView',
|
||||||
params: { rid, members: onlineMembers },
|
params: { rid, members: onlineMembers },
|
||||||
testID: 'room-actions-members'
|
testID: 'room-actions-members',
|
||||||
|
require: () => require('../RoomMembersView').default
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +261,8 @@ export default class RoomActionsView extends LoggedView {
|
||||||
nextAction: 'ADD_USER',
|
nextAction: 'ADD_USER',
|
||||||
rid
|
rid
|
||||||
},
|
},
|
||||||
testID: 'room-actions-add-user'
|
testID: 'room-actions-add-user',
|
||||||
|
require: () => require('../SelectedUsersView').default
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
sections[2].data = [...actions, ...sections[2].data];
|
sections[2].data = [...actions, ...sections[2].data];
|
||||||
|
|
|
@ -3,8 +3,9 @@ import PropTypes from 'prop-types';
|
||||||
import {
|
import {
|
||||||
View, Text, ScrollView, SafeAreaView
|
View, Text, ScrollView, SafeAreaView
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect, Provider } from 'react-redux';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
|
import { Navigation } from 'react-native-navigation';
|
||||||
|
|
||||||
import LoggedView from '../View';
|
import LoggedView from '../View';
|
||||||
import Status from '../../containers/status';
|
import Status from '../../containers/status';
|
||||||
|
@ -18,6 +19,7 @@ import log from '../../utils/log';
|
||||||
import RoomTypeIcon from '../../containers/RoomTypeIcon';
|
import RoomTypeIcon from '../../containers/RoomTypeIcon';
|
||||||
import I18n from '../../i18n';
|
import I18n from '../../i18n';
|
||||||
import { iconsMap } from '../../Icons';
|
import { iconsMap } from '../../Icons';
|
||||||
|
import store from '../../lib/createStore';
|
||||||
|
|
||||||
const PERMISSION_EDIT_ROOM = 'edit-room';
|
const PERMISSION_EDIT_ROOM = 'edit-room';
|
||||||
|
|
||||||
|
@ -32,6 +34,8 @@ const getRoomTitle = room => (room.t === 'd'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let RoomInfoEditView = null;
|
||||||
|
|
||||||
@connect(state => ({
|
@connect(state => ({
|
||||||
baseUrl: state.settings.Site_Url || state.server ? state.server.server : '',
|
baseUrl: state.settings.Site_Url || state.server ? state.server.server : '',
|
||||||
userId: state.login.user && state.login.user.id,
|
userId: state.login.user && state.login.user.id,
|
||||||
|
@ -80,6 +84,11 @@ export default class RoomInfoView extends LoggedView {
|
||||||
const { rid, navigator } = this.props;
|
const { rid, navigator } = this.props;
|
||||||
if (event.type === 'NavBarButtonPress') {
|
if (event.type === 'NavBarButtonPress') {
|
||||||
if (event.id === 'edit') {
|
if (event.id === 'edit') {
|
||||||
|
if (RoomInfoEditView == null) {
|
||||||
|
RoomInfoEditView = require('../RoomInfoEditView').default;
|
||||||
|
Navigation.registerComponent('RoomInfoEditView', () => RoomInfoEditView, store, Provider);
|
||||||
|
}
|
||||||
|
|
||||||
navigator.push({
|
navigator.push({
|
||||||
screen: 'RoomInfoEditView',
|
screen: 'RoomInfoEditView',
|
||||||
title: I18n.t('Room_Info_Edit'),
|
title: I18n.t('Room_Info_Edit'),
|
||||||
|
|
|
@ -3,9 +3,9 @@ import PropTypes from 'prop-types';
|
||||||
import {
|
import {
|
||||||
Text, View, LayoutAnimation, ActivityIndicator, SafeAreaView
|
Text, View, LayoutAnimation, ActivityIndicator, SafeAreaView
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect, Provider } from 'react-redux';
|
||||||
import equal from 'deep-equal';
|
|
||||||
import { RectButton } from 'react-native-gesture-handler';
|
import { RectButton } from 'react-native-gesture-handler';
|
||||||
|
import { Navigation } from 'react-native-navigation';
|
||||||
|
|
||||||
import { openRoom as openRoomAction, closeRoom as closeRoomAction, setLastOpen as setLastOpenAction } from '../../actions/room';
|
import { openRoom as openRoomAction, closeRoom as closeRoomAction, setLastOpen as setLastOpenAction } from '../../actions/room';
|
||||||
import { toggleReactionPicker as toggleReactionPickerAction, actionsShow as actionsShowAction } from '../../actions/messages';
|
import { toggleReactionPicker as toggleReactionPickerAction, actionsShow as actionsShowAction } from '../../actions/messages';
|
||||||
|
@ -24,6 +24,9 @@ import log from '../../utils/log';
|
||||||
import I18n from '../../i18n';
|
import I18n from '../../i18n';
|
||||||
import debounce from '../../utils/debounce';
|
import debounce from '../../utils/debounce';
|
||||||
import { iconsMap } from '../../Icons';
|
import { iconsMap } from '../../Icons';
|
||||||
|
import store from '../../lib/createStore';
|
||||||
|
|
||||||
|
let RoomActionsView = null;
|
||||||
|
|
||||||
@connect(state => ({
|
@connect(state => ({
|
||||||
user: {
|
user: {
|
||||||
|
@ -104,8 +107,23 @@ export default class RoomView extends LoggedView {
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps, nextState) {
|
shouldComponentUpdate(nextProps, nextState) {
|
||||||
const { room } = this.state;
|
const {
|
||||||
return !(equal(this.props, nextProps) && equal(this.state, nextState) && room.ro === nextState.room.ro);
|
room, loaded, joined, end
|
||||||
|
} = this.state;
|
||||||
|
const { showActions } = this.props;
|
||||||
|
|
||||||
|
if (room.ro !== nextState.room.ro) {
|
||||||
|
return true;
|
||||||
|
} else if (loaded !== nextState.loaded) {
|
||||||
|
return true;
|
||||||
|
} else if (joined !== nextState.joined) {
|
||||||
|
return true;
|
||||||
|
} else if (end !== nextState.end) {
|
||||||
|
return true;
|
||||||
|
} else if (showActions !== nextProps.showActions) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps, prevState) {
|
componentDidUpdate(prevProps, prevState) {
|
||||||
|
@ -141,6 +159,11 @@ export default class RoomView extends LoggedView {
|
||||||
|
|
||||||
if (event.type === 'NavBarButtonPress') {
|
if (event.type === 'NavBarButtonPress') {
|
||||||
if (event.id === 'more') {
|
if (event.id === 'more') {
|
||||||
|
if (RoomActionsView == null) {
|
||||||
|
RoomActionsView = require('../RoomActionsView').default;
|
||||||
|
Navigation.registerComponent('RoomActionsView', () => RoomActionsView, store, Provider);
|
||||||
|
}
|
||||||
|
|
||||||
navigator.push({
|
navigator.push({
|
||||||
screen: 'RoomActionsView',
|
screen: 'RoomActionsView',
|
||||||
title: I18n.t('Actions'),
|
title: I18n.t('Actions'),
|
||||||
|
|
|
@ -3,8 +3,9 @@ import PropTypes from 'prop-types';
|
||||||
import {
|
import {
|
||||||
Platform, View, FlatList, BackHandler, ActivityIndicator, SafeAreaView, Text, Image, Dimensions, ScrollView, Keyboard
|
Platform, View, FlatList, BackHandler, ActivityIndicator, SafeAreaView, Text, Image, Dimensions, ScrollView, Keyboard
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect, Provider } from 'react-redux';
|
||||||
import { isEqual } from 'lodash';
|
import { isEqual } from 'lodash';
|
||||||
|
import { Navigation } from 'react-native-navigation';
|
||||||
|
|
||||||
import SearchBox from '../../containers/SearchBox';
|
import SearchBox from '../../containers/SearchBox';
|
||||||
import database from '../../lib/realm';
|
import database from '../../lib/realm';
|
||||||
|
@ -18,12 +19,15 @@ import SortDropdown from './SortDropdown';
|
||||||
import ServerDropdown from './ServerDropdown';
|
import ServerDropdown from './ServerDropdown';
|
||||||
import Touch from '../../utils/touch';
|
import Touch from '../../utils/touch';
|
||||||
import { toggleSortDropdown as toggleSortDropdownAction } from '../../actions/rooms';
|
import { toggleSortDropdown as toggleSortDropdownAction } from '../../actions/rooms';
|
||||||
|
import store from '../../lib/createStore';
|
||||||
|
|
||||||
const ROW_HEIGHT = 70;
|
const ROW_HEIGHT = 70;
|
||||||
const SCROLL_OFFSET = 56;
|
const SCROLL_OFFSET = 56;
|
||||||
|
|
||||||
const isAndroid = () => Platform.OS === 'android';
|
const isAndroid = () => Platform.OS === 'android';
|
||||||
const getItemLayout = (data, index) => ({ length: ROW_HEIGHT, offset: ROW_HEIGHT * index, index });
|
const getItemLayout = (data, index) => ({ length: ROW_HEIGHT, offset: ROW_HEIGHT * index, index });
|
||||||
|
const keyExtractor = item => item.rid;
|
||||||
|
|
||||||
const leftButtons = [{
|
const leftButtons = [{
|
||||||
id: 'settings',
|
id: 'settings',
|
||||||
icon: { uri: 'settings', scale: Dimensions.get('window').scale },
|
icon: { uri: 'settings', scale: Dimensions.get('window').scale },
|
||||||
|
@ -42,6 +46,8 @@ if (Platform.OS === 'android') {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let NewMessageView = null;
|
||||||
|
|
||||||
@connect(state => ({
|
@connect(state => ({
|
||||||
userId: state.login.user && state.login.user.id,
|
userId: state.login.user && state.login.user.id,
|
||||||
server: state.server.server,
|
server: state.server.server,
|
||||||
|
@ -166,6 +172,11 @@ export default class RoomsListView extends LoggedView {
|
||||||
const { navigator } = this.props;
|
const { navigator } = this.props;
|
||||||
if (event.type === 'NavBarButtonPress') {
|
if (event.type === 'NavBarButtonPress') {
|
||||||
if (event.id === 'newMessage') {
|
if (event.id === 'newMessage') {
|
||||||
|
if (NewMessageView == null) {
|
||||||
|
NewMessageView = require('../NewMessageView').default;
|
||||||
|
Navigation.registerComponent('NewMessageView', () => NewMessageView, store, Provider);
|
||||||
|
}
|
||||||
|
|
||||||
navigator.showModal({
|
navigator.showModal({
|
||||||
screen: 'NewMessageView',
|
screen: 'NewMessageView',
|
||||||
title: I18n.t('New_Message'),
|
title: I18n.t('New_Message'),
|
||||||
|
@ -383,6 +394,8 @@ export default class RoomsListView extends LoggedView {
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getScrollRef = ref => this.scroll = ref
|
||||||
|
|
||||||
renderHeader = () => {
|
renderHeader = () => {
|
||||||
const { search } = this.state;
|
const { search } = this.state;
|
||||||
if (search.length > 0) {
|
if (search.length > 0) {
|
||||||
|
@ -456,7 +469,7 @@ export default class RoomsListView extends LoggedView {
|
||||||
<FlatList
|
<FlatList
|
||||||
data={data}
|
data={data}
|
||||||
extraData={data}
|
extraData={data}
|
||||||
keyExtractor={item => item.rid}
|
keyExtractor={keyExtractor}
|
||||||
style={styles.list}
|
style={styles.list}
|
||||||
renderItem={this.renderItem}
|
renderItem={this.renderItem}
|
||||||
ItemSeparatorComponent={this.renderSeparator}
|
ItemSeparatorComponent={this.renderSeparator}
|
||||||
|
@ -485,7 +498,7 @@ export default class RoomsListView extends LoggedView {
|
||||||
<FlatList
|
<FlatList
|
||||||
data={search}
|
data={search}
|
||||||
extraData={search}
|
extraData={search}
|
||||||
keyExtractor={item => item.rid}
|
keyExtractor={keyExtractor}
|
||||||
style={styles.list}
|
style={styles.list}
|
||||||
renderItem={this.renderItem}
|
renderItem={this.renderItem}
|
||||||
ItemSeparatorComponent={this.renderSeparator}
|
ItemSeparatorComponent={this.renderSeparator}
|
||||||
|
@ -519,7 +532,7 @@ export default class RoomsListView extends LoggedView {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollView
|
<ScrollView
|
||||||
ref={ref => this.scroll = ref}
|
ref={this.getScrollRef}
|
||||||
contentOffset={Platform.OS === 'ios' ? { x: 0, y: SCROLL_OFFSET } : {}}
|
contentOffset={Platform.OS === 'ios' ? { x: 0, y: SCROLL_OFFSET } : {}}
|
||||||
keyboardShouldPersistTaps='always'
|
keyboardShouldPersistTaps='always'
|
||||||
testID='rooms-list-view-list'
|
testID='rooms-list-view-list'
|
||||||
|
|
|
@ -3,7 +3,8 @@ import PropTypes from 'prop-types';
|
||||||
import {
|
import {
|
||||||
View, StyleSheet, SafeAreaView, FlatList, LayoutAnimation, Platform
|
View, StyleSheet, SafeAreaView, FlatList, LayoutAnimation, Platform
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect, Provider } from 'react-redux';
|
||||||
|
import { Navigation } from 'react-native-navigation';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
addUser as addUserAction, removeUser as removeUserAction, reset as resetAction, setLoading as setLoadingAction
|
addUser as addUserAction, removeUser as removeUserAction, reset as resetAction, setLoading as setLoadingAction
|
||||||
|
@ -18,6 +19,7 @@ import I18n from '../i18n';
|
||||||
import log from '../utils/log';
|
import log from '../utils/log';
|
||||||
import SearchBox from '../containers/SearchBox';
|
import SearchBox from '../containers/SearchBox';
|
||||||
import sharedStyles from './Styles';
|
import sharedStyles from './Styles';
|
||||||
|
import store from '../lib/createStore';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
safeAreaView: {
|
safeAreaView: {
|
||||||
|
@ -32,6 +34,8 @@ const styles = StyleSheet.create({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let CreateChannelView = null;
|
||||||
|
|
||||||
@connect(state => ({
|
@connect(state => ({
|
||||||
baseUrl: state.settings.Site_Url || state.server ? state.server.server : '',
|
baseUrl: state.settings.Site_Url || state.server ? state.server.server : '',
|
||||||
users: state.selectedUsers.users,
|
users: state.selectedUsers.users,
|
||||||
|
@ -108,6 +112,11 @@ export default class SelectedUsersView extends LoggedView {
|
||||||
if (event.id === 'create') {
|
if (event.id === 'create') {
|
||||||
const { nextAction, setLoadingInvite, navigator } = this.props;
|
const { nextAction, setLoadingInvite, navigator } = this.props;
|
||||||
if (nextAction === 'CREATE_CHANNEL') {
|
if (nextAction === 'CREATE_CHANNEL') {
|
||||||
|
if (CreateChannelView == null) {
|
||||||
|
CreateChannelView = require('./CreateChannelView').default;
|
||||||
|
Navigation.registerComponent('CreateChannelView', () => CreateChannelView, store, Provider);
|
||||||
|
}
|
||||||
|
|
||||||
navigator.push({
|
navigator.push({
|
||||||
screen: 'CreateChannelView',
|
screen: 'CreateChannelView',
|
||||||
title: I18n.t('Create_Channel'),
|
title: I18n.t('Create_Channel'),
|
||||||
|
|
|
@ -2,64 +2,22 @@ import { Navigation } from 'react-native-navigation';
|
||||||
import { Provider } from 'react-redux';
|
import { Provider } from 'react-redux';
|
||||||
import { gestureHandlerRootHOC } from 'react-native-gesture-handler';
|
import { gestureHandlerRootHOC } from 'react-native-gesture-handler';
|
||||||
|
|
||||||
import CreateChannelView from './CreateChannelView';
|
|
||||||
import ForgotPasswordView from './ForgotPasswordView';
|
|
||||||
import LoginSignupView from './LoginSignupView';
|
|
||||||
import LoginView from './LoginView';
|
|
||||||
import MentionedMessagesView from './MentionedMessagesView';
|
|
||||||
import NewMessageView from './NewMessageView';
|
|
||||||
import NewServerView from './NewServerView';
|
|
||||||
import OAuthView from './OAuthView';
|
|
||||||
import OnboardingView from './OnboardingView';
|
import OnboardingView from './OnboardingView';
|
||||||
import PinnedMessagesView from './PinnedMessagesView';
|
|
||||||
import PrivacyPolicyView from './PrivacyPolicyView';
|
|
||||||
import ProfileView from './ProfileView';
|
import ProfileView from './ProfileView';
|
||||||
import RegisterView from './RegisterView';
|
|
||||||
import RoomActionsView from './RoomActionsView';
|
|
||||||
import RoomFilesView from './RoomFilesView';
|
|
||||||
import RoomInfoEditView from './RoomInfoEditView';
|
|
||||||
import RoomInfoView from './RoomInfoView';
|
|
||||||
import RoomMembersView from './RoomMembersView';
|
|
||||||
import RoomsListHeaderView from './RoomsListView/Header';
|
import RoomsListHeaderView from './RoomsListView/Header';
|
||||||
import RoomsListSearchView from './RoomsListView/Search';
|
import RoomsListSearchView from './RoomsListView/Search';
|
||||||
import RoomsListView from './RoomsListView';
|
import RoomsListView from './RoomsListView';
|
||||||
import RoomView from './RoomView';
|
import RoomView from './RoomView';
|
||||||
import SearchMessagesView from './SearchMessagesView';
|
|
||||||
import SelectedUsersView from './SelectedUsersView';
|
|
||||||
import SettingsView from './SettingsView';
|
import SettingsView from './SettingsView';
|
||||||
import Sidebar from '../containers/Sidebar';
|
import Sidebar from '../containers/Sidebar';
|
||||||
import SnippetedMessagesView from './SnippetedMessagesView';
|
|
||||||
import StarredMessagesView from './StarredMessagesView';
|
|
||||||
import TermsServiceView from './TermsServiceView';
|
|
||||||
|
|
||||||
export const registerScreens = (store) => {
|
export const registerScreens = (store) => {
|
||||||
Navigation.registerComponent('CreateChannelView', () => CreateChannelView, store, Provider);
|
|
||||||
Navigation.registerComponent('ForgotPasswordView', () => ForgotPasswordView, store, Provider);
|
|
||||||
Navigation.registerComponent('LoginSignupView', () => LoginSignupView, store, Provider);
|
|
||||||
Navigation.registerComponent('LoginView', () => LoginView, store, Provider);
|
|
||||||
Navigation.registerComponent('MentionedMessagesView', () => gestureHandlerRootHOC(MentionedMessagesView), store, Provider);
|
|
||||||
Navigation.registerComponent('NewMessageView', () => NewMessageView, store, Provider);
|
|
||||||
Navigation.registerComponent('NewServerView', () => NewServerView, store, Provider);
|
|
||||||
Navigation.registerComponent('OAuthView', () => OAuthView, store, Provider);
|
|
||||||
Navigation.registerComponent('OnboardingView', () => OnboardingView, store, Provider);
|
Navigation.registerComponent('OnboardingView', () => OnboardingView, store, Provider);
|
||||||
Navigation.registerComponent('PinnedMessagesView', () => gestureHandlerRootHOC(PinnedMessagesView), store, Provider);
|
|
||||||
Navigation.registerComponent('PrivacyPolicyView', () => PrivacyPolicyView, store, Provider);
|
|
||||||
Navigation.registerComponent('ProfileView', () => ProfileView, store, Provider);
|
Navigation.registerComponent('ProfileView', () => ProfileView, store, Provider);
|
||||||
Navigation.registerComponent('RegisterView', () => RegisterView, store, Provider);
|
|
||||||
Navigation.registerComponent('RoomActionsView', () => RoomActionsView, store, Provider);
|
|
||||||
Navigation.registerComponent('RoomFilesView', () => gestureHandlerRootHOC(RoomFilesView), store, Provider);
|
|
||||||
Navigation.registerComponent('RoomInfoEditView', () => RoomInfoEditView, store, Provider);
|
|
||||||
Navigation.registerComponent('RoomInfoView', () => RoomInfoView, store, Provider);
|
|
||||||
Navigation.registerComponent('RoomMembersView', () => RoomMembersView, store, Provider);
|
|
||||||
Navigation.registerComponent('RoomsListHeaderView', () => RoomsListHeaderView, store, Provider);
|
Navigation.registerComponent('RoomsListHeaderView', () => RoomsListHeaderView, store, Provider);
|
||||||
Navigation.registerComponent('RoomsListSearchView', () => RoomsListSearchView, store, Provider);
|
Navigation.registerComponent('RoomsListSearchView', () => RoomsListSearchView, store, Provider);
|
||||||
Navigation.registerComponent('RoomsListView', () => gestureHandlerRootHOC(RoomsListView), store, Provider);
|
Navigation.registerComponent('RoomsListView', () => gestureHandlerRootHOC(RoomsListView), store, Provider);
|
||||||
Navigation.registerComponent('RoomView', () => gestureHandlerRootHOC(RoomView), store, Provider);
|
Navigation.registerComponent('RoomView', () => gestureHandlerRootHOC(RoomView), store, Provider);
|
||||||
Navigation.registerComponent('SearchMessagesView', () => gestureHandlerRootHOC(SearchMessagesView), store, Provider);
|
|
||||||
Navigation.registerComponent('SelectedUsersView', () => SelectedUsersView, store, Provider);
|
|
||||||
Navigation.registerComponent('SettingsView', () => SettingsView, store, Provider);
|
Navigation.registerComponent('SettingsView', () => SettingsView, store, Provider);
|
||||||
Navigation.registerComponent('Sidebar', () => Sidebar, store, Provider);
|
Navigation.registerComponent('Sidebar', () => Sidebar, store, Provider);
|
||||||
Navigation.registerComponent('SnippetedMessagesView', () => gestureHandlerRootHOC(SnippetedMessagesView), store, Provider);
|
|
||||||
Navigation.registerComponent('StarredMessagesView', () => gestureHandlerRootHOC(StarredMessagesView), store, Provider);
|
|
||||||
Navigation.registerComponent('TermsServiceView', () => TermsServiceView, store, Provider);
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -6788,9 +6788,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"detox": {
|
"detox": {
|
||||||
"version": "9.0.1",
|
"version": "9.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/detox/-/detox-9.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/detox/-/detox-9.0.2.tgz",
|
||||||
"integrity": "sha512-KT0Sptt4JvWHTXP1dxMzqXc/LCJxZIB9bKGtjDjg6hdLwOmLAxY3Zfz22ASKGC33rLT6dw/uvyODjgwfVzlYfw==",
|
"integrity": "sha512-TRPvaQpiWOzkYzh+qybefvPNHj7dSffY2kRQoKC7iJbMZUWfw5JNJ5htYEwvzH8g6kBR4zzlsYbf4/AwJvkQqw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"bunyan": "^1.8.12",
|
"bunyan": "^1.8.12",
|
||||||
|
@ -13737,7 +13737,7 @@
|
||||||
},
|
},
|
||||||
"rimraf": {
|
"rimraf": {
|
||||||
"version": "2.4.5",
|
"version": "2.4.5",
|
||||||
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz",
|
"resolved": "http://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz",
|
||||||
"integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=",
|
"integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
|
@ -13873,7 +13873,7 @@
|
||||||
},
|
},
|
||||||
"ncp": {
|
"ncp": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz",
|
"resolved": "http://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz",
|
||||||
"integrity": "sha1-GVoh1sRuNh0vsSgbo4uR6d9727M=",
|
"integrity": "sha1-GVoh1sRuNh0vsSgbo4uR6d9727M=",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"optional": true
|
"optional": true
|
||||||
|
@ -16709,9 +16709,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"react-native-device-info": {
|
"react-native-device-info": {
|
||||||
"version": "0.22.5",
|
"version": "0.22.6",
|
||||||
"resolved": "https://registry.npmjs.org/react-native-device-info/-/react-native-device-info-0.22.5.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-device-info/-/react-native-device-info-0.22.6.tgz",
|
||||||
"integrity": "sha512-Pe+7eoWOR/TmZxWLaa8rmEmqRckyvPnniDXjiKxaUSk5oUCCtHjFajVYSVkWoJGPwd4xQYjrhx1gr/tcvjSEwQ=="
|
"integrity": "sha512-/w87PmHPvT5MY3HwzdVEWyFg/ib91lY6TlYJGNnNPaXNXY60ShB8HI+GXKyq4KAtbUc/WhRM1RQ8/WKJOal+UQ=="
|
||||||
},
|
},
|
||||||
"react-native-dialog": {
|
"react-native-dialog": {
|
||||||
"version": "5.1.0",
|
"version": "5.1.0",
|
||||||
|
@ -16728,9 +16728,9 @@
|
||||||
"integrity": "sha512-NKYXiH8w/DjNXoozko1twjAd5F8shL/UiTVx/PQ8QNaasWpbxlXgeJ5exhDSIcDXao0AUdcPWJunYdSCjq208g=="
|
"integrity": "sha512-NKYXiH8w/DjNXoozko1twjAd5F8shL/UiTVx/PQ8QNaasWpbxlXgeJ5exhDSIcDXao0AUdcPWJunYdSCjq208g=="
|
||||||
},
|
},
|
||||||
"react-native-fast-image": {
|
"react-native-fast-image": {
|
||||||
"version": "5.0.3",
|
"version": "5.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/react-native-fast-image/-/react-native-fast-image-5.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-fast-image/-/react-native-fast-image-5.0.10.tgz",
|
||||||
"integrity": "sha512-70XlQPt8b7yQSMwUEEIN5jTx7KOx1EBD2XhIRIEHChfNv5Gwn8dh28RSo/Dq9qezf4CWJXO3CAb4lq+Hu9d0vw=="
|
"integrity": "sha512-9WRINd7xk0Hhv3ublbJqGpU+dEApzMmabHU/5ULGvQ0LBWdCFF/4ScQMPJlI0dnCMu/++/emRshn4ML6sQ1yhQ=="
|
||||||
},
|
},
|
||||||
"react-native-fit-image": {
|
"react-native-fit-image": {
|
||||||
"version": "1.5.4",
|
"version": "1.5.4",
|
||||||
|
@ -19775,9 +19775,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tail": {
|
"tail": {
|
||||||
"version": "1.3.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/tail/-/tail-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/tail/-/tail-1.4.0.tgz",
|
||||||
"integrity": "sha512-9Blh9bCW3lQyr10UAh//7K3kqljspQ+NcMa5nwVXicnxFXfiUizZrEC71kqVKPhe2UcMLXDEb+YnqR+tzvOEDQ==",
|
"integrity": "sha512-wjwfZw6wcMFTB1Po7NFUf4TdCDwX8duZjdTMhnHBEC677Q6mFRcVZE7f/nZDhG2Fpf/wEEKOJP9L7/b11/vlHQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"tapable": {
|
"tapable": {
|
||||||
|
|
|
@ -14,8 +14,7 @@
|
||||||
"storybook": "storybook start -p 7007",
|
"storybook": "storybook start -p 7007",
|
||||||
"snyk-protect": "snyk protect",
|
"snyk-protect": "snyk protect",
|
||||||
"fabric-ios": "./scripts/fabric-ios.sh",
|
"fabric-ios": "./scripts/fabric-ios.sh",
|
||||||
"fabric-android": "./scripts/fabric-android.sh",
|
"fabric-android": "./scripts/fabric-android.sh"
|
||||||
"postinstall": "cp ./temp/react.gradle ./node_modules/react-native"
|
|
||||||
},
|
},
|
||||||
"rnpm": {
|
"rnpm": {
|
||||||
"assets": [
|
"assets": [
|
||||||
|
@ -38,10 +37,10 @@
|
||||||
"react-native": "^0.57.1",
|
"react-native": "^0.57.1",
|
||||||
"react-native-actionsheet": "^2.4.2",
|
"react-native-actionsheet": "^2.4.2",
|
||||||
"react-native-audio": "^4.2.0",
|
"react-native-audio": "^4.2.0",
|
||||||
"react-native-device-info": "^0.22.5",
|
"react-native-device-info": "^0.22.6",
|
||||||
"react-native-dialog": "^5.1.0",
|
"react-native-dialog": "^5.1.0",
|
||||||
"react-native-fabric": "^0.5.1",
|
"react-native-fabric": "^0.5.1",
|
||||||
"react-native-fast-image": "^5.0.3",
|
"react-native-fast-image": "^5.0.10",
|
||||||
"react-native-gesture-handler": "^1.0.7",
|
"react-native-gesture-handler": "^1.0.7",
|
||||||
"react-native-i18n": "^2.0.15",
|
"react-native-i18n": "^2.0.15",
|
||||||
"react-native-image-crop-picker": "git+https://github.com/RocketChat/react-native-image-crop-picker.git",
|
"react-native-image-crop-picker": "git+https://github.com/RocketChat/react-native-image-crop-picker.git",
|
||||||
|
@ -87,7 +86,7 @@
|
||||||
"babel-plugin-transform-remove-console": "^6.9.4",
|
"babel-plugin-transform-remove-console": "^6.9.4",
|
||||||
"babel-runtime": "^6.26.0",
|
"babel-runtime": "^6.26.0",
|
||||||
"codecov": "^3.1.0",
|
"codecov": "^3.1.0",
|
||||||
"detox": "^9.0.1",
|
"detox": "^9.0.2",
|
||||||
"eslint": "^5.6.0",
|
"eslint": "^5.6.0",
|
||||||
"eslint-config-airbnb": "^17.1.0",
|
"eslint-config-airbnb": "^17.1.0",
|
||||||
"eslint-plugin-import": "^2.14.0",
|
"eslint-plugin-import": "^2.14.0",
|
||||||
|
|
|
@ -1,135 +0,0 @@
|
||||||
// Workaround to "error: Duplicate file. Original is here. The version qualifier may be implied. With gradle assembleRelease"
|
|
||||||
// https://github.com/facebook/react-native/issues/19211#issuecomment-389125030
|
|
||||||
import org.apache.tools.ant.taskdefs.condition.Os
|
|
||||||
|
|
||||||
def config = project.hasProperty("react") ? project.react : [];
|
|
||||||
|
|
||||||
def cliPath = config.cliPath ?: "node_modules/react-native/local-cli/cli.js"
|
|
||||||
def bundleAssetName = config.bundleAssetName ?: "index.android.bundle"
|
|
||||||
def entryFile = config.entryFile ?: "index.js"
|
|
||||||
def bundleCommand = config.bundleCommand ?: "bundle"
|
|
||||||
|
|
||||||
// because elvis operator
|
|
||||||
def elvisFile(thing) {
|
|
||||||
return thing ? file(thing) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
def reactRoot = elvisFile(config.root) ?: file("../../")
|
|
||||||
def inputExcludes = config.inputExcludes ?: ["android/**", "ios/**"]
|
|
||||||
def bundleConfig = config.bundleConfig ? "${reactRoot}/${config.bundleConfig}" : null ;
|
|
||||||
|
|
||||||
void runBefore(String dependentTaskName, Task task) {
|
|
||||||
Task dependentTask = tasks.findByPath(dependentTaskName);
|
|
||||||
if (dependentTask != null) {
|
|
||||||
dependentTask.dependsOn task
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gradle.projectsEvaluated {
|
|
||||||
// Grab all build types and product flavors
|
|
||||||
def buildTypes = android.buildTypes.collect { type -> type.name }
|
|
||||||
def productFlavors = android.productFlavors.collect { flavor -> flavor.name }
|
|
||||||
|
|
||||||
// When no product flavors defined, use empty
|
|
||||||
if (!productFlavors) productFlavors.add('')
|
|
||||||
|
|
||||||
productFlavors.each { productFlavorName ->
|
|
||||||
buildTypes.each { buildTypeName ->
|
|
||||||
// Create variant and target names
|
|
||||||
def flavorNameCapitalized = "${productFlavorName.capitalize()}"
|
|
||||||
def buildNameCapitalized = "${buildTypeName.capitalize()}"
|
|
||||||
def targetName = "${flavorNameCapitalized}${buildNameCapitalized}"
|
|
||||||
def targetPath = productFlavorName ?
|
|
||||||
"${productFlavorName}/${buildTypeName}" :
|
|
||||||
"${buildTypeName}"
|
|
||||||
|
|
||||||
// React js bundle directories
|
|
||||||
def jsBundleDirConfigName = "jsBundleDir${targetName}"
|
|
||||||
def jsBundleDir = elvisFile(config."$jsBundleDirConfigName") ?:
|
|
||||||
file("$buildDir/intermediates/assets/${targetPath}")
|
|
||||||
|
|
||||||
def resourcesDirConfigName = "resourcesDir${targetName}"
|
|
||||||
def resourcesDir = elvisFile(config."${resourcesDirConfigName}") ?:
|
|
||||||
file("$buildDir/intermediates/res/merged/${targetPath}")
|
|
||||||
def jsBundleFile = file("$jsBundleDir/$bundleAssetName")
|
|
||||||
|
|
||||||
// Bundle task name for variant
|
|
||||||
def bundleJsAndAssetsTaskName = "bundle${targetName}JsAndAssets"
|
|
||||||
|
|
||||||
// Additional node and packager commandline arguments
|
|
||||||
def nodeExecutableAndArgs = config.nodeExecutableAndArgs ?: ["node"]
|
|
||||||
def extraPackagerArgs = config.extraPackagerArgs ?: []
|
|
||||||
|
|
||||||
def currentBundleTask = tasks.create(
|
|
||||||
name: bundleJsAndAssetsTaskName,
|
|
||||||
type: Exec) {
|
|
||||||
group = "react"
|
|
||||||
description = "bundle JS and assets for ${targetName}."
|
|
||||||
|
|
||||||
// Create dirs if they are not there (e.g. the "clean" task just ran)
|
|
||||||
doFirst {
|
|
||||||
jsBundleDir.mkdirs()
|
|
||||||
resourcesDir.mkdirs()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up inputs and outputs so gradle can cache the result
|
|
||||||
inputs.files fileTree(dir: reactRoot, excludes: inputExcludes)
|
|
||||||
outputs.dir jsBundleDir
|
|
||||||
outputs.dir resourcesDir
|
|
||||||
|
|
||||||
// Set up the call to the react-native cli
|
|
||||||
workingDir reactRoot
|
|
||||||
|
|
||||||
// Set up dev mode
|
|
||||||
def devEnabled = !(config."devDisabledIn${targetName}"
|
|
||||||
|| targetName.toLowerCase().contains("release"))
|
|
||||||
|
|
||||||
def extraArgs = extraPackagerArgs;
|
|
||||||
|
|
||||||
if (bundleConfig) {
|
|
||||||
extraArgs = extraArgs.clone()
|
|
||||||
extraArgs.add("--config");
|
|
||||||
extraArgs.add(bundleConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
|
|
||||||
commandLine("cmd", "/c", *nodeExecutableAndArgs, cliPath, bundleCommand, "--platform", "android", "--dev", "${devEnabled}",
|
|
||||||
"--reset-cache", "--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir, *extraArgs)
|
|
||||||
} else {
|
|
||||||
commandLine(*nodeExecutableAndArgs, cliPath, bundleCommand, "--platform", "android", "--dev", "${devEnabled}",
|
|
||||||
"--reset-cache", "--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir, *extraArgs)
|
|
||||||
}
|
|
||||||
|
|
||||||
enabled config."bundleIn${targetName}" ||
|
|
||||||
config."bundleIn${buildTypeName.capitalize()}" ?:
|
|
||||||
targetName.toLowerCase().contains("release")
|
|
||||||
|
|
||||||
doLast {
|
|
||||||
def moveFunc = { resSuffix ->
|
|
||||||
File originalDir = file("${resourcesDir}/drawable-${resSuffix}")
|
|
||||||
if (originalDir.exists()) {
|
|
||||||
File destDir = file("${resourcesDir}/drawable-${resSuffix}-v4")
|
|
||||||
ant.move(file: originalDir, tofile: destDir)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
moveFunc.curry("ldpi").call()
|
|
||||||
moveFunc.curry("mdpi").call()
|
|
||||||
moveFunc.curry("hdpi").call()
|
|
||||||
moveFunc.curry("xhdpi").call()
|
|
||||||
moveFunc.curry("xxhdpi").call()
|
|
||||||
moveFunc.curry("xxxhdpi").call()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hook bundle${productFlavor}${buildType}JsAndAssets into the android build process
|
|
||||||
currentBundleTask.dependsOn("merge${targetName}Resources")
|
|
||||||
currentBundleTask.dependsOn("merge${targetName}Assets")
|
|
||||||
|
|
||||||
runBefore("process${flavorNameCapitalized}Armeabi-v7a${buildNameCapitalized}Resources", currentBundleTask)
|
|
||||||
runBefore("process${flavorNameCapitalized}X86${buildNameCapitalized}Resources", currentBundleTask)
|
|
||||||
runBefore("processUniversal${targetName}Resources", currentBundleTask)
|
|
||||||
runBefore("process${targetName}Resources", currentBundleTask)
|
|
||||||
runBefore("dataBindingProcessLayouts${targetName}", currentBundleTask)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue