forked from openedx/openedx-app-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Notification preference settings and relevant code (#104)
- Loading branch information
1 parent
66593fa
commit 1cec44b
Showing
28 changed files
with
344 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Dashboard/Dashboard.xcodeproj/xcshareddata/xcschemes/Dashboard.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Discussion/Discussion.xcodeproj/xcshareddata/xcschemes/Discussion.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
Notifications/Notifications/Presentation/Settings/NotificationsSettingsViewModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// 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 | ||
private var interactor: NotificationsInteractorProtocol | ||
private var analytics: NotificationsAnalytics | ||
var router: NotificationsRouter | ||
|
||
var errorMessage: String? { | ||
didSet { | ||
showError = errorMessage != nil | ||
} | ||
} | ||
|
||
public init( | ||
interactor: NotificationsInteractorProtocol, | ||
analytics: NotificationsAnalytics, | ||
router: NotificationsRouter | ||
) { | ||
self.interactor = interactor | ||
self.analytics = analytics | ||
self.router = router | ||
} | ||
|
||
public func toggleNotificationsPermissionAction() { | ||
hasPermission.toggle() | ||
analytics.notificationsDiscussionPermissionToggleEvent(action: hasPermission) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.