-
-
Notifications
You must be signed in to change notification settings - Fork 735
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into idempotent-requests
- Loading branch information
Showing
16 changed files
with
561 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
version = 4.2.0 | ||
version = 4.3.0 | ||
android.enableJetifier = true | ||
android.useAndroidX = true |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
-keep @com.parse.ParseClassName class com.parse.* | ||
-keepnames class com.parse.** { *; } | ||
-keepclassmembers public class * extends com.parse.** { | ||
public <init>(...); | ||
} | ||
|
||
# Required for Parse | ||
-keepattributes *Annotation* | ||
-keepattributes Signature | ||
# https://github.com/square/okio#proguard | ||
-dontwarn okio.** | ||
|
||
# Retracing stacktraces | ||
-keepattributes LineNumberTable,SourceFile | ||
-renamesourcefileattribute SourceFile |
59 changes: 59 additions & 0 deletions
59
parse/src/main/java/com/parse/ParseCountingUriHttpBody.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Copyright (c) 2015-present, Parse, LLC. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
package com.parse; | ||
|
||
import android.net.Uri; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
|
||
class ParseCountingUriHttpBody extends ParseUriHttpBody { | ||
|
||
private static final int DEFAULT_CHUNK_SIZE = 4096; | ||
private static final int EOF = -1; | ||
|
||
private final ProgressCallback progressCallback; | ||
|
||
public ParseCountingUriHttpBody(Uri uri, ProgressCallback progressCallback) { | ||
this(uri, null, progressCallback); | ||
} | ||
|
||
public ParseCountingUriHttpBody( | ||
Uri uri, String contentType, ProgressCallback progressCallback) { | ||
super(uri, contentType); | ||
this.progressCallback = progressCallback; | ||
} | ||
|
||
@Override | ||
public void writeTo(OutputStream output) throws IOException { | ||
if (output == null) { | ||
throw new IllegalArgumentException("Output stream may not be null"); | ||
} | ||
|
||
final InputStream fileInput = | ||
Parse.getApplicationContext().getContentResolver().openInputStream(uri); | ||
try { | ||
byte[] buffer = new byte[DEFAULT_CHUNK_SIZE]; | ||
int n; | ||
long totalLength = getContentLength(); | ||
long position = 0; | ||
while (EOF != (n = fileInput.read(buffer))) { | ||
output.write(buffer, 0, n); | ||
position += n; | ||
|
||
if (progressCallback != null) { | ||
int progress = (int) (100 * position / totalLength); | ||
progressCallback.done(progress); | ||
} | ||
} | ||
} finally { | ||
ParseIOUtils.closeQuietly(fileInput); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.