-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #232 from takenet/release/0.0.88
[Release] 0.0.88
- Loading branch information
Showing
34 changed files
with
1,111 additions
and
261 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
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
enum DSInteractiveMessageHeaderType { | ||
text, | ||
document, | ||
image, | ||
video, | ||
} |
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
39 changes: 39 additions & 0 deletions
39
lib/src/models/interactive_message/ds_interactive_message.model.dart
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import 'ds_interactive_message_action.model.dart'; | ||
import 'ds_interactive_message_body.model.dart'; | ||
import 'ds_interactive_message_footer.model.dart'; | ||
import 'ds_interactive_message_header.model.dart'; | ||
|
||
class DSInteractiveMessage { | ||
final DSInteractiveMessageHeader? header; | ||
final DSInteractiveMessageBody? body; | ||
final DSInteractiveMessageAction? action; | ||
final DSInteractiveMessageFooter? footer; | ||
|
||
DSInteractiveMessage({ | ||
this.header, | ||
this.body, | ||
this.action, | ||
this.footer, | ||
}); | ||
|
||
DSInteractiveMessage.fromJson(Map<String, dynamic> json) | ||
: header = json['header'] != null | ||
? DSInteractiveMessageHeader.fromJson(json['header']) | ||
: null, | ||
body = json['body'] != null | ||
? DSInteractiveMessageBody.fromJson(json['body']) | ||
: null, | ||
action = json['action'] != null | ||
? DSInteractiveMessageAction.fromJson(json['action']) | ||
: null, | ||
footer = json['footer'] != null | ||
? DSInteractiveMessageFooter.fromJson(json['footer']) | ||
: null; | ||
|
||
Map<String, dynamic> toJson() => { | ||
'header': header?.toJson(), | ||
'body': body?.toJson(), | ||
'action': action?.toJson(), | ||
'footer': footer?.toJson(), | ||
}; | ||
} |
45 changes: 45 additions & 0 deletions
45
lib/src/models/interactive_message/ds_interactive_message_action.model.dart
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import 'ds_interactive_message_button.model.dart'; | ||
import 'ds_interactive_message_section.model.dart'; | ||
|
||
class DSInteractiveMessageAction { | ||
final String? button; | ||
final List<DSInteractiveMessageButton>? buttons; | ||
final List<DSInteractiveMessageSection>? sections; | ||
|
||
DSInteractiveMessageAction({ | ||
this.button, | ||
this.buttons, | ||
this.sections, | ||
}); | ||
|
||
DSInteractiveMessageAction.fromJson(Map<String, dynamic> json) | ||
: button = json['button'], | ||
buttons = json['buttons'] != null | ||
? List.from(json['buttons']) | ||
.map( | ||
(e) => DSInteractiveMessageButton.fromJson(e), | ||
) | ||
.toList() | ||
: null, | ||
sections = json['sections'] != null | ||
? List.from(json['sections']) | ||
.map( | ||
(e) => DSInteractiveMessageSection.fromJson(e), | ||
) | ||
.toList() | ||
: null; | ||
|
||
Map<String, dynamic> toJson() => { | ||
'button': button, | ||
'buttons': buttons | ||
?.map( | ||
(e) => e.toJson(), | ||
) | ||
.toList(), | ||
'sections': sections | ||
?.map( | ||
(e) => e.toJson(), | ||
) | ||
.toList(), | ||
}; | ||
} |
14 changes: 14 additions & 0 deletions
14
lib/src/models/interactive_message/ds_interactive_message_body.model.dart
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class DSInteractiveMessageBody { | ||
final String? text; | ||
|
||
DSInteractiveMessageBody({ | ||
this.text, | ||
}); | ||
|
||
DSInteractiveMessageBody.fromJson(Map<String, dynamic> json) | ||
: text = json['text']; | ||
|
||
Map<String, dynamic> toJson() => { | ||
'text': text, | ||
}; | ||
} |
14 changes: 14 additions & 0 deletions
14
lib/src/models/interactive_message/ds_interactive_message_button.model.dart
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class DSInteractiveMessageButton { | ||
final String? title; | ||
|
||
DSInteractiveMessageButton({ | ||
this.title, | ||
}); | ||
|
||
DSInteractiveMessageButton.fromJson(Map<String, dynamic> json) | ||
: title = json['reply']?['title']; | ||
|
||
Map<String, dynamic> toJson() => { | ||
'title': title, | ||
}; | ||
} |
20 changes: 20 additions & 0 deletions
20
lib/src/models/interactive_message/ds_interactive_message_document.model.dart
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'ds_interactive_message_media.model.dart'; | ||
|
||
class DSInteractiveMessageDocument extends DSInteractiveMessageMedia { | ||
final String? filename; | ||
|
||
DSInteractiveMessageDocument({ | ||
super.link, | ||
this.filename, | ||
}); | ||
|
||
DSInteractiveMessageDocument.fromJson(Map<String, dynamic> json) | ||
: filename = json['filename'], | ||
super.fromJson(json); | ||
|
||
@override | ||
Map<String, dynamic> toJson() => { | ||
'link': super.link, | ||
'filename': filename, | ||
}; | ||
} |
14 changes: 14 additions & 0 deletions
14
lib/src/models/interactive_message/ds_interactive_message_footer.model.dart
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class DSInteractiveMessageFooter { | ||
final String? text; | ||
|
||
DSInteractiveMessageFooter({ | ||
this.text, | ||
}); | ||
|
||
DSInteractiveMessageFooter.fromJson(Map<String, dynamic> json) | ||
: text = json['text']; | ||
|
||
Map<String, dynamic> toJson() => { | ||
'text': text, | ||
}; | ||
} |
45 changes: 45 additions & 0 deletions
45
lib/src/models/interactive_message/ds_interactive_message_header.model.dart
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import 'package:get/get.dart'; | ||
|
||
import '../../enums/ds_interactive_message_header_type.enum.dart'; | ||
import 'ds_interactive_message_document.model.dart'; | ||
import 'ds_interactive_message_image.model.dart'; | ||
import 'ds_interactive_message_video.model.dart'; | ||
|
||
class DSInteractiveMessageHeader { | ||
final DSInteractiveMessageHeaderType? type; | ||
final String? text; | ||
final DSInteractiveMessageDocument? document; | ||
final DSInteractiveMessageImage? image; | ||
final DSInteractiveMessageVideo? video; | ||
|
||
DSInteractiveMessageHeader({ | ||
this.type, | ||
this.text, | ||
this.document, | ||
this.image, | ||
this.video, | ||
}); | ||
|
||
DSInteractiveMessageHeader.fromJson(Map<String, dynamic> json) | ||
: type = DSInteractiveMessageHeaderType.values.firstWhereOrNull( | ||
(e) => e.name == json['type'], | ||
), | ||
text = json['text'], | ||
document = json['document'] != null | ||
? DSInteractiveMessageDocument.fromJson(json['document']) | ||
: null, | ||
image = json['image'] != null | ||
? DSInteractiveMessageImage.fromJson(json['image']) | ||
: null, | ||
video = json['video'] != null | ||
? DSInteractiveMessageVideo.fromJson(json['video']) | ||
: null; | ||
|
||
Map<String, dynamic> toJson() => { | ||
'type': type?.name, | ||
'text': text, | ||
'document': document?.toJson(), | ||
'image': image?.toJson(), | ||
'video': video?.toJson(), | ||
}; | ||
} |
6 changes: 6 additions & 0 deletions
6
lib/src/models/interactive_message/ds_interactive_message_image.model.dart
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import 'ds_interactive_message_media.model.dart'; | ||
|
||
class DSInteractiveMessageImage extends DSInteractiveMessageMedia { | ||
DSInteractiveMessageImage.fromJson(Map<String, dynamic> json) | ||
: super.fromJson(json); | ||
} |
14 changes: 14 additions & 0 deletions
14
lib/src/models/interactive_message/ds_interactive_message_media.model.dart
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
abstract class DSInteractiveMessageMedia { | ||
final String? link; | ||
|
||
DSInteractiveMessageMedia({ | ||
this.link, | ||
}); | ||
|
||
DSInteractiveMessageMedia.fromJson(Map<String, dynamic> json) | ||
: link = json['link']; | ||
|
||
Map<String, dynamic> toJson() => { | ||
'link': link, | ||
}; | ||
} |
14 changes: 14 additions & 0 deletions
14
lib/src/models/interactive_message/ds_interactive_message_row.model.dart
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class DSInteractiveMessageRow { | ||
final String? title; | ||
|
||
DSInteractiveMessageRow({ | ||
this.title, | ||
}); | ||
|
||
DSInteractiveMessageRow.fromJson(Map<String, dynamic> json) | ||
: title = json['title']; | ||
|
||
Map<String, dynamic> toJson() => { | ||
'title': title, | ||
}; | ||
} |
Oops, something went wrong.