Commit Graph

564 Commits

Author SHA1 Message Date
Michael Diarmid 321e4a2909
Merge pull request #1058 from dgruseck/master
[Android] Add the ability to remove notifications based on the tag
2018-07-20 11:35:08 +01:00
Salakar 6a7d3ddc7a [types][iid] getToken & deleteToken now have option args with defaults that use `app.options.messagingSenderId` as authorizedEntity and '*' as scope 2018-07-15 00:44:20 +01:00
Salakar aa12de3248 [js][iid] getToken & deleteToken now have option args with defaults that use `app.options.messagingSenderId` as authorizedEntity and '*' as scope 2018-07-15 00:43:12 +01:00
David Gruseck 7f0d4ac10e merge master 2018-07-13 09:29:10 +02:00
David Gruseck 8b81e74f50 move removeDeliveredNotificationsByTag to android specific file 2018-07-13 09:22:38 +02:00
Salakar 2e2913114a revert #869 to fix #1292 temporarily 2018-07-11 08:21:02 +01:00
Salakar 16a7e192f7 [types][flow] fix NativeDocumentChange.type -> should be enum to match other usage 2018-07-10 22:45:26 +01:00
Salakar c35011145b [types][flow] add missing GetOptions type import 2018-07-10 22:44:27 +01:00
Salakar c023a001a4 [types][flow] fix _forceResending type 2018-07-10 22:43:34 +01:00
Salakar 5e9909954a [internals] check for string type else return early 2018-07-10 21:37:17 +01:00
Salakar 3668f15244 [android][auth] add support for `ForceResendingToken`, closes #721 2018-07-08 16:31:41 +01:00
Salakar 03dfbbdd47 [android][auth] add support for `ForceResendingToken`, closes #721 2018-07-08 16:22:16 +01:00
Salakar 9d90a99fb0 [storage][js][android] make paths consistent - without trailing slashes in `firebase.storage.Native.X` #1200 2018-07-07 03:32:57 +01:00
Salakar a8719338c0 [js][internals] cleanup old utils + add stripTrailingSlash util 2018-07-07 03:31:26 +01:00
Salakar 259f8f8d1b [storage][js] automatically attempt to call `decodeURI` on `putFile` paths 2018-07-07 02:30:23 +01:00
Chris Bianca a79bf81418 [firestore] Add support for `GetOptions` #1248 2018-07-03 16:03:43 +01:00
Michael Diarmid 43615ffcf6
Merge pull request #869 from ovaris/master
Flow type: Modifies db Reference push() to return ThenableReference
2018-07-01 17:36:41 +01:00
Chris Bianca c4a11fa629 [config][types] Remove duplicate 2018-06-19 08:06:42 +01:00
Chris Bianca 3b3d013656 [config][types] Tweak types for remote config 2018-06-19 07:15:51 +01:00
Ken Lim 1a1c91d5db Add type definition for RemoteConfig module 2018-06-19 12:08:30 +08:00
Case Taintor 96783d46eb adds getToken(string,string) and deleteToken(string,string) to typings 2018-06-18 15:59:21 +02:00
Case Taintor 3652a05848 adds support for getToken(string,string) and deleteToken(string,string) to iid 2018-06-17 20:32:38 +02:00
Chris Bianca 9e549d60b1 [firestore][typings] Add better type for DocumentChange.type #1180 2018-06-17 16:35:02 +01:00
Chris Bianca ab3557378e
Merge pull request #1220 from aMarCruz/importance-none
Closes #1213 : Incorrect definition of Android.Importance.None
2018-06-17 16:12:36 +01:00
Chris Bianca 00731cf10e Fix eslint error 2018-06-17 16:10:25 +01:00
Chris Bianca 8ee6e667e3
Merge pull request #1219 from aMarCruz/set-visibility
Closes #1216 : AndroidNotification.setVisibility does not exists
2018-06-17 16:09:01 +01:00
Chris Bianca cb05d63236 [auth] Update typings as per #1185 2018-06-17 16:07:23 +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
aMarCruz c3c4c48ce1 Closes #1213 : Incorrect definition of Android.Importance.None 2018-06-16 15:20:18 -05:00
aMarCruz 962880518e Closes #1216 : firebase.notifications.AndroidNotification.setVisibility does not exists 2018-06-16 14:56:55 -05: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
Salakar 59b406e8ed [js][auth] add signInWithEmailLink method + tweak isSignInWithEmailLink 2018-05-13 00:09:00 +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 cf25ba23e5 [both][auth] Deprecated firebase.auth().fetchProvidersForEmail in favor of firebase.auth().fetchSignInMethodsForEmail() 2018-05-12 22:51:42 +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
David Gruseck 89806d97f7 [Android] Add the ability to remove notifications based on the tag 2018-05-07 17:35:10 +02:00
Salakar d26f7a17ad [js][functions] misc HttpsError 2018-05-06 13:50:39 +01:00
Salakar e5233c9af3 Merge branch 'master' of https://github.com/invertase/react-native-firebase into functions 2018-05-06 00:55:37 +01:00
Salakar d06fbec40a [js][functions] finalise + cleanup 2018-05-06 00:50:09 +01:00
Salakar 30f23316c4 [core] add functions module to core + types 2018-05-05 19:25:52 +01:00
Salakar 368b3ad068 [functions][android][js] implementation - wip 2018-05-04 16:33:59 +01:00