Commit Graph

1880 Commits

Author SHA1 Message Date
Chris Bianca 34c0878098 [auth] Support email link in checkActionCode 2018-05-16 12:41:48 +01:00
Chris Bianca 35474462c6 [ios][firestore] Ensure that firestore uses the separate dispatch queue for callbacks 2018-05-16 12:11:55 +01:00
Chris Bianca 640d7aa7ae
Merge pull request #1074 from dluksza/android-notification-action-background-handler
Implement handling of Android actions in background
2018-05-16 10:39:18 +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
Chris Bianca fa9bac1a72 [ios] Set separate dispatch queues for firestore and database 2018-05-15 10:02:18 +01:00
Chris Bianca 54f41565db [misc] Update pods for tests and bridge 2018-05-15 10:01:52 +01:00
Michael Diarmid 7fb3e1464e
Merge pull request #1088 from pranjal-jain/fix-cancel-notification
[Android] [Notifications] Fix cancel notification promise
2018-05-15 00:23:26 +01:00
Pranjal Jain 4efb0c4dcf fix(notifications): Resolve promise on after notification is cancelled 2018-05-15 01:57:03 +05:30
Chris Bianca e68118e049
Merge pull request #1080 from dluksza/android-delete-channel
Add Android API to delete channel and channel group
2018-05-14 11:02:15 +01:00
Dariusz Luksza 57901cd29a Add Android API to delete channel and channel group 2018-05-14 09:24:44 +02:00
Salakar bcd655d765 Merge remote-tracking branch 'origin/master' 2018-05-13 18:31:37 +01:00
Salakar 061a60a106 [tests][storage] migrate and re-write legacy tests 2018-05-13 18:30:04 +01:00
Salakar 9112d4beff [tests][helpers] add Promise.defer() helper 2018-05-13 18:29:34 +01:00
Michael Diarmid 25c8677076
Update README.md 2018-05-13 08:59:54 +01:00
Salakar 6356360210 [tests][android] misc build 2018-05-13 01:36:02 +01:00
Salakar 0262bdfa0b [android] update package rnpm config to use `implementation` 2018-05-13 01:35:44 +01:00
Salakar 187c756550 [tests][auth] isSignInWithEmailLink tests 2018-05-13 01:00:30 +01:00
Salakar 93d4d7d674 [types][auth] add sendSignInLinkToEmail, signInWithEmailLink & isSignInWithEmailLink types and update EmailAuthProvider types 2018-05-13 00:48:57 +01:00
Salakar 98fb88a882 [tests][auth] misc email auth tests 2018-05-13 00:37:47 +01:00
Salakar d0ae75d531 [ios][auth] add signInWithEmailLink native method 2018-05-13 00:37:19 +01:00
Salakar 4a6f12ec59 [android][auth] add signInWithEmailLink native method 2018-05-13 00:36:22 +01:00
Salakar 59b406e8ed [js][auth] add signInWithEmailLink method + tweak isSignInWithEmailLink 2018-05-13 00:09:00 +01:00
Salakar 3cba1c4e62 [tests][auth] add tests for new EmailAuthProvider properties & methods 2018-05-12 23:36:57 +01:00
Salakar 1240e6cd93 [js][auth] update firebase.auth.EmailAuthProvider to support link credentials 2018-05-12 23:33:16 +01:00
Salakar b98276c2a5 [js][auth] add isSignInWithEmailLink method 2018-05-12 23:27:05 +01:00
Salakar 56ffaac06b [js][auth] add sendSignInLinkToEmail method 2018-05-12 23:21:39 +01:00
Salakar de33d97be9 [ios][auth] add sendSignInLinkToEmail native method 2018-05-12 23:14:06 +01:00
Salakar 15992f3ba9 [android][auth] add sendSignInLinkToEmail native method 2018-05-12 23:13:54 +01:00
Salakar 45bea847b4 [ios][auth] add `emailLink` support for internal getCredentialForProvider util 2018-05-12 22:58:47 +01:00
Salakar f81e50ccb8 [android][auth] add `emailLink` support for internal getCredentialForProvider util 2018-05-12 22:58:35 +01:00
Salakar cf25ba23e5 [both][auth] Deprecated firebase.auth().fetchProvidersForEmail in favor of firebase.auth().fetchSignInMethodsForEmail() 2018-05-12 22:51:42 +01:00
Salakar efc73163a5 [auth][android] import cleanup 2018-05-12 22:16:20 +01:00
Salakar a064d7dd2a [auth][android] update getJSError to handle 'INVALID_IDENTIFIER' - return from fetchSignInMethodsForEmail for example if email is invalid (not a standard auth exception, it's a grpc one it seems) 2018-05-12 22:15:23 +01:00
Salakar c185b3b060 [auth][android] update getJSError util regex to allow extracting codes from http errors - fixes #934 2018-05-12 22:11:50 +01:00
Salakar f13a2b5f9c [auth][android] replace deprecated task fetchProvidersForEmail with fetchSignInMethodsForEmail task + misc linting and legacy utils cleanup 2018-05-12 22:08:11 +01:00
Salakar e45db1a465 [tests][android] update to latest dependencies + fix build issues 2018-05-12 21:16:40 +01:00
Chris Bianca 6848044f13
Merge pull request #1073 from dluksza/notification-schedule-classcastexception
Fix ClassCastException while parsing fireDate
2018-05-11 14:26:46 +01:00
Dariusz Luksza dbc5a2d54e Fix ClassCastException while parsing fireDate
ClassCastException was thrown on Android 8.1 while trying to schedule
local notification. Use try-catch approach instead of relaying on the
default parse value.
2018-05-11 14:26:58 +02:00
Chris Bianca 13dd662903
Merge pull request #1072 from arnabkund/master
[Android] Fix a bug with Android Invites invitationMap email keys
2018-05-11 10:46:57 +01:00
arnabkund 175c579da3 [Android] Fix a bug with Android Invites invitationMap email keys 2018-05-11 15:03:01 +05:30
Chris Bianca f3806da600 4.1.0 2018-05-08 15:52:18 +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
Salakar 6040136a15 [js][functions] move errorOrResult fn outside class 2018-05-07 19:32:20 +01:00
Michael Diarmid 051ae10ad1
Update package.json 2018-05-07 19:28:01 +01:00
Michael Diarmid 19b226b048
Merge pull request #1056 from invertase/functions
Functions Implementation
2018-05-06 15:50:12 +01:00
Salakar c5df065956 [ios][functions] finalise implementation 2018-05-06 15:36:03 +01:00
Salakar d0198d98b8 [tests][ios] add Firebase/Functions to pods 2018-05-06 15:35:12 +01:00
Salakar 7d5fa69baf [ios][functions] start of implementation 2018-05-06 14:21:38 +01:00
Salakar 263df53dcf [tests][functions] added HttpsError tests 2018-05-06 13:52:56 +01:00