@@ -29,58 +29,67 @@ import { UserTab } from "../../../dialogs/UserTab";
29
29
import { OpenToTabPayload } from "../../../../../dispatcher/payloads/OpenToTabPayload" ;
30
30
import { Action } from "../../../../../dispatcher/actions" ;
31
31
import SdkConfig from "../../../../../SdkConfig" ;
32
+ import { MatrixClientPeg } from "../../../../../MatrixClientPeg" ;
32
33
import { showUserOnboardingPage } from "../../../user-onboarding/UserOnboardingPage" ;
33
34
34
35
interface IProps {
35
36
closeSettingsFn ( success : boolean ) : void ;
36
37
}
37
38
38
39
interface IState {
40
+ disablingReadReceiptsSupported : boolean ;
39
41
autocompleteDelay : string ;
40
42
readMarkerInViewThresholdMs : string ;
41
43
readMarkerOutOfViewThresholdMs : string ;
42
44
}
43
45
44
46
export default class PreferencesUserSettingsTab extends React . Component < IProps , IState > {
45
- static ROOM_LIST_SETTINGS = [
47
+ private static ROOM_LIST_SETTINGS = [
46
48
'breadcrumbs' ,
47
49
] ;
48
50
49
- static SPACES_SETTINGS = [
51
+ private static SPACES_SETTINGS = [
50
52
"Spaces.allRoomsInHome" ,
51
53
] ;
52
54
53
- static KEYBINDINGS_SETTINGS = [
55
+ private static KEYBINDINGS_SETTINGS = [
54
56
'ctrlFForSearch' ,
55
57
] ;
56
58
57
- static COMPOSER_SETTINGS = [
59
+ private static PRESENCE_SETTINGS = [
60
+ "sendTypingNotifications" ,
61
+ // sendReadReceipts - handled specially due to server needing support
62
+ ] ;
63
+
64
+ private static COMPOSER_SETTINGS = [
58
65
'MessageComposerInput.autoReplaceEmoji' ,
59
66
'MessageComposerInput.useMarkdown' ,
60
67
'MessageComposerInput.suggestEmoji' ,
61
- 'sendTypingNotifications' ,
62
68
'MessageComposerInput.ctrlEnterToSend' ,
63
69
'MessageComposerInput.surroundWith' ,
64
70
'MessageComposerInput.showStickersButton' ,
65
71
'MessageComposerInput.insertTrailingColon' ,
66
72
] ;
67
73
68
- static TIME_SETTINGS = [
74
+ private static TIME_SETTINGS = [
69
75
'showTwelveHourTimestamps' ,
70
76
'alwaysShowTimestamps' ,
71
77
] ;
72
- static CODE_BLOCKS_SETTINGS = [
78
+
79
+ private static CODE_BLOCKS_SETTINGS = [
73
80
'enableSyntaxHighlightLanguageDetection' ,
74
81
'expandCodeByDefault' ,
75
82
'showCodeLineNumbers' ,
76
83
] ;
77
- static IMAGES_AND_VIDEOS_SETTINGS = [
84
+
85
+ private static IMAGES_AND_VIDEOS_SETTINGS = [
78
86
'urlPreviewsEnabled' ,
79
87
'autoplayGifs' ,
80
88
'autoplayVideo' ,
81
89
'showImages' ,
82
90
] ;
83
- static TIMELINE_SETTINGS = [
91
+
92
+ private static TIMELINE_SETTINGS = [
84
93
'showTypingNotifications' ,
85
94
'showRedactions' ,
86
95
'showReadReceipts' ,
@@ -93,7 +102,8 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
93
102
'scrollToBottomOnMessageSent' ,
94
103
'useOnlyCurrentProfiles' ,
95
104
] ;
96
- static GENERAL_SETTINGS = [
105
+
106
+ private static GENERAL_SETTINGS = [
97
107
'promptBeforeInviteUnknownUsers' ,
98
108
// Start automatically after startup (electron-only)
99
109
// Autocomplete delay (niche text box)
@@ -103,6 +113,7 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
103
113
super ( props ) ;
104
114
105
115
this . state = {
116
+ disablingReadReceiptsSupported : false ,
106
117
autocompleteDelay :
107
118
SettingsStore . getValueAt ( SettingLevel . DEVICE , 'autocompleteDelay' ) . toString ( 10 ) ,
108
119
readMarkerInViewThresholdMs :
@@ -112,6 +123,15 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
112
123
} ;
113
124
}
114
125
126
+ public async componentDidMount ( ) : Promise < void > {
127
+ this . setState ( {
128
+ disablingReadReceiptsSupported : (
129
+ await MatrixClientPeg . get ( ) . doesServerSupportUnstableFeature ( "org.matrix.msc2285.stable" ) ||
130
+ await MatrixClientPeg . get ( ) . doesServerSupportUnstableFeature ( "org.matrix.msc2285" )
131
+ ) ,
132
+ } ) ;
133
+ }
134
+
115
135
private onAutocompleteDelayChange = ( e : React . ChangeEvent < HTMLInputElement > ) => {
116
136
this . setState ( { autocompleteDelay : e . target . value } ) ;
117
137
SettingsStore . setValue ( "autocompleteDelay" , null , SettingLevel . DEVICE , e . target . value ) ;
@@ -185,6 +205,20 @@ export default class PreferencesUserSettingsTab extends React.Component<IProps,
185
205
{ this . renderGroup ( PreferencesUserSettingsTab . TIME_SETTINGS ) }
186
206
</ div >
187
207
208
+ < div className = "mx_SettingsTab_section" >
209
+ < span className = "mx_SettingsTab_subheading" > { _t ( "Presence" ) } </ span >
210
+ < span className = "mx_SettingsTab_subsectionText" >
211
+ { _t ( "Share your activity and status with others." ) }
212
+ </ span >
213
+ < SettingsFlag
214
+ disabled = { ! this . state . disablingReadReceiptsSupported }
215
+ disabledDescription = { _t ( "Your server doesn't support disabling sending read receipts." ) }
216
+ name = "sendReadReceipts"
217
+ level = { SettingLevel . ACCOUNT }
218
+ />
219
+ { this . renderGroup ( PreferencesUserSettingsTab . PRESENCE_SETTINGS ) }
220
+ </ div >
221
+
188
222
< div className = "mx_SettingsTab_section" >
189
223
< span className = "mx_SettingsTab_subheading" > { _t ( "Composer" ) } </ span >
190
224
{ this . renderGroup ( PreferencesUserSettingsTab . COMPOSER_SETTINGS ) }
0 commit comments