Skip to content

v1.0.13 - Added full bool #91

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Mar 3, 2019
Merged
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.0.13
Added full bool to convert objects to JSON correctly

## 1.0.12
Fixed logout

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
```
dependencies:
parse_server_sdk: ^1.0.12
parse_server_sdk: ^1.0.13
```
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.

2 changes: 1 addition & 1 deletion 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 = '1.0.12';
const String keySdkVersion = '1.0.13';
const String keyLibraryName = 'Flutter Parse SDK';

// End Points
11 changes: 6 additions & 5 deletions lib/src/objects/parse_base.dart
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ abstract class ParseBase {

/// Converts object to [String] in JSON format
@protected
toJson({bool forApiRQ: false}) {
toJson({bool full, bool forApiRQ: false}) {
final map = <String, dynamic>{
keyVarClassName: className,
};
@@ -42,7 +42,7 @@ abstract class ParseBase {
}

getObjectData().forEach((key, value) {
if (!map.containsKey(key)) map[key] = parseEncode(value);
if (!map.containsKey(key)) map[key] = parseEncode(value, full: full);
});

if (forApiRQ) {
@@ -135,9 +135,10 @@ abstract class ParseBase {
Future<bool> pin() async {
if (objectId != null) {
await unpin();
var objectToSave = json.encode(toJson());
await ParseCoreData().getStore()
..setString(objectId, objectToSave);
final Map<String, dynamic> objectMap = parseEncode(this, full: true);
final String json = jsonEncode(objectMap);
var store = await ParseCoreData().getStore();
store.setString(objectId, json);
return true;
} else {
return false;
2 changes: 1 addition & 1 deletion lib/src/objects/parse_file.dart
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ class ParseFile extends ParseObject {
bool get saved => url != null;

@override
toJson({bool forApiRQ: false}) =>
toJson({bool full: false, bool forApiRQ: false}) =>
<String, String>{'__type': keyFile, 'name': name, 'url': url};

@override
8 changes: 6 additions & 2 deletions lib/src/utils/parse_encoder.dart
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ dynamic dateTimeEncoder(dynamic item) {
}

/// Custom json encoder for types related to parse
dynamic parseEncode(dynamic value) {
dynamic parseEncode(dynamic value, {bool full = false}) {
if (value is DateTime) return _encodeDate(value);

if (value is List) {
@@ -19,7 +19,11 @@ dynamic parseEncode(dynamic value) {
}

if (value is ParseObject) {
return _encodeObject(value);
if (full) {
return value.toJson(full: full);
} else {
return _encodeObject(value);
}
}

if (value is ParseUser) {
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: parse_server_sdk
description: Flutter plugin for Parse Server, (https://parseplatform.org), (https://back4app.com)
version: 1.0.12
version: 1.0.13
homepage: https://github.com/phillwiggins/flutter_parse_sdk
author: PhillWiggins <phill.wiggins@gmail.com>