Skip to content

Commit

Permalink
[expo-file-system] Apply requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lukmccall committed Apr 2, 2020
1 parent d6707e1 commit 647bbd1
Show file tree
Hide file tree
Showing 18 changed files with 202 additions and 166 deletions.
2 changes: 1 addition & 1 deletion packages/expo-file-system/CHANGELOG.md
Expand Up @@ -4,7 +4,7 @@

### 🛠 Breaking changes

- `FileSystem.downloadAsync` and `FileSystem.DownloadResumable` now works in the background - they won't reject when the user backgrounds the application. ([#7380](https://github.com/expo/expo/pull/7380) [@lukmccall](https://github.com/lukmccall))
- `FileSystem.downloadAsync` and `FileSystem.DownloadResumable` works in the background from now on - they won't reject when the application is moved to the background. ([#7380](https://github.com/expo/expo/pull/7380) by [@lukmccall](https://github.com/lukmccall))
- `FileSystem.getContentUriAsync` now returns a string. ([#7192](https://github.com/expo/expo/pull/7192) by [@lukmccall](https://github.com/lukmccall))

### 🎉 New features
Expand Down
Expand Up @@ -37,8 +37,6 @@
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.net.CookieHandler;
import java.nio.file.LinkOption;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
Expand Down Expand Up @@ -83,7 +81,6 @@ public FileSystemModule(Context context) {
} catch (IOException e) {
e.printStackTrace();
}

}

@Override
Expand Down Expand Up @@ -491,9 +488,14 @@ public void downloadAsync(String url, final String uriStr, final Map<String, Obj
} else if ("file".equals(uri.getScheme())) {
Request.Builder requestBuilder = new Request.Builder().url(url);
if (options != null && options.containsKey(HEADER_KEY)) {
final Map<String, Object> headers = (Map<String, Object>) options.get(HEADER_KEY);
for (String key : headers.keySet()) {
requestBuilder.addHeader(key, headers.get(key).toString());
try {
final Map<String, Object> headers = (Map<String, Object>) options.get(HEADER_KEY);
for (String key : headers.keySet()) {
requestBuilder.addHeader(key, (String) headers.get(key));
}
} catch (ClassCastException exception) {
promise.reject("ERR_FILESYSTEM_INVALID_HEADERS", "Invalid headers dictionary. Keys and values should be strings.", exception);
return;
}
}
getOkHttpClient().newCall(requestBuilder.build()).enqueue(new Callback() {
Expand Down
2 changes: 1 addition & 1 deletion packages/expo-file-system/build/FileSystem.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/expo-file-system/build/FileSystem.js.map

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions packages/expo-file-system/build/FileSystem.types.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/expo-file-system/build/FileSystem.types.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/expo-file-system/ios/EXFileSystem/EXFileSystem.h
Expand Up @@ -7,7 +7,7 @@
#import <UMFileSystemInterface/UMFileSystemInterface.h>
#import <EXFileSystem/EXSessionResumableDownloadTaskDelegate.h>

@interface EXFileSystem : UMExportedModule <UMEventEmitter, UMModuleRegistryConsumer, UMFileSystemInterface, EXResumableTaskRegister>
@interface EXFileSystem : UMExportedModule <UMEventEmitter, UMModuleRegistryConsumer, UMFileSystemInterface, EXSessionRegister>

@property (nonatomic, readonly) NSString *documentDirectory;
@property (nonatomic, readonly) NSString *cachesDirectory;
Expand Down

0 comments on commit 647bbd1

Please sign in to comment.