Skip to content

Commit 5df4afb

Browse files
committed
Merge branch 'single-server' into 4.47.0-single-server
# Conflicts: # android/app/build.gradle # app/i18n/locales/en.json # app/i18n/locales/pt-BR.json # ios/RocketChatRN.xcodeproj/project.pbxproj # ios/RocketChatRN/Info.plist # ios/ShareRocketChatRN/Info.plist # package.json
2 parents 29421c9 + 5e9aa95 commit 5df4afb

File tree

10 files changed

+75
-209
lines changed

10 files changed

+75
-209
lines changed

android/app/google-services.json

-83
This file was deleted.

android/app/src/debug/res/values/strings.xml

-4
This file was deleted.

android/gradle.properties

+6-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ newArchEnabled=false
3939

4040
# Application ID
4141
APPLICATION_ID=chat.rocket.reactnative
42-
43-
# App properties
44-
VERSIONCODE=999999999
45-
BugsnagAPIKey=""
42+
VERSIONCODE=1
43+
BugsnagAPIKey=""
44+
KEYSTORE=my-upload-key.keystore
45+
KEY_ALIAS=my-key-alias
46+
KEYSTORE_PASSWORD=
47+
KEY_PASSWORD=

app.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"name": "RocketChatRN",
33
"share": "ShareRocketChatRN",
4-
"displayName": "RocketChatRN"
4+
"displayName": "RocketChatRN",
5+
"server": "https://open.rocket.chat",
6+
"appGroup": "group.ios.chat.rocket",
7+
"appStoreID": "1272915472"
58
}

app/sagas/init.js

+28-19
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import AsyncStorage from '@react-native-async-storage/async-storage';
44

55
import { BIOMETRY_ENABLED_KEY, CURRENT_SERVER, TOKEN_KEY } from '../lib/constants';
66
import UserPreferences from '../lib/methods/userPreferences';
7-
import { selectServerRequest } from '../actions/server';
7+
import { selectServerRequest, serverRequest } from '../actions/server';
88
import { setAllPreferences } from '../actions/sortPreferences';
99
import { APP } from '../actions/actionsTypes';
1010
import log from '../lib/methods/helpers/log';
@@ -15,6 +15,8 @@ import { RootEnum } from '../definitions';
1515
import { getSortPreferences } from '../lib/methods';
1616
import { deepLinkingClickCallPush } from '../actions/deepLinking';
1717

18+
import appConfig from '../../app.json';
19+
1820
export const initLocalSettings = function* initLocalSettings() {
1921
const sortPreferences = getSortPreferences();
2022
yield put(setAllPreferences(sortPreferences));
@@ -24,8 +26,8 @@ const BIOMETRY_MIGRATION_KEY = 'kBiometryMigration';
2426

2527
const restore = function* restore() {
2628
try {
27-
const server = UserPreferences.getString(CURRENT_SERVER);
28-
let userId = UserPreferences.getString(`${TOKEN_KEY}-${server}`);
29+
// const server = UserPreferences.getString(CURRENT_SERVER);
30+
// let userId = UserPreferences.getString(`${TOKEN_KEY}-${server}`);
2931

3032
// Migration biometry setting from WatermelonDB to MMKV
3133
// TODO: remove it after a few versions
@@ -39,23 +41,30 @@ const restore = function* restore() {
3941
UserPreferences.setBool(BIOMETRY_MIGRATION_KEY, true);
4042
}
4143

42-
if (!server) {
43-
yield put(appStart({ root: RootEnum.ROOT_OUTSIDE }));
44-
} else if (!userId) {
45-
const serversDB = database.servers;
46-
const serversCollection = serversDB.get('servers');
47-
const servers = yield serversCollection.query().fetch();
44+
// if (!server) {
45+
// yield put(appStart({ root: RootEnum.ROOT_OUTSIDE }));
46+
// } else if (!userId) {
47+
// const serversDB = database.servers;
48+
// const serversCollection = serversDB.get('servers');
49+
// const servers = yield serversCollection.query().fetch();
4850

49-
// Check if there're other logged in servers and picks first one
50-
if (servers.length > 0) {
51-
for (let i = 0; i < servers.length; i += 1) {
52-
const newServer = servers[i].id;
53-
userId = UserPreferences.getString(`${TOKEN_KEY}-${newServer}`);
54-
if (userId) {
55-
return yield put(selectServerRequest(newServer));
56-
}
57-
}
58-
}
51+
// // Check if there're other logged in servers and picks first one
52+
// if (servers.length > 0) {
53+
// for (let i = 0; i < servers.length; i += 1) {
54+
// const newServer = servers[i].id;
55+
// userId = UserPreferences.getString(`${TOKEN_KEY}-${newServer}`);
56+
// if (userId) {
57+
// return yield put(selectServerRequest(newServer));
58+
// }
59+
// }
60+
// }
61+
const { server } = appConfig;
62+
const userId = UserPreferences.getString(`${TOKEN_KEY}-${server}`);
63+
64+
if (!userId) {
65+
UserPreferences.removeItem(TOKEN_KEY);
66+
UserPreferences.removeItem(CURRENT_SERVER);
67+
yield put(serverRequest(appConfig.server));
5968
yield put(appStart({ root: RootEnum.ROOT_OUTSIDE }));
6069
} else {
6170
const serversDB = database.servers;

app/sagas/login.js

+7-21
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { Q } from '@nozbe/watermelondb';
66
import moment from 'moment';
77
import * as types from '../actions/actionsTypes';
88
import { appStart } from '../actions/app';
9-
import { selectServerRequest, serverFinishAdd } from '../actions/server';
9+
import { selectServerRequest, serverFinishAdd, serverRequest } from '../actions/server';
1010
import { loginFailure, loginSuccess, logout as logoutAction, setUser } from '../actions/login';
1111
import { roomsRequest } from '../actions/rooms';
1212
import log, { events, logEvent } from '../lib/methods/helpers/log';
@@ -45,6 +45,8 @@ import appNavigation from '../lib/navigation/appNavigation';
4545
import { showActionSheetRef } from '../containers/ActionSheet';
4646
import { SupportedVersionsWarning } from '../containers/SupportedVersions';
4747

48+
import appConfig from '../../app.json';
49+
4850
const getServer = state => state.server.server;
4951
const loginWithPasswordCall = args => Services.loginWithPassword(args);
5052
const loginCall = (credentials, isFromWebView) => Services.login(credentials, isFromWebView);
@@ -251,33 +253,17 @@ const handleLogout = function* handleLogout({ forcedByServer, message }) {
251253
try {
252254
yield call(logoutCall, { server });
253255

256+
yield put(appStart({ root: RootEnum.ROOT_OUTSIDE }));
257+
yield put(serverRequest(appConfig.server));
258+
254259
// if the user was logged out by the server
255260
if (forcedByServer) {
256-
yield put(appStart({ root: RootEnum.ROOT_OUTSIDE }));
261+
// yield put(appStart({ root: RootEnum.ROOT_OUTSIDE }));
257262
if (message) {
258263
showErrorAlert(I18n.t(message), I18n.t('Oops'));
259264
}
260265
yield delay(300);
261266
EventEmitter.emit('NewServer', { server });
262-
} else {
263-
const serversDB = database.servers;
264-
// all servers
265-
const serversCollection = serversDB.get('servers');
266-
const servers = yield serversCollection.query().fetch();
267-
268-
// see if there're other logged in servers and selects first one
269-
if (servers.length > 0) {
270-
for (let i = 0; i < servers.length; i += 1) {
271-
const newServer = servers[i].id;
272-
const token = UserPreferences.getString(`${TOKEN_KEY}-${newServer}`);
273-
if (token) {
274-
yield put(selectServerRequest(newServer));
275-
return;
276-
}
277-
}
278-
}
279-
// if there's no servers, go outside
280-
yield put(appStart({ root: RootEnum.ROOT_OUTSIDE }));
281267
}
282268
} catch (e) {
283269
yield put(appStart({ root: RootEnum.ROOT_OUTSIDE }));

app/stacks/OutsideStack.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { connect } from 'react-redux';
55
import { ThemeContext } from '../theme';
66
import { ModalAnimation, StackAnimation, defaultHeader, themedHeader } from '../lib/methods/helpers/navigation';
77
// Outside Stack
8-
import NewServerView from '../views/NewServerView';
8+
// import NewServerView from '../views/NewServerView';
99
import WorkspaceView from '../views/WorkspaceView';
1010
import LoginView from '../views/LoginView';
1111
import ForgotPasswordView from '../views/ForgotPasswordView';
@@ -22,7 +22,7 @@ const _OutsideStack = () => {
2222

2323
return (
2424
<Outside.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...StackAnimation } as StackNavigationOptions}>
25-
<Outside.Screen name='NewServerView' component={NewServerView} options={NewServerView.navigationOptions} />
25+
{/* <Outside.Screen name='NewServerView' component={NewServerView} options={NewServerView.navigationOptions} /> */}
2626
<Outside.Screen name='WorkspaceView' component={WorkspaceView} />
2727
{/* @ts-ignore */}
2828
<Outside.Screen name='LoginView' component={LoginView} options={LoginView.navigationOptions} />

app/views/RoomsListView/Header/Header.tsx

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from 'react';
2-
import { StyleSheet, Text, TextInputProps, TouchableOpacity, TouchableOpacityProps, View } from 'react-native';
2+
import { StyleSheet, Text, TextInputProps, TouchableOpacityProps, View } from 'react-native';
33

44
import I18n from '../../../i18n';
55
import sharedStyles from '../../Styles';
6-
import { CustomIcon } from '../../../containers/CustomIcon';
6+
// import { CustomIcon } from '../../../containers/CustomIcon';
77
import { useTheme } from '../../../theme';
88
import SearchHeader from '../../../containers/SearchHeader';
99
import { useAppSelector } from '../../../lib/hooks';
@@ -50,11 +50,11 @@ const Header = React.memo(
5050
isFetching,
5151
serverName = 'Rocket.Chat',
5252
server,
53-
showServerDropdown,
53+
// showServerDropdown,
5454
showSearchHeader,
55-
onSearchChangeText,
56-
onPress
57-
}: IRoomHeader) => {
55+
onSearchChangeText
56+
}: // onPress
57+
IRoomHeader) => {
5858
const { status: supportedVersionsStatus } = useAppSelector(state => state.supportedVersions);
5959
const { colors } = useTheme();
6060

@@ -75,28 +75,28 @@ const Header = React.memo(
7575
}
7676
return (
7777
<View style={styles.container}>
78-
<TouchableOpacity onPress={onPress} testID='rooms-list-header-server-dropdown-button'>
79-
<View style={styles.button}>
80-
<Text style={[styles.title, { color: colors.headerTitleColor }]} numberOfLines={1}>
81-
{serverName}
82-
</Text>
83-
<CustomIcon
84-
name='chevron-down'
85-
color={colors.headerTintColor}
86-
style={[showServerDropdown && styles.upsideDown]}
87-
size={18}
88-
/>
89-
</View>
90-
{subtitle ? (
91-
<Text
92-
testID='rooms-list-header-server-subtitle'
93-
style={[styles.subtitle, { color: colors.auxiliaryText }]}
94-
numberOfLines={1}
95-
>
96-
{subtitle}
97-
</Text>
98-
) : null}
99-
</TouchableOpacity>
78+
{/* <TouchableOpacity onPress={onPress} testID='rooms-list-header-server-dropdown-button'> */}
79+
<View style={styles.button}>
80+
<Text style={[styles.title, { color: colors.headerTitleColor }]} numberOfLines={1}>
81+
{serverName}
82+
</Text>
83+
{/* <CustomIcon
84+
name='chevron-down'
85+
color={colors.headerTintColor}
86+
style={[showServerDropdown && styles.upsideDown]}
87+
size={18}
88+
/> */}
89+
</View>
90+
{subtitle ? (
91+
<Text
92+
testID='rooms-list-header-server-subtitle'
93+
style={[styles.subtitle, { color: colors.auxiliaryText }]}
94+
numberOfLines={1}
95+
>
96+
{subtitle}
97+
</Text>
98+
) : null}
99+
{/* </TouchableOpacity> */}
100100
</View>
101101
);
102102
}

ios/GoogleService-Info.plist

-36
This file was deleted.

0 commit comments

Comments
 (0)