From 79bd8f722f1813b7320f9a4039ada938d304e804 Mon Sep 17 00:00:00 2001 From: James Brinkerhoff Date: Sat, 15 Feb 2020 12:08:46 -0700 Subject: [PATCH 1/2] Fixed the Parse().initialize's return value (#307) * Release/1.0.26 - Update docs * Updated Live Queries related documentation (#301) * Fixed the parse initialize method Parse().initialize returns a new instantiation of the Parse class, but it should return the initialized instance. Co-authored-by: Phill Wiggins Co-authored-by: mregandla <3104483+mregandla@users.noreply.github.com> --- CHANGELOG.md | 3 +++ README.md | 16 ++++++++-------- lib/parse_server_sdk.dart | 2 +- lib/src/base/parse_constants.dart | 2 +- pubspec.yaml | 2 +- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72571ddcb..e7aa829a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ +## 1.0.26 + ## 1.0.25 +Update dependencies ## 1.0.24 Fixed lint diff --git a/README.md b/README.md index 6429e9ae7..cee257290 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Want to get involved? Join our Slack channel and help out! (http://flutter-parse To install, either add to your pubspec.yaml ```yml dependencies: - parse_server_sdk: ^1.0.25 + parse_server_sdk: ^1.0.26 ``` or clone this repository and add to your project. As this is an early development with multiple contributors, it is probably best to download/clone and keep updating as an when a new feature is added. @@ -330,7 +330,7 @@ You’ll get the LiveQuery events through this subscription. The first time you call subscribe, we’ll try to open the WebSocket connection to the LiveQuery server for you. ```dart -await liveQuery.subscribe(query); +Subscription subscription = await liveQuery.client.subscribe(query); ``` __Event Handling__ @@ -340,7 +340,7 @@ __Create event__ When a new ParseObject is created and it fulfills the QueryBuilder you subscribe, you’ll get this event. The object is the ParseObject which was created. ```dart -liveQuery.on(LiveQueryEvent.create, (value) { +subscription.on(LiveQueryEvent.create, (value) { print('*** CREATE ***: ${DateTime.now().toString()}\n $value '); print((value as ParseObject).objectId); print((value as ParseObject).updatedAt); @@ -356,7 +356,7 @@ When an existing ParseObject which fulfills the QueryBuilder you subscribe is up QueryBuilder before and after changes), you’ll get this event. The object is the ParseObject which was updated. Its content is the latest value of the ParseObject. ```dart -liveQuery.on(LiveQueryEvent.update, (value) { +subscription.on(LiveQueryEvent.update, (value) { print('*** UPDATE ***: ${DateTime.now().toString()}\n $value '); print((value as ParseObject).objectId); print((value as ParseObject).updatedAt); @@ -372,7 +372,7 @@ When an existing ParseObject’s old value does not fulfill the QueryBuilder but you’ll get this event. The object is the ParseObject which enters the QueryBuilder. Its content is the latest value of the ParseObject. ```dart -liveQuery.on(LiveQueryEvent.enter, (value) { +subscription.on(LiveQueryEvent.enter, (value) { print('*** ENTER ***: ${DateTime.now().toString()}\n $value '); print((value as ParseObject).objectId); print((value as ParseObject).updatedAt); @@ -388,7 +388,7 @@ When an existing ParseObject’s old value fulfills the QueryBuilder but its new you’ll get this event. The object is the ParseObject which leaves the QueryBuilder. Its content is the latest value of the ParseObject. ```dart -liveQuery.on(LiveQueryEvent.leave, (value) { +subscription.on(LiveQueryEvent.leave, (value) { print('*** LEAVE ***: ${DateTime.now().toString()}\n $value '); print((value as ParseObject).objectId); print((value as ParseObject).updatedAt); @@ -403,7 +403,7 @@ __Delete event__ When an existing ParseObject which fulfills the QueryBuilder is deleted, you’ll get this event. The object is the ParseObject which is deleted ```dart -liveQuery.on(LiveQueryEvent.delete, (value) { +subscription.on(LiveQueryEvent.delete, (value) { print('*** DELETE ***: ${DateTime.now().toString()}\n $value '); print((value as ParseObject).objectId); print((value as ParseObject).updatedAt); @@ -420,7 +420,7 @@ After that, you won’t get any events from the subscription object and will clo LiveQuery server. ```dart -await liveQuery.unSubscribe(); +liveQuery.client.unSubscribe(subscription); ``` ## Users diff --git a/lib/parse_server_sdk.dart b/lib/parse_server_sdk.dart index ee39774d3..69483c77c 100644 --- a/lib/parse_server_sdk.dart +++ b/lib/parse_server_sdk.dart @@ -135,7 +135,7 @@ class Parse { _hasBeenInitialized = true; - return Parse(); + return this; } bool hasParseBeenInitialized() => _hasBeenInitialized; diff --git a/lib/src/base/parse_constants.dart b/lib/src/base/parse_constants.dart index b003e9679..0105ee5e0 100644 --- a/lib/src/base/parse_constants.dart +++ b/lib/src/base/parse_constants.dart @@ -1,7 +1,7 @@ part of flutter_parse_sdk; // Library -const String keySdkVersion = '1.0.25'; +const String keySdkVersion = '1.0.26'; const String keyLibraryName = 'Flutter Parse SDK'; // End Points diff --git a/pubspec.yaml b/pubspec.yaml index 21f55d4ae..6ed3146e7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: parse_server_sdk description: Flutter plugin for Parse Server, (https://parseplatform.org), (https://back4app.com) -version: 1.0.25 +version: 1.0.26 homepage: https://github.com/phillwiggins/flutter_parse_sdk author: PhillWiggins From e2e5c346a389239cb434cf425aa01b79050335cb Mon Sep 17 00:00:00 2001 From: Michal Baran Date: Tue, 18 Feb 2020 21:56:00 +0100 Subject: [PATCH 2/2] Specified T return type instead of dynamic for get method --- lib/src/objects/parse_base.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/objects/parse_base.dart b/lib/src/objects/parse_base.dart index b3b13fe20..ad9620e7b 100644 --- a/lib/src/objects/parse_base.dart +++ b/lib/src/objects/parse_base.dart @@ -220,7 +220,7 @@ abstract class ParseBase { /// Returns null or [defaultValue] if provided. To get an int, call /// getType and an int will be returned, null, or a defaultValue if /// provided - dynamic get(String key, {T defaultValue}) { + T get(String key, {T defaultValue}) { if (_getObjectData().containsKey(key)) { if (T != null && _getObjectData()[key] is T) { final T data = _getObjectData()[key];