Skip to content

Commit 4ce74b3

Browse files
fix: various bugs (#762)
1 parent a76df23 commit 4ce74b3

22 files changed

+132
-77
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ unlinked_spec.ds
102102

103103
# macOS
104104
**/macos/Flutter/GeneratedPluginRegistrant.swift
105+
**/macos/flutter/ephemeral/
105106

106107
# Linux
107108
**/linux/flutter/ephemeral
@@ -120,3 +121,4 @@ app.*.symbols
120121
!**/ios/**/default.perspectivev3
121122
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
122123
!/dev/ci/**/Gemfile.lock
124+

packages/dart/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## [3.1.2](https://github.com/parse-community/Parse-SDK-Flutter/compare/dart-3.1.1...dart-3.1.2) (2022-07-01)
2+
3+
### Bug Fixes
4+
5+
* unhandled exception in `ParseRelation`, type `ParseObject` is not a subtype of type ([#696](https://github.com/parse-community/Parse-SDK-Flutter/issues/696))
6+
* error in progress callback ([#679](https://github.com/parse-community/Parse-SDK-Flutter/issues/679))
7+
* incorrect return type when calling `first()` ([#661](https://github.com/parse-community/Parse-SDK-Flutter/issues/661))
8+
* error in `ParseLiveListWidget` when enabling `lazyloading` ([#653](https://github.com/parse-community/Parse-SDK-Flutter/issues/653))
9+
* unexpected null value after call `user.logout()` ([#770](https://github.com/parse-community/Parse-SDK-Flutter/issues/770))
10+
111
## [3.1.1](https://github.com/parse-community/Parse-SDK-Flutter/compare/V3.1.0...dart-3.1.1) (2022-05-30)
212

313
### Refactors

packages/dart/README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ This method returns an `Future` that either resolves in an error (equivalent of
272272

273273
Choosing between `query()` and `find()` comes down to personal preference. Both methods can be used for querying a `ParseQuery`, just the output method differs.
274274

275-
Similar to `find()` the `QueryBuilder` also has a function called `Future<T>? first()`. Just like `find()` `first()` is just a convenience method that makes querying the first object satisfying the query simpler. `first()` returns an `Future`, that resoles in an error or the first object matching the query. In case no object satisfies the query, the result will be `null`.
275+
Similar to `find()` the `QueryBuilder` also has a function called `Future<T?> first()`. Just like `find()` `first()` is just a convenience method that makes querying the first object satisfying the query simpler. `first()` returns an `Future`, that resoles in an error or the first object matching the query. In case no object satisfies the query, the result will be `null`.
276276

277277
## Complex Queries
278278
You can create complex queries to really put your database to the test:
@@ -739,6 +739,13 @@ You can retrieve the ACL list of an object using:
739739
ParseACL parseACL = parseObject.getACL();
740740
```
741741

742+
To set the ACL to `ParseRole` use:
743+
744+
```dart
745+
parseACL.setReadAccess(userId: "role:ROLE_NAME", allowed: true);
746+
parseACL.setWriteAccess(userId: "role:ROLE_NAME", allowed: true);
747+
748+
```
742749
## Config
743750
The SDK supports Parse Config. A map of all configs can be grabbed from the server by calling :
744751
```dart

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

Lines changed: 1 addition & 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 = '3.1.0';
4+
const String keySdkVersion = '3.1.2';
55
const String keyLibraryName = 'Flutter Parse SDK';
66

77
// End Points

packages/dart/lib/src/network/parse_query.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ class QueryBuilder<T extends ParseObject> {
536536

537537
/// Find the first object that satisfies the query.
538538
/// Returns null, if no object is found.
539-
Future<T>? first() async {
539+
Future<T?> first() async {
540540
ParseResponse parseResponse =
541541
await (QueryBuilder.copy(this)..setLimit(1)).query();
542542
if (parseResponse.success) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class ParseFile extends ParseFileBase {
7171
final Map<String, String> headers = <String, String>{
7272
HttpHeaders.contentTypeHeader:
7373
mime(file!.path) ?? 'application/octet-stream',
74+
HttpHeaders.contentLengthHeader: '${file!.lengthSync()}',
7475
};
7576
try {
7677
final String uri = ParseCoreData().serverUrl + _path;

packages/dart/lib/src/objects/parse_relation.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ParseRelation<T extends ParseObject> {
2929
Set<T>? _knownObjects = <T>{};
3030

3131
QueryBuilder getQuery() {
32-
return QueryBuilder(ParseObject(_targetClass!))
32+
return QueryBuilder(ParseCoreData.instance.createObject(_targetClass!))
3333
..whereRelatedTo(_key, _parent!.parseClassName, _parentObjectId);
3434
}
3535

packages/dart/lib/src/objects/parse_user.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,16 @@ class ParseUser extends ParseObject implements ParseCloneable {
315315
/// server. Will also delete the local user data unless
316316
/// deleteLocalUserData is false.
317317
Future<ParseResponse> logout({bool deleteLocalUserData = true}) async {
318-
final String sessionId = ParseCoreData().sessionId!;
318+
final String? sessionId = ParseCoreData().sessionId;
319+
320+
if (sessionId == null) {
321+
return await _handleResponse(
322+
this,
323+
ParseNetworkResponse(data: "{}", statusCode: 200),
324+
ParseApiRQ.logout,
325+
_debug,
326+
parseClassName);
327+
}
319328

320329
forgetLocalSession();
321330

packages/dart/lib/src/utils/parse_live_list.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ class ParseLiveList<T extends ParseObject> {
144144
}),
145145
);
146146
}
147-
query.keysToReturn(keys);
147+
if (keys.isNotEmpty) {
148+
query.keysToReturn(keys);
149+
}
148150
}
149151
return await query.query<T>();
150152
}

packages/dart/pubspec.yaml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,34 @@
11
name: parse_server_sdk
22
description: Dart plugin for Parse Server, (https://parseplatform.org), (https://back4app.com)
3-
version: 3.1.1
4-
homepage: https://github.com/phillwiggins/flutter_parse_sdk
3+
version: 3.1.2
4+
homepage: https://github.com/parse-community/Parse-SDK-Flutter
55

66
environment:
77
sdk: ">=2.12.0 <3.0.0"
88

99
dependencies:
1010
# Networking
11-
dio: ^4.0.0
12-
http: ^0.13.3
13-
web_socket_channel: ^2.1.0
11+
dio: ^4.0.6
12+
http: ^0.13.4
13+
web_socket_channel: ^2.2.0
1414

1515
#Database
16-
sembast: ^3.1.0+2
17-
sembast_web: ^2.0.0+2
16+
sembast: ^3.2.0
17+
sembast_web: ^2.0.1+1
1818
xxtea: ^2.1.0
1919

2020
# Utils
21-
uuid: ^3.0.4
22-
meta: ^1.3.0
21+
uuid: ^3.0.6
22+
meta: ^1.7.0
2323
path: ^1.8.0
2424
mime_type: ^1.0.0
2525

26+
dependency_overrides:
27+
path: ^1.8.2 # required for transitive use only
28+
2629
dev_dependencies:
2730
lints: ^1.0.1
2831
# Testing
29-
build_runner: ^2.0.5
30-
mockito: ^5.0.10
31-
test: ^1.17.9
32+
build_runner: ^2.1.11
33+
mockito: ^5.2.0
34+
test: ^1.21.1

0 commit comments

Comments
 (0)