forked from Ivasoft/mattermost-mobile
Gekidou servers (#5960)
* Servers logout and websocket state * addNewServer uility and rename file * add LaunchType for add new server * added time to LaunchProps type * Remove unnecessary props for launchToHome * Fix local action updateLastPostAt * Batch fetchProfilesPerChannels requests in chunks of 50 * WS handleUserAddedToChannelEvent to return early if no channelId is set * WS handleNewPostEvent to batch update last_post_at * add common actions to sync other servers * Entry actions to sync other servers data * Do not attempt to fetch notification data if payload does not contain a channelId * Set database as default at the end of the login flow * Handle logout when other servers remain * Handle Server options * Show alert when logging out from the account screen * Add workaround to have Lottie animate the loading component * Fix badge position in ServerIcon component * Server screen to support adding new server * Fix login screen to display error when credentials do not match * add localization strings * fix DatabaseProvider to update on server switch * Fix home icon and server icon subscriptions and badge display * Add dependencies to onLogout callback * feedback * Only updateLastPostAt if needed
This commit is contained in:
@@ -29,14 +29,16 @@ export function withServerDatabase<T>(Component: ComponentType<T>): ComponentTyp
|
||||
) : undefined;
|
||||
|
||||
if (server) {
|
||||
const serverDatabase =
|
||||
DatabaseManager.serverDatabases[server?.url]?.database;
|
||||
const database =
|
||||
DatabaseManager.serverDatabases[server.url]?.database;
|
||||
|
||||
setState({
|
||||
database: serverDatabase,
|
||||
serverUrl: server?.url,
|
||||
serverDisplayName: server?.displayName,
|
||||
});
|
||||
if (database) {
|
||||
setState({
|
||||
database,
|
||||
serverUrl: server.url,
|
||||
serverDisplayName: server.displayName,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
setState(undefined);
|
||||
}
|
||||
@@ -55,7 +57,10 @@ export function withServerDatabase<T>(Component: ComponentType<T>): ComponentTyp
|
||||
}
|
||||
|
||||
return (
|
||||
<DatabaseProvider database={state.database}>
|
||||
<DatabaseProvider
|
||||
database={state.database}
|
||||
key={state.serverUrl}
|
||||
>
|
||||
<UserLocaleProvider database={state.database}>
|
||||
<ServerProvider server={{displayName: state.serverDisplayName, url: state.serverUrl}}>
|
||||
<ThemeProvider database={state.database}>
|
||||
|
||||
@@ -376,9 +376,9 @@ class DatabaseManager {
|
||||
const databaseShm = `${androidFilesDir}${databaseName}.db-shm`;
|
||||
const databaseWal = `${androidFilesDir}${databaseName}.db-wal`;
|
||||
|
||||
FileSystem.deleteAsync(databaseFile);
|
||||
FileSystem.deleteAsync(databaseShm);
|
||||
FileSystem.deleteAsync(databaseWal);
|
||||
FileSystem.deleteAsync(databaseFile, {idempotent: true});
|
||||
FileSystem.deleteAsync(databaseShm, {idempotent: true});
|
||||
FileSystem.deleteAsync(databaseWal, {idempotent: true});
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user