Skip to content

fix: various bugs #762

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 57 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
38611e6
fixes #653
tk2232 Jul 4, 2021
0c88af7
first: Correct return type
sils Aug 2, 2021
4ef447a
Merge pull request #654 from tk2232/master
RodrigoSMarques Sep 14, 2021
149d250
Merge pull request #662 from sils/patch-1
RodrigoSMarques Sep 14, 2021
b0bddc6
Update Readme.md
ManasMalla Sep 28, 2021
902161e
Merge pull request #678 from ManasMalla/master
RodrigoSMarques Oct 2, 2021
3f670d0
Fix logout error when no user is logged in / Update dependencies in p…
RodrigoSMarques Oct 20, 2021
1114232
docs: fix typo in README (#689)
fischerscode Nov 16, 2021
0364486
Fix ParseFile transfer
RodrigoSMarques Feb 3, 2022
78dd3d6
Update dependencies versions
RodrigoSMarques Apr 23, 2022
aa4b3b5
Fix #697 / Update Constants
RodrigoSMarques Apr 23, 2022
c7ca772
Update pubspec.yaml with override dependency
RodrigoSMarques Apr 25, 2022
5d561f7
Update pubspec.yaml
RodrigoSMarques Apr 25, 2022
ef26c34
Update package version
RodrigoSMarques Apr 25, 2022
ecea19d
Update pubspec.yaml
RodrigoSMarques Apr 25, 2022
2549265
Update parse_file.dart
RodrigoSMarques Apr 26, 2022
2f841c2
Merge pull request #1 from parse-community/development
RodrigoSMarques May 2, 2022
4283708
New version 3.2.0
RodrigoSMarques May 2, 2022
e888716
Update .gitignore
RodrigoSMarques May 10, 2022
7dd3a2d
Remove unnecessary files from the project
RodrigoSMarques May 10, 2022
560a65c
fixes #653
tk2232 Jul 4, 2021
3357093
first: Correct return type
sils Aug 2, 2021
3a4a7e4
Create config.yml
TomWFox Aug 2, 2021
c1361dd
Add files via upload
TomWFox Aug 2, 2021
2e26928
Update ---1-report-an-issue.md
TomWFox Aug 4, 2021
1c063af
Update ---2-feature-request.md
TomWFox Aug 4, 2021
c274144
Update ---1-report-an-issue.md
TomWFox Aug 4, 2021
e0b29b5
Update ---1-report-an-issue.md
TomWFox Aug 4, 2021
76fa228
Update Readme.md
ManasMalla Sep 28, 2021
043e790
docs: fix typo in README (#689)
fischerscode Nov 16, 2021
3ac7466
New version 3.2.0
RodrigoSMarques May 2, 2022
ba13a39
Update .gitignore
RodrigoSMarques May 10, 2022
6a11398
Remove unnecessary files from the project
RodrigoSMarques May 10, 2022
87a3f72
Merge branch 'development' of https://github.com/RodrigoSMarques/Pars…
RodrigoSMarques May 31, 2022
06f0035
Merge branch 'master' of https://github.com/parse-community/Parse-SDK…
RodrigoSMarques Jun 1, 2022
aa28ea4
Merge branch 'master' of https://github.com/parse-community/Parse-SDK…
RodrigoSMarques Jun 2, 2022
c250a2e
Merge branch 'parse-community-master' into development
RodrigoSMarques Jun 2, 2022
93da0e7
Version 3.2.0
RodrigoSMarques Jun 2, 2022
6009764
Update pubspec.yaml
RodrigoSMarques Jun 2, 2022
736394e
Update .gitignore
RodrigoSMarques Jun 3, 2022
b7ae7b4
Update CHANGELOG / README
RodrigoSMarques Jun 3, 2022
749bb40
Added instructions for using ACL with ParseRole
RodrigoSMarques Jun 3, 2022
1460a5e
CHANGELOG update
RodrigoSMarques Jun 3, 2022
9fdb42d
Adjustments requested in PR
RodrigoSMarques Jun 6, 2022
b6f1a5e
Update pubspec.yaml
RodrigoSMarques Jun 6, 2022
a23fb59
Update CHANGELOG.md
RodrigoSMarques Jun 8, 2022
7c84251
Fix revision comments
RodrigoSMarques Jun 11, 2022
b2e676d
Update packages/flutter/CHANGELOG.md
mtrezza Jun 11, 2022
8b9ff93
Update packages/dart/CHANGELOG.md
mtrezza Jun 11, 2022
1e12516
Update packages/flutter/CHANGELOG.md
mtrezza Jun 11, 2022
67c533a
Merge branch 'master' into development
mtrezza Jun 28, 2022
d9d8833
Merge branch 'master' into development
mtrezza Jun 28, 2022
42e0dc8
Update flutter-dependencies.bat
RodrigoSMarques Jun 29, 2022
fa1cbb9
Update packages/dart/CHANGELOG.md
mtrezza Jun 30, 2022
bbe1e91
Update packages/flutter/CHANGELOG.md
mtrezza Jun 30, 2022
7800000
Update CHANGELOG.md
RodrigoSMarques Jul 7, 2022
7b738ee
Update packages/dart/CHANGELOG.md
mtrezza Jul 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ unlinked_spec.ds

# macOS
**/macos/Flutter/GeneratedPluginRegistrant.swift
**/macos/flutter/ephemeral/

# Linux
**/linux/flutter/ephemeral
Expand All @@ -120,3 +121,4 @@ app.*.symbols
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/dev/ci/**/Gemfile.lock

10 changes: 10 additions & 0 deletions packages/dart/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## [3.1.2](https://github.com/parse-community/Parse-SDK-Flutter/compare/dart-3.1.1...dart-3.1.2) (2022-07-01)

### Bug Fixes

* unhandled exception in `ParseRelation`, type `ParseObject` is not a subtype of type ([#696](https://github.com/parse-community/Parse-SDK-Flutter/issues/696))
* error in progress callback ([#679](https://github.com/parse-community/Parse-SDK-Flutter/issues/679))
* incorrect return type when calling `first()` ([#661](https://github.com/parse-community/Parse-SDK-Flutter/issues/661))
* error in `ParseLiveListWidget` when enabling `lazyloading` ([#653](https://github.com/parse-community/Parse-SDK-Flutter/issues/653))
* unexpected null value after call `user.logout()` ([#770](https://github.com/parse-community/Parse-SDK-Flutter/issues/770))

## [3.1.1](https://github.com/parse-community/Parse-SDK-Flutter/compare/V3.1.0...dart-3.1.1) (2022-05-30)

### Refactors
Expand Down
9 changes: 8 additions & 1 deletion packages/dart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ This method returns an `Future` that either resolves in an error (equivalent of

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

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`.
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`.

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

To set the ACL to `ParseRole` use:

```dart
parseACL.setReadAccess(userId: "role:ROLE_NAME", allowed: true);
parseACL.setWriteAccess(userId: "role:ROLE_NAME", allowed: true);

```
## Config
The SDK supports Parse Config. A map of all configs can be grabbed from the server by calling :
```dart
Expand Down
2 changes: 1 addition & 1 deletion packages/dart/lib/src/base/parse_constants.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
part of flutter_parse_sdk;

// Library
const String keySdkVersion = '3.1.0';
const String keySdkVersion = '3.1.2';
const String keyLibraryName = 'Flutter Parse SDK';

// End Points
Expand Down
2 changes: 1 addition & 1 deletion packages/dart/lib/src/network/parse_query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ class QueryBuilder<T extends ParseObject> {

/// Find the first object that satisfies the query.
/// Returns null, if no object is found.
Future<T>? first() async {
Future<T?> first() async {
ParseResponse parseResponse =
await (QueryBuilder.copy(this)..setLimit(1)).query();
if (parseResponse.success) {
Expand Down
1 change: 1 addition & 0 deletions packages/dart/lib/src/objects/parse_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class ParseFile extends ParseFileBase {
final Map<String, String> headers = <String, String>{
HttpHeaders.contentTypeHeader:
mime(file!.path) ?? 'application/octet-stream',
HttpHeaders.contentLengthHeader: '${file!.lengthSync()}',
};
try {
final String uri = ParseCoreData().serverUrl + _path;
Expand Down
2 changes: 1 addition & 1 deletion packages/dart/lib/src/objects/parse_relation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ParseRelation<T extends ParseObject> {
Set<T>? _knownObjects = <T>{};

QueryBuilder getQuery() {
return QueryBuilder(ParseObject(_targetClass!))
return QueryBuilder(ParseCoreData.instance.createObject(_targetClass!))
..whereRelatedTo(_key, _parent!.parseClassName, _parentObjectId);
}

Expand Down
11 changes: 10 additions & 1 deletion packages/dart/lib/src/objects/parse_user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,16 @@ class ParseUser extends ParseObject implements ParseCloneable {
/// server. Will also delete the local user data unless
/// deleteLocalUserData is false.
Future<ParseResponse> logout({bool deleteLocalUserData = true}) async {
final String sessionId = ParseCoreData().sessionId!;
final String? sessionId = ParseCoreData().sessionId;

if (sessionId == null) {
return await _handleResponse(
this,
ParseNetworkResponse(data: "{}", statusCode: 200),
ParseApiRQ.logout,
_debug,
parseClassName);
}

forgetLocalSession();

Expand Down
4 changes: 3 additions & 1 deletion packages/dart/lib/src/utils/parse_live_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ class ParseLiveList<T extends ParseObject> {
}),
);
}
query.keysToReturn(keys);
if (keys.isNotEmpty) {
query.keysToReturn(keys);
}
}
return await query.query<T>();
}
Expand Down
27 changes: 15 additions & 12 deletions packages/dart/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
name: parse_server_sdk
description: Dart plugin for Parse Server, (https://parseplatform.org), (https://back4app.com)
version: 3.1.1
homepage: https://github.com/phillwiggins/flutter_parse_sdk
version: 3.1.2
homepage: https://github.com/parse-community/Parse-SDK-Flutter

environment:
sdk: ">=2.12.0 <3.0.0"

dependencies:
# Networking
dio: ^4.0.0
http: ^0.13.3
web_socket_channel: ^2.1.0
dio: ^4.0.6
http: ^0.13.4
web_socket_channel: ^2.2.0

#Database
sembast: ^3.1.0+2
sembast_web: ^2.0.0+2
sembast: ^3.2.0
sembast_web: ^2.0.1+1
xxtea: ^2.1.0

# Utils
uuid: ^3.0.4
meta: ^1.3.0
uuid: ^3.0.6
meta: ^1.7.0
path: ^1.8.0
mime_type: ^1.0.0

dependency_overrides:
path: ^1.8.2 # required for transitive use only

dev_dependencies:
lints: ^1.0.1
# Testing
build_runner: ^2.0.5
mockito: ^5.0.10
test: ^1.17.9
build_runner: ^2.1.11
mockito: ^5.2.0
test: ^1.21.1
9 changes: 9 additions & 0 deletions packages/flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [3.1.3](https://github.com/parse-community/Parse-SDK-Flutter/compare/flutter-3.1.2...flutter-3.1.3) (2022-07-01)

### Bug Fixes

* old version of `connectivity_plus package` ([#717](https://github.com/parse-community/Parse-SDK-Flutter/issues/717))
* dependency `package_info_plus` does not work in web ([#714](https://github.com/parse-community/Parse-SDK-Flutter/issues/714))
* missing plugin exception, no implementation found for method `getAll` ([#712](https://github.com/parse-community/Parse-SDK-Flutter/issues/712))


## [3.1.2](https://github.com/parse-community/Parse-SDK-Flutter/compare/flutter-3.1.1...flutter-3.1.2) (2022-05-30)

### Refactors
Expand Down
22 changes: 21 additions & 1 deletion packages/flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,19 @@ Due to Cross-origin resource sharing (CORS) restrictions, this requires adding `
When running directly via docker, set the env var `PARSE_SERVER_ALLOW_HEADERS=X-Parse-Installation-Id`.
When running via express, set [ParseServerOptions](https://parseplatform.org/parse-server/api/master/ParseServerOptions.html) `allowHeaders: ['X-Parse-Installation-Id']`.

#### Desktop Support (macOS)
The security entitlements posed by the macOS framework require that your app is granted permission to open outgoing network connections, so that the Parse Flutter SDK can communicate with Parse Server. To grant this permission, add the following lines:
```
<key>com.apple.security.network.client</key>
<true/>
```
to the following files:
```
/macOS/Runner/Release.entitlements
/macOS/Runner/DebugProfile.entitlements
```
to help the Parse SDK for Flutter communicate with the Web to access the server and send/retrive data.

#### Network client
By default, this SDK uses the `ParseHTTPClient`.
Another option is use `ParseDioClient`. This client supports the most features (for example a progress callback at the file upload), but a benchmark has shown, that dio is slower than http on web.
Expand Down Expand Up @@ -296,7 +309,7 @@ This method returns an `Future` that either resolves in an error (equivalent of

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

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`.
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`.

## Complex Queries

Expand Down Expand Up @@ -844,6 +857,13 @@ You can retrieve the ACL list of an object using:
ParseACL parseACL = parseObject.getACL();
```

To set the ACL to `ParseRole` use:

```dart
parseACL.setReadAccess(userId: "role:ROLE_NAME", allowed: true);
parseACL.setWriteAccess(userId: "role:ROLE_NAME", allowed: true);
```

## Config
The SDK supports Parse Config. A map of all configs can be grabbed from the server by calling :
```dart
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Generated file. Do not edit.
//

// clang-format off

#include "generated_plugin_registrant.h"


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Generated file. Do not edit.
//

// clang-format off

#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_

Expand Down

This file was deleted.

This file was deleted.

16 changes: 5 additions & 11 deletions packages/flutter/lib/parse_server_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/material.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:parse_server_sdk/parse_server_sdk.dart' as sdk;
import 'package:parse_server_sdk_flutter/src/storage/core_store_directory_io.dart'
if (dart.library.html) 'package:parse_server_sdk_flutter/src/storage/core_store_directory_web.dart';
import 'package:path/path.dart' as path;
import 'package:path_provider/path_provider.dart';
import 'package:sembast/sembast.dart';
import 'package:shared_preferences/shared_preferences.dart';

Expand Down Expand Up @@ -90,8 +91,8 @@ class Parse extends sdk.Parse
parseFileConstructor: parseFileConstructor,
liveListRetryIntervals: liveListRetryIntervals,
connectivityProvider: connectivityProvider ?? this,
fileDirectory: fileDirectory ??
(!sdk.parseIsWeb ? (await getTemporaryDirectory()).path : null),
fileDirectory:
fileDirectory ?? (await CoreStoreDirectory().getTempDirectory()),
appResumedStream: appResumedStream ?? _appResumedStreamController.stream,
clientCreator: clientCreator,
) as Parse;
Expand Down Expand Up @@ -136,14 +137,7 @@ class Parse extends sdk.Parse

Future<String> dbDirectory() async {
String dbDirectory = '';
if (!sdk.parseIsWeb &&
(Platform.isIOS ||
Platform.isAndroid ||
Platform.isMacOS ||
Platform.isLinux ||
Platform.isWindows)) {
dbDirectory = (await getApplicationDocumentsDirectory()).path;
}
dbDirectory = await CoreStoreDirectory().getDatabaseDirectory();
return path.join('$dbDirectory/parse', 'parse.db');
}

Expand Down
11 changes: 11 additions & 0 deletions packages/flutter/lib/src/storage/core_store_directory_io.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:path_provider/path_provider.dart';

class CoreStoreDirectory {
Future<String> getDatabaseDirectory() async {
return (await getApplicationDocumentsDirectory()).path;
}

Future<String?> getTempDirectory() async {
return (await getTemporaryDirectory()).path;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CoreStoreDirectory {
Future<String> getDatabaseDirectory() async {
return '';
}

Future<String?> getTempDirectory() async {
return '';
}
}
36 changes: 16 additions & 20 deletions packages/flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: parse_server_sdk_flutter
description: Flutter plugin for Parse Server, (https://parseplatform.org), (https://back4app.com)
version: 3.1.2
homepage: https://github.com/phillwiggins/flutter_parse_sdk
version: 3.1.3
homepage: https://github.com/parse-community/Parse-SDK-Flutter

environment:
sdk: ">=2.12.0 <3.0.0"
Expand All @@ -10,36 +10,32 @@ dependencies:
flutter:
sdk: flutter

# Uncomment for Release version
parse_server_sdk: ^3.1.1

parse_server_sdk: ^3.1.2
# Uncomment for local testing
#parse_server_sdk:
# path: ../dart

# Uncomment for test with Github Branch
#parse_server_sdk:
# git:
# url: https://github.com/parse-community/Parse-SDK-Flutter.git
# ref: nullsafety
# path: packages/dart

# Networking
dio: ^4.0.0
connectivity_plus: ^1.0.1 # only used in the flutter part
dio: ^4.0.6
connectivity_plus: ^2.3.2 # only used in the flutter part

#Database
shared_preferences: ^2.0.5 # only used in the flutter part
shared_preferences: ^2.0.15 # only used in the flutter part

# Utils
path_provider: ^2.0.1 # only used in the flutter part
package_info_plus: ^1.0.0 # only used in the flutter part
sembast: ^3.0.0+4 # required for transitive use only
path: ^1.8.0 # required for transitive use only
path_provider: ^2.0.10 # only used in the flutter part
package_info_plus: ^1.4.2 # only used in the flutter part
sembast: ^3.2.0
sembast_web: ^2.0.1+1
path: ^1.8.1 # required for transitive use only

dependency_overrides:
path: ^1.8.2 # required for transitive use only
platform: ^3.1.0

dev_dependencies:
flutter_lints: ^1.0.4
# Testing
flutter_test:
sdk: flutter
mockito: ^5.0.10
mockito: ^5.2.0
9 changes: 5 additions & 4 deletions tools/flutter-dependencies.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
call flutter config --no-analytics
cd packages/dart
flutter pub get
call flutter pub get
cd ../..
cd packages/flutter
flutter pub remove parse_server_sdk
flutter pub add parse_server_sdk --path ../dart
flutter pub get
call flutter pub remove parse_server_sdk
call flutter pub add parse_server_sdk --path ../dart
call flutter pub get
Empty file modified tools/flutter-dependencies.sh
100755 → 100644
Empty file.