Skip to content

Commit 3098213

Browse files
committed
realm [nfc]: Move proxy boilerplate out of central store.dart
1 parent 5efff58 commit 3098213

File tree

2 files changed

+37
-27
lines changed

2 files changed

+37
-27
lines changed

lib/model/realm.dart

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'package:flutter/foundation.dart';
2+
13
import '../api/model/events.dart';
24
import '../api/model/initial_snapshot.dart';
35
import '../api/model/model.dart';
@@ -34,6 +36,38 @@ mixin RealmStore {
3436
EmailAddressVisibility? get emailAddressVisibility;
3537
}
3638

39+
mixin ProxyRealmStore on RealmStore {
40+
@protected
41+
RealmStore get realmStore;
42+
43+
@override
44+
int get serverPresencePingIntervalSeconds => realmStore.serverPresencePingIntervalSeconds;
45+
@override
46+
int get serverPresenceOfflineThresholdSeconds => realmStore.serverPresenceOfflineThresholdSeconds;
47+
@override
48+
RealmWildcardMentionPolicy get realmWildcardMentionPolicy => realmStore.realmWildcardMentionPolicy;
49+
@override
50+
bool get realmMandatoryTopics => realmStore.realmMandatoryTopics;
51+
@override
52+
int get realmWaitingPeriodThreshold => realmStore.realmWaitingPeriodThreshold;
53+
@override
54+
bool get realmAllowMessageEditing => realmStore.realmAllowMessageEditing;
55+
@override
56+
int? get realmMessageContentEditLimitSeconds => realmStore.realmMessageContentEditLimitSeconds;
57+
@override
58+
bool get realmPresenceDisabled => realmStore.realmPresenceDisabled;
59+
@override
60+
int get maxFileUploadSizeMib => realmStore.maxFileUploadSizeMib;
61+
@override
62+
String get realmEmptyTopicDisplayName => realmStore.realmEmptyTopicDisplayName;
63+
@override
64+
Map<String, RealmDefaultExternalAccount> get realmDefaultExternalAccounts => realmStore.realmDefaultExternalAccounts;
65+
@override
66+
List<CustomProfileField> get customProfileFields => realmStore.customProfileFields;
67+
@override
68+
EmailAddressVisibility? get emailAddressVisibility => realmStore.emailAddressVisibility;
69+
}
70+
3771
/// The implementation of [RealmStore] that does the work.
3872
class RealmStoreImpl extends PerAccountStoreBase with RealmStore {
3973
RealmStoreImpl({

lib/model/store.dart

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ Uri? tryResolveUrl(Uri baseUrl, String reference) {
438438
class PerAccountStore extends PerAccountStoreBase with
439439
ChangeNotifier,
440440
UserGroupStore, ProxyUserGroupStore,
441-
RealmStore,
441+
RealmStore, ProxyRealmStore,
442442
EmojiStore,
443443
SavedSnippetStore,
444444
UserStore,
@@ -579,33 +579,9 @@ class PerAccountStore extends PerAccountStoreBase with
579579
UserGroupStore get userGroupStore => _groups;
580580
final UserGroupStoreImpl _groups;
581581

582+
@protected
582583
@override
583-
int get serverPresencePingIntervalSeconds => _realm.serverPresencePingIntervalSeconds;
584-
@override
585-
int get serverPresenceOfflineThresholdSeconds => _realm.serverPresenceOfflineThresholdSeconds;
586-
@override
587-
RealmWildcardMentionPolicy get realmWildcardMentionPolicy => _realm.realmWildcardMentionPolicy;
588-
@override
589-
bool get realmMandatoryTopics => _realm.realmMandatoryTopics;
590-
@override
591-
int get realmWaitingPeriodThreshold => _realm.realmWaitingPeriodThreshold;
592-
@override
593-
bool get realmAllowMessageEditing => _realm.realmAllowMessageEditing;
594-
@override
595-
int? get realmMessageContentEditLimitSeconds => _realm.realmMessageContentEditLimitSeconds;
596-
@override
597-
bool get realmPresenceDisabled => _realm.realmPresenceDisabled;
598-
@override
599-
int get maxFileUploadSizeMib => _realm.maxFileUploadSizeMib;
600-
@override
601-
String get realmEmptyTopicDisplayName => _realm.realmEmptyTopicDisplayName;
602-
@override
603-
Map<String, RealmDefaultExternalAccount> get realmDefaultExternalAccounts => _realm.realmDefaultExternalAccounts;
604-
@override
605-
List<CustomProfileField> get customProfileFields => _realm.customProfileFields;
606-
@override
607-
EmailAddressVisibility? get emailAddressVisibility => _realm.emailAddressVisibility;
608-
584+
RealmStore get realmStore => _realm;
609585
final RealmStoreImpl _realm;
610586

611587
////////////////////////////////

0 commit comments

Comments
 (0)