Commit Graph

44 Commits

Author SHA1 Message Date
Case Taintor 96783d46eb adds getToken(string,string) and deleteToken(string,string) to typings 2018-06-18 15:59:21 +02:00
Chris Bianca 9e549d60b1 [firestore][typings] Add better type for DocumentChange.type #1180 2018-06-17 16:35:02 +01:00
Chris Bianca 34545f1b6e
Merge pull request #1185 from sowdri/pr/phone-auth-listener-typings
Updated typings for PhoneAuthListener
2018-06-17 16:06:19 +01:00
Chris Bianca dae0645006 [android] Update to latest version of android libs; Fix compilation issues 2018-06-17 15:59:47 +01:00
sowdri 5b3d9f97f7 Updated typings for PhoneAuthListener 2018-06-07 11:15:44 +09:30
Chris Bianca 88b1cad8c4 [android][notifications] Change actions `runInBackground` to use `showUserInterface` instead 2018-05-18 08:26:16 +01:00
Dariusz Luksza 17f7f39dac Implement handling of Android actions in background
There are some cases when local notification action should be handled in
background eg. snoozing the reminder. In case of it launching app UI is
not necessary and would be confusing for the end user.

Therefore there should be a way to handle local notification action in
background.

For this reason new property 'runInBackground' was added to the
AndroidAction class and TypeScript type.

Also new broadcast receiver and service were implemented to handle
properly background actions.

In order to run particular action in background API consumer need to set its
'runInBackground' property to 'true', eg:

  ...
  .android.addAction(new firebase.notifications.Android.Action("snooze",
  "ic_snooze", "Snooze").setRunInBackground(true))
  ...

Then, there are two cases that API consumer needs to handle.

First when app is in the foreground, standard notification and
notification action code path will be executed. This mean, that:
 * onNotification() listener will be called (which should call
 displayNotification(), in order to show it to the user),
 * onNotificationOpen() listener will be called after the action is
 tapped by the user

Secondly, when application is in background or it is not running new
'RNFirebaseBackgroundNotificationAction' handler will be called. To
properly handle this case API consumer should create a background
asynchronous handler:

  const handleAsyncTask = async (notificationOpen: NotifficationOpen) => {
    if (notificationOpen && notificationOpen.notification) {
      const action = notificationOpen.action;
      const notificationId = notificationOpen.notification.notificationId;
      if (action === "snooze") {
        console.log("Reschedule notification for later time", notificationId);
      } else {
        console.log("unsupported action", action);
      }
      // hide the notification
      firebase.notifications().removeDeliveredNotification(notificationId);
    }
  }

Next hander should be registered to headless handler:

  AppRegistry.registerHeadlessTask('RNFirebaseBackgroundNotificationAction', () => handleAsyncTask);

Finally AndroidManifest.xml file must be modified, to include receiver
and service definition:

  <receiver
      android:name="io.invertase.firebase.notifications.RNFirebaseBackgroundNotificationActionReceiver"
      android:exported="true">
    <intent-filter>
      <action android:name="io.invertase.firebase.notifications.BackgroundAction"/>
    </intent-filter>
  </receiver>
  <service android:name="io.invertase.firebase.notifications.RNFirebaseBackgroundNotificationActionsService"/>

Now when ever 'Snooze' action is pressed it will launch
'handleAsyncTask' function in the background or onNotificationOpen()
when app is in foreground. And reschedule the notification
for the later time.
2018-05-16 08:20:24 +02:00
Dariusz Luksza 57901cd29a Add Android API to delete channel and channel group 2018-05-14 09:24:44 +02:00
Salakar 93d4d7d674 [types][auth] add sendSignInLinkToEmail, signInWithEmailLink & isSignInWithEmailLink types and update EmailAuthProvider types 2018-05-13 00:48:57 +01:00
Chris Bianca 25506479d3 [firestore][android] Add support for firestore v16 2018-05-08 15:36:49 +01:00
Salakar ef33a7cb2a [ts][typings][functions] add type defs 2018-05-07 19:49:34 +01:00
Chris Bianca ff41a45fdd [firestore][types] Add Typescript types for Blob 2018-05-04 16:30:32 +01:00
Adam Michel ea8e106129
Use union type for `fieldPath` option to query `orderBy` and `where` functions.
Constructing and passing a FieldPath object to the `orderBy` or `where` functions of a Firestore query currently raises a type error since those functions are only typed to expect a `string` value. This fixes that since those functions do accept FieldPath object types as well as astrings.
2018-04-24 12:46:23 -07:00
Chris Bianca c275e02fcc [types] Fix typescript issues 2018-04-16 08:14:30 +01:00
Chris Bianca b0abf23c6d [firestore] Add support for settings 2018-04-13 09:58:53 +01:00
Chris Bianca 1922a25198 [firestore] Add setLogLevel support 2018-04-13 08:41:57 +01:00
Chris Bianca c27918c53c [types] Add missing constructors 2018-04-13 08:41:57 +01:00
Chris Bianca 590d69ce89 [types] Add missing typescript statics for messaging, notifications and links 2018-04-12 08:50:13 +01:00
Michele Bombardi 3d80395c82 typings 2018-04-08 11:46:41 +02:00
Chris Bianca b21e7d0eab [crashlytics] Move to top level crashlytics namespace 2018-04-03 16:51:05 +01:00
Chris Bianca cf24a7dcc8 [types] Add TypeScript typings for firestore transactions 2018-03-28 16:00:58 +01:00
Chris Bianca dd940b953b [firestore] Add support for enable / disable network 2018-03-27 17:31:25 +01:00
Chris Bianca 1ea711fb31 [types] Some basic typescript stuff for new messaging, notifications and links rewrite 2018-03-23 17:31:25 +00:00
Ifiok Jr b06d68e39e
fix: types for request permission
Currently returns void rather than a promise which causes TypeScript compilation to fail.
2018-03-23 06:32:32 +00:00
Chris Bianca 2891027f25 [tests] Fix some configuration issues 2018-03-22 14:55:02 +00:00
Chris Bianca 8060c949a2 [typings] Add a few missing app, auth and firestore Typescript typings 2018-01-31 09:09:12 +00:00
chrisbianca c8195088db
Merge branch 'master' into master 2018-01-30 11:10:15 +00:00
Paul Huynh 90195769fd Fix implicit 'any' and incorrect placement of optional boolean in getIdToken 2018-01-30 21:15:09 +11:00
Paul Huynh 7f394b56e5 Remove implicit 'any' type on QuerySnapshot.forEach() 2018-01-30 10:44:57 +11:00
pheromonez 157f0109cd
Merge branch 'master' into typescript-definitions-static-module-fix 2018-01-30 10:07:07 +11:00
chrisbianca a81ea85c0d
Merge pull request #771 from pheromonez/master
Add Typescript Definitions for Cloud Firestore
2018-01-29 16:03:15 +00:00
Paul Huynh 80be7474ff Address typing issues:
- Remove constructors intended to be private, and convert classes to
interfaces
- Allow 'false' for QueryListenOptions and DocumentListenOptions
properites
2018-01-29 20:55:18 +11:00
Paul Huynh 2bd4a667a9 Fix TS definitions so modules can be accessed from the default export 2018-01-29 16:14:13 +11:00
Daniel Waller 42fe8ddd65 [typings][typescript] fix tsc errors 2018-01-26 17:39:52 +01:00
Daniel Waller 1770181058 [typings][typescript]: fix stupid typo I introduced with my last PR that breaks tsc compilation 2018-01-26 13:34:06 +01:00
Paul Huynh 578198e2e6 Add Typescript Definitions for Cloud Firestore 2018-01-22 23:25:54 +11:00
Daniel W 2611f7c8e3 [typings][typescript] update typings for the auth module 2018-01-18 17:05:44 +01:00
Michael Diarmid c14d9292b0
Merge pull request #655 from invertase/auth-language
Set auth language #654
2018-01-17 15:23:41 +00:00
Paul Huynh edc12487f5 Add Typescript definitions for Dynamic Links 2018-01-16 22:34:26 +11:00
Elliot Hesp 9ea0a5cc7f [auth] Move useDeviceLanguage to unsupported method 2018-01-06 15:14:11 +00:00
Elliot Hesp 9d47709ffa Merge with master 2018-01-06 14:47:11 +00:00
Krystof Celba a80748bfbf [typings][typescript] Add missing types for Crashlytics 2018-01-04 03:39:10 +01:00
Elliot Hesp 7cfcb4efa0 [auth] Update typescript 2017-11-30 12:56:28 +00:00
Chris Bianca fbe73f5dcb [types] Get types properly exporting as part of the build 2017-11-17 16:17:27 +00:00