Skip to content

Commit 1d66090

Browse files
authored
feat: Add the new snooze api field to the Message model (#2163)
2 parents 8ed2408 + 55a5067 commit 1d66090

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ android {
8383
}
8484

8585
dependencies {
86+
implementation project(':Core')
8687
implementation project(path: ':Core:Legacy')
8788
implementation project(path: ':Core:Legacy:AppLock')
8889
implementation project(path: ':Core:Legacy:BugTracker')

app/src/main/java/com/infomaniak/mail/data/cache/RealmDatabase.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Infomaniak Mail - Android
3-
* Copyright (C) 2022-2024 Infomaniak Network SA
3+
* Copyright (C) 2022-2025 Infomaniak Network SA
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -161,7 +161,7 @@ object RealmDatabase {
161161
//region Configurations versions
162162
const val USER_INFO_SCHEMA_VERSION = 2L
163163
const val MAILBOX_INFO_SCHEMA_VERSION = 8L
164-
const val MAILBOX_CONTENT_SCHEMA_VERSION = 20L
164+
const val MAILBOX_CONTENT_SCHEMA_VERSION = 21L
165165
//endregion
166166

167167
//region Configurations names

app/src/main/java/com/infomaniak/mail/data/models/message/Message.kt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Infomaniak Mail - Android
3-
* Copyright (C) 2022-2024 Infomaniak Network SA
3+
* Copyright (C) 2022-2025 Infomaniak Network SA
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU General Public License as published by
@@ -19,6 +19,8 @@
1919

2020
package com.infomaniak.mail.data.models.message
2121

22+
import com.infomaniak.core.ApiEnum
23+
import com.infomaniak.core.apiEnumValueOfOrNull
2224
import com.infomaniak.lib.core.utils.Utils.enumValueOfOrNull
2325
import com.infomaniak.mail.data.api.RealmInstantSerializer
2426
import com.infomaniak.mail.data.api.UnwrappingJsonListSerializer
@@ -106,6 +108,12 @@ class Message : RealmObject {
106108
var bimi: Bimi? = null
107109
@SerialName("schedule_action")
108110
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
109117

110118
// TODO: Those are unused for now, but if we ever want to use them, we need to save them in `Message.keepHeavyData()`.
111119
// If we don't do it now, we'll probably forget to do it in the future.
@@ -220,6 +228,14 @@ class Message : RealmObject {
220228
ACKNOWLEDGED,
221229
}
222230

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+
223239
fun initLocalValues(
224240
messageInitialState: MessageInitialState,
225241
latestCalendarEventResponse: CalendarEventResponse?,

0 commit comments

Comments
 (0)