Files
mattermost-mobile/app/database/subscription/servers.ts
Elias Nahum 5b9492356b Gekidou MultiServers second part (#5963)
* Edit Server display name

* Lock iPhone to portrait and iPad to landscape

* Create actions for app global to store device token and multi server tutorial

* Add MutliServer tutorial on first use

* WebSocket reconnection priority

* have isRecordGlobalEqualToRaw to not check for value

* Return early on edit server if error is found

* Prepopulate server screen with last logged out server address and name

* Add CompassIcon to circleCI asset generation
2022-02-17 10:42:06 -03:00

31 lines
960 B
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {Q} from '@nozbe/watermelondb';
import {MM_TABLES} from '@constants/database';
import DatabaseManager from '@database/manager';
import type ServersModel from '@typings/database/models/app/servers';
const {SERVERS} = MM_TABLES.APP;
export const subscribeActiveServers = (observer: (servers: ServersModel[]) => void) => {
const db = DatabaseManager.appDatabase?.database;
return db?.
get(SERVERS).
query(Q.where('identifier', Q.notEq(''))).
observeWithColumns(['display_name', 'last_active_at']).
subscribe(observer);
};
export const subscribeAllServers = (observer: (servers: ServersModel[]) => void) => {
const db = DatabaseManager.appDatabase?.database;
return db?.
get(SERVERS).
query().
observeWithColumns(['last_active_at']).
subscribe(observer);
};