-
Notifications
You must be signed in to change notification settings - Fork 0
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
Changes from 2 commits
5f7d61d
af36304
603c080
5e4a65c
c34444d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// NotificationsPersistence.swift | ||
// Notifications | ||
// | ||
// Created by Saeed Bashir on 12/13/24. | ||
// | ||
|
||
import CoreData | ||
|
||
public class NotificationsPersistence: NotificationsPersistenceProtocol { | ||
private var context: NSManagedObjectContext | ||
|
||
public init(context: NSManagedObjectContext) { | ||
self.context = context | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// NotificationsSettingsViewModel.swift | ||
// Notifications | ||
// | ||
// Created by Saeed Bashir on 12/13/24. | ||
// | ||
|
||
import Foundation | ||
import Core | ||
import SwiftUI | ||
|
||
public class NotificationsSettingsViewModel: ObservableObject { | ||
@Published var showError: Bool = false | ||
public var hasPermission: Bool = false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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’. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. got it |
||
private var interactor: NotificationsInteractorProtocol | ||
private var analytics: NotificationsAnalytics | ||
|
||
var errorMessage: String? { | ||
didSet { | ||
showError = errorMessage != nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation issue |
||
} | ||
} | ||
|
||
public init( | ||
interactor: NotificationsInteractorProtocol, | ||
analytics: NotificationsAnalytics | ||
) { | ||
self.interactor = interactor | ||
self.analytics = analytics | ||
} | ||
|
||
public func toggleNotificationsPermissionAction() { | ||
hasPermission.toggle() | ||
analytics.notificationsDiscussionPermissionToggleEvent(action: hasPermission) | ||
} | ||
} |
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.
Please remove this file as it's duplicate here.