-
Notifications
You must be signed in to change notification settings - Fork 176
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 #633 from appwrite/feat-revert-offline
Feat revert offline
- Loading branch information
Showing
23 changed files
with
80 additions
and
1,196 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,13 @@ | ||
part of {{ language.params.packageName }}; | ||
|
||
class ID { | ||
ID._(); | ||
|
||
// Generate a unique ID based on timestamp | ||
// Recreated from https://www.php.net/manual/en/function.uniqid.php | ||
static String _uniqid() { | ||
final now = DateTime.now(); | ||
final secondsSinceEpoch = (now.millisecondsSinceEpoch / 1000).floor(); | ||
final msecs = now.microsecondsSinceEpoch - secondsSinceEpoch * 1000000; | ||
return secondsSinceEpoch.toRadixString(16) + | ||
msecs.toRadixString(16).padLeft(5, '0'); | ||
} | ||
|
||
// Generate a unique ID with padding to have a longer ID | ||
// Recreated from https://github.com/utopia-php/database/blob/main/src/Database/ID.php#L13 | ||
static String _unique({int padding = 7}) { | ||
String id = _uniqid(); | ||
|
||
if (padding > 0) { | ||
StringBuffer sb = StringBuffer(); | ||
for (var i = 0; i < padding; i++) { | ||
sb.write(Random().nextInt(16).toRadixString(16)); | ||
} | ||
|
||
id += sb.toString(); | ||
ID._(); | ||
|
||
static String unique() { | ||
return 'unique()'; | ||
} | ||
|
||
return id; | ||
} | ||
|
||
static String unique() { | ||
return _unique(); | ||
} | ||
|
||
static String custom(String id) { | ||
return id; | ||
} | ||
} | ||
static String custom(String id) { | ||
return id; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
name: {{ language.params.packageName }}_example | ||
environment: | ||
sdk: ">=2.17.0 <3.0.0" | ||
sdk: '>=2.17.0 <3.0.0' |
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,27 +1,26 @@ | ||
library {{ language.params.packageName }}; | ||
|
||
import 'dart:async'; | ||
import 'dart:math'; | ||
import 'dart:typed_data'; | ||
import 'src/enums.dart'; | ||
import 'src/service.dart'; | ||
import 'src/input_file.dart'; | ||
import 'models.dart' as models; | ||
import 'src/upload_progress.dart'; | ||
|
||
export 'src/response.dart'; | ||
export 'src/client.dart'; | ||
export 'src/exception.dart'; | ||
export 'src/input_file.dart'; | ||
export 'src/realtime.dart'; | ||
export 'src/realtime_message.dart'; | ||
export 'src/realtime_subscription.dart'; | ||
export 'src/response.dart'; | ||
export 'src/upload_progress.dart'; | ||
export 'src/realtime_subscription.dart'; | ||
export 'src/realtime_message.dart'; | ||
export 'src/input_file.dart'; | ||
|
||
part 'id.dart'; | ||
part 'permission.dart'; | ||
part 'query.dart'; | ||
part 'permission.dart'; | ||
part 'role.dart'; | ||
part 'id.dart'; | ||
{% for service in spec.services %} | ||
part 'services/{{service.name | caseDash}}.dart'; | ||
{% endfor %} |
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.