-
Notifications
You must be signed in to change notification settings - Fork 437
[NEW] Menu for changing push notification settings #1396
[NEW] Menu for changing push notification settings #1396
Conversation
# Conflicts: # Rocket.Chat.xcodeproj/project.pbxproj
internal let settings: [(title: String?, elements: [NotificationSettingModel])] = [ | ||
(title: nil, [ | ||
NotificationsSwitchCell.SettingModel(value: "1", type: .switch, leftTitle: "q", leftDescription: "w", rightTitle: "e", rightDescription: "r"), | ||
NotificationsSwitchCell.SettingModel(value: "0", type: .switch, leftTitle: "t", leftDescription: "y", rightTitle: "u", rightDescription: "i"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing Comma Violation: Collection literals should not have trailing commas. (trailing_comma)
let api: AnyAPIFetcher | ||
|
||
func fetchSettings() { | ||
api.fetch(SettingsRequest(), succeeded: { result in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused Closure Parameter Violation: Unused parameter "result" in a closure should be replaced with _. (unused_closure_parameter)
@artrmz Thank you for the PR! Can you take a look on the conflicts please? |
# Conflicts: # Rocket.Chat.xcodeproj/project.pbxproj # Rocket.Chat/Controllers/Settings/PreferencesViewController.swift # Rocket.Chat/Controllers/Settings/PreferencesViewModel.swift # Rocket.Chat/Resources/en.lproj/Localizable.strings # Rocket.Chat/Storyboards/Preferences.storyboard
Resolved conflicts, although there is still lots of work left, sadly I did not have much time lately :( Hopefully, I'll get back to it soon. |
@artrmz Thank you! |
# Conflicts: # Rocket.Chat.xcodeproj/project.pbxproj # Rocket.Chat/Controllers/Settings/PreferencesViewController.swift # Rocket.Chat/Controllers/Settings/PreferencesViewModel.swift # Rocket.Chat/Storyboards/Preferences.storyboard
…b.com/artrmz/Rocket.Chat.iOS into feature/288-notifications-preferences # Conflicts: # Rocket.Chat/Storyboards/Preferences.storyboard
Hey @artrmz ! |
# Conflicts: # Rocket.Chat.xcodeproj/project.pbxproj
@Sameesunkaria Hey man! I am still quite short on time but will do my best to push it forward a little bit this/next week. |
@artrmz I'm not very familiar with the API stuff rn. But if you need any help, I have plenty of time. 😃 |
@Sameesunkaria Thank you! Pretty much API (getting current notifications settings and saving new ones) is the last thing to do ;) Seems like RocketChat/Rocket.Chat#10128 has been merged so need to implement |
…r notifications setting cell protocol
self.viewModel.mobileAlertsModel.value.value = subscription.mobilePushNotifications ?? "placeholder" | ||
self.viewModel.mailAlertsModel.value.value = subscription.emailNotifications ?? "placeholder" | ||
|
||
}, errored: { error in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused Closure Parameter Violation: Unused parameter "error" in a closure should be replaced with _. (unused_closure_parameter)
self.viewModel.counterModel.value.value = false // TODO: ??? | ||
// self.viewModel.desktopAlertsModel.value.value // TODO: ??? | ||
// self.viewModel.desktopAudioModel.value.value // TODO: ??? | ||
// self.viewModel.desktopSoundModel.value.value // TODO: ??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Todo Violation: TODOs should be resolved (???). (todo)
self.viewModel.enableModel.value.value = !subscription.disableNotifications | ||
self.viewModel.counterModel.value.value = false // TODO: ??? | ||
// self.viewModel.desktopAlertsModel.value.value // TODO: ??? | ||
// self.viewModel.desktopAudioModel.value.value // TODO: ??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Todo Violation: TODOs should be resolved (???). (todo)
|
||
self.viewModel.enableModel.value.value = !subscription.disableNotifications | ||
self.viewModel.counterModel.value.value = false // TODO: ??? | ||
// self.viewModel.desktopAlertsModel.value.value // TODO: ??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Todo Violation: TODOs should be resolved (???). (todo)
} | ||
|
||
self.viewModel.enableModel.value.value = !subscription.disableNotifications | ||
self.viewModel.counterModel.value.value = false // TODO: ??? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Todo Violation: TODOs should be resolved (???). (todo)
Tried to implement https://rocket.chat/docs/developer-guides/rest-api/subscriptions/getone/ but seems like values for notifications are missing or am I doing something wrong? @rafaelks Getting such response (on open.rocket.chat):
|
Guys this PR is ready for review. @rafaelks @cardoso @filipealva |
Thank you @Sameesunkaria for your contribution, looks much nicer now :) |
…ences' into feature/288-notifications-preferences
This is looking really really good, thanks a lot for the work on this! Few things we can improve before we merge IMHO:
|
@artrmz Can you please help me with the animations? |
@Sameesunkaria Can take a look at that tomorrow morning 👍 |
|
@@ -366,7 +366,7 @@ | |||
"myaccount.settings.notifications.duration.default" = "Default"; // TODO | |||
"myaccount.settings.notifications.duration.seconds" = "seconds"; // TODO | |||
|
|||
"alert.update_notifications_preferences_success.title" = "Successfully updated your notification preferences."; // TODO | |||
"alert.update_notifications_preferences_success.title" = "Perferences saved"; // TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo :) "Preferences saved".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sometimes I hate that Xcode doesn't have autocorrect for strings. 🙈
@@ -366,7 +366,7 @@ | |||
"myaccount.settings.notifications.duration.default" = "Default"; // TODO | |||
"myaccount.settings.notifications.duration.seconds" = "seconds"; // TODO | |||
|
|||
"alert.update_notifications_preferences_success.title" = "Successfully updated your notification preferences."; // TODO | |||
"alert.update_notifications_preferences_success.title" = "Perferences saved"; // TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo :) "Preferences saved".
@@ -366,7 +366,7 @@ | |||
"myaccount.settings.notifications.duration.default" = "Default"; // TODO | |||
"myaccount.settings.notifications.duration.seconds" = "seconds"; // TODO | |||
|
|||
"alert.update_notifications_preferences_success.title" = "Successfully updated your notification preferences."; // TODO | |||
"alert.update_notifications_preferences_success.title" = "Perferences saved"; // TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo :) "Preferences saved".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still missing this one @Sameesunkaria
@@ -365,7 +365,7 @@ | |||
"myaccount.settings.notifications.duration.default" = "Default"; | |||
"myaccount.settings.notifications.duration.seconds" = "seconds"; | |||
|
|||
"alert.update_notifications_preferences_success.title" = "Successfully updated your notification preferences."; | |||
"alert.update_notifications_preferences_success.title" = "Perferences saved"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo :) "Preferences saved".
@@ -365,7 +365,7 @@ | |||
"myaccount.settings.notifications.duration.default" = "Default"; // TODO | |||
"myaccount.settings.notifications.duration.seconds" = "seconds"; // TODO | |||
|
|||
"alert.update_notifications_preferences_success.title" = "Successfully updated your notification preferences."; // TODO | |||
"alert.update_notifications_preferences_success.title" = "Perferences saved"; // TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo :) "Preferences saved".
@@ -364,7 +364,7 @@ | |||
"myaccount.settings.notifications.duration.default" = "Default"; // TODO | |||
"myaccount.settings.notifications.duration.seconds" = "seconds"; // TODO | |||
|
|||
"alert.update_notifications_preferences_success.title" = "Successfully updated your notification preferences."; // TODO | |||
"alert.update_notifications_preferences_success.title" = "Perferences saved"; // TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo :) "Preferences saved".
@@ -365,7 +365,7 @@ | |||
"myaccount.settings.notifications.duration.default" = "Default"; // TODO | |||
"myaccount.settings.notifications.duration.seconds" = "seconds"; // TODO | |||
|
|||
"alert.update_notifications_preferences_success.title" = "Successfully updated your notification preferences."; // TODO | |||
"alert.update_notifications_preferences_success.title" = "Perferences saved"; // TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo :) "Preferences saved".
@@ -366,7 +366,7 @@ | |||
"myaccount.settings.notifications.duration.default" = "Default"; // TODO | |||
"myaccount.settings.notifications.duration.seconds" = "seconds"; // TODO | |||
|
|||
"alert.update_notifications_preferences_success.title" = "Successfully updated your notification preferences."; // TODO | |||
"alert.update_notifications_preferences_success.title" = "Perferences saved"; // TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo :) "Preferences saved".
@@ -363,7 +363,7 @@ | |||
"myaccount.settings.notifications.duration.default" = "Default"; // TODO | |||
"myaccount.settings.notifications.duration.seconds" = "seconds"; // TODO | |||
|
|||
"alert.update_notifications_preferences_success.title" = "Successfully updated your notification preferences."; // TODO | |||
"alert.update_notifications_preferences_success.title" = "Perferences saved"; // TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo :) "Preferences saved".
@@ -365,7 +365,7 @@ | |||
"myaccount.settings.notifications.duration.default" = "Default"; // TODO | |||
"myaccount.settings.notifications.duration.seconds" = "seconds"; // TODO | |||
|
|||
"alert.update_notifications_preferences_success.title" = "Successfully updated your notification preferences."; // TODO | |||
"alert.update_notifications_preferences_success.title" = "Perferences saved"; // TODO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo :) "Preferences saved".
@Sameesunkaria I am done with enabling/disabling save button although not sure yet if I want to push that :) We either have to request subscription to make sure we are synced with the server or leave the controller after saving, not sure what is better... additional request or closing controller 🤔 Will let know once I finish the animation. |
@artrmz That makes sense... if it's too complicated let's leave the button the way it is now. |
…es (updating model after successful save)
@rafaelks @Sameesunkaria Pushed the change to enable/disable "Save button" as needed. |
@artrmz @Sameesunkaria Looking great to me, gonna review the code! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking really nice! 👍
Thanks @artrmz for all your hard work on this one! 🎉 |
Yes, thank you very much for that @artrmz, many people are going to be happy with this PR!!! 🎉 |
@RocketChat/ios
Closes #288
add a controller for notifications preferences
switch cell
drop-down menu for a "choose cells"
implement the saveNotifications POST
localize everything
clean up the code
write tests
fix switch cell height when the description has more than 1 line
replace drop down menu with picker view (like system's add event)
notification's icon for subscription actions' list
[OPTIONAL] allow changing global notification preferences (accessible from Preferences menu?)
NOTES: