File tree 2 files changed +31
-0
lines changed
Parse/src/main/java/com/parse
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,28 @@ public Task<T> then(Task<Void> task) throws Exception {
137
137
}
138
138
}
139
139
140
+ @ Override
141
+ /* package */ Task <Void > saveAsync (final String sessionToken , final Task <Void > toAwait ) {
142
+ return super .saveAsync (sessionToken , toAwait ).continueWithTask (new Continuation <Void , Task <Void >>() {
143
+ @ Override
144
+ public Task <Void > then (Task <Void > task ) throws Exception {
145
+ // Retry the fetch as a save operation because this Installation was deleted on the server.
146
+ // Do not attempt to resave an object if LDS is enabled, since changing objectId is not allowed.
147
+ if (!Parse .isLocalDatastoreEnabled ()
148
+ && task .getError () != null
149
+ && task .getError () instanceof ParseException
150
+ && ((ParseException ) task .getError ()).getCode () == ParseException .OBJECT_NOT_FOUND ) {
151
+ synchronized (mutex ) {
152
+ setObjectId (null );
153
+ markAllFieldDirty ();
154
+ return ParseInstallation .super .saveAsync (sessionToken , toAwait );
155
+ }
156
+ }
157
+ return task ;
158
+ }
159
+ });
160
+ }
161
+
140
162
@ Override
141
163
/* package */ Task <Void > handleSaveResultAsync (ParseObject .State result ,
142
164
ParseOperationSet operationsBeforeSave ) {
Original file line number Diff line number Diff line change @@ -2815,6 +2815,15 @@ private void rebuildEstimatedData() {
2815
2815
}
2816
2816
}
2817
2817
2818
+ /* package */ void markAllFieldDirty () {
2819
+ synchronized (mutex ) {
2820
+ estimatedData .clear ();
2821
+ for (String key : state .keySet ()) {
2822
+ performPut (key , state .get (key ));
2823
+ }
2824
+ }
2825
+ }
2826
+
2818
2827
/**
2819
2828
* performOperation() is like {@link #put(String, Object)} but instead of just taking a new value,
2820
2829
* it takes a ParseFieldOperation that modifies the value.
You can’t perform that action at this time.
0 commit comments