-
-
Notifications
You must be signed in to change notification settings - Fork 205
fix some issues #216
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
fix some issues #216
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,4 @@ build/ | |
example/ios/Frameworks/ | ||
example/lib/ui/ | ||
|
||
.vscode/ | ||
.vscode/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ part of flutter_parse_sdk; | |
abstract class ParseBase { | ||
String parseClassName; | ||
Type type; | ||
bool _dirty = false; // reserved property | ||
final bool _dirty = false; // reserved property | ||
phillwiggins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
final Map<String, dynamic> _unsavedChanges = Map<String, dynamic>(); | ||
final Map<String, dynamic> _savingChanges = Map<String, dynamic>(); | ||
|
||
|
@@ -41,12 +41,13 @@ abstract class ParseBase { | |
if (_dirty || _unsavedChanges.isNotEmpty) { | ||
return true; | ||
} | ||
bool match = false; | ||
_getObjectData().forEach((String key, dynamic value) { | ||
if (value is ParseObject && value._areChildrenDirty(seenObjects)) { | ||
return true; | ||
match = true; | ||
} | ||
}); | ||
return false; | ||
return match; | ||
} | ||
|
||
/// Returns [DateTime] createdAt | ||
|
@@ -88,7 +89,8 @@ abstract class ParseBase { | |
map[keyVarUpdatedAt] = _parseDateFormat.format(updatedAt); | ||
} | ||
|
||
final Map<String, dynamic> target = forApiRQ ? _unsavedChanges : _getObjectData(); | ||
final Map<String, dynamic> target = | ||
forApiRQ ? _unsavedChanges : _getObjectData(); | ||
target.forEach((String key, dynamic value) { | ||
if (!map.containsKey(key)) { | ||
map[key] = parseEncode(value, full: full); | ||
|
@@ -100,6 +102,7 @@ abstract class ParseBase { | |
map.remove(keyVarUpdatedAt); | ||
map.remove(keyVarClassName); | ||
//map.remove(keyVarAcl); | ||
map.remove(keyVarObjectId); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we sure this is correct for all calls? Seems strange that it's there in the first place. Have you ran tests that everything else works with this removed? Rather than just installation? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do all the test in example. yes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this works when saving? I'm not sure saving an object would work anymore. It will create a new object. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @phillwiggins |
||
map.remove(keyParamSessionToken); | ||
} | ||
|
||
|
@@ -152,7 +155,8 @@ abstract class ParseBase { | |
|
||
/// Returns the objects variables | ||
@protected | ||
Map<String, dynamic> _getObjectData() => _objectData ?? Map<String, dynamic>(); | ||
Map<String, dynamic> _getObjectData() => | ||
_objectData ?? Map<String, dynamic>(); | ||
|
||
bool containsValue(Object value) { | ||
return _getObjectData().containsValue(value); | ||
|
@@ -169,11 +173,11 @@ abstract class ParseBase { | |
void operator []=(String key, dynamic value) { | ||
set<dynamic>(key, value); | ||
} | ||
|
||
/// Saves in storage | ||
Future<void> saveInStorage(String key) async { | ||
final String objectJson = json.encode(toJson(full: true)); | ||
ParseCoreData().getStore() | ||
..setString(key, objectJson); | ||
ParseCoreData().getStore()..setString(key, objectJson); | ||
} | ||
|
||
/// Sets type [T] from objectData | ||
|
@@ -237,8 +241,7 @@ abstract class ParseBase { | |
await unpin(); | ||
final Map<String, dynamic> objectMap = parseEncode(this, full: true); | ||
final String json = jsonEncode(objectMap); | ||
ParseCoreData().getStore() | ||
..setString(objectId, json); | ||
ParseCoreData().getStore()..setString(objectId, json); | ||
return true; | ||
} else { | ||
return false; | ||
|
@@ -250,8 +253,7 @@ abstract class ParseBase { | |
/// Replicates Android SDK pin process and saves object to storage | ||
Future<bool> unpin({String key}) async { | ||
if (objectId != null) { | ||
ParseCoreData().getStore() | ||
..remove(key ?? objectId); | ||
ParseCoreData().getStore()..remove(key ?? objectId); | ||
return true; | ||
} | ||
|
||
|
@@ -282,10 +284,14 @@ abstract class ParseBase { | |
String getClassName() => parseClassName; | ||
@Deprecated('Prefer to use parseClassName') | ||
String setClassName(String className) => parseClassName = className; | ||
@protected @Deprecated('Prefer to use _getObjectData method, or operator [] for certain key.') | ||
@protected | ||
@Deprecated( | ||
'Prefer to use _getObjectData method, or operator [] for certain key.') | ||
Map<String, dynamic> getObjectData() => _getObjectData(); | ||
|
||
@protected @Deprecated('Prefer to use _setObjectData method, or operator [] for certain key.') | ||
@protected | ||
@Deprecated( | ||
'Prefer to use _setObjectData method, or operator [] for certain key.') | ||
void setObjectData(Map<String, dynamic> objectData) => | ||
_setObjectData(objectData); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why has this been removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bwcause it is not used yet. so I comment it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a big and will need to be investigated further.