Messages - Room notification modes.

The web client defines 4 levels of notifications: 'All messages (loud)', 'All messages', 'Mentions only' and 'Mute'.
The ios client support only 2 modes: Mute / Unmute.

We update the client to map these 2 modes with the 4 new ones until a new design is defined to handle the 4 levels on mobile client:
- When a room is in 'Mute' or 'Mentions only mode', it is displayed as mute. Else it is unmute.
- When the user unmute a room, the room switches in 'All message mode'.
- When the user mute a room, the room switches in 'Mentions only' mode.

On ios client, mute a room
This commit is contained in:
giomfo
2016-09-08 10:43:03 +02:00
parent cd809e8e8c
commit 0c17bf4068
4 changed files with 363 additions and 73 deletions
@@ -1509,18 +1509,34 @@ NSString *const kRoomSettingsAdvancedCellViewIdentifier = @"kRoomSettingsAdvance
if ([updatedItemsDict objectForKey:kRoomSettingsMuteNotifKey])
{
[mxRoom setMute:roomNotifSwitch.on completion:^{
if (weakSelf)
{
__strong __typeof(weakSelf)strongSelf = weakSelf;
if (roomNotifSwitch.on)
{
[mxRoom mentionsOnly:^{
[strongSelf->updatedItemsDict removeObjectForKey:kRoomSettingsMuteNotifKey];
[strongSelf onSave:nil];
}
}];
if (weakSelf)
{
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf->updatedItemsDict removeObjectForKey:kRoomSettingsMuteNotifKey];
[strongSelf onSave:nil];
}
}];
}
else
{
[mxRoom allMessages:^{
if (weakSelf)
{
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf->updatedItemsDict removeObjectForKey:kRoomSettingsMuteNotifKey];
[strongSelf onSave:nil];
}
}];
}
return;
}
@@ -1798,7 +1814,7 @@ NSString *const kRoomSettingsAdvancedCellViewIdentifier = @"kRoomSettingsAdvance
}
else
{
roomNotifSwitch.on = mxRoom.isMute;
roomNotifSwitch.on = mxRoom.isMute || mxRoom.isMentionsOnly;
}
cell = roomNotifCell;
@@ -2769,7 +2785,7 @@ NSString *const kRoomSettingsAdvancedCellViewIdentifier = @"kRoomSettingsAdvance
{
if (theSwitch == roomNotifSwitch)
{
if (roomNotifSwitch.on == mxRoom.isMute)
if (roomNotifSwitch.on == (mxRoom.isMute || mxRoom.isMentionsOnly))
{
[updatedItemsDict removeObjectForKey:kRoomSettingsMuteNotifKey];
}