feat(chat): quick reactions from the account setting like Teams
- hover bar shows defaultMessageReactions from chatsvc users/ME/properties, Teams default like/heart/laugh/surprised when unset, toned with preferredSkinToneIndex - "Customise default reactions" button in the reaction picker opens Teams' dialog (5 slots, remove, skin tone, Save disabled while unchanged) - save writes PUT users/ME/properties?name=defaultMessageReactions with the JSON string value, demo mode stays local - deviation: slot remove is a corner button instead of Teams' hover popover Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -0,0 +1,127 @@
1
use gpui_kit::Context;
2
3
use crate::app_state::AppState;
4
use crate::emoticons;
5
6
pub fn quick_reaction_glyphs(reaction_ids: &[String], skin_tone: u8) -> Vec<String> {
7
reaction_ids
8
.iter()
9
.filter_map(|reaction_id| chatsvc::reaction_glyph_for_key(reaction_id))
10
.map(|glyph| emoticons::with_tone(&glyph, skin_tone))
11
.collect()
12
}
13
14
pub fn reaction_id_for_glyph(glyph: &str) -> Option<String> {
15
chatsvc::reaction_key(&emoticons::without_tone(glyph))
16
}
17
18
pub fn slots_for(reaction_ids: &[String]) -> Vec<Option<String>> {
19
let length = reaction_ids.len().max(teams_core::DEFAULT_REACTION_SLOTS);
20
(0..length)
21
.map(|index| reaction_ids.get(index).cloned())
22
.collect()
23
}
24
25
/// Teams' replace rule: an id already in another slot leaves that slot empty.
26
pub fn place_in_slot(slots: &mut [Option<String>], index: usize, reaction_id: String) {
27
for slot in slots.iter_mut() {
28
if slot.as_deref() == Some(reaction_id.as_str()) {
29
*slot = None;
30
}
31
}
32
if let Some(slot) = slots.get_mut(index) {
33
*slot = Some(reaction_id);
34
}
35
}
36
37
pub fn filled(slots: &[Option<String>]) -> Vec<String> {
38
slots.iter().flatten().cloned().collect()
39
}
40
41
impl AppState {
42
pub fn default_reactions(&self) -> Vec<String> {
43
teams_core::default_reactions(&self.store)
44
}
45
46
pub fn quick_reactions(&self) -> Vec<String> {
47
quick_reaction_glyphs(
48
&self.default_reactions(),
49
teams_core::skin_tone(&self.store),
50
)
51
}
52
53
pub fn set_default_reactions(&mut self, reaction_ids: Vec<String>, cx: &mut Context<Self>) {
54
let Some(engine_or_demo) = self.chat_action_engine(cx) else {
55
return;
56
};
57
let previous = self.default_reactions();
58
let _ = teams_core::store_account_default_reactions(&self.store, Some(&reaction_ids));
59
cx.notify();
60
let Some(engine) = engine_or_demo else {
61
return;
62
};
63
self.run_chat_action(
64
"Customising default reactions",
65
async move { engine.set_default_reactions(&reaction_ids).await },
66
move |state, cx| {
67
let _ = teams_core::store_account_default_reactions(&state.store, Some(&previous));
68
cx.notify();
69
},
70
|_, _| {},
71
cx,
72
);
73
}
74
}
75
76
#[cfg(test)]
77
mod tests {
78
use super::*;
79
80
fn ids(values: &[&str]) -> Vec<String> {
81
values.iter().map(|value| (*value).to_owned()).collect()
82
}
83
84
#[test]
85
fn teams_defaults_show_as_glyphs_and_like_takes_the_tone() {
86
let defaults = ids(&teams_core::TEAMS_DEFAULT_REACTIONS);
87
assert_eq!(
88
quick_reaction_glyphs(&defaults, 0),
89
["\u{1F44D}", "\u{2764}", "\u{1F606}", "\u{1F62E}"]
90
);
91
assert_eq!(quick_reaction_glyphs(&defaults, 2)[0], "\u{1F44D}\u{1F3FC}");
92
assert_eq!(
93
chatsvc::reaction_key(&quick_reaction_glyphs(&defaults, 2)[0]).as_deref(),
94
Some("yes-tone2")
95
);
96
}
97
98
#[test]
99
fn unknown_ids_are_left_out() {
100
assert_eq!(
101
quick_reaction_glyphs(&ids(&["heart", "custom-gone"]), 0),
102
["\u{2764}"]
103
);
104
}
105
106
#[test]
107
fn picked_glyphs_store_the_untoned_id() {
108
assert_eq!(
109
reaction_id_for_glyph("\u{1F44D}\u{1F3FC}").as_deref(),
110
Some("like")
111
);
112
assert_eq!(
113
reaction_id_for_glyph("\u{2764}\u{FE0F}").as_deref(),
114
Some("heart")
115
);
116
}
117
118
#[test]
119
fn there_are_always_five_slots_and_a_repeat_moves() {
120
let mut slots = slots_for(&ids(&["like", "heart"]));
121
assert_eq!(slots.len(), 5);
122
place_in_slot(&mut slots, 3, "like".to_owned());
123
assert_eq!(filled(&slots), ["heart", "like"]);
124
assert_eq!(slots[0], None);
125
assert_eq!(slots_for(&ids(&["a", "b", "c", "d", "e", "f"])).len(), 6);
126
}
127
}
@@ -0,0 +1,127 @@1
use gpui_kit::Context;2
3
use crate::app_state::AppState;4
use crate::emoticons;5
6
pub fn quick_reaction_glyphs(reaction_ids: &[String], skin_tone: u8) -> Vec<String> {7
reaction_ids8
.iter()9
.filter_map(|reaction_id| chatsvc::reaction_glyph_for_key(reaction_id))10
.map(|glyph| emoticons::with_tone(&glyph, skin_tone))11
.collect()12
}13
14
pub fn reaction_id_for_glyph(glyph: &str) -> Option<String> {15
chatsvc::reaction_key(&emoticons::without_tone(glyph))16
}17
18
pub fn slots_for(reaction_ids: &[String]) -> Vec<Option<String>> {19
let length = reaction_ids.len().max(teams_core::DEFAULT_REACTION_SLOTS);20
(0..length)21
.map(|index| reaction_ids.get(index).cloned())22
.collect()23
}24
25
/// Teams' replace rule: an id already in another slot leaves that slot empty.26
pub fn place_in_slot(slots: &mut [Option<String>], index: usize, reaction_id: String) {27
for slot in slots.iter_mut() {28
if slot.as_deref() == Some(reaction_id.as_str()) {29
*slot = None;30
}31
}32
if let Some(slot) = slots.get_mut(index) {33
*slot = Some(reaction_id);34
}35
}36
37
pub fn filled(slots: &[Option<String>]) -> Vec<String> {38
slots.iter().flatten().cloned().collect()39
}40
41
impl AppState {42
pub fn default_reactions(&self) -> Vec<String> {43
teams_core::default_reactions(&self.store)44
}45
46
pub fn quick_reactions(&self) -> Vec<String> {47
quick_reaction_glyphs(48
&self.default_reactions(),49
teams_core::skin_tone(&self.store),50
)51
}52
53
pub fn set_default_reactions(&mut self, reaction_ids: Vec<String>, cx: &mut Context<Self>) {54
let Some(engine_or_demo) = self.chat_action_engine(cx) else {55
return;56
};57
let previous = self.default_reactions();58
let _ = teams_core::store_account_default_reactions(&self.store, Some(&reaction_ids));59
cx.notify();60
let Some(engine) = engine_or_demo else {61
return;62
};63
self.run_chat_action(64
"Customising default reactions",65
async move { engine.set_default_reactions(&reaction_ids).await },66
move |state, cx| {67
let _ = teams_core::store_account_default_reactions(&state.store, Some(&previous));68
cx.notify();69
},70
|_, _| {},71
cx,72
);73
}74
}75
76
#[cfg(test)]77
mod tests {78
use super::*;79
80
fn ids(values: &[&str]) -> Vec<String> {81
values.iter().map(|value| (*value).to_owned()).collect()82
}83
84
#[test]85
fn teams_defaults_show_as_glyphs_and_like_takes_the_tone() {86
let defaults = ids(&teams_core::TEAMS_DEFAULT_REACTIONS);87
assert_eq!(88
quick_reaction_glyphs(&defaults, 0),89
["\u{1F44D}", "\u{2764}", "\u{1F606}", "\u{1F62E}"]90
);91
assert_eq!(quick_reaction_glyphs(&defaults, 2)[0], "\u{1F44D}\u{1F3FC}");92
assert_eq!(93
chatsvc::reaction_key(&quick_reaction_glyphs(&defaults, 2)[0]).as_deref(),94
Some("yes-tone2")95
);96
}97
98
#[test]99
fn unknown_ids_are_left_out() {100
assert_eq!(101
quick_reaction_glyphs(&ids(&["heart", "custom-gone"]), 0),102
["\u{2764}"]103
);104
}105
106
#[test]107
fn picked_glyphs_store_the_untoned_id() {108
assert_eq!(109
reaction_id_for_glyph("\u{1F44D}\u{1F3FC}").as_deref(),110
Some("like")111
);112
assert_eq!(113
reaction_id_for_glyph("\u{2764}\u{FE0F}").as_deref(),114
Some("heart")115
);116
}117
118
#[test]119
fn there_are_always_five_slots_and_a_repeat_moves() {120
let mut slots = slots_for(&ids(&["like", "heart"]));121
assert_eq!(slots.len(), 5);122
place_in_slot(&mut slots, 3, "like".to_owned());123
assert_eq!(filled(&slots), ["heart", "like"]);124
assert_eq!(slots[0], None);125
assert_eq!(slots_for(&ids(&["a", "b", "c", "d", "e", "f"])).len(), 6);126
}127
}@@ -13,6 +13,7 @@ pub mod chat_actions;
13
13
pub mod chat_members;
14
14
pub mod connection_banner;
15
15
pub mod data;
16
pub mod default_reactions;
16
17
pub mod demo;
17
18
pub mod demo_meetings;
18
19
pub mod demo_profiles;
@@ -13,6 +13,7 @@ pub mod chat_actions;13
pub mod chat_members;13
pub mod chat_members;14
pub mod connection_banner;14
pub mod connection_banner;15
pub mod data;15
pub mod data;16
pub mod default_reactions;16
pub mod demo;17
pub mod demo;17
pub mod demo_meetings;18
pub mod demo_meetings;18
pub mod demo_profiles;19
pub mod demo_profiles;@@ -31,16 +31,16 @@ mod render_env;
31
31
mod scheduled;
32
32
mod shared;
33
33
34
use super::add_people_dialog::open_add_people;
34
35
use super::attachments::FileActions;
35
36
use super::avatar::{
36
37
bot_tile, member_stack, person_avatar, spec_avatar, square_avatar, with_presence,
37
38
};
38
39
use super::call_controls::header_call_controls;
39
40
use super::channel_tabs::{ChannelPane, HEADER_TITLE_MAX_WIDTH};
40
use super::add_people_dialog::open_add_people;
41
41
use super::chat_members::members_popover;
42
42
use super::composer::{Composer, ComposerEvent, EditPreview, Outgoing, ReplyPreview};
43
use super::message_actions::{Action, DelegateEntry, MessageMenu, QUICK_REACTION_COUNT};
43
use super::message_actions::{Action, DelegateEntry, MessageMenu};
44
44
use super::message_row::{AVATAR_GAP, AVATAR_SIZE, render_message_row, render_skeleton_row};
45
45
use super::new_chat::{NewChatDraft, NewChatEvent, Pick, composer_placeholder};
46
46
use super::pin_banner::{pin_banner_inset, pin_banner_overlay};
@@ -51,7 +51,6 @@ use super::reaction_pills::{ReactionControls, ReactionPopover};
51
51
use super::scroll_edge::edge_divider;
52
52
use super::toolbar_placement::{TimelineBounds, record_bounds};
53
53
use super::widgets::{icon, symbol};
54
use app_ui_kit::layout::{ISLAND_GAP, RAIL_WIDTH, SIDEBAR_WIDTH};
55
54
use crate::agents::{AgentRun, StartRequest};
56
55
use crate::app_state::{AppEvent, AppState, Selection, composer_name, selection_title};
57
56
use crate::backend::Engine;
@@ -82,6 +81,7 @@ use crate::sidebar_model::{AvatarSpec, Face, channel_unread};
82
81
use crate::theme;
83
82
use crate::translation::TranslationLine;
84
83
use crate::typing::typing_tooltip;
84
use app_ui_kit::layout::{ISLAND_GAP, RAIL_WIDTH, SIDEBAR_WIDTH};
85
85
use detached::DetachedWindow;
86
86
use feed::{FeedStash, subject_input};
87
87
use mcp::ReactionProposal;
@@ -3060,6 +3060,7 @@ impl ConversationView {
3060
3060
let pinned = chat_id
3061
3061
.as_deref()
3062
3062
.is_some_and(|chat_id| state.is_pinned(chat_id, key));
3063
let quick = state.quick_reactions();
3063
3064
let in_chat = chat_id.is_some();
3064
3065
let (delegate, manage_agents) = self.delegate_entries(key, cx);
3065
3066
MessageMenu {
@@ -3087,7 +3088,7 @@ impl ConversationView {
3087
3088
pin,
3088
3089
hover,
3089
3090
picker: self.picker.clone(),
3090
quick: self.recent.read(cx).most_used(QUICK_REACTION_COUNT),
3091
quick,
3091
3092
mine,
3092
3093
done: action(|this, key, _, cx| this.suppress_toolbar(key, cx)),
3093
3094
}
@@ -31,16 +31,16 @@ mod render_env;31
mod scheduled;31
mod scheduled;32
mod shared;32
mod shared;33
33
34
use super::add_people_dialog::open_add_people;34
use super::attachments::FileActions;35
use super::attachments::FileActions;35
use super::avatar::{36
use super::avatar::{36
bot_tile, member_stack, person_avatar, spec_avatar, square_avatar, with_presence,37
bot_tile, member_stack, person_avatar, spec_avatar, square_avatar, with_presence,37
};38
};38
use super::call_controls::header_call_controls;39
use super::call_controls::header_call_controls;39
use super::channel_tabs::{ChannelPane, HEADER_TITLE_MAX_WIDTH};40
use super::channel_tabs::{ChannelPane, HEADER_TITLE_MAX_WIDTH};40
use super::add_people_dialog::open_add_people;41
use super::chat_members::members_popover;41
use super::chat_members::members_popover;42
use super::composer::{Composer, ComposerEvent, EditPreview, Outgoing, ReplyPreview};42
use super::composer::{Composer, ComposerEvent, EditPreview, Outgoing, ReplyPreview};43
use super::message_actions::{Action, DelegateEntry, MessageMenu, QUICK_REACTION_COUNT};43
use super::message_actions::{Action, DelegateEntry, MessageMenu};44
use super::message_row::{AVATAR_GAP, AVATAR_SIZE, render_message_row, render_skeleton_row};44
use super::message_row::{AVATAR_GAP, AVATAR_SIZE, render_message_row, render_skeleton_row};45
use super::new_chat::{NewChatDraft, NewChatEvent, Pick, composer_placeholder};45
use super::new_chat::{NewChatDraft, NewChatEvent, Pick, composer_placeholder};46
use super::pin_banner::{pin_banner_inset, pin_banner_overlay};46
use super::pin_banner::{pin_banner_inset, pin_banner_overlay};@@ -51,7 +51,6 @@ use super::reaction_pills::{ReactionControls, ReactionPopover};51
use super::scroll_edge::edge_divider;51
use super::scroll_edge::edge_divider;52
use super::toolbar_placement::{TimelineBounds, record_bounds};52
use super::toolbar_placement::{TimelineBounds, record_bounds};53
use super::widgets::{icon, symbol};53
use super::widgets::{icon, symbol};54
use app_ui_kit::layout::{ISLAND_GAP, RAIL_WIDTH, SIDEBAR_WIDTH};55
use crate::agents::{AgentRun, StartRequest};54
use crate::agents::{AgentRun, StartRequest};56
use crate::app_state::{AppEvent, AppState, Selection, composer_name, selection_title};55
use crate::app_state::{AppEvent, AppState, Selection, composer_name, selection_title};57
use crate::backend::Engine;56
use crate::backend::Engine;@@ -82,6 +81,7 @@ use crate::sidebar_model::{AvatarSpec, Face, channel_unread};82
use crate::theme;81
use crate::theme;83
use crate::translation::TranslationLine;82
use crate::translation::TranslationLine;84
use crate::typing::typing_tooltip;83
use crate::typing::typing_tooltip;84
use app_ui_kit::layout::{ISLAND_GAP, RAIL_WIDTH, SIDEBAR_WIDTH};85
use detached::DetachedWindow;85
use detached::DetachedWindow;86
use feed::{FeedStash, subject_input};86
use feed::{FeedStash, subject_input};87
use mcp::ReactionProposal;87
use mcp::ReactionProposal;@@ -3060,6 +3060,7 @@ impl ConversationView {3060
let pinned = chat_id3060
let pinned = chat_id3061
.as_deref()3061
.as_deref()3062
.is_some_and(|chat_id| state.is_pinned(chat_id, key));3062
.is_some_and(|chat_id| state.is_pinned(chat_id, key));3063
let quick = state.quick_reactions();3063
let in_chat = chat_id.is_some();3064
let in_chat = chat_id.is_some();3064
let (delegate, manage_agents) = self.delegate_entries(key, cx);3065
let (delegate, manage_agents) = self.delegate_entries(key, cx);3065
MessageMenu {3066
MessageMenu {@@ -3087,7 +3088,7 @@ impl ConversationView {3087
pin,3088
pin,3088
hover,3089
hover,3089
picker: self.picker.clone(),3090
picker: self.picker.clone(),3090
quick: self.recent.read(cx).most_used(QUICK_REACTION_COUNT),3091
quick,3091
mine,3092
mine,3092
done: action(|this, key, _, cx| this.suppress_toolbar(key, cx)),3093
done: action(|this, key, _, cx| this.suppress_toolbar(key, cx)),3093
}3094
}@@ -0,0 +1,263 @@
1
use std::collections::HashSet;
2
use std::rc::Rc;
3
4
use gpui_kit::assets::IconName;
5
use gpui_kit::component::button::{Button, ButtonVariants as _};
6
use gpui_kit::component::dialog::{Dialog, DialogFooter};
7
use gpui_kit::component::popover::Popover;
8
use gpui_kit::component::tooltip::Tooltip;
9
use gpui_kit::component::{Disableable as _, WindowExt as _, h_flex, v_flex};
10
use gpui_kit::prelude::FluentBuilder as _;
11
use gpui_kit::*;
12
13
use super::reaction_picker::ReactionPicker;
14
use super::widgets::{Corner, corner_badge, icon};
15
use crate::app_state::AppState;
16
use crate::default_reactions::{
17
filled, place_in_slot, quick_reaction_glyphs, reaction_id_for_glyph, slots_for,
18
};
19
use crate::emoji;
20
use crate::emoticons::{SKIN_TONE_COUNT, with_tone};
21
use crate::theme;
22
23
pub const CUSTOMIZE_TOOLTIP: &str = "Customise default reactions";
24
const TITLE: &str = "Customise your reactions and appearance in Teams";
25
const DESCRIPTION: &str = "Click on a reaction below, then choose an emoji to replace it with.";
26
const SKIN_TONE_TEXT: &str =
27
"Choose a skin tone. After selection, reactions and emoji will appear with this skin tone.";
28
const CHOOSE_EMOJI: &str = "Choose an emoji";
29
const REMOVE_REACTION: &str = "Remove reaction";
30
const TONE_SAMPLE: &str = "\u{1F44D}";
31
const DIALOG_WIDTH: f32 = 440.;
32
const SLOT_SIZE: f32 = 48.;
33
const SLOT_GLYPH_SIZE: f32 = 26.;
34
const TONE_SIZE: f32 = 36.;
35
const TONE_GLYPH_SIZE: f32 = 20.;
36
const REMOVE_SIZE: f32 = 18.;
37
const REMOVE_OVERHANG: f32 = 5.;
38
const SECTION_GAP: f32 = 16.;
39
const TEXT_SIZE: f32 = 13.;
40
41
struct CustomizeForm {
42
state: Entity<AppState>,
43
picker: Entity<ReactionPicker>,
44
saved_ids: Vec<String>,
45
saved_tone: u8,
46
slots: Vec<Option<String>>,
47
skin_tone: u8,
48
}
49
50
impl CustomizeForm {
51
fn new(state: Entity<AppState>, window: &mut Window, cx: &mut Context<Self>) -> Self {
52
let (saved_ids, saved_tone, store) = {
53
let app = state.read(cx);
54
(
55
app.default_reactions(),
56
teams_core::skin_tone(&app.store),
57
app.store.clone(),
58
)
59
};
60
let recent = cx.new(|_| emoji::Recent::load(&store));
61
let picker_state = state.clone();
62
let picker =
63
cx.new(|cx| ReactionPicker::new(picker_state, recent, window, cx).for_customizing());
64
CustomizeForm {
65
state,
66
picker,
67
slots: slots_for(&saved_ids),
68
saved_ids,
69
saved_tone,
70
skin_tone: saved_tone,
71
}
72
}
73
74
fn unchanged(&self) -> bool {
75
filled(&self.slots) == self.saved_ids && self.skin_tone == self.saved_tone
76
}
77
78
fn place(&mut self, index: usize, glyph: &str, cx: &mut Context<Self>) {
79
if let Some(reaction_id) = reaction_id_for_glyph(glyph) {
80
place_in_slot(&mut self.slots, index, reaction_id);
81
cx.notify();
82
}
83
}
84
85
fn remove(&mut self, index: usize, cx: &mut Context<Self>) {
86
if let Some(slot) = self.slots.get_mut(index) {
87
*slot = None;
88
cx.notify();
89
}
90
}
91
92
fn save(&mut self, window: &mut Window, cx: &mut Context<Self>) {
93
let reaction_ids = filled(&self.slots);
94
let (tone_changed, tone) = (self.skin_tone != self.saved_tone, self.skin_tone);
95
self.state.update(cx, |state, cx| {
96
if tone_changed {
97
state.set_skin_tone(tone, cx);
98
}
99
state.set_default_reactions(reaction_ids, cx);
100
});
101
window.close_dialog(cx);
102
}
103
104
fn slot_glyph(&self, reaction_id: &str) -> Option<String> {
105
quick_reaction_glyphs(&[reaction_id.to_owned()], self.skin_tone)
106
.into_iter()
107
.next()
108
}
109
110
fn slot(&self, index: usize, cx: &mut Context<Self>) -> AnyElement {
111
let glyph = self
112
.slots
113
.get(index)
114
.cloned()
115
.flatten()
116
.and_then(|reaction_id| self.slot_glyph(&reaction_id));
117
let label = if glyph.is_some() {
118
REMOVE_REACTION
119
} else {
120
CHOOSE_EMOJI
121
};
122
let trigger = Button::new(("customize-reaction-slot", index))
123
.size(px(SLOT_SIZE))
124
.rounded(px(10.))
125
.tooltip(label)
126
.map(|button| match &glyph {
127
Some(glyph) => {
128
button.child(div().text_size(px(SLOT_GLYPH_SIZE)).child(glyph.clone()))
129
}
130
None => button.child(icon(IconName::Plus, 18., theme::text_muted())),
131
});
132
let (picker, view) = (self.picker.clone(), cx.entity().downgrade());
133
let selected: HashSet<String> = glyph.iter().cloned().collect();
134
let popover = Popover::new(("customize-reaction-picker", index))
135
.anchor(Anchor::TopLeft)
136
.trigger(trigger)
137
.on_open_change({
138
let picker = self.picker.clone();
139
move |open, window, cx| {
140
if *open {
141
picker.update(cx, |picker, cx| picker.reset(window, cx));
142
}
143
}
144
})
145
.content(move |_, _, cx| {
146
let popover = cx.entity().downgrade();
147
let view = view.clone();
148
picker.update(cx, |picker, _| {
149
picker.set_target(
150
Rc::new(move |glyph, _, cx| {
151
view.update(cx, |form, cx| form.place(index, glyph, cx))
152
.ok();
153
}),
154
Rc::new(|_, _| {}),
155
popover,
156
selected.clone(),
157
)
158
});
159
picker.clone()
160
});
161
let remove = glyph.is_some().then(|| {
162
corner_badge(Corner::TopRight, REMOVE_OVERHANG).child(
163
div()
164
.id(("customize-reaction-remove", index))
165
.size(px(REMOVE_SIZE))
166
.flex()
167
.items_center()
168
.justify_center()
169
.rounded_full()
170
.cursor_pointer()
171
.bg(theme::popup_hover())
172
.hover(|button| button.bg(theme::row_hover()))
173
.child(icon(IconName::X, 10., theme::text_soft()))
174
.tooltip(|window, cx| Tooltip::new(REMOVE_REACTION).build(window, cx))
175
.on_click(cx.listener(move |form, _, _, cx| {
176
cx.stop_propagation();
177
form.remove(index, cx);
178
})),
179
)
180
});
181
div()
182
.relative()
183
.child(popover)
184
.children(remove)
185
.into_any_element()
186
}
187
188
fn tone_choice(&self, tone: u8, cx: &mut Context<Self>) -> AnyElement {
189
let selected = tone == self.skin_tone;
190
div()
191
.id(("customize-skin-tone", usize::from(tone)))
192
.size(px(TONE_SIZE))
193
.flex()
194
.items_center()
195
.justify_center()
196
.rounded_full()
197
.cursor_pointer()
198
.text_size(px(TONE_GLYPH_SIZE))
199
.when(selected, |choice| choice.bg(theme::reaction_on_own()))
200
.when(!selected, |choice| {
201
choice.hover(|choice| choice.bg(theme::popup_hover()))
202
})
203
.child(with_tone(TONE_SAMPLE, tone))
204
.on_click(cx.listener(move |form, _, _, cx| {
205
form.skin_tone = tone;
206
cx.notify();
207
}))
208
.into_any_element()
209
}
210
}
211
212
impl Render for CustomizeForm {
213
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
214
let slots: Vec<AnyElement> = (0..self.slots.len())
215
.map(|index| self.slot(index, cx))
216
.collect();
217
let tones: Vec<AnyElement> = (0..=SKIN_TONE_COUNT)
218
.map(|tone| self.tone_choice(tone, cx))
219
.collect();
220
v_flex()
221
.gap(px(SECTION_GAP))
222
.text_size(px(TEXT_SIZE))
223
.text_color(theme::text())
224
.child(div().text_color(theme::text_soft()).child(DESCRIPTION))
225
.child(
226
h_flex()
227
.justify_center()
228
.gap(px(10.))
229
.py(px(4.))
230
.children(slots),
231
)
232
.child(div().text_color(theme::text_soft()).child(SKIN_TONE_TEXT))
233
.child(h_flex().gap(px(6.)).children(tones))
234
}
235
}
236
237
pub fn open_customize_reactions(state: Entity<AppState>, window: &mut Window, cx: &mut App) {
238
let form = cx.new(|cx| CustomizeForm::new(state, window, cx));
239
window.open_dialog(cx, move |dialog: Dialog, _, cx| {
240
let submit_form = form.clone();
241
let unchanged = form.read(cx).unchanged();
242
let footer = DialogFooter::new()
243
.child(
244
Button::new("customize-reactions-cancel")
245
.label("Cancel")
246
.on_click(|_, window, cx| window.close_dialog(cx)),
247
)
248
.child(
249
Button::new("customize-reactions-save")
250
.primary()
251
.label("Save")
252
.disabled(unchanged)
253
.on_click(move |_, window, cx| {
254
submit_form.update(cx, |form, cx| form.save(window, cx));
255
}),
256
);
257
dialog
258
.title(TITLE)
259
.w(px(DIALOG_WIDTH))
260
.child(form.clone())
261
.footer(footer)
262
});
263
}
@@ -0,0 +1,263 @@1
use std::collections::HashSet;2
use std::rc::Rc;3
4
use gpui_kit::assets::IconName;5
use gpui_kit::component::button::{Button, ButtonVariants as _};6
use gpui_kit::component::dialog::{Dialog, DialogFooter};7
use gpui_kit::component::popover::Popover;8
use gpui_kit::component::tooltip::Tooltip;9
use gpui_kit::component::{Disableable as _, WindowExt as _, h_flex, v_flex};10
use gpui_kit::prelude::FluentBuilder as _;11
use gpui_kit::*;12
13
use super::reaction_picker::ReactionPicker;14
use super::widgets::{Corner, corner_badge, icon};15
use crate::app_state::AppState;16
use crate::default_reactions::{17
filled, place_in_slot, quick_reaction_glyphs, reaction_id_for_glyph, slots_for,18
};19
use crate::emoji;20
use crate::emoticons::{SKIN_TONE_COUNT, with_tone};21
use crate::theme;22
23
pub const CUSTOMIZE_TOOLTIP: &str = "Customise default reactions";24
const TITLE: &str = "Customise your reactions and appearance in Teams";25
const DESCRIPTION: &str = "Click on a reaction below, then choose an emoji to replace it with.";26
const SKIN_TONE_TEXT: &str =27
"Choose a skin tone. After selection, reactions and emoji will appear with this skin tone.";28
const CHOOSE_EMOJI: &str = "Choose an emoji";29
const REMOVE_REACTION: &str = "Remove reaction";30
const TONE_SAMPLE: &str = "\u{1F44D}";31
const DIALOG_WIDTH: f32 = 440.;32
const SLOT_SIZE: f32 = 48.;33
const SLOT_GLYPH_SIZE: f32 = 26.;34
const TONE_SIZE: f32 = 36.;35
const TONE_GLYPH_SIZE: f32 = 20.;36
const REMOVE_SIZE: f32 = 18.;37
const REMOVE_OVERHANG: f32 = 5.;38
const SECTION_GAP: f32 = 16.;39
const TEXT_SIZE: f32 = 13.;40
41
struct CustomizeForm {42
state: Entity<AppState>,43
picker: Entity<ReactionPicker>,44
saved_ids: Vec<String>,45
saved_tone: u8,46
slots: Vec<Option<String>>,47
skin_tone: u8,48
}49
50
impl CustomizeForm {51
fn new(state: Entity<AppState>, window: &mut Window, cx: &mut Context<Self>) -> Self {52
let (saved_ids, saved_tone, store) = {53
let app = state.read(cx);54
(55
app.default_reactions(),56
teams_core::skin_tone(&app.store),57
app.store.clone(),58
)59
};60
let recent = cx.new(|_| emoji::Recent::load(&store));61
let picker_state = state.clone();62
let picker =63
cx.new(|cx| ReactionPicker::new(picker_state, recent, window, cx).for_customizing());64
CustomizeForm {65
state,66
picker,67
slots: slots_for(&saved_ids),68
saved_ids,69
saved_tone,70
skin_tone: saved_tone,71
}72
}73
74
fn unchanged(&self) -> bool {75
filled(&self.slots) == self.saved_ids && self.skin_tone == self.saved_tone76
}77
78
fn place(&mut self, index: usize, glyph: &str, cx: &mut Context<Self>) {79
if let Some(reaction_id) = reaction_id_for_glyph(glyph) {80
place_in_slot(&mut self.slots, index, reaction_id);81
cx.notify();82
}83
}84
85
fn remove(&mut self, index: usize, cx: &mut Context<Self>) {86
if let Some(slot) = self.slots.get_mut(index) {87
*slot = None;88
cx.notify();89
}90
}91
92
fn save(&mut self, window: &mut Window, cx: &mut Context<Self>) {93
let reaction_ids = filled(&self.slots);94
let (tone_changed, tone) = (self.skin_tone != self.saved_tone, self.skin_tone);95
self.state.update(cx, |state, cx| {96
if tone_changed {97
state.set_skin_tone(tone, cx);98
}99
state.set_default_reactions(reaction_ids, cx);100
});101
window.close_dialog(cx);102
}103
104
fn slot_glyph(&self, reaction_id: &str) -> Option<String> {105
quick_reaction_glyphs(&[reaction_id.to_owned()], self.skin_tone)106
.into_iter()107
.next()108
}109
110
fn slot(&self, index: usize, cx: &mut Context<Self>) -> AnyElement {111
let glyph = self112
.slots113
.get(index)114
.cloned()115
.flatten()116
.and_then(|reaction_id| self.slot_glyph(&reaction_id));117
let label = if glyph.is_some() {118
REMOVE_REACTION119
} else {120
CHOOSE_EMOJI121
};122
let trigger = Button::new(("customize-reaction-slot", index))123
.size(px(SLOT_SIZE))124
.rounded(px(10.))125
.tooltip(label)126
.map(|button| match &glyph {127
Some(glyph) => {128
button.child(div().text_size(px(SLOT_GLYPH_SIZE)).child(glyph.clone()))129
}130
None => button.child(icon(IconName::Plus, 18., theme::text_muted())),131
});132
let (picker, view) = (self.picker.clone(), cx.entity().downgrade());133
let selected: HashSet<String> = glyph.iter().cloned().collect();134
let popover = Popover::new(("customize-reaction-picker", index))135
.anchor(Anchor::TopLeft)136
.trigger(trigger)137
.on_open_change({138
let picker = self.picker.clone();139
move |open, window, cx| {140
if *open {141
picker.update(cx, |picker, cx| picker.reset(window, cx));142
}143
}144
})145
.content(move |_, _, cx| {146
let popover = cx.entity().downgrade();147
let view = view.clone();148
picker.update(cx, |picker, _| {149
picker.set_target(150
Rc::new(move |glyph, _, cx| {151
view.update(cx, |form, cx| form.place(index, glyph, cx))152
.ok();153
}),154
Rc::new(|_, _| {}),155
popover,156
selected.clone(),157
)158
});159
picker.clone()160
});161
let remove = glyph.is_some().then(|| {162
corner_badge(Corner::TopRight, REMOVE_OVERHANG).child(163
div()164
.id(("customize-reaction-remove", index))165
.size(px(REMOVE_SIZE))166
.flex()167
.items_center()168
.justify_center()169
.rounded_full()170
.cursor_pointer()171
.bg(theme::popup_hover())172
.hover(|button| button.bg(theme::row_hover()))173
.child(icon(IconName::X, 10., theme::text_soft()))174
.tooltip(|window, cx| Tooltip::new(REMOVE_REACTION).build(window, cx))175
.on_click(cx.listener(move |form, _, _, cx| {176
cx.stop_propagation();177
form.remove(index, cx);178
})),179
)180
});181
div()182
.relative()183
.child(popover)184
.children(remove)185
.into_any_element()186
}187
188
fn tone_choice(&self, tone: u8, cx: &mut Context<Self>) -> AnyElement {189
let selected = tone == self.skin_tone;190
div()191
.id(("customize-skin-tone", usize::from(tone)))192
.size(px(TONE_SIZE))193
.flex()194
.items_center()195
.justify_center()196
.rounded_full()197
.cursor_pointer()198
.text_size(px(TONE_GLYPH_SIZE))199
.when(selected, |choice| choice.bg(theme::reaction_on_own()))200
.when(!selected, |choice| {201
choice.hover(|choice| choice.bg(theme::popup_hover()))202
})203
.child(with_tone(TONE_SAMPLE, tone))204
.on_click(cx.listener(move |form, _, _, cx| {205
form.skin_tone = tone;206
cx.notify();207
}))208
.into_any_element()209
}210
}211
212
impl Render for CustomizeForm {213
fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {214
let slots: Vec<AnyElement> = (0..self.slots.len())215
.map(|index| self.slot(index, cx))216
.collect();217
let tones: Vec<AnyElement> = (0..=SKIN_TONE_COUNT)218
.map(|tone| self.tone_choice(tone, cx))219
.collect();220
v_flex()221
.gap(px(SECTION_GAP))222
.text_size(px(TEXT_SIZE))223
.text_color(theme::text())224
.child(div().text_color(theme::text_soft()).child(DESCRIPTION))225
.child(226
h_flex()227
.justify_center()228
.gap(px(10.))229
.py(px(4.))230
.children(slots),231
)232
.child(div().text_color(theme::text_soft()).child(SKIN_TONE_TEXT))233
.child(h_flex().gap(px(6.)).children(tones))234
}235
}236
237
pub fn open_customize_reactions(state: Entity<AppState>, window: &mut Window, cx: &mut App) {238
let form = cx.new(|cx| CustomizeForm::new(state, window, cx));239
window.open_dialog(cx, move |dialog: Dialog, _, cx| {240
let submit_form = form.clone();241
let unchanged = form.read(cx).unchanged();242
let footer = DialogFooter::new()243
.child(244
Button::new("customize-reactions-cancel")245
.label("Cancel")246
.on_click(|_, window, cx| window.close_dialog(cx)),247
)248
.child(249
Button::new("customize-reactions-save")250
.primary()251
.label("Save")252
.disabled(unchanged)253
.on_click(move |_, window, cx| {254
submit_form.update(cx, |form, cx| form.save(window, cx));255
}),256
);257
dialog258
.title(TITLE)259
.w(px(DIALOG_WIDTH))260
.child(form.clone())261
.footer(footer)262
});263
}@@ -23,7 +23,6 @@ const BAR_PADDING: f32 = 3.;
23
23
const BAR_ICON: f32 = 16.;
24
24
const DELEGATE_ITEM_WIDTH: f32 = 188.;
25
25
const DELEGATE_AGENT_SIZE: f32 = 11.;
26
pub const QUICK_REACTION_COUNT: usize = 4;
27
26
28
27
pub type Action = Rc<dyn Fn(&mut Window, &mut App)>;
29
28
pub type OpenChange = Rc<dyn Fn(bool, &mut Window, &mut App)>;
@@ -23,7 +23,6 @@ const BAR_PADDING: f32 = 3.;23
const BAR_ICON: f32 = 16.;23
const BAR_ICON: f32 = 16.;24
const DELEGATE_ITEM_WIDTH: f32 = 188.;24
const DELEGATE_ITEM_WIDTH: f32 = 188.;25
const DELEGATE_AGENT_SIZE: f32 = 11.;25
const DELEGATE_AGENT_SIZE: f32 = 11.;26
pub const QUICK_REACTION_COUNT: usize = 4;27
26
28
pub type Action = Rc<dyn Fn(&mut Window, &mut App)>;27
pub type Action = Rc<dyn Fn(&mut Window, &mut App)>;29
pub type OpenChange = Rc<dyn Fn(bool, &mut Window, &mut App)>;28
pub type OpenChange = Rc<dyn Fn(bool, &mut Window, &mut App)>;@@ -37,6 +37,7 @@ pub mod chat_members;
37
37
pub mod composer;
38
38
pub mod connection_banner;
39
39
pub mod conversation;
40
pub mod customize_reactions;
40
41
pub mod dialog_overlay;
41
42
pub mod emoji_popup;
42
43
pub mod format_toolbar;
@@ -37,6 +37,7 @@ pub mod chat_members;37
pub mod composer;37
pub mod composer;38
pub mod connection_banner;38
pub mod connection_banner;39
pub mod conversation;39
pub mod conversation;40
pub mod customize_reactions;40
pub mod dialog_overlay;41
pub mod dialog_overlay;41
pub mod emoji_popup;42
pub mod emoji_popup;42
pub mod format_toolbar;43
pub mod format_toolbar;@@ -10,7 +10,12 @@ use gpui_kit::component::{
10
10
use gpui_kit::prelude::FluentBuilder as _;
11
11
use gpui_kit::*;
12
12
13
use gpui_kit::assets::IconName;
14
use gpui_kit::component::tooltip::Tooltip;
15
16
use super::customize_reactions::{CUSTOMIZE_TOOLTIP, open_customize_reactions};
13
17
use super::skin_tone_choices::{tone_badge, tone_choices};
18
use super::widgets::icon;
14
19
use crate::app_state::AppState;
15
20
use crate::emoji;
16
21
use crate::emoticons;
@@ -67,6 +72,7 @@ pub struct ReactionPicker {
67
72
target: Option<PickTarget>,
68
73
skin_tone: u8,
69
74
tone_menu: Option<(String, Point<Pixels>)>,
75
customizing: bool,
70
76
_subscription: Subscription,
71
77
}
72
78
@@ -88,10 +94,16 @@ impl ReactionPicker {
88
94
target: None,
89
95
skin_tone: 0,
90
96
tone_menu: None,
97
customizing: false,
91
98
_subscription: subscription,
92
99
}
93
100
}
94
101
102
pub fn for_customizing(mut self) -> Self {
103
self.customizing = true;
104
self
105
}
106
95
107
pub fn set_target(
96
108
&mut self,
97
109
on_pick: PickHandler,
@@ -195,10 +207,43 @@ impl ReactionPicker {
195
207
196
208
fn pick_tone(&mut self, glyph: &str, tone: u8, window: &mut Window, cx: &mut Context<Self>) {
197
209
self.skin_tone = tone;
198
self.app.update(cx, |state, cx| state.set_skin_tone(tone, cx));
210
if !self.customizing {
211
self.app
212
.update(cx, |state, cx| state.set_skin_tone(tone, cx));
213
}
199
214
self.pick(&emoticons::with_tone(glyph, tone), false, window, cx);
200
215
}
201
216
217
fn open_customize(&mut self, window: &mut Window, cx: &mut Context<Self>) {
218
if let Some(target) = self.target.take() {
219
target
220
.popover
221
.update(cx, |state, cx| state.dismiss(window, cx))
222
.ok();
223
(target.on_done)(window, cx);
224
}
225
open_customize_reactions(self.app.clone(), window, cx);
226
}
227
228
fn customize_button(&self, cx: &mut Context<Self>) -> Option<AnyElement> {
229
(!self.customizing).then(|| {
230
div()
231
.id("customize-reactions-trigger")
232
.size(px(CELL_SIZE))
233
.flex_none()
234
.flex()
235
.items_center()
236
.justify_center()
237
.rounded(px(8.))
238
.cursor_pointer()
239
.hover(|button| button.bg(theme::popup_hover()))
240
.child(icon(IconName::Settings, 16., theme::text_soft()))
241
.tooltip(|window, cx| Tooltip::new(CUSTOMIZE_TOOLTIP).build(window, cx))
242
.on_click(cx.listener(|this, _, window, cx| this.open_customize(window, cx)))
243
.into_any_element()
244
})
245
}
246
202
247
fn tone_menu(&self, cx: &mut Context<Self>) -> Option<AnyElement> {
203
248
let (base, position) = self.tone_menu.clone()?;
204
249
let (pick_view, dismiss_view) = (cx.entity().downgrade(), cx.entity().downgrade());
@@ -303,14 +348,21 @@ impl Render for ReactionPicker {
303
348
.p(px(8.))
304
349
.child(h_flex().gap(px(2.)).children(quick))
305
350
.child(
306
div()
307
.h(px(32.))
308
.px(px(8.))
309
.flex()
351
h_flex()
352
.gap(px(4.))
310
353
.items_center()
311
.rounded(px(8.))
312
.bg(theme::popup_hover())
313
.child(Input::new(&self.input).appearance(false).bordered(false)),
354
.child(
355
div()
356
.flex_1()
357
.h(px(32.))
358
.px(px(8.))
359
.flex()
360
.items_center()
361
.rounded(px(8.))
362
.bg(theme::popup_hover())
363
.child(Input::new(&self.input).appearance(false).bordered(false)),
364
)
365
.children(self.customize_button(cx)),
314
366
)
315
367
.child(
316
368
div()
@@ -10,7 +10,12 @@ use gpui_kit::component::{10
use gpui_kit::prelude::FluentBuilder as _;10
use gpui_kit::prelude::FluentBuilder as _;11
use gpui_kit::*;11
use gpui_kit::*;12
12
13
use gpui_kit::assets::IconName;14
use gpui_kit::component::tooltip::Tooltip;15
16
use super::customize_reactions::{CUSTOMIZE_TOOLTIP, open_customize_reactions};13
use super::skin_tone_choices::{tone_badge, tone_choices};17
use super::skin_tone_choices::{tone_badge, tone_choices};18
use super::widgets::icon;14
use crate::app_state::AppState;19
use crate::app_state::AppState;15
use crate::emoji;20
use crate::emoji;16
use crate::emoticons;21
use crate::emoticons;@@ -67,6 +72,7 @@ pub struct ReactionPicker {67
target: Option<PickTarget>,72
target: Option<PickTarget>,68
skin_tone: u8,73
skin_tone: u8,69
tone_menu: Option<(String, Point<Pixels>)>,74
tone_menu: Option<(String, Point<Pixels>)>,75
customizing: bool,70
_subscription: Subscription,76
_subscription: Subscription,71
}77
}72
78
@@ -88,10 +94,16 @@ impl ReactionPicker {88
target: None,94
target: None,89
skin_tone: 0,95
skin_tone: 0,90
tone_menu: None,96
tone_menu: None,97
customizing: false,91
_subscription: subscription,98
_subscription: subscription,92
}99
}93
}100
}94
101
102
pub fn for_customizing(mut self) -> Self {103
self.customizing = true;104
self105
}106
95
pub fn set_target(107
pub fn set_target(96
&mut self,108
&mut self,97
on_pick: PickHandler,109
on_pick: PickHandler,@@ -195,10 +207,43 @@ impl ReactionPicker {195
207
196
fn pick_tone(&mut self, glyph: &str, tone: u8, window: &mut Window, cx: &mut Context<Self>) {208
fn pick_tone(&mut self, glyph: &str, tone: u8, window: &mut Window, cx: &mut Context<Self>) {197
self.skin_tone = tone;209
self.skin_tone = tone;198
self.app.update(cx, |state, cx| state.set_skin_tone(tone, cx));210
if !self.customizing {211
self.app212
.update(cx, |state, cx| state.set_skin_tone(tone, cx));213
}199
self.pick(&emoticons::with_tone(glyph, tone), false, window, cx);214
self.pick(&emoticons::with_tone(glyph, tone), false, window, cx);200
}215
}201
216
217
fn open_customize(&mut self, window: &mut Window, cx: &mut Context<Self>) {218
if let Some(target) = self.target.take() {219
target220
.popover221
.update(cx, |state, cx| state.dismiss(window, cx))222
.ok();223
(target.on_done)(window, cx);224
}225
open_customize_reactions(self.app.clone(), window, cx);226
}227
228
fn customize_button(&self, cx: &mut Context<Self>) -> Option<AnyElement> {229
(!self.customizing).then(|| {230
div()231
.id("customize-reactions-trigger")232
.size(px(CELL_SIZE))233
.flex_none()234
.flex()235
.items_center()236
.justify_center()237
.rounded(px(8.))238
.cursor_pointer()239
.hover(|button| button.bg(theme::popup_hover()))240
.child(icon(IconName::Settings, 16., theme::text_soft()))241
.tooltip(|window, cx| Tooltip::new(CUSTOMIZE_TOOLTIP).build(window, cx))242
.on_click(cx.listener(|this, _, window, cx| this.open_customize(window, cx)))243
.into_any_element()244
})245
}246
202
fn tone_menu(&self, cx: &mut Context<Self>) -> Option<AnyElement> {247
fn tone_menu(&self, cx: &mut Context<Self>) -> Option<AnyElement> {203
let (base, position) = self.tone_menu.clone()?;248
let (base, position) = self.tone_menu.clone()?;204
let (pick_view, dismiss_view) = (cx.entity().downgrade(), cx.entity().downgrade());249
let (pick_view, dismiss_view) = (cx.entity().downgrade(), cx.entity().downgrade());@@ -303,14 +348,21 @@ impl Render for ReactionPicker {303
.p(px(8.))348
.p(px(8.))304
.child(h_flex().gap(px(2.)).children(quick))349
.child(h_flex().gap(px(2.)).children(quick))305
.child(350
.child(306
div()351
h_flex()307
.h(px(32.))352
.gap(px(4.))308
.px(px(8.))309
.flex()310
.items_center()353
.items_center()311
.rounded(px(8.))354
.child(312
.bg(theme::popup_hover())355
div()313
.child(Input::new(&self.input).appearance(false).bordered(false)),356
.flex_1()357
.h(px(32.))358
.px(px(8.))359
.flex()360
.items_center()361
.rounded(px(8.))362
.bg(theme::popup_hover())363
.child(Input::new(&self.input).appearance(false).bordered(false)),364
)365
.children(self.customize_button(cx)),314
)366
)315
.child(367
.child(316
div()368
div()@@ -9,6 +9,7 @@ const SETTINGS_KEY: &str = "simpleCollabUserSettings";
9
9
const SETTINGS_ID: &str = "simpleCollabUserSettingsId";
10
10
const TEAMS_ORDER_KEY: &str = "teamsOrder";
11
11
const SKIN_TONE_KEY: &str = "preferredSkinToneIndex";
12
const DEFAULT_REACTIONS_KEY: &str = "defaultMessageReactions";
12
13
const MAX_SKIN_TONE: u8 = 5;
13
14
const MUTED_FIELD: &str = "hasUserEnabledMutedChatSection";
14
15
const MEETING_FIELD: &str = "hasUserEnabledMeetingChatSection";
@@ -98,6 +99,11 @@ impl<T: MessageTransport> UserSettings<T> {
98
99
.await
99
100
}
100
101
102
pub async fn set_default_reactions(&self, reaction_ids: &[String]) -> Result<()> {
103
self.set_property(DEFAULT_REACTIONS_KEY, default_reactions_value(reaction_ids))
104
.await
105
}
106
101
107
pub async fn set_property(&self, name: &str, value: Value) -> Result<()> {
102
108
let url = format!("{}?name={name}", self.base_url);
103
109
let mut body = Map::new();
@@ -147,6 +153,25 @@ pub fn parse_skin_tone(properties: &Value) -> Option<u8> {
147
153
(tone <= MAX_SKIN_TONE).then_some(tone)
148
154
}
149
155
156
pub fn parse_default_reactions(properties: &Value) -> Option<Vec<String>> {
157
let entries = match properties.get(DEFAULT_REACTIONS_KEY)? {
158
Value::String(text) => serde_json::from_str::<Value>(text).ok()?,
159
other => other.clone(),
160
};
161
entries.as_array().map(|entries| {
162
entries
163
.iter()
164
.filter_map(Value::as_str)
165
.filter(|reaction_id| !reaction_id.is_empty())
166
.map(str::to_owned)
167
.collect()
168
})
169
}
170
171
pub fn default_reactions_value(reaction_ids: &[String]) -> Value {
172
Value::String(Value::from(reaction_ids.to_vec()).to_string())
173
}
174
150
175
pub fn parse_teams_order(properties: &Value) -> Vec<(String, i64)> {
151
176
let entries = match properties.get(TEAMS_ORDER_KEY) {
152
177
Some(Value::String(text)) => serde_json::from_str::<Value>(text).ok(),
@@ -228,6 +253,53 @@ mod tests {
228
253
assert_eq!(parse_skin_tone(&json!({})), None);
229
254
}
230
255
256
#[test]
257
fn default_reactions_are_read_from_the_json_string_or_an_array() {
258
assert_eq!(
259
parse_default_reactions(&json!({DEFAULT_REACTIONS_KEY: r#"["like","heart","fire"]"#})),
260
Some(vec![
261
"like".to_owned(),
262
"heart".to_owned(),
263
"fire".to_owned()
264
])
265
);
266
assert_eq!(
267
parse_default_reactions(&json!({DEFAULT_REACTIONS_KEY: ["yes", "", 3]})),
268
Some(vec!["yes".to_owned()])
269
);
270
assert_eq!(
271
parse_default_reactions(&json!({DEFAULT_REACTIONS_KEY: "[]"})),
272
Some(Vec::new())
273
);
274
assert_eq!(parse_default_reactions(&json!({})), None);
275
assert_eq!(
276
parse_default_reactions(&json!({DEFAULT_REACTIONS_KEY: "not json"})),
277
None
278
);
279
}
280
281
#[tokio::test]
282
async fn default_reactions_are_put_as_a_json_string() {
283
let transport = Canned {
284
answers: Mutex::new(vec![(200, Value::Null)].into()),
285
requests: Mutex::new(Vec::new()),
286
};
287
UserSettings::with_transport(&transport, "emea")
288
.set_default_reactions(&["like".to_owned(), "fire".to_owned()])
289
.await
290
.unwrap();
291
let requests = transport.requests.lock().unwrap();
292
assert_eq!(requests[0].method, Method::Put);
293
assert_eq!(
294
requests[0].url,
295
"https://teams.cloud.microsoft/api/chatsvc/emea/v1/users/ME/properties?name=defaultMessageReactions"
296
);
297
assert_eq!(
298
requests[0].body,
299
Some(json!({"defaultMessageReactions": r#"["like","fire"]"#}))
300
);
301
}
302
231
303
#[test]
232
304
fn unset_fields_use_the_teams_defaults() {
233
305
let parsed = parse_chat_sections(&json!({}));
@@ -9,6 +9,7 @@ const SETTINGS_KEY: &str = "simpleCollabUserSettings";9
const SETTINGS_ID: &str = "simpleCollabUserSettingsId";9
const SETTINGS_ID: &str = "simpleCollabUserSettingsId";10
const TEAMS_ORDER_KEY: &str = "teamsOrder";10
const TEAMS_ORDER_KEY: &str = "teamsOrder";11
const SKIN_TONE_KEY: &str = "preferredSkinToneIndex";11
const SKIN_TONE_KEY: &str = "preferredSkinToneIndex";12
const DEFAULT_REACTIONS_KEY: &str = "defaultMessageReactions";12
const MAX_SKIN_TONE: u8 = 5;13
const MAX_SKIN_TONE: u8 = 5;13
const MUTED_FIELD: &str = "hasUserEnabledMutedChatSection";14
const MUTED_FIELD: &str = "hasUserEnabledMutedChatSection";14
const MEETING_FIELD: &str = "hasUserEnabledMeetingChatSection";15
const MEETING_FIELD: &str = "hasUserEnabledMeetingChatSection";@@ -98,6 +99,11 @@ impl<T: MessageTransport> UserSettings<T> {98
.await99
.await99
}100
}100
101
102
pub async fn set_default_reactions(&self, reaction_ids: &[String]) -> Result<()> {103
self.set_property(DEFAULT_REACTIONS_KEY, default_reactions_value(reaction_ids))104
.await105
}106
101
pub async fn set_property(&self, name: &str, value: Value) -> Result<()> {107
pub async fn set_property(&self, name: &str, value: Value) -> Result<()> {102
let url = format!("{}?name={name}", self.base_url);108
let url = format!("{}?name={name}", self.base_url);103
let mut body = Map::new();109
let mut body = Map::new();@@ -147,6 +153,25 @@ pub fn parse_skin_tone(properties: &Value) -> Option<u8> {147
(tone <= MAX_SKIN_TONE).then_some(tone)153
(tone <= MAX_SKIN_TONE).then_some(tone)148
}154
}149
155
156
pub fn parse_default_reactions(properties: &Value) -> Option<Vec<String>> {157
let entries = match properties.get(DEFAULT_REACTIONS_KEY)? {158
Value::String(text) => serde_json::from_str::<Value>(text).ok()?,159
other => other.clone(),160
};161
entries.as_array().map(|entries| {162
entries163
.iter()164
.filter_map(Value::as_str)165
.filter(|reaction_id| !reaction_id.is_empty())166
.map(str::to_owned)167
.collect()168
})169
}170
171
pub fn default_reactions_value(reaction_ids: &[String]) -> Value {172
Value::String(Value::from(reaction_ids.to_vec()).to_string())173
}174
150
pub fn parse_teams_order(properties: &Value) -> Vec<(String, i64)> {175
pub fn parse_teams_order(properties: &Value) -> Vec<(String, i64)> {151
let entries = match properties.get(TEAMS_ORDER_KEY) {176
let entries = match properties.get(TEAMS_ORDER_KEY) {152
Some(Value::String(text)) => serde_json::from_str::<Value>(text).ok(),177
Some(Value::String(text)) => serde_json::from_str::<Value>(text).ok(),@@ -228,6 +253,53 @@ mod tests {228
assert_eq!(parse_skin_tone(&json!({})), None);253
assert_eq!(parse_skin_tone(&json!({})), None);229
}254
}230
255
256
#[test]257
fn default_reactions_are_read_from_the_json_string_or_an_array() {258
assert_eq!(259
parse_default_reactions(&json!({DEFAULT_REACTIONS_KEY: r#"["like","heart","fire"]"#})),260
Some(vec![261
"like".to_owned(),262
"heart".to_owned(),263
"fire".to_owned()264
])265
);266
assert_eq!(267
parse_default_reactions(&json!({DEFAULT_REACTIONS_KEY: ["yes", "", 3]})),268
Some(vec!["yes".to_owned()])269
);270
assert_eq!(271
parse_default_reactions(&json!({DEFAULT_REACTIONS_KEY: "[]"})),272
Some(Vec::new())273
);274
assert_eq!(parse_default_reactions(&json!({})), None);275
assert_eq!(276
parse_default_reactions(&json!({DEFAULT_REACTIONS_KEY: "not json"})),277
None278
);279
}280
281
#[tokio::test]282
async fn default_reactions_are_put_as_a_json_string() {283
let transport = Canned {284
answers: Mutex::new(vec![(200, Value::Null)].into()),285
requests: Mutex::new(Vec::new()),286
};287
UserSettings::with_transport(&transport, "emea")288
.set_default_reactions(&["like".to_owned(), "fire".to_owned()])289
.await290
.unwrap();291
let requests = transport.requests.lock().unwrap();292
assert_eq!(requests[0].method, Method::Put);293
assert_eq!(294
requests[0].url,295
"https://teams.cloud.microsoft/api/chatsvc/emea/v1/users/ME/properties?name=defaultMessageReactions"296
);297
assert_eq!(298
requests[0].body,299
Some(json!({"defaultMessageReactions": r#"["like","fire"]"#}))300
);301
}302
231
#[test]303
#[test]232
fn unset_fields_use_the_teams_defaults() {304
fn unset_fields_use_the_teams_defaults() {233
let parsed = parse_chat_sections(&json!({}));305
let parsed = parse_chat_sections(&json!({}));@@ -0,0 +1,51 @@
1
use store::Store;
2
3
use crate::error::Result;
4
5
const META_ACCOUNT_DEFAULT_REACTIONS: &str = "default_reactions_account";
6
pub const TEAMS_DEFAULT_REACTIONS: [&str; 4] = ["like", "heart", "laugh", "surprised"];
7
pub const DEFAULT_REACTION_SLOTS: usize = 5;
8
9
pub fn store_account_default_reactions(
10
store: &Store,
11
reaction_ids: Option<&[String]>,
12
) -> Result<()> {
13
let value = reaction_ids
14
.map(|reaction_ids| serde_json::Value::from(reaction_ids.to_vec()).to_string())
15
.unwrap_or_default();
16
Ok(store.set_meta(META_ACCOUNT_DEFAULT_REACTIONS, &value)?)
17
}
18
19
/// The account setting `defaultMessageReactions`, Teams' own default set when it was never saved.
20
pub fn default_reactions(store: &Store) -> Vec<String> {
21
store
22
.meta(META_ACCOUNT_DEFAULT_REACTIONS)
23
.ok()
24
.flatten()
25
.filter(|stored| !stored.is_empty())
26
.and_then(|stored| serde_json::from_str::<Vec<String>>(&stored).ok())
27
.unwrap_or_else(|| {
28
TEAMS_DEFAULT_REACTIONS
29
.iter()
30
.map(|reaction_id| (*reaction_id).to_owned())
31
.collect()
32
})
33
}
34
35
#[cfg(test)]
36
mod tests {
37
use super::*;
38
39
#[test]
40
fn falls_back_to_the_teams_set_until_the_account_has_one() {
41
let store = Store::open_in_memory().unwrap();
42
assert_eq!(default_reactions(&store), TEAMS_DEFAULT_REACTIONS);
43
let saved = vec!["fire".to_owned(), "like".to_owned()];
44
store_account_default_reactions(&store, Some(&saved)).unwrap();
45
assert_eq!(default_reactions(&store), saved);
46
store_account_default_reactions(&store, Some(&[])).unwrap();
47
assert!(default_reactions(&store).is_empty());
48
store_account_default_reactions(&store, None).unwrap();
49
assert_eq!(default_reactions(&store), TEAMS_DEFAULT_REACTIONS);
50
}
51
}
@@ -0,0 +1,51 @@1
use store::Store;2
3
use crate::error::Result;4
5
const META_ACCOUNT_DEFAULT_REACTIONS: &str = "default_reactions_account";6
pub const TEAMS_DEFAULT_REACTIONS: [&str; 4] = ["like", "heart", "laugh", "surprised"];7
pub const DEFAULT_REACTION_SLOTS: usize = 5;8
9
pub fn store_account_default_reactions(10
store: &Store,11
reaction_ids: Option<&[String]>,12
) -> Result<()> {13
let value = reaction_ids14
.map(|reaction_ids| serde_json::Value::from(reaction_ids.to_vec()).to_string())15
.unwrap_or_default();16
Ok(store.set_meta(META_ACCOUNT_DEFAULT_REACTIONS, &value)?)17
}18
19
/// The account setting `defaultMessageReactions`, Teams' own default set when it was never saved.20
pub fn default_reactions(store: &Store) -> Vec<String> {21
store22
.meta(META_ACCOUNT_DEFAULT_REACTIONS)23
.ok()24
.flatten()25
.filter(|stored| !stored.is_empty())26
.and_then(|stored| serde_json::from_str::<Vec<String>>(&stored).ok())27
.unwrap_or_else(|| {28
TEAMS_DEFAULT_REACTIONS29
.iter()30
.map(|reaction_id| (*reaction_id).to_owned())31
.collect()32
})33
}34
35
#[cfg(test)]36
mod tests {37
use super::*;38
39
#[test]40
fn falls_back_to_the_teams_set_until_the_account_has_one() {41
let store = Store::open_in_memory().unwrap();42
assert_eq!(default_reactions(&store), TEAMS_DEFAULT_REACTIONS);43
let saved = vec!["fire".to_owned(), "like".to_owned()];44
store_account_default_reactions(&store, Some(&saved)).unwrap();45
assert_eq!(default_reactions(&store), saved);46
store_account_default_reactions(&store, Some(&[])).unwrap();47
assert!(default_reactions(&store).is_empty());48
store_account_default_reactions(&store, None).unwrap();49
assert_eq!(default_reactions(&store), TEAMS_DEFAULT_REACTIONS);50
}51
}@@ -3,7 +3,9 @@ use std::future::Future;
3
3
use std::pin::Pin;
4
4
use std::sync::{Arc, Mutex};
5
5
6
use chatsvc::settings::{parse_chat_sections, parse_skin_tone, parse_teams_order};
6
use chatsvc::settings::{
7
parse_chat_sections, parse_default_reactions, parse_skin_tone, parse_teams_order,
8
};
7
9
use chatsvc::{
8
10
ChannelNotificationLevel, ChannelNotifications, ChannelSettings, ChatSection,
9
11
ChatSectionSettings, Pins, UserSettings, pins::SessionTransport,
@@ -70,6 +72,15 @@ pub trait FolderSource: Send + Sync {
70
72
fn set_skin_tone(&self, _tone: u8) -> BoxFuture<'_, Result<()>> {
71
73
Box::pin(async { Ok(()) })
72
74
}
75
fn default_reactions(&self) -> Option<Vec<String>> {
76
None
77
}
78
fn set_default_reactions<'a>(
79
&'a self,
80
_reaction_ids: &'a [String],
81
) -> BoxFuture<'a, Result<()>> {
82
Box::pin(async { Ok(()) })
83
}
73
84
fn set_section_enabled(&self, section: ChatSection, enabled: bool)
74
85
-> BoxFuture<'_, Result<()>>;
75
86
fn set_folder_expanded<'a>(
@@ -96,6 +107,7 @@ pub struct ChatsvcFolderSource {
96
107
channel_settings: ChannelSettings,
97
108
properties: Mutex<Option<Value>>,
98
109
skin_tone: Mutex<Option<u8>>,
110
default_reactions: Mutex<Option<Vec<String>>>,
99
111
group_ids: Mutex<HashMap<String, String>>,
100
112
}
101
113
@@ -107,6 +119,7 @@ impl ChatsvcFolderSource {
107
119
channel_settings: ChannelSettings::new(session),
108
120
properties: Mutex::new(None),
109
121
skin_tone: Mutex::new(None),
122
default_reactions: Mutex::new(None),
110
123
group_ids: Mutex::new(HashMap::new()),
111
124
}
112
125
}
@@ -151,6 +164,7 @@ impl FolderSource for ChatsvcFolderSource {
151
164
let properties = self.settings.properties().await?;
152
165
let sections = parse_chat_sections(&properties);
153
166
*self.skin_tone.lock().unwrap() = parse_skin_tone(&properties);
167
*self.default_reactions.lock().unwrap() = parse_default_reactions(&properties);
154
168
*self.properties.lock().unwrap() = Some(properties);
155
169
Ok(sections)
156
170
})
@@ -164,6 +178,17 @@ impl FolderSource for ChatsvcFolderSource {
164
178
Box::pin(async move { Ok(self.settings.set_skin_tone(tone).await?) })
165
179
}
166
180
181
fn default_reactions(&self) -> Option<Vec<String>> {
182
self.default_reactions.lock().unwrap().clone()
183
}
184
185
fn set_default_reactions<'a>(
186
&'a self,
187
reaction_ids: &'a [String],
188
) -> BoxFuture<'a, Result<()>> {
189
Box::pin(async move { Ok(self.settings.set_default_reactions(reaction_ids).await?) })
190
}
191
167
192
fn teams_order(&self) -> BoxFuture<'_, Result<Vec<(String, i64)>>> {
168
193
Box::pin(async {
169
194
let cached = self.properties.lock().unwrap().take();
@@ -478,12 +503,18 @@ impl<R: Remote> SyncEngine<R> {
478
503
479
504
async fn refresh_section_settings(&self, source: &Arc<dyn FolderSource>) {
480
505
let outcome = match source.section_settings().await {
481
Ok(settings) => self.apply_section_settings(&settings).and_then(|()| {
482
match source.preferred_skin_tone() {
506
Ok(settings) => self
507
.apply_section_settings(&settings)
508
.and_then(|()| match source.preferred_skin_tone() {
483
509
Some(tone) => crate::skin_tone::store_account_skin_tone(&self.store, tone),
484
510
None => Ok(()),
485
}
486
}),
511
})
512
.and_then(|()| {
513
crate::default_reactions::store_account_default_reactions(
514
&self.store,
515
source.default_reactions().as_deref(),
516
)
517
}),
487
518
Err(error) => Err(error),
488
519
};
489
520
if let Err(error) = outcome {
@@ -510,6 +541,13 @@ impl<R: Remote> SyncEngine<R> {
510
541
crate::skin_tone::store_account_skin_tone(&self.store, tone)
511
542
}
512
543
544
pub async fn set_default_reactions(&self, reaction_ids: &[String]) -> Result<()> {
545
self.folder_source()?
546
.set_default_reactions(reaction_ids)
547
.await?;
548
crate::default_reactions::store_account_default_reactions(&self.store, Some(reaction_ids))
549
}
550
513
551
pub async fn set_folder_expanded(&self, folder_id: &str, expanded: bool) -> Result<()> {
514
552
self.folder_source()?
515
553
.set_folder_expanded(folder_id, expanded)
@@ -3,7 +3,9 @@ use std::future::Future;3
use std::pin::Pin;3
use std::pin::Pin;4
use std::sync::{Arc, Mutex};4
use std::sync::{Arc, Mutex};5
5
6
use chatsvc::settings::{parse_chat_sections, parse_skin_tone, parse_teams_order};6
use chatsvc::settings::{7
parse_chat_sections, parse_default_reactions, parse_skin_tone, parse_teams_order,8
};7
use chatsvc::{9
use chatsvc::{8
ChannelNotificationLevel, ChannelNotifications, ChannelSettings, ChatSection,10
ChannelNotificationLevel, ChannelNotifications, ChannelSettings, ChatSection,9
ChatSectionSettings, Pins, UserSettings, pins::SessionTransport,11
ChatSectionSettings, Pins, UserSettings, pins::SessionTransport,@@ -70,6 +72,15 @@ pub trait FolderSource: Send + Sync {70
fn set_skin_tone(&self, _tone: u8) -> BoxFuture<'_, Result<()>> {72
fn set_skin_tone(&self, _tone: u8) -> BoxFuture<'_, Result<()>> {71
Box::pin(async { Ok(()) })73
Box::pin(async { Ok(()) })72
}74
}75
fn default_reactions(&self) -> Option<Vec<String>> {76
None77
}78
fn set_default_reactions<'a>(79
&'a self,80
_reaction_ids: &'a [String],81
) -> BoxFuture<'a, Result<()>> {82
Box::pin(async { Ok(()) })83
}73
fn set_section_enabled(&self, section: ChatSection, enabled: bool)84
fn set_section_enabled(&self, section: ChatSection, enabled: bool)74
-> BoxFuture<'_, Result<()>>;85
-> BoxFuture<'_, Result<()>>;75
fn set_folder_expanded<'a>(86
fn set_folder_expanded<'a>(@@ -96,6 +107,7 @@ pub struct ChatsvcFolderSource {96
channel_settings: ChannelSettings,107
channel_settings: ChannelSettings,97
properties: Mutex<Option<Value>>,108
properties: Mutex<Option<Value>>,98
skin_tone: Mutex<Option<u8>>,109
skin_tone: Mutex<Option<u8>>,110
default_reactions: Mutex<Option<Vec<String>>>,99
group_ids: Mutex<HashMap<String, String>>,111
group_ids: Mutex<HashMap<String, String>>,100
}112
}101
113
@@ -107,6 +119,7 @@ impl ChatsvcFolderSource {107
channel_settings: ChannelSettings::new(session),119
channel_settings: ChannelSettings::new(session),108
properties: Mutex::new(None),120
properties: Mutex::new(None),109
skin_tone: Mutex::new(None),121
skin_tone: Mutex::new(None),122
default_reactions: Mutex::new(None),110
group_ids: Mutex::new(HashMap::new()),123
group_ids: Mutex::new(HashMap::new()),111
}124
}112
}125
}@@ -151,6 +164,7 @@ impl FolderSource for ChatsvcFolderSource {151
let properties = self.settings.properties().await?;164
let properties = self.settings.properties().await?;152
let sections = parse_chat_sections(&properties);165
let sections = parse_chat_sections(&properties);153
*self.skin_tone.lock().unwrap() = parse_skin_tone(&properties);166
*self.skin_tone.lock().unwrap() = parse_skin_tone(&properties);167
*self.default_reactions.lock().unwrap() = parse_default_reactions(&properties);154
*self.properties.lock().unwrap() = Some(properties);168
*self.properties.lock().unwrap() = Some(properties);155
Ok(sections)169
Ok(sections)156
})170
})@@ -164,6 +178,17 @@ impl FolderSource for ChatsvcFolderSource {164
Box::pin(async move { Ok(self.settings.set_skin_tone(tone).await?) })178
Box::pin(async move { Ok(self.settings.set_skin_tone(tone).await?) })165
}179
}166
180
181
fn default_reactions(&self) -> Option<Vec<String>> {182
self.default_reactions.lock().unwrap().clone()183
}184
185
fn set_default_reactions<'a>(186
&'a self,187
reaction_ids: &'a [String],188
) -> BoxFuture<'a, Result<()>> {189
Box::pin(async move { Ok(self.settings.set_default_reactions(reaction_ids).await?) })190
}191
167
fn teams_order(&self) -> BoxFuture<'_, Result<Vec<(String, i64)>>> {192
fn teams_order(&self) -> BoxFuture<'_, Result<Vec<(String, i64)>>> {168
Box::pin(async {193
Box::pin(async {169
let cached = self.properties.lock().unwrap().take();194
let cached = self.properties.lock().unwrap().take();@@ -478,12 +503,18 @@ impl<R: Remote> SyncEngine<R> {478
503
479
async fn refresh_section_settings(&self, source: &Arc<dyn FolderSource>) {504
async fn refresh_section_settings(&self, source: &Arc<dyn FolderSource>) {480
let outcome = match source.section_settings().await {505
let outcome = match source.section_settings().await {481
Ok(settings) => self.apply_section_settings(&settings).and_then(|()| {506
Ok(settings) => self482
match source.preferred_skin_tone() {507
.apply_section_settings(&settings)508
.and_then(|()| match source.preferred_skin_tone() {483
Some(tone) => crate::skin_tone::store_account_skin_tone(&self.store, tone),509
Some(tone) => crate::skin_tone::store_account_skin_tone(&self.store, tone),484
None => Ok(()),510
None => Ok(()),485
}511
})486
}),512
.and_then(|()| {513
crate::default_reactions::store_account_default_reactions(514
&self.store,515
source.default_reactions().as_deref(),516
)517
}),487
Err(error) => Err(error),518
Err(error) => Err(error),488
};519
};489
if let Err(error) = outcome {520
if let Err(error) = outcome {@@ -510,6 +541,13 @@ impl<R: Remote> SyncEngine<R> {510
crate::skin_tone::store_account_skin_tone(&self.store, tone)541
crate::skin_tone::store_account_skin_tone(&self.store, tone)511
}542
}512
543
544
pub async fn set_default_reactions(&self, reaction_ids: &[String]) -> Result<()> {545
self.folder_source()?546
.set_default_reactions(reaction_ids)547
.await?;548
crate::default_reactions::store_account_default_reactions(&self.store, Some(reaction_ids))549
}550
513
pub async fn set_folder_expanded(&self, folder_id: &str, expanded: bool) -> Result<()> {551
pub async fn set_folder_expanded(&self, folder_id: &str, expanded: bool) -> Result<()> {514
self.folder_source()?552
self.folder_source()?515
.set_folder_expanded(folder_id, expanded)553
.set_folder_expanded(folder_id, expanded)@@ -13,6 +13,7 @@ mod card_widgets;
13
13
mod card_width;
14
14
mod channel_sync;
15
15
mod chat_paging;
16
mod default_reactions;
16
17
mod download;
17
18
mod draft;
18
19
mod emoticon_tags;
@@ -106,6 +107,10 @@ pub use chatsvc::{
106
107
TranslationStatus, TranslationTrigger, authoring_patch, behavior_patch, language_code,
107
108
parse_language_settings, target_patch,
108
109
};
110
pub use default_reactions::{
111
DEFAULT_REACTION_SLOTS, TEAMS_DEFAULT_REACTIONS, default_reactions,
112
store_account_default_reactions,
113
};
109
114
pub use download::LibraryFile;
110
115
pub use draft::{
111
116
Draft, DraftLine, Edit, FormatState, LineKind, MAX_DEPTH, Mark, MarkKind, OBJECT_MARK,
@@ -13,6 +13,7 @@ mod card_widgets;13
mod card_width;13
mod card_width;14
mod channel_sync;14
mod channel_sync;15
mod chat_paging;15
mod chat_paging;16
mod default_reactions;16
mod download;17
mod download;17
mod draft;18
mod draft;18
mod emoticon_tags;19
mod emoticon_tags;@@ -106,6 +107,10 @@ pub use chatsvc::{106
TranslationStatus, TranslationTrigger, authoring_patch, behavior_patch, language_code,107
TranslationStatus, TranslationTrigger, authoring_patch, behavior_patch, language_code,107
parse_language_settings, target_patch,108
parse_language_settings, target_patch,108
};109
};110
pub use default_reactions::{111
DEFAULT_REACTION_SLOTS, TEAMS_DEFAULT_REACTIONS, default_reactions,112
store_account_default_reactions,113
};109
pub use download::LibraryFile;114
pub use download::LibraryFile;110
pub use draft::{115
pub use draft::{111
Draft, DraftLine, Edit, FormatState, LineKind, MAX_DEPTH, Mark, MarkKind, OBJECT_MARK,116
Draft, DraftLine, Edit, FormatState, LineKind, MAX_DEPTH, Mark, MarkKind, OBJECT_MARK,