Commit Graph

21 Commits

Author SHA1 Message Date
Connor McEwen 51efaab120 Handle "Never Ask Again" in permissions and add requestMultiplePermissions
Summary:
In order to get featured in the Google Play Store, we had to handle a few specific cases with permissions based on feedback from the editorial team.

First, which was previously possible with this permissions module was bumping the sdk to version 23.

The second is requesting multiple permissions at one time. In order for the camera + upload to work, we needed to request both camera permissions + media storage in one flow.

The last is handling the case where the user checks the "Never Ask Again" box. This will only appear after a user denies a permission once and is then prompted again. The logic for handling this case is taken from here: http://stackoverflow.com/questions/31928868/how-do-we-distinguish-never-asked-from-stop-asking-in-android-ms-runtime-permis/35495372#35495372

We were also seeing a few crashes similar to #10009 due to `onRequestPermissionsResult` being called before `onResume` (http://stackoverflow.com/questions/35205643/why-is-onresume-called-after-onrequestpermissionsresult), so I delaye
Closes https://github.com/facebook/react-native/pull/10221

Differential Revision: D4232551

fbshipit-source-id: fee698d1c48a2d86623cb87996f3d17f4c10a62e
2016-11-24 22:43:28 -08:00
Andrei Coman 17405b9774 Fix image example
Summary: Bundled images is ios only, legacy image was not present in android resources.

Reviewed By: javache

Differential Revision: D3930349

fbshipit-source-id: 663019351615b173621ef27dbf67ec595f8a590f
2016-09-29 07:28:55 -07:00
Andrei Coman f07ca31303 Listen to device orientation changes
Summary:
Similar to iOS, send device orientation changes events. This does not have the
`getCurrentOrientation` method, because it's not used. If necessary, we'll
add it separately.
This also adds a simple example for testing.

We listen to orientation changes in `onGlobalLayout`, and check if the rotation of the device has changed. If it has, we emit the event.
But:
- `onGlobalLayout` (and `onConfigurationChanged` - which is the method usually used for checking for device orientation changes) is *not* called when the device goes from landscape
  to reverse landscape (same with portrait), as that is not a relayout / configuration change. We could detect if this happens with the help of an `OrientationEventListener`. However, this listener notifies you if the degree
  of the phone changes by a single degree, which means that you need to know by how many degrees the phone needs to change in order for the orientation to change. I haven't looked into how accurate this could be, but I suspect that in practice it would cause a lot of bugs. A simple `abgs` and google search reveals that everybody uses a different margin for detecting a rotation change (from 30 to 45 degrees), so I suspect that this won't work
  as expected in practice. Therefore, we're not using this here, and we're sticking to what android provides via `onConfigurationChanged`. If we find that we have issues because users need to know when the user goes
  from landscape to reverse landscape, then we'll have to revisit this.

Reviewed By: foghina

Differential Revision: D3797521

fbshipit-source-id: 62508efd342a9a4b41b42b6138c73553cfdefebc
2016-09-06 03:59:01 -07:00
Andrei Coman 5d240a8ed3 Fix uiexplorer BUCK install
Summary: It's missing a dependency

Reviewed By: bestander

Differential Revision: D3821094

fbshipit-source-id: 8e048f6daa052ff002ebef2498920d7bd69d324d
2016-09-06 03:43:49 -07:00
leeight 4963a37e80 Move `getLaunchOptions` from ReactActivity to ReactActivityDelegate
Summary:
After 3c4fd42749, `getLaunchOptions` no longer exists in class `ReactActivity`.
We need refactor UIExplorerActivity to fix the build error.
Closes https://github.com/facebook/react-native/pull/9320

Differential Revision: D3696381

Pulled By: astreet

fbshipit-source-id: 5700cf2363029a95cfbdaf6230e4f82ea69fb472
2016-08-11 04:13:40 -07:00
Pieter De Baets 2f73ca8f76 Cleanup UIExplorer folder
Summary: Move all JS to a js/ subfolder so we get some overview of this folder again.

Reviewed By: bestander

Differential Revision: D3542598

fbshipit-source-id: 7637133fe4152f4d39e461b443b38510272d5bc8
2016-07-12 05:59:13 -07:00
leeight dcc2abc1f6 Fix Examples/{UIExplorer,Movies}
Summary:
Thanks for submitting a pull request! Please provide enough information so that others can review your pull request:

(You can skip this if you're fixing a typo or adding an app to the Showcase.)

UIExplorerActivity.java and MoviesActivity.java should override `getReactNativeHost` method. And this PR will fix https://github.com/facebook/react-native/issues/8215.

**Test plan (required)**

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

Make sure tests pass on both Travis and Circle CI.

**Code formatting**

Look around. Match the style of the rest of the codebase. See also the simple [style guide](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#style-guide).

For more info, see the ["Pull Requests" section of our "Contributing" guidelines](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md#pull-requests).
Closes https://github.com/facebook/react-native/pull/8223

Differential Revision: D3456957

fbshipit-source-id: cc0b51e5bfaec71d210bfba81b1f7cd06a723d8c
2016-06-20 08:43:29 -07:00
Andrei Coman b7352b4667 Open source permissions
Summary:
This moves into open source the PermissionsModule and the activity and listener interfaces
necessary to make permissions work.
It also moves the PermissionsExample into the UIExplorer. In order to make this
work, the device has to be Android M and above, and the target sdk of the app has to be 23+, so I changed the uiexplorer manifest to
target that API. This has the unfortunate consequence that people testing on
devices with API 23+ will have to enable the `draw over other apps` setting that
react needs for RedBoxing. The app will automatically send the user to that screen,
so enabling the setting and resuming the app should be trivial.
For testing, try requesting permission for a permission that is currently
revoked. If a permission is granted, it can be revoked via adb (`adb shell pm
revoke com.your.app android.permission.PERMISSION_NAME`), and then requested.

Reviewed By: bestander

Differential Revision: D3431324

fbshipit-source-id: 8cbaea676d2b5727cb5191cdb77a02e213bf9ba3
2016-06-15 09:43:58 -07:00
Janic Duplessis c596f8d0ef Allow building UIExplorer with Buck
Summary:This adds a BUCK file to UIExplorer to allow building it with buck. It is based on the one in the movies app but I removed the extra deps that were not needed in both files.

Also add build version number and target sdk version in the Android manifest so Buck can use it since it was only specified in the gradle build and caused the app to run on a super old target sdk.

bestander mkonicek Would it be simple to also build the ndk part with Buck? Right now it is built with gradle and packaged after. I suppose it is already being done internally at facebook. The BUCK files for building the cpp code are already there but I couldn't figure out what was missing to make it work :(

That is pretty much the only missing part to have first class support for building RN apps with Buck in OSS. We could eventually include BUCK files with the generated project.

**Test plan (required)**
Build and run UIExplorer and Movies examples using Buck.

Edited:
```
./gradlew ReactAndroid:packageReactNdkLibsForBuck
Closes https://github.com/facebook/react-native/pull/6399

Reviewed By: mkonicek

Differential Revision: D3042355

Pulled By: bestander

fb-gh-sync-id: 74760c7ba12d35b1853d2e3706c2ba130f9eef1c
fbshipit-source-id: 74760c7ba12d35b1853d2e3706c2ba130f9eef1c
2016-04-12 13:05:24 -07:00
Christine Abernathy 09958618c5 Adding emulator, simulator UIExplorer example across docs
Summary:Current docs show an Appetize.io example for AlertIOS doc. This pull request adds that feature across all applicable iOS and Android docs. So if a doc has an example in UIExplorer, it shows up in the top right and clicking to Play should navigate to the relevant example.

The changes here also touched NavigationExperimental to fix a typo that prevented iOS deep link from working. Code was also added to help support Android deep links but there's an outstanding issue (a race condition) around how Android deep links trigger getInitialURL in NavigationRootContainer that prevents this from fully working.

For adding the docs, a few things were done outside this pull request:

1/ Release builds for UIExplorer Android and iOS apps were uploaded to Appetize.io. The Appetize.io info (public key to run the build) is embedded in the docs.
2/ The iOS build was generated by making a few changes to get a local bundle. The current UIExplorer set up doesn't support "react-native run-ios".

Regarding the Appetize bu
Closes https://github.com/facebook/react-native/pull/6306

Differential Revision: D3129651

Pulled By: bestander

fb-gh-sync-id: d296d64db8236faa36f35484bb6b362990caf934
fbshipit-source-id: d296d64db8236faa36f35484bb6b362990caf934
2016-04-04 06:05:23 -07:00
Sokovikov 1bab7c5182 vibration module
Summary:I will fix other notes from https://github.com/facebook/react-native/pull/2794 if I get positive feedback.
Closes https://github.com/facebook/react-native/pull/6061

Reviewed By: nicklockwood

Differential Revision: D2982173

Pulled By: dmmiller

fb-gh-sync-id: d1e9407798b0293b090897a10996085b0f0c1b3e
shipit-source-id: d1e9407798b0293b090897a10996085b0f0c1b3e
2016-03-03 04:08:31 -08:00
Konstantin Raev 5112a63953 Added ability to run Movies app with BUCK
Reviewed By: mkonicek

Differential Revision: D2874873

fb-gh-sync-id: 9feface8d9a18742e68206dbafb804de25f53ed8
shipit-source-id: 9feface8d9a18742e68206dbafb804de25f53ed8
2016-02-25 17:15:58 -08:00
Janic Duplessis ad17a2f290 Use ReactActivity for UIExplorer and Movies examples
Summary:This also fixes the examples since the app lifecycle methods were renamed recently.
Closes https://github.com/facebook/react-native/pull/6053

Differential Revision: D2959525

Pulled By: mkonicek

fb-gh-sync-id: 4a445b5e69b55aa75a1063054cf4c78de1f15da6
shipit-source-id: 4a445b5e69b55aa75a1063054cf4c78de1f15da6
2016-02-21 16:36:33 -08:00
Andreas Drivenes b85a52a461 Update Image docs and examples to the new asset system
Summary:
After the release of 0.14, static images should be placed in the source code tree and then required as explained in the [Images guide] (https://facebook.github.io/react-native/docs/images.html). This pull request updates the image documentation and examples to the new asset system. UIExplorer tested on iOS and Android.
Closes https://github.com/facebook/react-native/pull/4987

Reviewed By: svcscm

Differential Revision: D2796276

Pulled By: bestander

fb-gh-sync-id: 732ffa2f136391bb8a3e40a54b5b1ff5022c97f2
2016-01-27 13:47:45 -08:00
Qiao Liang 5030cae757 add permission for android geolocation example
Summary:
<img width="860" alt="screen shot 2015-12-03 at 3 38 02 pm" src="https://cloud.githubusercontent.com/assets/5563225/11554542/e7a33554-99d3-11e5-8d3a-e9ea47952a28.png">
Closes https://github.com/facebook/react-native/pull/4524

Reviewed By: svcscm

Differential Revision: D2717843

Pulled By: mkonicek

fb-gh-sync-id: 7828a7f28bb95be3d292d0ae3351c9d9678bb964
2015-12-03 06:27:24 -08:00
Konstantin Raev 0779dd1e87 Open source the Android NetInfo module
Reviewed By: mkonicek

Differential Revision: D2703432

fb-gh-sync-id: 4a85844f1734ec433df543c89f0fdd56fe5db13c
2015-12-02 11:52:22 -08:00
Pasquale Anatriello bfeaa6a4f5 Custom fonts support added
Reviewed By: andreicoman11

Differential Revision: D2629077

fb-gh-sync-id: 8d647aff13f97d90c5047ad0ddbcae90215ca4ca
2015-11-06 18:15:31 -08:00
Aaron Chiu f8b8fa40fd fix calls to ReactInstanceManager.onResume()
Differential Revision: D2604172

fb-gh-sync-id: 8993b221c55ebe9f1882d203b1729dfce45795ef
2015-10-31 06:26:27 -07:00
Martin Konicek 855f7be4b8 Make Android examples depend on source again
Summary: @​public

The idea was to depend on a fixed version from Maven to make running the examples easy, however that only works if we depend on both fixed version of JS and the Android artifacts.

The current way leads to version mismatches and causes confusion: https://github.com/facebook/react-native/issues/3329

This commit makes the Android examples consistent with iOS (always build the latest JS and native code from master).

Added docs here: 8abfb5e0e2

Reviewed By: @foghina

Differential Revision: D2531525

fb-gh-sync-id: 7c0844b63ddeb94ad008a3f0e7a43e1af69031c4
2015-10-14 07:48:25 -07:00
Martin Konicek 27ab039b6a Export latest Android changes 2015-09-17 14:33:28 +01:00
Martin Konicek 42eb5464fd Release React Native for Android
This is an early release and there are several things that are known
not to work if you're porting your iOS app to Android.

See the Known Issues guide on the website.

We will work with the community to reach platform parity with iOS.
2015-09-14 18:13:39 +01:00