-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pull request #66: Aboldyrev MM-6367 inbox times
Merge in MML/infobip-mobile-messaging-flutter from aboldyrev-MM-6367-inbox-times to main Squashed commit of the following: commit e6af92dcfda62aa9659adfca75f90dc552a6ac02 Author: Alexander Boldyrev <[email protected]> Date: Thu Apr 25 15:13:29 2024 +0300 - refactoring commit 732ab20d1e5ad7a344a15c5d15c98aa160e38335 Author: Alexander Boldyrev <[email protected]> Date: Thu Apr 25 14:23:05 2024 +0300 - receivedTimestamp commit 5131556e2a21384653b368ef5cc060c426a5df28 Author: Alexander Boldyrev <[email protected]> Date: Tue Apr 23 16:46:10 2024 +0300 - receivedTimestamp commit 5eddc9ca16af5378aef16df0d2e981bfd32244d4 Author: Alexander Boldyrev <[email protected]> Date: Tue Apr 23 10:41:27 2024 +0300 - inbox message model
- Loading branch information
1 parent
af6b020
commit a666ada
Showing
3 changed files
with
141 additions
and
32 deletions.
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
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 |
---|---|---|
@@ -1,39 +1,127 @@ | ||
import 'package:infobip_mobilemessaging/models/message.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
|
||
class InboxMessage extends Message { | ||
final String? topic; | ||
final bool? seen; | ||
/// A message stored in the inbox. | ||
/// | ||
/// InboxMessage always has a special topic, has sentTimestamp - milliseconds | ||
/// from epoch in UTC, and seen status. To mark message as seen, use special | ||
/// markMessagesSeen. | ||
class InboxMessage { | ||
final String messageId; | ||
final String topic; | ||
final bool seen; | ||
final String? title; | ||
final String? body; | ||
final String? sound; | ||
final bool? vibrate; // Android only | ||
final String? icon; // Android only | ||
final bool? silent; | ||
final String? category; // Android only | ||
final Map<String, dynamic>? customPayload; | ||
final String? internalData; | ||
final String? contentUrl; | ||
final Map<String, dynamic>? originalPayload; // iOS only | ||
final String? browserUrl; | ||
final String? deeplink; | ||
final String? webViewUrl; | ||
final String? inAppOpenTitle; | ||
final String? inAppDismissTitle; | ||
final num? sentTimestamp; | ||
|
||
InboxMessage({ | ||
required super.messageId, | ||
super.title, | ||
super.body, | ||
super.sound, | ||
super.silent, | ||
super.customPayload, | ||
super.internalData, | ||
super.receivedTimestamp, | ||
super.seenDate, | ||
super.contentUrl, | ||
super.originalPayload, | ||
super.vibrate, | ||
super.icon, | ||
super.category, | ||
super.browserUrl, | ||
super.deeplink, | ||
super.webViewUrl, | ||
super.inAppOpenTitle, | ||
super.inAppDismissTitle, | ||
this.seen, | ||
this.topic, | ||
required this.messageId, | ||
required this.seen, | ||
required this.topic, | ||
this.title, | ||
this.body, | ||
this.sound, | ||
this.vibrate, | ||
this.icon, | ||
this.silent, | ||
this.category, | ||
this.customPayload, | ||
this.internalData, | ||
this.contentUrl, | ||
this.originalPayload, | ||
this.browserUrl, | ||
this.deeplink, | ||
this.webViewUrl, | ||
this.inAppOpenTitle, | ||
this.inAppDismissTitle, | ||
this.sentTimestamp, | ||
}); | ||
|
||
InboxMessage.fromJson(Map<String, dynamic> json) | ||
: topic = json['inboxData'] != null | ||
: messageId = json['messageId'], | ||
topic = json['inboxData'] != null | ||
? json['inboxData']['inbox']['topic'] | ||
: json['topic'], | ||
seen = json['inboxData'] != null | ||
? json['inboxData']['inbox']['seen'] | ||
: json['seen'], | ||
super.fromJson(json); | ||
title = json['title'], | ||
body = json['body'], | ||
sound = json['sound'], | ||
vibrate = json['vibrate'], | ||
icon = json['icon'], | ||
silent = json['silent'], | ||
category = json['category'], | ||
customPayload = json['customPayload'], | ||
internalData = json['internalData'], | ||
contentUrl = json['contentUrl'], | ||
originalPayload = json['originalPayload'], | ||
browserUrl = json['browserUrl'], | ||
deeplink = json['deeplink'], | ||
webViewUrl = json['webViewUrl'], | ||
inAppOpenTitle = json['inAppOpenTitle'], | ||
inAppDismissTitle = json['inAppDismissTitle'], | ||
sentTimestamp = json['sentTimestamp']; | ||
|
||
@override | ||
bool operator ==(Object other) => | ||
identical(this, other) || | ||
other is InboxMessage && | ||
runtimeType == other.runtimeType && | ||
messageId == other.messageId && | ||
seen == other.seen && | ||
topic == other.topic && | ||
title == other.title && | ||
body == other.body && | ||
sound == other.sound && | ||
vibrate == other.vibrate && | ||
icon == other.icon && | ||
silent == other.silent && | ||
category == other.category && | ||
mapEquals(customPayload, other.customPayload) && | ||
internalData == other.internalData && | ||
contentUrl == other.contentUrl && | ||
mapEquals(originalPayload, other.originalPayload) && | ||
browserUrl == other.browserUrl && | ||
deeplink == other.deeplink && | ||
webViewUrl == other.webViewUrl && | ||
inAppOpenTitle == other.inAppOpenTitle && | ||
inAppDismissTitle == other.inAppDismissTitle && | ||
sentTimestamp == other.sentTimestamp; | ||
|
||
@override | ||
int get hashCode => | ||
messageId.hashCode ^ | ||
seen.hashCode ^ | ||
topic.hashCode ^ | ||
title.hashCode ^ | ||
body.hashCode ^ | ||
sound.hashCode ^ | ||
vibrate.hashCode ^ | ||
icon.hashCode ^ | ||
silent.hashCode ^ | ||
category.hashCode ^ | ||
customPayload.hashCode ^ | ||
internalData.hashCode ^ | ||
contentUrl.hashCode ^ | ||
originalPayload.hashCode ^ | ||
browserUrl.hashCode ^ | ||
deeplink.hashCode ^ | ||
webViewUrl.hashCode ^ | ||
inAppOpenTitle.hashCode ^ | ||
inAppDismissTitle.hashCode ^ | ||
sentTimestamp.hashCode; | ||
} |