Skip to content
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

Android: Deprecation warnings about SDCardDir and SDCardApplicationDir #54

Closed
ataillefer opened this issue May 28, 2018 · 6 comments
Closed

Comments

@ataillefer
Copy link

Branch: 0.10.9

Just calling the following code:

import RNFetchBlob from 'react-native-fetch-blob';

const url = http://my.server.com/my/upload/API;
const headers = { Authorization: 'Bearer xxxxxxxxx' };
const body = RNFetchBlob.wrap('file:///storage/emulated/0/Android/data/some/local/file');
const res = await RNFetchBlob.fetch('POST', url, headers, body);

generates the following warnings in the Android logs:

W ReactNativeJS: SDCardDir as a constant is deprecated and will be removed in feature release. Use RNFetchBlob.android.getSDCardDir():Promise instead.
W ReactNativeJS: SDCardApplicationDir as a constant is deprecated and will be removed in feature release. Use RNFetchBlob.android.getSDCardApplicationDir():Promise instead. This variable can be empty on error in native code.

These warnings have been added by 22fd32a but apparently there are still some occurrences of SDCardDir and SDCardApplicationDir in the code of the 0.10.9 branch.

I'm aware that the 0.10.9 branch isn't stable yet but it is intended to be released with a bunch of bug fixes so I believe that these warnings should be fixed before the release.

Thanks

@ataillefer ataillefer changed the title Android: Depreaction warnings about SDCardDir and SDCardApplicationDir Android: Deprecation warnings about SDCardDir and SDCardApplicationDir May 28, 2018
@chrusart
Copy link

chrusart commented Jun 8, 2018

@ataillefer are you sure it's from react-native-fetch-blob itself, not from other package that uses it?

yarn why react-native-fetch-blob

Do you run this code in some app?

@ataillefer
Copy link
Author

Hi,

Pretty sure yes.
Here's the output of yarn why react-native-fetch-blob:

yarn why react-native-fetch-blob
yarn why v1.6.0
[1/4] Why do we have the module "react-native-fetch-blob"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "react-native-fetch-blob@0.10.8"
info Has been hoisted to "react-native-fetch-blob"
info This module exists because it's specified in "dependencies".
info Disk size without dependencies: "32.49MB"
info Disk size with unique dependencies: "32.58MB"
info Disk size with transitive dependencies: "32.8MB"
info Number of shared dependencies: 8
Done in 1.04s.

Note that it states react-native-fetch-blob@0.10.8 though I am relying on the latest commit of the 0.10.9 branch in my package.json:

"dependencies": {
  ...
  "react-native-fetch-blob": "git+https://github.com/joltup/react-native-fetch-blob#4add85726fab5dadc67f642840f9b64435329cb1",
  ...
},

(this is because the package.json of react-native-fetch-blob's 0.10.9 branch is versioned with 0.10.8.)

And the only place where we call RNFetchBlob in our app is the code mentioned above.
If I comment this code I don't get the warning anymore.

To reproduce, you only need to checkout the 0.10.9 branch and run some similar code.

In fact, I've realized that you don't even need to specify any parameter to the RNFetchBlob.fetch command, the minimum code required to reproduce is:

const res = await RNFetchBlob.fetch('POST', null, {}, null);

@chrusart
Copy link

It's ok, just wanted to see if yarn why react-native-fetch-blob will print you some other library using it.
I'm busy today, but will check it soon again.

Thanks for response @ataillefer

@chrusart
Copy link

You're right, this getters are called when dirs object is instantiated just be importing fs.js file.
Will think about it @ataillefer .

@chrusart
Copy link

Simple is to put depracation info to release notes.
It was even kind of bug, because it was taking values on instantiation, not when used.

@Traviskn
Copy link

This issue should be resolved by #77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants