Merge branch 'single-server' into 4.33.1-single-server

This commit is contained in:
Diego Mello 2022-12-08 15:47:53 -03:00
commit 8dd6b2a171
10 changed files with 76 additions and 204 deletions

View File

@ -1,83 +0,0 @@
{
"project_info": {
"project_number": "115198584049",
"firebase_url": "https://rocketchat-reactnative-test.firebaseio.com",
"project_id": "rocketchat-reactnative-test",
"storage_bucket": "rocketchat-reactnative-test.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:115198584049:android:a79216ae48935d2c9ab550",
"android_client_info": {
"package_name": "chat.rocket.android"
}
},
"oauth_client": [
{
"client_id": "115198584049-ack609b1338b827fta26s9rd2ab1aad5.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAWwowhAfACHBw3YxmDOXY3QyakgjhJLqc"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "115198584049-ack609b1338b827fta26s9rd2ab1aad5.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "115198584049-0efgfvm0oh9ap55g7epmqnjm27mq3j4e.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "chat.rocket.reactnative"
}
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:115198584049:android:8be27b1f7c42a2ed",
"android_client_info": {
"package_name": "chat.rocket.reactnative"
}
},
"oauth_client": [
{
"client_id": "115198584049-ack609b1338b827fta26s9rd2ab1aad5.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAWwowhAfACHBw3YxmDOXY3QyakgjhJLqc"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "115198584049-ack609b1338b827fta26s9rd2ab1aad5.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "115198584049-0efgfvm0oh9ap55g7epmqnjm27mq3j4e.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "chat.rocket.reactnative"
}
}
]
}
}
}
],
"configuration_version": "1"
}

View File

@ -1,4 +0,0 @@
<resources>
<string name="app_name">[DEBUG] Rocket.Chat Experimental</string>
<string name="share_extension_name">[DEBUG] Rocket.Chat Experimental</string>
</resources>

View File

@ -39,7 +39,9 @@ newArchEnabled=false
# Application ID
APPLICATION_ID=chat.rocket.reactnative
# App properties
VERSIONCODE=999999999
BugsnagAPIKey=""
VERSIONCODE=1
BugsnagAPIKey=""
KEYSTORE=my-upload-key.keystore
KEY_ALIAS=my-key-alias
KEYSTORE_PASSWORD=
KEY_PASSWORD=

View File

@ -1,5 +1,8 @@
{
"name": "RocketChatRN",
"share": "ShareRocketChatRN",
"displayName": "RocketChatRN"
"displayName": "RocketChatRN",
"server": "https://open.rocket.chat",
"appGroup": "group.ios.chat.rocket",
"appStoreID": "1272915472"
}

View File

@ -3,7 +3,7 @@ import RNBootSplash from 'react-native-bootsplash';
import { BIOMETRY_ENABLED_KEY, CURRENT_SERVER, TOKEN_KEY } from '../lib/constants';
import UserPreferences from '../lib/methods/userPreferences';
import { selectServerRequest } from '../actions/server';
import { selectServerRequest, serverRequest } from '../actions/server';
import { setAllPreferences } from '../actions/sortPreferences';
import { APP } from '../actions/actionsTypes';
import log from '../lib/methods/helpers/log';
@ -13,6 +13,8 @@ import { appReady, appStart } from '../actions/app';
import { RootEnum } from '../definitions';
import { getSortPreferences } from '../lib/methods';
import appConfig from '../../app.json';
export const initLocalSettings = function* initLocalSettings() {
const sortPreferences = getSortPreferences();
yield put(setAllPreferences(sortPreferences));
@ -22,8 +24,8 @@ const BIOMETRY_MIGRATION_KEY = 'kBiometryMigration';
const restore = function* restore() {
try {
const server = UserPreferences.getString(CURRENT_SERVER);
let userId = UserPreferences.getString(`${TOKEN_KEY}-${server}`);
// const server = UserPreferences.getString(CURRENT_SERVER);
// let userId = UserPreferences.getString(`${TOKEN_KEY}-${server}`);
// Migration biometry setting from WatermelonDB to MMKV
// TODO: remove it after a few versions
@ -37,23 +39,30 @@ const restore = function* restore() {
UserPreferences.setBool(BIOMETRY_MIGRATION_KEY, true);
}
if (!server) {
yield put(appStart({ root: RootEnum.ROOT_OUTSIDE }));
} else if (!userId) {
const serversDB = database.servers;
const serversCollection = serversDB.get('servers');
const servers = yield serversCollection.query().fetch();
// if (!server) {
// yield put(appStart({ root: RootEnum.ROOT_OUTSIDE }));
// } else if (!userId) {
// const serversDB = database.servers;
// const serversCollection = serversDB.get('servers');
// const servers = yield serversCollection.query().fetch();
// Check if there're other logged in servers and picks first one
if (servers.length > 0) {
for (let i = 0; i < servers.length; i += 1) {
const newServer = servers[i].id;
userId = UserPreferences.getString(`${TOKEN_KEY}-${newServer}`);
if (userId) {
return yield put(selectServerRequest(newServer));
}
}
}
// // Check if there're other logged in servers and picks first one
// if (servers.length > 0) {
// for (let i = 0; i < servers.length; i += 1) {
// const newServer = servers[i].id;
// userId = UserPreferences.getString(`${TOKEN_KEY}-${newServer}`);
// if (userId) {
// return yield put(selectServerRequest(newServer));
// }
// }
// }
const { server } = appConfig;
const userId = UserPreferences.getString(`${TOKEN_KEY}-${server}`);
if (!userId) {
UserPreferences.removeItem(TOKEN_KEY);
UserPreferences.removeItem(CURRENT_SERVER);
yield put(serverRequest(appConfig.server));
yield put(appStart({ root: RootEnum.ROOT_OUTSIDE }));
} else {
const serversDB = database.servers;

View File

@ -4,7 +4,7 @@ import { Q } from '@nozbe/watermelondb';
import * as types from '../actions/actionsTypes';
import { appStart } from '../actions/app';
import { selectServerRequest, serverFinishAdd } from '../actions/server';
import { selectServerRequest, serverFinishAdd, serverRequest } from '../actions/server';
import { loginFailure, loginSuccess, logout as logoutAction, setUser } from '../actions/login';
import { roomsRequest } from '../actions/rooms';
import log, { events, logEvent } from '../lib/methods/helpers/log';
@ -37,6 +37,8 @@ import {
} from '../lib/methods';
import { Services } from '../lib/services';
import appConfig from '../../app.json';
const getServer = state => state.server.server;
const loginWithPasswordCall = args => Services.loginWithPassword(args);
const loginCall = (credentials, isFromWebView) => Services.login(credentials, isFromWebView);
@ -211,33 +213,17 @@ const handleLogout = function* handleLogout({ forcedByServer, message }) {
try {
yield call(logoutCall, { server });
yield put(appStart({ root: RootEnum.ROOT_OUTSIDE }));
yield put(serverRequest(appConfig.server));
// if the user was logged out by the server
if (forcedByServer) {
yield put(appStart({ root: RootEnum.ROOT_OUTSIDE }));
// yield put(appStart({ root: RootEnum.ROOT_OUTSIDE }));
if (message) {
showErrorAlert(I18n.t(message), I18n.t('Oops'));
}
yield delay(300);
EventEmitter.emit('NewServer', { server });
} else {
const serversDB = database.servers;
// all servers
const serversCollection = serversDB.get('servers');
const servers = yield serversCollection.query().fetch();
// see if there're other logged in servers and selects first one
if (servers.length > 0) {
for (let i = 0; i < servers.length; i += 1) {
const newServer = servers[i].id;
const token = UserPreferences.getString(`${TOKEN_KEY}-${newServer}`);
if (token) {
yield put(selectServerRequest(newServer));
return;
}
}
}
// if there's no servers, go outside
yield put(appStart({ root: RootEnum.ROOT_OUTSIDE }));
}
} catch (e) {
yield put(appStart({ root: RootEnum.ROOT_OUTSIDE }));

View File

@ -5,7 +5,7 @@ import { connect } from 'react-redux';
import { ThemeContext } from '../theme';
import { ModalAnimation, StackAnimation, defaultHeader, themedHeader } from '../lib/methods/helpers/navigation';
// Outside Stack
import NewServerView from '../views/NewServerView';
// import NewServerView from '../views/NewServerView';
import WorkspaceView from '../views/WorkspaceView';
import LoginView from '../views/LoginView';
import ForgotPasswordView from '../views/ForgotPasswordView';
@ -22,7 +22,7 @@ const _OutsideStack = () => {
return (
<Outside.Navigator screenOptions={{ ...defaultHeader, ...themedHeader(theme), ...StackAnimation } as StackNavigationOptions}>
<Outside.Screen name='NewServerView' component={NewServerView} options={NewServerView.navigationOptions} />
{/* <Outside.Screen name='NewServerView' component={NewServerView} options={NewServerView.navigationOptions} /> */}
<Outside.Screen name='WorkspaceView' component={WorkspaceView} options={WorkspaceView.navigationOptions} />
<Outside.Screen name='LoginView' component={LoginView} options={LoginView.navigationOptions} />
<Outside.Screen name='ForgotPasswordView' component={ForgotPasswordView} />

View File

@ -3,7 +3,7 @@ import { StyleSheet, Text, TextInputProps, TouchableOpacity, TouchableOpacityPro
import I18n from '../../../i18n';
import sharedStyles from '../../Styles';
import { CustomIcon } from '../../../containers/CustomIcon';
// import { CustomIcon } from '../../../containers/CustomIcon';
import { isIOS, isTablet } from '../../../lib/methods/helpers';
import { useOrientation } from '../../../dimensions';
import { useTheme } from '../../../theme';
@ -49,11 +49,11 @@ const Header = React.memo(
isFetching,
serverName = 'Rocket.Chat',
server,
showServerDropdown,
// showServerDropdown,
showSearchHeader,
onSearchChangeText,
onPress
}: IRoomHeader) => {
onSearchChangeText
}: // onPress
IRoomHeader) => {
const { colors } = useTheme();
const { isLandscape } = useOrientation();
const scale = isIOS && isLandscape && !isTablet ? 0.8 : 1;
@ -75,28 +75,28 @@ const Header = React.memo(
}
return (
<View style={styles.container}>
<TouchableOpacity onPress={onPress} testID='rooms-list-header-server-dropdown-button'>
<View style={styles.button}>
<Text style={[styles.title, { fontSize: titleFontSize, color: colors.headerTitleColor }]} numberOfLines={1}>
{serverName}
</Text>
<CustomIcon
name='chevron-down'
color={colors.headerTintColor}
style={[showServerDropdown && styles.upsideDown]}
size={18}
/>
</View>
{subtitle ? (
<Text
testID='rooms-list-header-server-subtitle'
style={[styles.subtitle, { color: colors.auxiliaryText, fontSize: subTitleFontSize }]}
numberOfLines={1}
>
{subtitle}
</Text>
) : null}
</TouchableOpacity>
{/* <TouchableOpacity onPress={onPress} testID='rooms-list-header-server-dropdown-button'> */}
<View style={styles.button}>
<Text style={[styles.title, { fontSize: titleFontSize, color: colors.headerTitleColor }]} numberOfLines={1}>
{serverName}
</Text>
{/* <CustomIcon
name='chevron-down'
color={colors.headerTintColor}
style={[showServerDropdown && styles.upsideDown]}
size={18}
/> */}
</View>
{subtitle ? (
<Text
testID='rooms-list-header-server-subtitle'
style={[styles.subtitle, { color: colors.auxiliaryText, fontSize: subTitleFontSize }]}
numberOfLines={1}
>
{subtitle}
</Text>
) : null}
{/* </TouchableOpacity> */}
</View>
);
}

View File

@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>115198584049-0efgfvm0oh9ap55g7epmqnjm27mq3j4e.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.115198584049-0efgfvm0oh9ap55g7epmqnjm27mq3j4e</string>
<key>API_KEY</key>
<string>AIzaSyDEMLMz0En0vwFBlLSQkQ9oyhmCMPcpZxc</string>
<key>GCM_SENDER_ID</key>
<string>115198584049</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>chat.rocket.reactnative</string>
<key>PROJECT_ID</key>
<string>rocketchat-reactnative-test</string>
<key>STORAGE_BUCKET</key>
<string>rocketchat-reactnative-test.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:115198584049:ios:8be27b1f7c42a2ed</string>
<key>DATABASE_URL</key>
<string>https://rocketchat-reactnative-test.firebaseio.com</string>
</dict>
</plist>

View File

@ -47,7 +47,6 @@
1E598AE925151A63002BDFBD /* SendMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E598AE825151A63002BDFBD /* SendMessage.swift */; };
1E67380424DC529B0009E081 /* String+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E67380324DC529B0009E081 /* String+Extensions.swift */; };
1E680ED92512990700C9257A /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E680ED82512990700C9257A /* Request.swift */; };
1E6CC61F2513DBF400965591 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 7A006F13229C83B600803143 /* GoogleService-Info.plist */; };
1E76CBC2251529560067298C /* Storage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB8EF712510F1EE00F352B7 /* Storage.swift */; };
1E76CBC325152A460067298C /* String+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E67380324DC529B0009E081 /* String+Extensions.swift */; };
1E76CBC725152BFF0067298C /* Payload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E01C8262511303900FEF824 /* Payload.swift */; };
@ -75,7 +74,6 @@
1EC6ACBB22CB9FC300A41C61 /* ShareRocketChatRN.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 1EC6ACB022CB9FC300A41C61 /* ShareRocketChatRN.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
1EC6ACF622CBA01500A41C61 /* ShareRocketChatRN.m in Sources */ = {isa = PBXBuildFile; fileRef = 1EC6ACF522CBA01500A41C61 /* ShareRocketChatRN.m */; };
1ED00BB12513E04400A1331F /* ReplyNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ED00BB02513E04400A1331F /* ReplyNotification.swift */; };
1ED59D4C22CBA77D00C54289 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1ED59D4B22CBA77D00C54289 /* GoogleService-Info.plist */; };
1EF5FBD1250C109E00614FEA /* Encryption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EF5FBD0250C109E00614FEA /* Encryption.swift */; };
1EFEB5982493B6640072EDC0 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EFEB5972493B6640072EDC0 /* NotificationService.swift */; };
1EFEB59C2493B6640072EDC0 /* NotificationService.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 1EFEB5952493B6640072EDC0 /* NotificationService.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
@ -258,7 +256,6 @@
1EC6ACF522CBA01500A41C61 /* ShareRocketChatRN.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ShareRocketChatRN.m; sourceTree = "<group>"; };
1EC6AD6022CBA20C00A41C61 /* ShareRocketChatRN.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ShareRocketChatRN.entitlements; sourceTree = "<group>"; };
1ED00BB02513E04400A1331F /* ReplyNotification.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReplyNotification.swift; sourceTree = "<group>"; };
1ED59D4B22CBA77D00C54289 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = SOURCE_ROOT; };
1EF5FBD0250C109E00614FEA /* Encryption.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Encryption.swift; sourceTree = "<group>"; };
1EFEB5952493B6640072EDC0 /* NotificationService.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = NotificationService.appex; sourceTree = BUILT_PRODUCTS_DIR; };
1EFEB5972493B6640072EDC0 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
@ -358,7 +355,6 @@
13B07FAE1A68108700A75B9A /* RocketChatRN */ = {
isa = PBXGroup;
children = (
7A006F13229C83B600803143 /* GoogleService-Info.plist */,
60B2A6A31FC4588700BD58E5 /* RocketChatRN.entitlements */,
008F07F21AC5B25A0029DE68 /* main.jsbundle */,
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
@ -457,7 +453,6 @@
1EC6ACB122CB9FC300A41C61 /* ShareRocketChatRN */ = {
isa = PBXGroup;
children = (
1ED59D4B22CBA77D00C54289 /* GoogleService-Info.plist */,
1EC6AD6022CBA20C00A41C61 /* ShareRocketChatRN.entitlements */,
1EC6ACB522CB9FC300A41C61 /* MainInterface.storyboard */,
1EC6ACB822CB9FC300A41C61 /* Info.plist */,
@ -1654,7 +1649,7 @@
"$(inherited)",
"$(SRCROOT)/../node_modules/rn-extensions-share/ios/**",
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/**",
"$PODS_CONFIGURATION_BUILD_DIR/Firebase",
$PODS_CONFIGURATION_BUILD_DIR/Firebase,
);
INFOPLIST_FILE = ShareRocketChatRN/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
@ -1722,7 +1717,7 @@
"$(inherited)",
"$(SRCROOT)/../node_modules/rn-extensions-share/ios/**",
"$(SRCROOT)/../node_modules/react-native-firebase/ios/RNFirebase/**",
"$PODS_CONFIGURATION_BUILD_DIR/Firebase",
$PODS_CONFIGURATION_BUILD_DIR/Firebase,
);
INFOPLIST_FILE = ShareRocketChatRN/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;