Skip to content

Commit c889b4f

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 25b2e4f + c388545 commit c889b4f

34 files changed

Lines changed: 814 additions & 155 deletions

.github/workflows/ci.yml

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ on:
33
push:
44
branches:
55
- "master"
6-
- "development"
76
paths-ignore:
87
- "**/README.md"
98
pull_request:
@@ -16,31 +15,31 @@ jobs:
1615
matrix:
1716
include:
1817
# Dart framework may contain breaking changes in minor version releases, not following semver.
19-
- name: Dart 3.0, Ubuntu
18+
# The latest Dart framework (below) is tested on all architectures (Ubuntu, macOS, Windows).
19+
- name: Dart 3.1, Ubuntu
2020
os: ubuntu-latest
21-
sdk: 3.0.0
22-
- name: Dart 3.0, macOS
21+
sdk: 3.1.2
22+
- name: Dart 3.1, macOS
2323
os: macos-latest
24-
sdk: 3.0.0
25-
- name: Dart 3.0, Windows
24+
sdk: 3.1.2
25+
- name: Dart 3.1, Windows
2626
os: windows-latest
27-
sdk: 3.0.0
28-
# Only the latest Dart framework version (above) is tested with all architectures. Previous
29-
# Dart framework versions (below) are only tested with Ubuntu to reduce CI resource usage.
27+
sdk: 3.1.2
28+
# Older Dart framework versions (below) are only tested with Ubuntu to reduce CI resource usage.
29+
- name: Dart 3.0
30+
os: ubuntu-latest
31+
sdk: 3.0.7
3032
- name: Dart 2.19
3133
os: ubuntu-latest
3234
sdk: 2.19.6
33-
- name: Dart 2.18
34-
os: ubuntu-latest
35-
sdk: 2.18.7
3635
- name: Dart beta
3736
os: ubuntu-latest
3837
sdk: beta
3938
fail-fast: false
4039
name: Test ${{ matrix.name }}
4140
steps:
4241
- name: Checkout code
43-
uses: actions/checkout@v3
42+
uses: actions/checkout@v4
4443
- name: Setup dart
4544
uses: dart-lang/setup-dart@v1.5.0
4645
with:
@@ -77,31 +76,31 @@ jobs:
7776
matrix:
7877
include:
7978
# Flutter framework may contain breaking changes in minor version releases, not following semver.
80-
- name: Flutter 3.10, Ubuntu
79+
# The latest Flutter framework (below) is tested on all architectures (Ubuntu, macOS, Windows).
80+
- name: Flutter 3.13, Ubuntu
8181
os: ubuntu-latest
82-
sdk: 3.10.x
83-
- name: Flutter 3.10, macOS
82+
sdk: 3.13.6
83+
- name: Flutter 3.13, macOS
8484
os: macos-latest
85-
sdk: 3.10.x
86-
- name: Flutter 3.10, Windows
85+
sdk: 3.13.6
86+
- name: Flutter 3.13, Windows
8787
os: windows-latest
88-
sdk: 3.10.x
89-
# Only the latest Flutter framework version (above) is tested with all architectures. Previous
90-
# Flutter framework versions (below) are only tested with Ubuntu to reduce CI resource usage.
91-
- name: Flutter 3.7
88+
sdk: 3.13.6
89+
# Older Flutter framework versions (below) are only tested with Ubuntu to reduce CI resource usage.
90+
- name: Flutter 3.10
9291
os: ubuntu-latest
93-
sdk: 3.7.x
94-
- name: Flutter 3.3
92+
sdk: 3.10.6
93+
- name: Flutter 3.7
9594
os: ubuntu-latest
96-
sdk: 3.3.x
95+
sdk: 3.7.12
9796
- name: Flutter beta
9897
os: ubuntu-latest
9998
sdk: beta
10099
fail-fast: false
101100
name: Test ${{ matrix.name }}
102101
steps:
103102
- name: Checkout code
104-
uses: actions/checkout@v3
103+
uses: actions/checkout@v4
105104
- name: Setup flutter (beta)
106105
if: ${{ matrix.sdk == 'beta' }}
107106
uses: subosito/flutter-action@v2
@@ -116,14 +115,10 @@ jobs:
116115
cache: true
117116
- name: Install dependencies on Ubuntu and MacOS
118117
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
119-
run: |
120-
(cd packages/dart && flutter pub get)
121-
(cd packages/flutter && flutter pub get)
118+
run: (cd packages/flutter && flutter pub get)
122119
- name: Install dependencies on Windows
123120
if: matrix.os == 'windows-latest'
124-
run: |
125-
cmd /c "cd packages\dart && flutter pub get"
126-
cmd /c "cd packages\flutter && flutter pub get"
121+
run: cmd /c "cd packages\flutter && flutter pub get"
127122
- name: Analyze code
128123
run: flutter analyze packages/flutter --fatal-infos
129124
- name: Lint

packages/dart/CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,37 @@
1+
## [6.4.0](https://github.com/parse-community/Parse-SDK-Flutter/compare/dart-6.3.0...dart-6.4.0) (2024-03-30)
2+
3+
### Features
4+
5+
* Add `ParseXFile` for cross-platform `XFile` support ([#990](https://github.com/parse-community/Parse-SDK-Flutter/pull/990))
6+
7+
## [6.3.0](https://github.com/parse-community/Parse-SDK-Flutter/compare/dart-6.2.0...dart-6.3.0) (2023-11-11)
8+
9+
### Features
10+
11+
* Add `installationId` in LiveQuery `connect` ([#976](https://github.com/parse-community/Parse-SDK-Flutter/pull/976))
12+
13+
## [6.2.0](https://github.com/parse-community/Parse-SDK-Flutter/compare/dart-6.1.0...dart-6.2.0) (2023-10-18)
14+
15+
### Features
16+
17+
* Added `saveEventually` and `deleteEventually` in `ParseObject` ([#911](https://github.com/parse-community/Parse-SDK-Flutter/pull/911))
18+
19+
## [6.1.0](https://github.com/parse-community/Parse-SDK-Flutter/compare/dart-6.0.0...dart-6.1.0) (2023-10-17)
20+
21+
### Features
22+
23+
* Add `context` in `ParseObject` ([#970](https://github.com/parse-community/Parse-SDK-Flutter/pull/970))
24+
25+
## [6.0.0](https://github.com/parse-community/Parse-SDK-Flutter/compare/dart-5.1.3...dart-6.0.0) (2023-10-16)
26+
27+
### BREAKING CHANGES
28+
29+
* This release removes support for Dart 2.18 ([#969](https://github.com/parse-community/Parse-SDK-Flutter/pull/969))
30+
31+
### Features
32+
33+
* Add support for Dart 3.1, remove support for Dart 2.18 ([#969](https://github.com/parse-community/Parse-SDK-Flutter/pull/969))
34+
135
## [5.1.3](https://github.com/parse-community/Parse-SDK-Flutter/compare/dart-5.1.2...dart-5.1.3) (2023-07-18)
236

337
### Bug Fixes

packages/dart/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@ This library gives you access to the powerful Parse Server backend from your Dar
2828

2929
## Compatibility
3030

31-
The Parse Dart SDK is continuously tested with the most recent release of the Dart framework to ensure compatibility. To give developers time to upgrade their app to the newest Dart framework, previous Dart framework releases are supported for at least 1 year after their [release date](https://dart.dev/get-dart/archive).
31+
The Parse Dart SDK is continuously tested with the most recent release of the Dart framework to ensure compatibility. To give developers time to upgrade their app to a newer Dart framework, previous Dart framework releases are supported for at least 1 year after the [release date](https://dart.dev/get-dart/archive) of the next higher significant version.
3232

33-
| Version | Latest Version | End of Support | Compatible |
34-
|-----------|----------------|----------------|----------------------------------------------|
35-
| Dart 3.0 | 3.0.0 | May 2024 | ✅ Yes |
36-
| Dart 2.19 | 2.19.6 | Mar 2024 | ✅ Yes |
37-
| Dart 2.18 | 2.18.7 | Jan 2024 | ✅ Yes |
38-
| Dart 2.17 | 2.17.7 | Aug 2023 | ❌ No (Parse Dart SDK requires Dart >=2.18.0) |
33+
| Version | Latest Version | End of Support | Compatible |
34+
|-----------|----------------|----------------|------------|
35+
| Dart 3.1 | 3.1.2 | Sep 2024 | ✅ Yes |
36+
| Dart 3.0 | 3.0.7 | May 2024 | ✅ Yes |
37+
| Dart 2.19 | 2.19.6 | Mar 2024 | ✅ Yes |
3938

4039
## Getting Started
4140

@@ -51,3 +50,4 @@ We want to make contributing to this project as easy and transparent as possible
5150

5251
[guide]: https://docs.parseplatform.org/dart/guide/
5352
[open-collective-link]: https://opencollective.com/parse-server
53+

packages/dart/example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ publish_to: 'none'
55
version: 1.0.0
66

77
environment:
8-
sdk: ">=2.18.0 <4.0.0"
8+
sdk: ">=2.19.6 <4.0.0"
99

1010
dependencies:
1111
parse_server_sdk:

packages/dart/lib/parse_server_sdk.dart

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ import 'dart:math';
66
import 'dart:typed_data';
77

88
import 'package:collection/collection.dart';
9+
import 'package:cross_file/cross_file.dart';
910
import 'package:dio/dio.dart';
1011
import 'package:meta/meta.dart';
11-
import 'package:mime_type/mime_type.dart';
12+
import 'package:mime/mime.dart';
1213
import 'package:path/path.dart' as path;
1314
import 'package:sembast/sembast.dart';
1415
import 'package:sembast/sembast_io.dart';
@@ -41,15 +42,15 @@ part 'src/objects/parse_base.dart';
4142
part 'src/objects/parse_cloneable.dart';
4243
part 'src/objects/parse_config.dart';
4344
part 'src/objects/parse_error.dart';
45+
part 'src/objects/parse_exception.dart';
4446
part 'src/objects/parse_file.dart';
45-
part 'src/objects/parse_number.dart';
4647
part 'src/objects/parse_file_base.dart';
4748
part 'src/objects/parse_file_web.dart';
4849
part 'src/objects/parse_function.dart';
4950
part 'src/objects/parse_geo_point.dart';
5051
part 'src/objects/parse_installation.dart';
52+
part 'src/objects/parse_number.dart';
5153
part 'src/objects/parse_object.dart';
52-
part 'src/objects/parse_exception.dart';
5354
part 'src/objects/parse_operation/parse_add_operation.dart';
5455
part 'src/objects/parse_operation/parse_add_relation_operation.dart';
5556
part 'src/objects/parse_operation/parse_add_unique_operation.dart';
@@ -62,6 +63,7 @@ part 'src/objects/parse_response.dart';
6263
part 'src/objects/parse_save_state_aware_child.dart';
6364
part 'src/objects/parse_session.dart';
6465
part 'src/objects/parse_user.dart';
66+
part 'src/objects/parse_x_file.dart';
6567
part 'src/objects/response/parse_error_response.dart';
6668
part 'src/objects/response/parse_exception_response.dart';
6769
part 'src/objects/response/parse_response_builder.dart';
@@ -83,6 +85,8 @@ part 'src/utils/valuable.dart';
8385
class Parse {
8486
bool _hasBeenInitialized = false;
8587

88+
static bool objectsExistForEventually = false;
89+
8690
/// To initialize Parse Server in your application
8791
///
8892
/// This should be initialized in MyApp() creation
@@ -148,6 +152,12 @@ class Parse {
148152

149153
_hasBeenInitialized = true;
150154

155+
objectsExistForEventually = await checkObjectsExistForEventually();
156+
157+
if (objectsExistForEventually) {
158+
ParseObject.submitEventually();
159+
}
160+
151161
return this;
152162
}
153163

packages/dart/lib/src/base/parse_constants.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
part of flutter_parse_sdk;
22

33
// Library
4-
const String keySdkVersion = '5.1.3';
4+
const String keySdkVersion = '6.4.0';
55
const String keyLibraryName = 'Flutter Parse SDK';
66

77
// End Points
@@ -44,6 +44,7 @@ const String keyFileClassname = 'ParseFile';
4444
// Headers
4545
const String keyHeaderSessionToken = 'X-Parse-Session-Token';
4646
const String keyHeaderRevocableSession = 'X-Parse-Revocable-Session';
47+
const String keyHeaderCloudContext = 'X-Parse-Cloud-Context';
4748
const String keyHeaderUserAgent = 'user-agent';
4849
const String keyHeaderApplicationId = 'X-Parse-Application-Id';
4950
const String keyHeaderContentType = 'content-type';
@@ -58,6 +59,8 @@ const String keyParamSessionToken = 'sessionToken';
5859
// Storage
5960
const String keyParseStoreBase = 'flutter_parse_sdk_';
6061
const String keyParseStoreUser = '${keyParseStoreBase}user';
62+
const String keyParseStoreObjects = '${keyParseStoreBase}objects';
63+
const String keyParseStoreDeletes = '${keyParseStoreBase}deletes';
6164
const String keyParseStoreInstallation = '${keyParseStoreBase}installation';
6265

6366
// Installation
@@ -81,5 +84,6 @@ const String keyVarInstallationId = 'installationId';
8184
// Error
8285
const String keyError = 'error';
8386
const String keyCode = 'code';
87+
const String keyNetworkError = 'NetworkError';
8488

8589
const bool parseIsWeb = identical(0, 0.0);

packages/dart/lib/src/network/parse_dio_client.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ class _ParseDioClient with dio.DioMixin implements dio.Dio {
229229
_logCUrl(options, data, path);
230230
}
231231

232+
checkForSubmitEventually();
233+
232234
return super.request(
233235
path,
234236
data: data,

packages/dart/lib/src/network/parse_http_client.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ class _ParseHTTPClient extends http.BaseClient {
158158
_logCUrl(request);
159159
}
160160

161+
checkForSubmitEventually();
162+
161163
return _client.send(request);
162164
}
163165

packages/dart/lib/src/network/parse_live_query.dart

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class Subscription<T extends ParseObject> {
2222
'error'
2323
];
2424
Map<String, Function> eventCallbacks = <String, Function>{};
25+
2526
void on(LiveQueryEvent op, Function callback) {
2627
eventCallbacks[_liveQueryEvent[op.index]] = callback;
2728
}
@@ -140,8 +141,10 @@ class LiveQueryClient {
140141
reconnectingController = LiveQueryReconnectingController(
141142
() => reconnect(userInitialized: false), getClientEventStream, _debug);
142143
}
144+
143145
static LiveQueryClient get instance => _getInstance();
144146
static LiveQueryClient? _instance;
147+
145148
static LiveQueryClient _getInstance({bool? debug, bool? autoSendSessionId}) {
146149
String? liveQueryURL = ParseCoreData().liveQueryURL;
147150
if (liveQueryURL == null) {
@@ -174,13 +177,14 @@ class LiveQueryClient {
174177
bool _connecting = false;
175178
late StreamController<LiveQueryClientEvent> _clientEventStreamController;
176179
late Stream<LiveQueryClientEvent> _clientEventStream;
180+
StreamController<String>? chanelStream;
177181
late LiveQueryReconnectingController reconnectingController;
178182

179183
final Map<int, Subscription> _requestSubscription = <int, Subscription>{};
180184

181185
Future<void> reconnect({bool userInitialized = false}) async {
182186
await _connect(userInitialized: userInitialized);
183-
_connectLiveQuery();
187+
await _connectLiveQuery();
184188
}
185189

186190
int readyState() {
@@ -286,6 +290,8 @@ class LiveQueryClient {
286290
_channel = channel;
287291
channel.stream.listen((dynamic message) {
288292
_handleMessage(message);
293+
294+
chanelStream?.sink.add(message);
289295
}, onDone: () {
290296
_clientEventStreamController.sink
291297
.add(LiveQueryClientEvent.disconnected);
@@ -315,7 +321,7 @@ class LiveQueryClient {
315321
}
316322
}
317323

318-
void _connectLiveQuery() {
324+
Future<void> _connectLiveQuery() async {
319325
WebSocketChannel? channel = _channel;
320326
if (channel == null) {
321327
return;
@@ -333,10 +339,22 @@ class LiveQueryClient {
333339
connectMessage['sessionToken'] = sessionId;
334340
}
335341
}
342+
336343
String? clientKey = ParseCoreData().clientKey;
344+
if (clientKey != null) {
345+
connectMessage['clientKey'] = clientKey;
346+
}
347+
337348
String? masterKey = ParseCoreData().masterKey;
338-
if (clientKey != null) connectMessage['clientKey'] = clientKey;
339-
if (masterKey != null) connectMessage['masterKey'] = masterKey;
349+
if (masterKey != null) {
350+
connectMessage['masterKey'] = masterKey;
351+
}
352+
353+
String? parseInstallation =
354+
(await ParseInstallation.currentInstallation()).installationId;
355+
if (parseInstallation != null) {
356+
connectMessage['installationId'] = parseInstallation;
357+
}
340358

341359
if (_debug) {
342360
print('$_printConstLiveQuery: ConnectMessage: $connectMessage');

packages/dart/lib/src/objects/parse_file.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class ParseFile extends ParseFileBase {
8282

8383
final Map<String, String> headers = <String, String>{
8484
HttpHeaders.contentTypeHeader:
85-
mime(file!.path) ?? 'application/octet-stream',
85+
lookupMimeType(file!.path) ?? 'application/octet-stream',
8686
HttpHeaders.contentLengthHeader: '${file!.lengthSync()}',
8787
};
8888

0 commit comments

Comments
 (0)