-
Notifications
You must be signed in to change notification settings - Fork 16
Restore Session Implementation #324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
e378d26
feat: restore widget
BraCR10 a1cb539
Merge branch 'main' into feat/br/restore
BraCR10 0da33ba
feat:restore model
BraCR10 b3acd39
draft : sent request
BraCR10 795e394
feat: receive restore data
BraCR10 445438f
feat : get orders details
BraCR10 24e325d
feat : Update orders
BraCR10 ba7f7bb
feat : request last index
BraCR10 c75c571
feat : restoring orders when mostro instance change
BraCR10 fdf5038
feat : re-load user orders
BraCR10 3a80ae5
feat : admin subscription
BraCR10 e83c6dd
feat : restore overlay
BraCR10 90fb352
refactor : orders requests
BraCR10 fdc9288
fix : admin subs
BraCR10 1851637
fix : admin events track
BraCR10 a137150
fix : duplicated admin events
BraCR10 4200881
fix : update new admin subscription after each user change
BraCR10 6067d02
Merge remote-tracking branch 'origin/main' into feat/br/restoredata
BraCR10 8394099
feat : using trade key
BraCR10 daa159b
feat : new key managment
BraCR10 238f4e8
feat : new restore organization
BraCR10 d15ab0d
feat : overlay information
BraCR10 4646080
fix : analyze issue
BraCR10 dde3538
fix : analyze issues
BraCR10 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 'dart:convert'; | ||
|
|
||
| class LastTradeIndexRequest { | ||
| final int version; | ||
| final String action; | ||
|
|
||
| LastTradeIndexRequest({ | ||
| this.version = 1, | ||
| this.action = 'last-trade-index', | ||
| }); | ||
|
|
||
| String toJsonString() { | ||
| return jsonEncode([ | ||
| { | ||
| 'restore': { | ||
| 'version': version, | ||
| 'action': action, | ||
| 'payload': null, | ||
| } | ||
| }, | ||
| null | ||
| ]); | ||
| } | ||
| } | ||
|
|
||
| class LastTradeIndexResponse { | ||
| final int version; | ||
| final String action; | ||
| final int tradeIndex; | ||
|
|
||
| LastTradeIndexResponse({ | ||
| required this.version, | ||
| required this.action, | ||
| required this.tradeIndex, | ||
| }); | ||
|
|
||
| factory LastTradeIndexResponse.fromJson(Map<String, dynamic> json) { | ||
| final restore = json['restore'] as Map<String, dynamic>; | ||
| return LastTradeIndexResponse( | ||
| version: restore['version'] as int, | ||
| action: restore['action'] as String, | ||
| tradeIndex: restore['trade_index'] as int, | ||
| ); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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,28 @@ | ||
| import 'dart:convert'; | ||
|
|
||
| class OrdersRequestMessage { | ||
| final int version; | ||
| final int requestId; | ||
| final String action; | ||
| final List<String> orderIds; | ||
|
|
||
| OrdersRequestMessage({ | ||
| this.version = 1, | ||
| required this.requestId, | ||
| this.action = 'orders', | ||
| required this.orderIds, | ||
| }); | ||
|
|
||
| Map<String, dynamic> toJson() => { | ||
| 'order': { | ||
| 'version': version, | ||
| 'request_id': requestId, | ||
| 'action': action, | ||
| 'payload': { | ||
| 'ids': orderIds, | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| String toJsonString() => jsonEncode([toJson(), null]); | ||
| } |
This file contains hidden or 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 hidden or 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,91 @@ | ||
| import 'package:mostro_mobile/data/models/payload.dart'; | ||
|
|
||
| class RestoreData implements Payload { | ||
| final List<RestoredOrder> orders; | ||
| final List<RestoredDispute> disputes; | ||
|
|
||
| RestoreData({ | ||
| required this.orders, | ||
| required this.disputes, | ||
| }); | ||
|
|
||
| @override | ||
| String get type => 'restore_data'; | ||
|
|
||
| factory RestoreData.fromJson(Map<String, dynamic> json) { | ||
| final restoreData = json['restore_data'] as Map<String, dynamic>; | ||
|
|
||
| return RestoreData( | ||
| orders: (restoreData['orders'] as List<dynamic>?) | ||
| ?.map((o) => RestoredOrder.fromJson(o as Map<String, dynamic>)) | ||
| .toList() ?? [], | ||
| disputes: (restoreData['disputes'] as List<dynamic>?) | ||
| ?.map((d) => RestoredDispute.fromJson(d as Map<String, dynamic>)) | ||
| .toList() ?? [], | ||
| ); | ||
| } | ||
BraCR10 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| @override | ||
| Map<String, dynamic> toJson() => { | ||
| 'restore_data': { | ||
| 'orders': orders.map((o) => o.toJson()).toList(), | ||
| 'disputes': disputes.map((d) => d.toJson()).toList(), | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| class RestoredOrder { | ||
| final String id; | ||
| final int tradeIndex; | ||
| final String status; | ||
|
|
||
| RestoredOrder({ | ||
| required this.id, | ||
| required this.tradeIndex, | ||
| required this.status, | ||
| }); | ||
|
|
||
| factory RestoredOrder.fromJson(Map<String, dynamic> json) { | ||
| return RestoredOrder( | ||
| id: json['order_id'] as String, | ||
| tradeIndex: json['trade_index'] as int, | ||
| status: json['status'] as String, | ||
| ); | ||
| } | ||
BraCR10 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Map<String, dynamic> toJson() => { | ||
| 'id': id, | ||
| 'trade_index': tradeIndex, | ||
| 'status': status, | ||
| }; | ||
| } | ||
|
|
||
| class RestoredDispute { | ||
| final String disputeId; | ||
| final String orderId; | ||
| final int tradeIndex; | ||
| final String status; | ||
|
|
||
| RestoredDispute({ | ||
| required this.disputeId, | ||
| required this.orderId, | ||
| required this.tradeIndex, | ||
| required this.status, | ||
| }); | ||
|
|
||
| factory RestoredDispute.fromJson(Map<String, dynamic> json) { | ||
| return RestoredDispute( | ||
| disputeId: json['dispute_id'] as String, | ||
| orderId: json['order_id'] as String, | ||
| tradeIndex: json['trade_index'] as int, | ||
| status: json['status'] as String, | ||
| ); | ||
| } | ||
BraCR10 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| Map<String, dynamic> toJson() => { | ||
| 'dispute_id': disputeId, | ||
| 'order_id': orderId, | ||
| 'trade_index': tradeIndex, | ||
| 'status': status, | ||
| }; | ||
| } | ||
This file contains hidden or 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,21 @@ | ||
| import 'dart:convert'; | ||
|
|
||
| class RestoreMessage { | ||
| final int version; | ||
| final String action; | ||
|
|
||
| RestoreMessage({ | ||
| this.version = 1, | ||
| this.action = 'restore-session', | ||
| }); | ||
|
|
||
| Map<String, dynamic> toJson() => { | ||
| 'restore': { | ||
| 'version': version, | ||
| 'action': action, | ||
| 'payload': null, | ||
| }, | ||
| }; | ||
|
|
||
| String toJsonString() => jsonEncode([toJson(), null]); | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why create a new function to build gift wrap event there is
mostroWrap()in this same file?