Commit Graph

47 Commits

Author SHA1 Message Date
David Aurelio ad8a335864 Remove knowledge of fbjs from the packager
Summary:Follow-up to https://github.com/facebook/react-native/pull/5084

This…
- changes all requires within RN to `require('fbjs/lib/…')`
- updates `.flowconfig`
- updates `packager/blacklist.js`
- adapts tests
- removes things from `Libraries/vendor/{core,emitter}` that are also in fbjs
- removes knowledge of `fbjs` from the packager

Closes https://github.com/facebook/react-native/pull/5084

Reviewed By: bestander

Differential Revision: D2926835

fb-gh-sync-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
shipit-source-id: 2095e22b2f38e032599d1f2601722b3560e8b6e9
2016-03-02 04:28:38 -08:00
Jacob Turner 5c418655bf Remove duplicate register call
Summary:Hello!

As described in #3288, the `PushNotificationsIOS` `register` callback fires twice.  See that issue for discussion.

There wasn't any feedback on a proposed PR, so this is the first effort.  This change does make the register callback act as expected on my device.  I can make any changes necessary.

Thanks!
Closes https://github.com/facebook/react-native/pull/6111

Differential Revision: D2970806

Pulled By: nicklockwood

fb-gh-sync-id: a8d0b53210f85cc24b4befdb0e90af46512fa4fb
shipit-source-id: a8d0b53210f85cc24b4befdb0e90af46512fa4fb
2016-02-24 03:56:31 -08:00
Alonso Holmes 183d6a088c Adds category and alertAction properties to local notification details object
Summary:In order to use iOS notification actions with local notifications, we need to be able to specify a category string. This PR adds a category property to the `details` object used to create a local notification.

I also added support for the `alertAction` property, which is used to control the "slide to {alertAction}" text beneath the notification.

Finally, I added the doc for `userInfo` to `presentLocalNotification` (previously was only documented for `scheduleLocalNotification`.

**Test plan (required)**

I implemented the example from the [react-native-ios-notification-actions README](https://github.com/holmesal/react-native-ios-notification-actions), and created a couple of actions and grouped them under a category with identifier `something_happened`.

Prior to the changes in this PR, the shown local notification would not contain any actions.

With the changes in this PR, the shown local notification contains the specified actions.

Like so:
![demo](https://camo.githubusercontent.com/c4a86
Closes https://github.com/facebook/react-native/pull/5994

Differential Revision: D2953919

Pulled By: nicklockwood

fb-gh-sync-id: a05a9ea9ae8c150ff0714e106410e094c2747eca
shipit-source-id: a05a9ea9ae8c150ff0714e106410e094c2747eca
2016-02-19 05:19:34 -08:00
Konstantin Raev 6f1417c849 CI now builds docs website and deploys it to /%version% path
Summary:
Copy of #5760 reverted merge.

We need to preserve history of docs changes on the webserver.
The goal is to allow users to browse outdated versions of docs.
To make things simple all websites will be released to https://facebook.github.io/react-native/releases/version/XX folder when there is a branch cut.

I switched from Travis CI to Cirle CI because it works faster and I am more familiar with it.

How it works:

1. If code is pushed to `master` branch then CI will build a fresh version of docs and put it in https://github.com/facebook/react-native/tree/gh-pages/releases/next folder.
Github will serve this website from https://facebook.github.io/react-native/releases/version/next URL.
All relative URLs will work within that website

2. If code is pushed to `0.20-stable` branch then CI will build a fresh version of docs and put it in https://github.com/facebook/react-native/tree/gh-pages/releases/0.20 folder.
Github will serve this website from https://facebook.github.io/react-native/releases/v
Closes https://github.com/facebook/react-native/pull/5873

Reviewed By: svcscm

Differential Revision: D2926901

Pulled By: androidtrunkagent

fb-gh-sync-id: 16aea430bac815933d9c603f03921cc6353906f1
shipit-source-id: 16aea430bac815933d9c603f03921cc6353906f1
2016-02-11 06:17:42 -08:00
slycoder 758d9e8304 Add observers for local notifications
Summary:
This commit adds the delegate hooks so that local notifications get
passed onto the JS and adds a new event listener type for local
notifications.

Also add functions to clear local notifications
Closes https://github.com/facebook/react-native/pull/2084

Reviewed By: svcscm

Differential Revision: D2908096

Pulled By: nicklockwood

fb-gh-sync-id: 759d299ea35abea177e72934076297d666d3ea20
shipit-source-id: 759d299ea35abea177e72934076297d666d3ea20
2016-02-09 05:46:33 -08:00
Nick Lockwood cb45eaa0e8 Made Map & Set polyfills available globally
Summary:
public

Map and Set are a standard JavaScript features, but are only supported in a subset of JSC versions that we target (e.g. iOS 7's JSC doesn't support Set).

The consequence of this is that failing to require('Set') before using it won't error during testing on a modern OS, but will fail on older OS versions. This diff makes the Map and Set polyfills available globally to all RN apps to avoid that problem.

Reviewed By: davidaurelio

Differential Revision: D2833997

fb-gh-sync-id: 713d8b69f6a1bce2472a1b2e6b84f69d75f30289
2016-01-20 08:27:38 -08:00
pecheriere ac72611bb1 Add soundName config for UILocalNotification
Summary:
Current version wasn't triggering any sound when a local notification was fired. I added the possibility to provide a custom sound and fallback to the default iOS sound if not provided.
Closes https://github.com/facebook/react-native/pull/4836

Reviewed By: svcscm

Differential Revision: D2807381

Pulled By: bestander

fb-gh-sync-id: c25e8f3c30a0714a5d9558c0c1fe344d0e93321e
2016-01-07 12:01:26 -08:00
Noah Jorgenson 385fa00af8 Docs for manual linking in PushNotificationsIOS
Summary:
close #3831
Closes https://github.com/facebook/react-native/pull/5008

Reviewed By: svcscm

Differential Revision: D2794281

Pulled By: bestander

fb-gh-sync-id: 7bf367233fa562b5772fae51511b47cd29030ba2
2016-01-06 10:19:31 -08:00
Michelle Todd 1dc5dca604 Rename methods in RCTPushNotificationManager so app store doesn't warn
Summary:
Including RCTPushNotificationManager is required for local notifications, which don't require a Push Notifications entitlement on your provisioning profile. However, if you don't have the entitlement, the app store warns you when you push an app build that contains `application:didRegisterForRemoteNotificationsWithDeviceToken:`, even if it isn't being called. This renames the methods so they have different names from the ones on UIApplication so the app store doesn't warn about them.
Closes https://github.com/facebook/react-native/pull/4897

Reviewed By: spicyj

Differential Revision: D2780533

Pulled By: nicklockwood

fb-gh-sync-id: 1a688f1ebd3cc9f86ba340ce453fdbfb46949839
2016-01-05 02:43:29 -08:00
Justas Brazauskas 0e8b207cc3 Bugfix - Typos
Summary:
Fixed few typos in `./Examples` and `./Libraries` folders.
Closes https://github.com/facebook/react-native/pull/4788

Reviewed By: svcscm

Differential Revision: D2759918

Pulled By: androidtrunkagent

fb-gh-sync-id: d692b5c7f561822353e522f9d4dfde7e60b491cf
2015-12-15 09:09:32 -08:00
Nick Lockwood 060664fd3d Refactored module access to allow for lazy loading
Summary: public

The `bridge.modules` dictionary provides access to all native modules, but this API requires that every module is initialized in advance so that any module can be accessed.

This diff introduces a better API that will allow modules to be initialized lazily as they are needed, and deprecates `bridge.modules` (modules that use it will still work, but should be rewritten to use `bridge.moduleClasses` or `-[bridge moduleForName/Class:` instead.

The rules are now as follows:

* Any module that overrides `init` or `setBridge:` will be initialized on the main thread when the bridge is created
* Any module that implements `constantsToExport:` will be initialized later when the config is exported (the module itself will be initialized on a background queue, but  `constantsToExport:` will still be called on the main thread.
* All other modules will be initialized lazily when a method is first called on them.

These rules may seem slightly arcane, but they have the advantage of not violating any assumptions that may have been made by existing code - any module written under the original assumption that it would be initialized synchronously on the main thread when the bridge is created should still function exactly the same, but modules that avoid overriding `init` or `setBridge:` will now be loaded lazily.

I've rewritten most of the standard modules to take advantage of this new lazy loading, with the following results:

Out of the 65 modules included in UIExplorer:

* 16 are initialized on the main thread when the bridge is created
* A further 8 are initialized when the config is exported to JS
* The remaining 41 will be initialized lazily on-demand

Reviewed By: jspahrsummers

Differential Revision: D2677695

fb-gh-sync-id: 507ae7e9fd6b563e89292c7371767c978e928f33
2015-11-25 04:49:45 -08:00
Nick Lockwood fa0b45c58b Replaced RCTSparseArray with NSDictionary
Reviewed By: jspahrsummers

Differential Revision: D2651920

fb-gh-sync-id: 953e2ea33abfc7a3a553da95b13e9ab2bccc5a1c
2015-11-14 10:28:28 -08:00
Adam Terlson da250671e5 Add support for cancelAllLocalNotifications
Summary: Closes https://github.com/facebook/react-native/pull/2980

Reviewed By: svcscm

Differential Revision: D2550080

Pulled By: javache

fb-gh-sync-id: 76a7088f4f86191b02e6c176e4a8a7bc85f90835
2015-10-16 10:57:25 -07:00
Harry Wolff 1b94586fe6 Add documentation for making PushNotificationIOS events work,
Summary: I was just implementing push notifications for my iOS app and was very confused why the `register` event wasn't working.

[Eventually I ran across this tutorial](https://medium.com/@​DannyvanderJagt/how-to-use-push-notifications-in-react-native-41e8b14aadae) that explained that I needed to update my AppDelegate to make that event work.

I've updated the documentation to include that note within the actual file.
Closes https://github.com/facebook/react-native/pull/3390

Reviewed By: @​svcscm

Differential Revision: D2537853

Pulled By: @javache

fb-gh-sync-id: 1e8860173c38f6b2d7f9d273019f201e4cc9c0f2
2015-10-14 09:09:26 -07:00
Danny van der Jagt 200b81172e Fix for IOS 8
Summary: **Problem**
Using push notifications in IOS 8 will throw this error:
`registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later.`
The problem is that the check is running on compile instead of runtime.

**Solution**
If have changed the compile if statement to a runtime if statement. The fix is tested on: IOS 7.1 and 8.* and everything is working now.
This solution is also discussed in: https://github.com/facebook/react-native/issues/1613 and it was part of  https://github.com/facebook/react-native/pull/1979. (is being separated to keep things moving)

Please let me know what you think.Closes https://github.com/facebook/react-native/pull/2332

Reviewed By: @​svcscm

Differential Revision: D2490987

Pulled By: @ericvicenti
2015-09-30 21:02:31 -07:00
Magnus Bergman 6068c07e98 Fix dead link in PushNotificationIOS docs.
Summary: Closes https://github.com/facebook/react-native/pull/3117

Reviewed By: @​svcscm

Differential Revision: D2495539

Pulled By: @frantic
2015-09-30 15:40:27 -07:00
Yusef Napora 2f9bd1f62f App Extension support
Summary: This adds workarounds for the code that was preventing React from compiling when linked against an iOS App Extension target.

Some iOS APIs are unavailable to App Extensions, and Xcode's static analysis will catch attempts to use methods that have been flagged as unavailable.

React currently uses two APIs that are off limits to extensions: `[UIApplication sharedApplication]` and `[UIAlertView initWith ...]`.

This commit adds a helper function to `RCTUtils.[hm]` called `RCTRunningInAppExtension()`, which returns `YES` if, at runtime, it can be determined that we're running in an app extension (by checking whether the path to `[NSBundle mainBundle]` has the `"appex"` path extension).

It also adds a `RCTSharedApplication()` function, which will return `nil` if running in an App Extension. If running in an App, `RCTSharedApplication()` calls `sharedApplication` by calling `performSelector:` on the `UIApplication` class.  This passes the static analysis check, and, in my opinion, obeys the "spirit of th
Closes https://github.com/facebook/react-native/pull/1895

Reviewed By: @​svcscm

Differential Revision: D2224128

Pulled By: @nicklockwood
2015-09-22 10:46:26 -07:00
Jeff Morrison 2bbdbc704d React native fixups
Reviewed By: @gabelevi

Differential Revision: D2456130
2015-09-18 10:36:24 -07:00
Nick Lockwood 88e0bbc469 Ran Convert > To Modern Objective C Syntax 2015-08-25 01:08:49 -08:00
Nick Lockwood 8d1e02b8bd Convert alloc/init to new to please linter 2015-08-17 08:46:00 -07:00
Nick Lockwood ef5cec4f08 Text highlighting on iOS
Summary:
This diff implements highlighting of tapped text subranges for the iOS `<Text>` component, styled to match how iOS webkit views highlight links (translucent grey overlay with rounded corners).

Highlighting is enabled by default for any `<Text>` component which has an onPress handler. To disable the highlight, add `suppressHighlighting={true}` to the component props.
2015-07-24 08:41:58 -08:00
Jacob Rosenthal a8cb47e011 add local notification api schedule and present
Summary:
Add local notifications to the push library.
```
  var PushNotificationIOS = React.PushNotificationIOS;
  PushNotificationIOS.requestPermissions();

  var notification = {
    "fireDate": Date.now() + 10000,
    "alertBody":"Whats up pumpkin"
  };

  PushNotificationIOS.scheduleLocalNotification(notification);
 //lock screen or move away from app
```

Apple has another api for pushing immediately instead of scheduling, like when your background delegate has been called with some new data (bluetooth, location, etc)
```
  var PushNotificationIOS = React.PushNotificationIOS;
  PushNotificationIOS.requestPermissions();

  var notification = {
    "alertBody":"Whats up pumpkin"
  };

  PushNotificationIOS.presentLocalNotification(notification);
 //lock screen or move away from app
```

Closed https://github.com/facebook/react-native/pull/843 looks related:

See https://developer.apple.com/library/ios/documentation/iPhone/Reference/UILocalNotification_Class/ for much more available in
Closes https://github.com/facebook/react-native/pull/1616
Github Author: Jacob Rosenthal <jakerosenthal@gmail.com>
2015-07-14 09:08:30 -08:00
Shuangzuan df8287d8ee [PushNotification] Unregister for remote notifications support.
Summary:
See iOS Developer Library: [- unregisterForRemoteNotifications](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html#//apple_ref/occ/instm/UIApplication/unregisterForRemoteNotifications).

Unregister for all remote notifications received via Apple Push Notification service.

**Discussion**
You should call this method in rare circumstances only, such as when a new version of the app removes support for all types of remote notifications. Users can temporarily prevent apps from receiving remote notifications through the Notifications section of the Settings app. Apps unregistered through this method can always re-register.
Closes https://github.com/facebook/react-native/pull/1520
Github Author: Shuangzuan <shuangzuan.he@icloud.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-15 12:13:46 -08:00
Nick Lockwood 650fc9de4c Increased warning levels to -Wall -Wextra, and fixed Xcode 7 beta issues
Summary:
@public

I've increased the warning levels in the OSS frameworks, which caught a bunch of minor issues. I also fixed some new errors in Xcode 7 relating to designated initializers and TLS security.

Test Plan:
* Test the sample apps and make sure they still work.
* Run tests.
2015-06-15 07:52:50 -08:00
Tadeu Zagallo 2a7adfb815 [ReactNative] Use RCTNullIfNill and (id)kCFNull
Summary:
@public

Use consistent `null` handling:

`value || null`                ->  `RCTNullIfNil(value)`
`value == null ? nil : value`  ->  `RCTNilIfNull(value)`
`[NSNull null]`                ->  `(id)kCFNull`

Test Plan: The tests should be enough.
2015-06-12 11:03:10 -08:00
Eric Vicenti 1b9067a3e3 [ReactNative] PushNotificationIOS listener Map 2015-06-11 13:43:36 -08:00
Gabe Levi b05e99a531 [Flow] Fix or suppress react-native github errors for Flow v0.12.0 2015-06-10 13:34:19 -08:00
Nick Lockwood 5d154f1af4 Fixed deployment targets for React iOS submodules 2015-06-10 06:16:15 -08:00
Tadeu Zagallo 847dff8d75 [ReactNative] Make JavaScript executors bridge modules
Summary:
@public

This is the first of a few diffs that change the way the executors are handled
by the bridge.

For they are just promoted to modules, so they are automatically loaded by the bridge.

Test Plan:
Tested on UIExplorer, Catalyst and MAdMan.
Tested all the 3 executors, everything looks fine.
2015-06-09 15:40:55 -08:00
Andrew Imm 89a1e94a15 Add an event for remote notification registration, and improve permissions request
Summary:
In order to add Push support to the Parse JS SDK in React Native, we need a way to receive the APNS device token from the JS context. This adds another event to PushNotificationIOS, so that code can respond to a successful registration.

Additionally, I've updated the `requestPermissions` call to accept an optional map of parameters. This way, developers can request a subset of user notification types.
Closes https://github.com/facebook/react-native/pull/1304
Github Author: Andrew Imm <andrewi@fb.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-06-03 14:06:44 -08:00
Spencer Ahrens 11b515b1b0 [ReactNative] clean lint in all of Libraries/ 2015-05-19 13:47:04 -08:00
Kevin Gozali 824da1bada [ReactNative] pass in launchOptions to relevant bridged modules 2015-04-30 14:51:09 -08:00
Nick Lockwood eb0476074f Improved debug and fixed macros 2015-04-30 09:59:16 -08:00
Tadeu Zagallo d293bed5ab [ReactNative] Fix analyze errors on oss 2015-04-24 08:28:35 -08:00
Jakub Zika e293efbfb1 Bump .buckversion to 6cdb82cb7493a86c39d0f0dc3c102d0f470f55de. 2015-04-23 08:24:08 -08:00
Tadeu Zagallo 4616037428 [ReactNative] Fix push notifications on iOS7 2015-04-10 03:09:35 -08:00
Alex Akers 8a57c4e980 [React Native] RCT_EXPORT lvl.2 2015-04-08 08:34:10 -08:00
Nick Lockwood bf4868edda Added non-class-scanning-based approach fror registering js methods 2015-04-08 05:45:20 -08:00
laiso e35521300a (Xcode) Set indent=2 in all xcodeproj files.
Summary:
These are default settings now.
I saw my Xcode be configured indent=4.

![2015-03-30 12 16 11 pm](https://cloud.githubusercontent.com/assets/39830/6889697/98f8b930-d6d6-11e4-81c8-d2146855d127.png)

Closes https://github.com/facebook/react-native/pull/472
Github Author: laiso <laiso@lai.so>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-04-01 17:14:45 -08:00
Jakub Zika 011e342bbc Revert .buckversion bumps. 2015-03-26 11:02:54 -08:00
Eric Vicenti 7e02a1e111 [ReactNative] PushNotificationIOS documentation 2015-03-26 10:01:12 -08:00
Tadeu Zagallo 20291a02df [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
Tadeu Zagallo 8679c0bc96 [ReactNative] Add deep linking api 2015-03-25 19:01:08 -08:00
Nick Lockwood 94db4facf5 Unfork UIManager 2015-03-24 17:24:51 -08:00
Tadeu Zagallo fe0527a7c4 [ReactNative] Remove auto permission request from setAppIconBadgeNumber 2015-03-24 10:33:46 -08:00
Jakub Zika 20a0bea197 Fix build - remove relative import path 2015-03-24 06:07:47 -08:00
Tadeu Zagallo 8ae0eacf17 [ReactNative] Open Source PushNotifications and move Badge Number methods and permission into it 2015-03-24 04:31:34 -08:00