|
1 | 1 | /*
|
2 | 2 | * Infomaniak Mail - Android
|
3 |
| - * Copyright (C) 2022-2024 Infomaniak Network SA |
| 3 | + * Copyright (C) 2022-2025 Infomaniak Network SA |
4 | 4 | *
|
5 | 5 | * This program is free software: you can redistribute it and/or modify
|
6 | 6 | * it under the terms of the GNU General Public License as published by
|
|
19 | 19 |
|
20 | 20 | package com.infomaniak.mail.data.models.message
|
21 | 21 |
|
| 22 | +import com.infomaniak.core.ApiEnum |
| 23 | +import com.infomaniak.core.apiEnumValueOfOrNull |
22 | 24 | import com.infomaniak.lib.core.utils.Utils.enumValueOfOrNull
|
23 | 25 | import com.infomaniak.mail.data.api.RealmInstantSerializer
|
24 | 26 | import com.infomaniak.mail.data.api.UnwrappingJsonListSerializer
|
@@ -106,6 +108,12 @@ class Message : RealmObject {
|
106 | 108 | var bimi: Bimi? = null
|
107 | 109 | @SerialName("schedule_action")
|
108 | 110 | var unscheduleDraftUrl: String? = null
|
| 111 | + @SerialName("snooze_state") |
| 112 | + private var _snoozeState: String? = null |
| 113 | + @SerialName("snooze_end_date") |
| 114 | + var snoozeEndDate: RealmInstant? = null |
| 115 | + @SerialName("snooze_action") |
| 116 | + var snoozeAction: String? = null |
109 | 117 |
|
110 | 118 | // TODO: Those are unused for now, but if we ever want to use them, we need to save them in `Message.keepHeavyData()`.
|
111 | 119 | // If we don't do it now, we'll probably forget to do it in the future.
|
@@ -220,6 +228,14 @@ class Message : RealmObject {
|
220 | 228 | ACKNOWLEDGED,
|
221 | 229 | }
|
222 | 230 |
|
| 231 | + val snoozeState: SnoozeState? get() = apiEnumValueOfOrNull<SnoozeState>(_snoozeState) |
| 232 | + |
| 233 | + enum class SnoozeState(override val apiValue: String): ApiEnum { |
| 234 | + Snoozed(apiValue = "snoozed"), |
| 235 | + Unsnoozed(apiValue = "unsnoozed"), |
| 236 | + WasSnoozed(apiValue = "was_snoozed"), |
| 237 | + } |
| 238 | + |
223 | 239 | fun initLocalValues(
|
224 | 240 | messageInitialState: MessageInitialState,
|
225 | 241 | latestCalendarEventResponse: CalendarEventResponse?,
|
|
0 commit comments