forked from zulip/zulip-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdirectSelectors.js
94 lines (64 loc) · 3.23 KB
/
directSelectors.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* @flow strict-local */
import type {
GlobalState,
DraftState,
FetchingState,
FlagsState,
LoadingState,
MessagesState,
MuteState,
NarrowsState,
TopicsState,
PresenceState,
RealmBot,
RealmEmojiState,
RealmState,
SettingsState,
StreamUnreadItem,
TypingState,
UnreadHuddlesState,
UnreadMentionsState,
UnreadPmsState,
Account,
Debug,
Subscription,
Stream,
Outbox,
User,
UserGroup,
} from './types';
import type { SessionState } from './session/sessionReducers';
export const getAccounts = (state: GlobalState): Account[] => state.accounts;
export const getSession = (state: GlobalState): SessionState => state.session;
export const getIsActive = (state: GlobalState): boolean => state.session.isActive;
export const getIsOnline = (state: GlobalState): boolean => state.session.isOnline;
export const getDebug = (state: GlobalState): Debug => state.session.debug;
export const getIsHydrated = (state: GlobalState): boolean => state.session.isHydrated;
export const getCanCreateStreams = (state: GlobalState): boolean => state.realm.canCreateStreams;
export const getDrafts = (state: GlobalState): DraftState => state.drafts;
export const getLoading = (state: GlobalState): LoadingState => state.loading;
export const getMessages = (state: GlobalState): MessagesState => state.messages;
export const getMute = (state: GlobalState): MuteState => state.mute;
export const getTyping = (state: GlobalState): TypingState => state.typing;
export const getTopics = (state: GlobalState): TopicsState => state.topics;
export const getUserGroups = (state: GlobalState): UserGroup[] => state.userGroups;
export const getUsers = (state: GlobalState): User[] => state.users;
export const getFetching = (state: GlobalState): FetchingState => state.fetching;
export const getFlags = (state: GlobalState): FlagsState => state.flags;
export const getReadFlags = (state: GlobalState): { [messageId: number]: boolean } =>
state.flags.read;
export const getAllNarrows = (state: GlobalState): NarrowsState => state.narrows;
export const getSettings = (state: GlobalState): SettingsState => state.settings;
export const getSubscriptions = (state: GlobalState): Subscription[] => state.subscriptions;
export const getStreams = (state: GlobalState): Stream[] => state.streams;
export const getPresence = (state: GlobalState): PresenceState => state.presence;
export const getOutbox = (state: GlobalState): Outbox[] => state.outbox;
export const getUnreadStreams = (state: GlobalState): StreamUnreadItem[] => state.unread.streams;
export const getUnreadPms = (state: GlobalState): UnreadPmsState => state.unread.pms;
export const getUnreadHuddles = (state: GlobalState): UnreadHuddlesState => state.unread.huddles;
export const getUnreadMentions = (state: GlobalState): UnreadMentionsState => state.unread.mentions;
export const getRealm = (state: GlobalState): RealmState => state.realm;
export const getCrossRealmBots = (state: GlobalState): RealmBot[] => state.realm.crossRealmBots;
export const getRawRealmEmoji = (state: GlobalState): RealmEmojiState => state.realm.emoji;
export const getNonActiveUsers = (state: GlobalState): User[] => state.realm.nonActiveUsers;
export const getIsAdmin = (state: GlobalState): boolean => state.realm.isAdmin;