forked from openedx/openedx-app-ios
-
Notifications
You must be signed in to change notification settings - Fork 1
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: Notifications Inbox Screen Implementation #113
Open
shafqat-muneer
wants to merge
1
commit into
2U/develop
Choose a base branch
from
Shafqat/LEARNER-10288
base: 2U/develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,019
−27
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
Notifications/Notifications/Assets.xcassets/discussions.imageset/Contents.json
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,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "discussions.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"template-rendering-intent" : "template" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
Notifications/Notifications/Assets.xcassets/discussions.imageset/discussions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
Notifications/Notifications/Assets.xcassets/three_dots_menu.imageset/Contents.json
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,15 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "three_dots_menu.svg", | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"template-rendering-intent" : "template" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...ions/Notifications/Assets.xcassets/three_dots_menu.imageset/three_dots_menu.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
147 changes: 147 additions & 0 deletions
147
Notifications/Notifications/Data/Model/Data_Notifications.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,147 @@ | ||
// | ||
// Notifications.swift | ||
// Notifications | ||
// | ||
// Created by Shafqat Muneer on 1/6/25. | ||
// | ||
|
||
import Foundation | ||
import Core | ||
|
||
public extension DataLayer { | ||
struct Notifications: Codable { | ||
public let next: String? | ||
public let count: Int? | ||
public let numPages: Int? | ||
public let currentPage: Int? | ||
public let start: Int? | ||
public let results: [Notification]? | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case next | ||
case count | ||
case numPages = "num_pages" | ||
case currentPage = "current_page" | ||
case start | ||
case results | ||
} | ||
|
||
public init( | ||
next: String?, | ||
count: Int?, | ||
numPages: Int?, | ||
currentPage: Int?, | ||
start: Int?, | ||
results: [Notification]? | ||
) { | ||
self.next = next | ||
self.count = count | ||
self.numPages = numPages | ||
self.currentPage = currentPage | ||
self.start = start | ||
self.results = results | ||
} | ||
} | ||
|
||
struct Notification: Codable { | ||
public let id: Int? | ||
public let appName: String? | ||
public let notificationType: String? | ||
public let contentContext: ContentContext? | ||
public let content: String? | ||
public let lastRead: String? | ||
public let lastSeen: String? | ||
public let created: String | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case id | ||
case appName = "app_name" | ||
case notificationType = "notification_type" | ||
case contentContext = "content_context" | ||
case content | ||
case lastRead = "last_read" | ||
case lastSeen = "last_seen" | ||
case created | ||
} | ||
|
||
public init( | ||
id: Int?, | ||
appName: String?, | ||
notificationType: String?, | ||
contentContext: ContentContext?, | ||
content: String?, | ||
lastRead: String?, | ||
lastSeen: String?, | ||
created: String | ||
) { | ||
self.id = id | ||
self.appName = appName | ||
self.notificationType = notificationType | ||
self.contentContext = contentContext | ||
self.content = content | ||
self.lastRead = lastRead | ||
self.lastSeen = lastSeen | ||
self.created = created | ||
} | ||
} | ||
|
||
struct ContentContext: Codable { | ||
public let topicId: String? | ||
public let parentId: String? | ||
public let threadId: String? | ||
public let commentId: String? | ||
public let postTitle: String? | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case topicId = "topic_id" | ||
case parentId = "parent_id" | ||
case threadId = "thread_id" | ||
case commentId = "comment_id" | ||
case postTitle = "post_title" | ||
} | ||
|
||
public init( | ||
topicId: String?, | ||
parentId: String?, | ||
threadId: String?, | ||
commentId: String?, | ||
postTitle: String? | ||
) { | ||
self.topicId = topicId | ||
self.parentId = parentId | ||
self.threadId = threadId | ||
self.commentId = commentId | ||
self.postTitle = postTitle | ||
} | ||
} | ||
} | ||
|
||
public extension DataLayer.Notifications { | ||
var domain: Notifications { | ||
Notifications( | ||
next: next, | ||
count: count, | ||
numPages: numPages, | ||
currentPage: currentPage, | ||
start: start, | ||
results: results?.compactMap { result in | ||
Notification( | ||
id: result.id, | ||
appName: result.appName, | ||
notificationType: result.notificationType, | ||
contentContext: ContentContext( | ||
topicId: result.contentContext?.topicId, | ||
parentId: result.contentContext?.parentId, | ||
threadId: result.contentContext?.threadId, | ||
commentId: result.contentContext?.commentId, | ||
postTitle: result.contentContext?.postTitle | ||
), | ||
content: result.content, | ||
lastRead: result.lastRead.flatMap { Date(iso8601: $0) }, | ||
lastSeen: result.lastSeen.flatMap { Date(iso8601: $0) }, | ||
created: Date(iso8601: result.created) | ||
) | ||
} | ||
) | ||
} | ||
} |
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 fix indentations here