cordova-plugin-inappbrowser icon indicating copy to clipboard operation
cordova-plugin-inappbrowser copied to clipboard

fix(android): Allow loading local files

Open NoelDeMartin opened this issue 4 years ago • 3 comments
trafficstars

Platforms affected

Android

Motivation and Context

This PR allows opening local files in the inappbrowser for Android applications targeting SDK 30 or later. The use-case for this is the same as #693, but applicable to Android instead of iOS.

Description

Starting with SDK 30, the default value for the allowFileAccess setting changed in Android (as specified in the documentation). It was true before and it's false now, meaning that this can potentially break existing applications.

This problem is something that has already been tackled in cordova core (Initially in https://github.com/apache/cordova-android/pull/1111, later updated in https://github.com/apache/cordova-android/pull/1222). So I just followed the same strategy and this setting is only updated if the AndroidInsecureFileModeEnabled preference is set to true.

Testing

I've tested the fix in my application. Given that the code is quite simple and it's already in cordova core, I don't think it needs any further testing.

Checklist

  • [x] I've run the tests to see all new and existing tests pass
  • [ ] I added automated test coverage as appropriate for this change
  • [x] Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • [ ] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • [ ] I've updated the documentation if necessary

NoelDeMartin avatar Jun 17 '21 14:06 NoelDeMartin

Hello, please accept the merge 'cause we need that correction. Thanks bro!

quenis avatar Nov 19 '21 15:11 quenis

@quenis Until this gets merged, you can use our fork which is the 5.0 release + this one fix. https://github.com/moodlemobile/cordova-plugin-inappbrowser

NoelDeMartin avatar Nov 19 '21 16:11 NoelDeMartin

@quenis Until this gets merged, you can use our fork which is the 5.0 release + this one fix. https://github.com/moodlemobile/cordova-plugin-inappbrowser

@NoelDeMartin Thanks man for yr reply!

quenis avatar Nov 19 '21 17:11 quenis