Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Notification preference settings and relevant code #104

Merged
merged 5 commits into from
Dec 20, 2024

Conversation

saeedbashir
Copy link

Description

Add push notifications settings in the profile settings to change the permission of discussion activities to send the notifications messages.

This PR only adds the UI as the preference API isn't ready yet.

Config PR: https://github.com/edx/edx-mobile-config/pull/188

Screenshots:

Profile Settings Push Notification Settings
Simulator Screenshot - iPhone 16 Pro - 2024-12-17 at 13 59 19 Simulator Screenshot - iPhone 16 Pro - 2024-12-17 at 13 59 31


var errorMessage: String? {
didSet {
withAnimation {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad practice: openedx#277
needs to move animations inside view

@Published var showError: Bool = false
public var hasPermission: Bool = false
private var interactor: NotificationsInteractorProtocol
private var router: NotificationsRouter
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we plan to perform routing from this view?


public class NotificationsSettingsViewModel: ObservableObject {
@Published var showError: Bool = false
public var hasPermission: Bool = false
Copy link
Collaborator

@rnr rnr Dec 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we will have a list of push settings, perhaps we need to develop a way to interact with the list of ‘settings’.
Same in View - we need to have a ForEach that will show a list of all settings (I realise we don't have an API now, but we need to interact with many settings, and for the API we could just have an empty function at the moment). Just add one/two more settings to the existing ‘Discussion Activities'.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in the future, we will be getting more push notification settings, but when we are not sure, that's why I keep it simple as per the current requirements. When they come, we will plan it accordingly.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it

Comment on lines 34 to 43
.highPriorityGesture(
DragGesture(minimumDistance: 20, coordinateSpace: .local).onEnded { _ in
viewModel.toggleNotificationsPermissionAction()
}
)
.highPriorityGesture(
TapGesture().onEnded {
viewModel.toggleNotificationsPermissionAction()
}
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We added PriorityGesture here to fix iOS18 bug when parental View intercepts gestures and when we use Toggle not just like 'toggle'. Do you see the same here? Otherwise we don't need . highPriorityGesture here. Please look. Thank you

@saeedbashir saeedbashir requested a review from rnr December 18, 2024 06:13
@shafqat-muneer
Copy link

@saeedbashir Please update the navigation bar design to match the Figma designs.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this file as it's duplicate here.


var errorMessage: String? {
didSet {
showError = errorMessage != nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation issue

Copy link

@shafqat-muneer shafqat-muneer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@saeedbashir saeedbashir merged commit 1cec44b into 2U/develop Dec 20, 2024
2 checks passed
@saeedbashir saeedbashir deleted the saeed/LEARNER-10312 branch December 20, 2024 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants