Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

[WIP] Feature: parametrizable UI document interaction controller #570

Open
wants to merge 29 commits into
base: 0.11.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8121dbf
Apply possible fix to fs.readFile and fs.readStream for #287
wkh237 Mar 27, 2017
4d15c0f
Merge branch '0.10.5' into issue-287-wip
wkh237 Apr 16, 2017
40fefd4
Add Android fs.readFile app provider URI support #287
wkh237 Apr 16, 2017
50a4d06
Merge branch 'issue-287-merged' into uri
wkh237 Jul 2, 2017
a8cfeb1
Correct app content provider URI handle #287
wkh237 Jul 2, 2017
bb7fec4
Merge branch 'issue-287' of github.com:wkh237/react-native-fetch-blob…
wkh237 Jul 2, 2017
08f8403
Fixed a bug which causes XMLHttpRequest getting incorrect header when…
wkh237 Jul 3, 2017
c217fab
Merge branch 'uri' into 0.10.7
wkh237 Jul 3, 2017
8a75a9b
Set mime if set in addAndroidDownloads (#421)
jsm Jul 3, 2017
ed2732a
Fix Download Manager bug when the file is not a multimedia #391
wkh237 Jul 5, 2017
dd4dbb2
Merge branch '0.10.7' of github.com:wkh237/react-native-fetch-blob in…
wkh237 Jul 5, 2017
6bb7c65
Add support for TLS 1.2 when running Android 4 (#430)
jhellman Jul 14, 2017
b70a124
Update README.md
wkh237 Jul 14, 2017
712c8a3
[iOS] Fix for RNFetchBlob.writeChunk failing to write base64 encoded …
joshbax Jul 17, 2017
d83d800
Add missing API Blob.safeClose()
wkh237 Jul 25, 2017
d1d07d0
Fix Compilation Error in React Native 0.47.0 (#452)
Hizoul Aug 2, 2017
206588f
Merge branch 'master' of github.com:wkh237/react-native-fetch-blob in…
wkh237 Aug 2, 2017
6bde516
Bump to 0.10.7
wkh237 Aug 2, 2017
5f3c018
Merge branch '0.10.7' of github.com:wkh237/react-native-fetch-blob in…
wkh237 Aug 2, 2017
50c1573
Update PULL_REQUEST_TEMPLATE
wkh237 Aug 2, 2017
55009f1
Correct unterminated string #455
wkh237 Aug 3, 2017
9ab4ebb
bump to 0.10.8
bcpclone Aug 3, 2017
4c133d6
refs #51397 Added parameters to UIDocumentInteractionController
Oct 24, 2017
37d1e73
refs #51397 Added parameters to UIDocumentInteractionController
Oct 24, 2017
11d9b65
Added parameters to UIDocumentInteractionController
Oct 24, 2017
a93abc6
Support to change color of navigation bar
Moreno97 Oct 24, 2017
45c200f
Support to change background color of the navigation bar on iOS
Oct 31, 2017
ce06de4
Merge remote-tracking branch 'upstream/0.10.8' into _parametrizable_u…
Nov 17, 2017
8b0aa72
Solved merge issue
Nov 17, 2017
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
49 changes: 38 additions & 11 deletions ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@ import {
NativeModules,
DeviceEventEmitter,
Platform,
NativeAppEventEmitter,
NativeAppEventEmitter
} from 'react-native'

const RNFetchBlob:RNFetchBlobNative = NativeModules.RNFetchBlob
const RNFetchBlob: RNFetchBlobNative = NativeModules.RNFetchBlob

/**
* Open a file using UIDocumentInteractionController
* @param {string]} path Path of the file to be open.
* @param {string} scheme URI scheme that needs to support, optional
* @return {Promise}
*/
function previewDocument(path:string, scheme:string) {
if(Platform.OS === 'ios')
function previewDocument(path: string, scheme: string) {
if (Platform.OS === 'ios') {
return RNFetchBlob.previewDocument('file://' + path, scheme)
else
} else {
return Promise.reject('RNFetchBlob.openDocument only supports IOS.')
}
}

/**
Expand All @@ -31,11 +32,37 @@ function previewDocument(path:string, scheme:string) {
* @param {string} name The name of the target file, optional
* @return {Promise}
*/
function openDocument(path:string, scheme:string, name: string) {
if(Platform.OS === 'ios')
function openDocument(path: string, scheme: string, name: string) {
if (Platform.OS === 'ios') {
return RNFetchBlob.openDocument('file://' + path, scheme, name)
else
return Promise.reject('RNFetchBlob.previewDocument only supports IOS.')
}
}

/**
* Preview a file using UIDocumentInteractionController
* @param {string]} path Path of the file to be open.
* @param {string} scheme URI scheme that needs to support, optional
* @param {string} name The name of the target file, optional
* @param

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Moreno97 please add the @param definitions.

* @param
* @return {Promise}
*/
function openDocumentWithFont(
path: string,
fontFamily: string,
fontSize: number,
hexString: string,
scheme: string
) {
if (Platform.OS === 'ios') {
return RNFetchBlob.openDocument(
'file://' + path,
fontFamily,
fontSize,
hexString,
scheme
)
}
}

/**
Expand All @@ -44,8 +71,8 @@ function openDocument(path:string, scheme:string, name: string) {
* @param {string} url URL of the resource, only file URL is supported
* @return {Promise}
*/
function excludeFromBackupKey(url:string) {
return RNFetchBlob.excludeFromBackupKey('file://' + path);
function excludeFromBackupKey(url: string) {
return RNFetchBlob.excludeFromBackupKey('file://' + path)
}

export default {
Expand Down
Loading