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

Add STNotification type and icon #272

Merged
merged 1 commit into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
28 changes: 18 additions & 10 deletions SNUTT-2022/SNUTT/Models/STNotification.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,31 @@ struct STNotification: Hashable {
return "업데이트 알림"
case .lectureRemove:
return "폐강 알림"
case .link:
return "공지"
case .lectureVacancy:
return "빈자리 알림"
case .friend:
return "친구"
case .newFeature:
return "신규 기능"
}
}

var imageName: String {
switch type {
case .normal:
return "exclamation"
return "noti.exclamation"
case .courseBook:
return "calendar"
return "noti.calendar"
case .lectureUpdate:
return "refresh"
return "noti.refresh"
case .lectureRemove:
return "trash"
case .link:
return "megaphone"
return "noti.trash"
case .lectureVacancy:
return "noti.vacancy"
case .friend:
return "noti.friend"
case .newFeature:
return "noti.megaphone"
}
}
}
Expand All @@ -66,12 +74,12 @@ extension STNotification {
detail = nil
case .lectureRemove, .lectureUpdate:
detail = dto.detail as? NotificationDto.Detail
case .link:
case .lectureVacancy, .friend, .newFeature:
link = dto.detail as? String
}
}
}

enum NotificationType: Int {
case normal = 0, courseBook, lectureUpdate, lectureRemove, link
case normal = 0, courseBook, lectureUpdate, lectureRemove, lectureVacancy, friend, newFeature
}
2 changes: 1 addition & 1 deletion SNUTT-2022/SNUTT/Repositories/Dto/NotificationDto.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct NotificationDto: Decodable {
.lectureRemove:
detail = try? container.decode(Detail.self, forKey: .detail)
return
case .link:
case .lectureVacancy, .friend, .newFeature:
detail = try? container.decode(String.self, forKey: .detail)
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct NotificationListCell_Previews: PreviewProvider {
static var previews: some View {
VStack {
NotificationListCell(notification: .init(message: "공지", created_at: "2022-04-30T08:11:04.200Z", type: .normal, user_id: ""))
NotificationListCell(notification: .init(message: "알림", created_at: "2022-04-30T08:11:04.200Z", type: .link, user_id: ""))
NotificationListCell(notification: .init(message: "알림", created_at: "2022-04-30T08:11:04.200Z", type: .lectureVacancy, user_id: ""))
NotificationListCell(notification: .init(message: "아무내용", created_at: "2022-04-30T08:11:04.200Z", type: .lectureUpdate, user_id: ""))
NotificationListCell(notification: .init(message: String(repeating: "공지입니다. ", count: 10), created_at: "2022-04-30T08:11:04.200Z", type: .lectureRemove, user_id: ""))
NotificationListCell(notification: .init(message: String(repeating: "공지입니다. ", count: 30), created_at: "2022-04-30T08:11:04.200Z", type: .courseBook, user_id: ""))
Expand Down
Loading