Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Convert boolean to proxies for type
  • Loading branch information
seadowg committed Nov 26, 2025
commit f7de4962b230f340ca31a677173a06a47fd67355
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,62 @@ data class ServerFormDetails @JvmOverloads constructor(
val formId: String?,
val formVersion: String?,
val hash: String?,
val manifest: ManifestFile?,
val type: Type
) : Serializable {

@Deprecated(message = "Use primary constructor instead")
constructor(
formName: String?,
downloadUrl: String?,
formId: String?,
formVersion: String?,
hash: String?,
isNotOnDevice: Boolean,
isUpdated: Boolean,
manifest: ManifestFile?,
) : this(
formName,
downloadUrl,
formId,
formVersion,
hash,
manifest,
if (isNotOnDevice) {
Type.New
} else if (isUpdated) {
Type.UpdatedVersion
} else {
Type.OnDevice
}
)

@Deprecated(
message = "Use type instead",
replaceWith = ReplaceWith("type")
) val isNotOnDevice: Boolean,
)
val isNotOnDevice: Boolean = when (type) {
Type.OnDevice -> false
Type.New -> true
Type.UpdatedVersion -> false
Type.UpdatedHash -> false
Type.UpdatedMedia -> false
}

@Deprecated(
message = "Use type instead",
replaceWith = ReplaceWith("type")
) val isUpdated: Boolean,
val manifest: ManifestFile?,
val type: Type? = null
) : Serializable {
)
val isUpdated: Boolean = when (type) {
Type.OnDevice -> false
Type.New -> false
Type.UpdatedVersion -> true
Type.UpdatedHash -> true
Type.UpdatedMedia -> true
}

companion object {
private const val serialVersionUID = 3L
private const val serialVersionUID = 4L
}

enum class Type {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ object ServerFormUseCases {
listItem.formID,
listItem.version,
listItem.hash,
!thisFormAlreadyDownloaded,
isNewerFormVersionAvailable || areNewerMediaFilesAvailable,
manifestFile,
type
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ class NotificationManagerNotifier(
val notificationId = uniqueIdGenerator.getInt(FORM_UPDATE_NOTIFICATION_IDENTIFIER)

val metaPrefs = settingsProvider.getMetaSettings()
val updateId = updates
.mapTo(HashSet()) { (_, _, formId, _, hash, _, _, manifest) -> formId + hash + manifest?.hash }
val updateId = updates.mapTo(HashSet()) { (_, _, formId, _, hash, manifest, _) ->
formId + hash + manifest?.hash
}
if (metaPrefs.getStringSet(MetaKeys.LAST_UPDATED_NOTIFICATION) != updateId) {
notificationManager.notify(
notificationId,
Expand Down