-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Config Tab with editor for configs.
- Loading branch information
Showing
29 changed files
with
635 additions
and
198 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,36 @@ | ||
import 'package:enum_to_string/enum_to_string.dart'; | ||
import 'package:mobileraker/dto/files/moonraker/file_notification_item.dart'; | ||
import 'package:mobileraker/dto/files/moonraker/file_notification_source_item.dart'; | ||
import 'package:mobileraker/service/moonraker/file_service.dart'; | ||
|
||
class FileApiResponse { | ||
final FileAction fileAction; | ||
final FileNotificationItem item; | ||
final FileNotificationSourceItem? sourceItem; | ||
|
||
FileApiResponse.fromJson(Map<String, dynamic> json) | ||
: this.fileAction = | ||
EnumToString.fromString(FileAction.values, json['action'])!, | ||
this.item = FileNotificationItem.fromJson(json['item']), | ||
this.sourceItem = (json.containsKey('source_item')) | ||
? FileNotificationSourceItem.fromJson(json['source_item']) | ||
: null; | ||
|
||
|
||
@override | ||
bool operator ==(Object other) => | ||
identical(this, other) || | ||
other is FileApiResponse && | ||
runtimeType == other.runtimeType && | ||
fileAction == other.fileAction && | ||
item == other.item && | ||
sourceItem == other.sourceItem; | ||
|
||
@override | ||
int get hashCode => fileAction.hashCode ^ item.hashCode ^ sourceItem.hashCode; | ||
|
||
@override | ||
String toString() { | ||
return 'FileListChangedNotification{fileAction: $fileAction, item: $item, sourceItem: $sourceItem}'; | ||
} | ||
} |
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,30 @@ | ||
class FileNotificationItem { | ||
final String path; | ||
final String root; | ||
final int? size; | ||
final double? modified; | ||
|
||
String get fullPath => '$root/$path'; | ||
|
||
FileNotificationItem.fromJson(Map<String, dynamic> json) | ||
: this.path = json['path'], | ||
this.root = json['root'], | ||
this.size = json['size'], | ||
this.modified = double.tryParse(json['modified'].toString()); | ||
|
||
@override | ||
bool operator ==(Object other) => | ||
identical(this, other) || | ||
other is FileNotificationItem && | ||
runtimeType == other.runtimeType && | ||
path == other.path && | ||
root == other.root; | ||
|
||
@override | ||
int get hashCode => path.hashCode ^ root.hashCode; | ||
|
||
@override | ||
String toString() { | ||
return 'FileNotificationItem{path: $path, root: $root, size: $size, modified: $modified}'; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
lib/dto/files/moonraker/file_notification_source_item.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,26 @@ | ||
class FileNotificationSourceItem { | ||
final String path; | ||
final String root; | ||
|
||
FileNotificationSourceItem.fromJson(Map<String, dynamic> json) | ||
: this.path = json['path'], | ||
this.root = json['root']; | ||
|
||
String get fullPath => '$root/$path'; | ||
|
||
@override | ||
bool operator ==(Object other) => | ||
identical(this, other) || | ||
other is FileNotificationSourceItem && | ||
runtimeType == other.runtimeType && | ||
path == other.path && | ||
root == other.root; | ||
|
||
@override | ||
int get hashCode => path.hashCode ^ root.hashCode; | ||
|
||
@override | ||
String toString() { | ||
return 'FileListChangedSourceItem{path: $path, root: $root}'; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
lib/dto/files/notification/file_list_changed_notification.dart
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
lib/dto/files/notification/file_list_changed_source_item.dart
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.