@@ -12,6 +12,9 @@ import 'store.dart';
12
12
/// * [RealmStoreImpl] for the implementation of this that does the work.
13
13
/// * [HasRealmStore] for an implementation useful for other substores.
14
14
mixin RealmStore on PerAccountStoreBase {
15
+ //|//////////////////////////////////////////////////////////////
16
+ // Server settings, explicitly so named.
17
+
15
18
Duration get serverPresencePingInterval => Duration (seconds: serverPresencePingIntervalSeconds);
16
19
int get serverPresencePingIntervalSeconds;
17
20
Duration get serverPresenceOfflineThreshold => Duration (seconds: serverPresenceOfflineThresholdSeconds);
@@ -24,17 +27,35 @@ mixin RealmStore on PerAccountStoreBase {
24
27
Duration get serverTypingStartedWaitPeriod => Duration (milliseconds: serverTypingStartedWaitPeriodMilliseconds);
25
28
int get serverTypingStartedWaitPeriodMilliseconds;
26
29
27
- RealmWildcardMentionPolicy get realmWildcardMentionPolicy;
28
- bool get realmMandatoryTopics;
29
- /// For docs, please see [InitialSnapshot.realmWaitingPeriodThreshold] .
30
- int get realmWaitingPeriodThreshold;
30
+ //|//////////////////////////////////////////////////////////////
31
+ // Realm settings.
32
+
33
+ //|//////////////////////////////
34
+ // Realm settings found in realm/update_dict events:
35
+ // https://zulip.com/api/get-events#realm-update_dict
36
+ // TODO(#668): update all these realm settings on events.
37
+
31
38
bool get realmAllowMessageEditing;
39
+ bool get realmMandatoryTopics;
40
+ int get maxFileUploadSizeMib;
32
41
Duration ? get realmMessageContentEditLimit =>
33
42
realmMessageContentEditLimitSeconds == null ? null
34
43
: Duration (seconds: realmMessageContentEditLimitSeconds! );
35
44
int ? get realmMessageContentEditLimitSeconds;
36
45
bool get realmPresenceDisabled;
37
- int get maxFileUploadSizeMib;
46
+ int get realmWaitingPeriodThreshold;
47
+
48
+ //|//////////////////////////////
49
+ // Realm settings previously found in realm/update_dict events,
50
+ // but now deprecated.
51
+
52
+ RealmWildcardMentionPolicy get realmWildcardMentionPolicy; // TODO(#662): replaced by can_mention_many_users_group
53
+
54
+ EmailAddressVisibility ? get emailAddressVisibility; // TODO: replaced at FL-163 by a user setting
55
+
56
+ //|//////////////////////////////
57
+ // Realm settings that lack events.
58
+ // (Each of these is probably secretly a server setting.)
38
59
39
60
/// The display name to use for empty topics.
40
61
///
@@ -44,9 +65,14 @@ mixin RealmStore on PerAccountStoreBase {
44
65
String get realmEmptyTopicDisplayName;
45
66
46
67
Map <String , RealmDefaultExternalAccount > get realmDefaultExternalAccounts;
68
+
69
+ //|//////////////////////////////
70
+ // Realm settings with their own events.
71
+
47
72
List <CustomProfileField > get customProfileFields;
48
- /// For docs, please see [InitialSnapshot.emailAddressVisibility] .
49
- EmailAddressVisibility ? get emailAddressVisibility;
73
+
74
+ //|//////////////////////////////////////////////////////////////
75
+ // Methods that examine the settings.
50
76
51
77
/// Process the given topic to match how it would appear
52
78
/// on a message object from the server.
@@ -109,27 +135,27 @@ mixin ProxyRealmStore on RealmStore {
109
135
@override
110
136
int get serverTypingStartedWaitPeriodMilliseconds => realmStore.serverTypingStartedWaitPeriodMilliseconds;
111
137
@override
112
- RealmWildcardMentionPolicy get realmWildcardMentionPolicy => realmStore.realmWildcardMentionPolicy ;
138
+ bool get realmAllowMessageEditing => realmStore.realmAllowMessageEditing ;
113
139
@override
114
140
bool get realmMandatoryTopics => realmStore.realmMandatoryTopics;
115
141
@override
116
- int get realmWaitingPeriodThreshold => realmStore.realmWaitingPeriodThreshold;
117
- @override
118
- bool get realmAllowMessageEditing => realmStore.realmAllowMessageEditing;
142
+ int get maxFileUploadSizeMib => realmStore.maxFileUploadSizeMib;
119
143
@override
120
144
int ? get realmMessageContentEditLimitSeconds => realmStore.realmMessageContentEditLimitSeconds;
121
145
@override
122
146
bool get realmPresenceDisabled => realmStore.realmPresenceDisabled;
123
147
@override
124
- int get maxFileUploadSizeMib => realmStore.maxFileUploadSizeMib;
148
+ int get realmWaitingPeriodThreshold => realmStore.realmWaitingPeriodThreshold;
149
+ @override
150
+ RealmWildcardMentionPolicy get realmWildcardMentionPolicy => realmStore.realmWildcardMentionPolicy;
151
+ @override
152
+ EmailAddressVisibility ? get emailAddressVisibility => realmStore.emailAddressVisibility;
125
153
@override
126
154
String get realmEmptyTopicDisplayName => realmStore.realmEmptyTopicDisplayName;
127
155
@override
128
156
Map <String , RealmDefaultExternalAccount > get realmDefaultExternalAccounts => realmStore.realmDefaultExternalAccounts;
129
157
@override
130
158
List <CustomProfileField > get customProfileFields => realmStore.customProfileFields;
131
- @override
132
- EmailAddressVisibility ? get emailAddressVisibility => realmStore.emailAddressVisibility;
133
159
}
134
160
135
161
/// A base class for [PerAccountStore] substores that need access to [RealmStore]
@@ -154,17 +180,17 @@ class RealmStoreImpl extends PerAccountStoreBase with RealmStore {
154
180
serverTypingStartedExpiryPeriodMilliseconds = initialSnapshot.serverTypingStartedExpiryPeriodMilliseconds,
155
181
serverTypingStoppedWaitPeriodMilliseconds = initialSnapshot.serverTypingStoppedWaitPeriodMilliseconds,
156
182
serverTypingStartedWaitPeriodMilliseconds = initialSnapshot.serverTypingStartedWaitPeriodMilliseconds,
157
- realmWildcardMentionPolicy = initialSnapshot.realmWildcardMentionPolicy ,
183
+ realmAllowMessageEditing = initialSnapshot.realmAllowMessageEditing ,
158
184
realmMandatoryTopics = initialSnapshot.realmMandatoryTopics,
159
- realmWaitingPeriodThreshold = initialSnapshot.realmWaitingPeriodThreshold,
160
- realmPresenceDisabled = initialSnapshot.realmPresenceDisabled,
161
185
maxFileUploadSizeMib = initialSnapshot.maxFileUploadSizeMib,
162
- _realmEmptyTopicDisplayName = initialSnapshot.realmEmptyTopicDisplayName,
163
- realmAllowMessageEditing = initialSnapshot.realmAllowMessageEditing,
164
186
realmMessageContentEditLimitSeconds = initialSnapshot.realmMessageContentEditLimitSeconds,
187
+ realmPresenceDisabled = initialSnapshot.realmPresenceDisabled,
188
+ realmWaitingPeriodThreshold = initialSnapshot.realmWaitingPeriodThreshold,
189
+ realmWildcardMentionPolicy = initialSnapshot.realmWildcardMentionPolicy,
190
+ emailAddressVisibility = initialSnapshot.emailAddressVisibility,
191
+ _realmEmptyTopicDisplayName = initialSnapshot.realmEmptyTopicDisplayName,
165
192
realmDefaultExternalAccounts = initialSnapshot.realmDefaultExternalAccounts,
166
- customProfileFields = _sortCustomProfileFields (initialSnapshot.customProfileFields),
167
- emailAddressVisibility = initialSnapshot.emailAddressVisibility;
193
+ customProfileFields = _sortCustomProfileFields (initialSnapshot.customProfileFields);
168
194
169
195
@override
170
196
final int serverPresencePingIntervalSeconds;
@@ -179,19 +205,23 @@ class RealmStoreImpl extends PerAccountStoreBase with RealmStore {
179
205
final int serverTypingStartedWaitPeriodMilliseconds;
180
206
181
207
@override
182
- final RealmWildcardMentionPolicy realmWildcardMentionPolicy ; // TODO(#668): update this realm setting
208
+ final bool realmAllowMessageEditing ; // TODO(#668): update this realm setting
183
209
@override
184
210
final bool realmMandatoryTopics; // TODO(#668): update this realm setting
185
211
@override
186
- final int realmWaitingPeriodThreshold; // TODO(#668): update this realm setting
187
- @override
188
- final bool realmAllowMessageEditing; // TODO(#668): update this realm setting
212
+ final int maxFileUploadSizeMib; // No event for this.
189
213
@override
190
214
final int ? realmMessageContentEditLimitSeconds; // TODO(#668): update this realm setting
191
215
@override
192
216
final bool realmPresenceDisabled; // TODO(#668): update this realm setting
193
217
@override
194
- final int maxFileUploadSizeMib; // No event for this.
218
+ final int realmWaitingPeriodThreshold; // TODO(#668): update this realm setting
219
+
220
+ @override
221
+ final RealmWildcardMentionPolicy realmWildcardMentionPolicy; // TODO(#668): update this realm setting
222
+
223
+ @override
224
+ final EmailAddressVisibility ? emailAddressVisibility; // TODO(#668): update this realm setting
195
225
196
226
@override
197
227
String get realmEmptyTopicDisplayName {
@@ -222,9 +252,6 @@ class RealmStoreImpl extends PerAccountStoreBase with RealmStore {
222
252
return displayFields.followedBy (nonDisplayFields).toList ();
223
253
}
224
254
225
- @override
226
- final EmailAddressVisibility ? emailAddressVisibility; // TODO(#668): update this realm setting
227
-
228
255
void handleCustomProfileFieldsEvent (CustomProfileFieldsEvent event) {
229
256
customProfileFields = _sortCustomProfileFields (event.fields);
230
257
}
0 commit comments