-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
84a3611
commit 2deaa93
Showing
2 changed files
with
49 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
|
||
abstract class RemoteFile { | ||
/// File path. | ||
@required | ||
String path; | ||
|
||
/// File content length or folder size | ||
@required | ||
int size; | ||
|
||
// Date of last modification. | ||
@required | ||
DateTime lastModified; | ||
|
||
/// Creation date of the file. | ||
@required | ||
DateTime createdDate; | ||
|
||
/// Returns the decoded name of the file / folder without the whole path | ||
@required | ||
String get name { | ||
// normalised path (remove trailing slash) | ||
final end = path.endsWith('/') ? path.length - 1 : path.length; | ||
return Uri.parse(path, 0, end).pathSegments.last; | ||
} | ||
|
||
/// Whether the file is a directory. | ||
@required | ||
bool isDirectory; | ||
} |
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,18 @@ | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:txt/sync/file.dart'; | ||
|
||
abstract class SyncService { | ||
Future<void> authorize(BuildContext context); | ||
|
||
Future<String> getAccountName(); | ||
|
||
Future<List<RemoteFile>> listFolder(String path); | ||
|
||
Future<void> upload(String localPath, String remotePath); | ||
|
||
Future<void> download(String remotePath, String localPath); | ||
} | ||
|
||
Future<void> sync(String localPath, String remotePath) async { | ||
throw UnimplementedError(); | ||
} |