-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(nextcloud)!: Remove WebDavFile in favor of low-level WebDavR…
…esponse Signed-off-by: provokateurin <[email protected]>
- Loading branch information
1 parent
548176b
commit efc8823
Showing
8 changed files
with
53 additions
and
111 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
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
88 changes: 0 additions & 88 deletions
88
packages/nextcloud/lib/src/api/webdav/models/webdav_file.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export 'options_parser.dart'; | ||
export 'webdav_response_converter.dart'; | ||
export 'webdav_response_helpers.dart'; | ||
export 'webdav_uri.dart'; | ||
export 'xml_date_time_converter.dart'; | ||
export 'xml_duration_converter.dart'; |
26 changes: 26 additions & 0 deletions
26
packages/nextcloud/lib/src/api/webdav/utils/webdav_response_helpers.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 @@ | ||
import 'package:nextcloud/src/api/webdav/models/models.dart'; | ||
|
||
/// Helpers | ||
extension WebDavResponseHelpers on WebDavResponse { | ||
/// All available props. | ||
WebDavProp get props => propstats.singleWhere((propstat) => propstat.status.contains('200 OK')).prop; | ||
|
||
/// The path of the resource. | ||
PathUri get path { | ||
final href = PathUri.parse(Uri.decodeFull(this.href!)); | ||
return PathUri( | ||
isAbsolute: false, | ||
isDirectory: href.isDirectory, | ||
pathSegments: href.pathSegments.sublist(2), | ||
); | ||
} | ||
|
||
/// The name of the resource. | ||
String get name => path.name; | ||
|
||
/// Whether the file is hidden. | ||
bool get isHidden => props.ncHidden ?? name.startsWith('.'); | ||
|
||
/// Whether the file is a directory | ||
bool get isDirectory => props.davResourcetype?.collection != null || path.isDirectory; | ||
} |