47 Commits
Author SHA1 Message Date
Mertcan MermerkayaandGitHub 3ee0fff1e5 Use yarn install --frozen-lockfile in CI (#1676) 2019-04-17 22:27:34 +01:00
Mertcan MermerkayaandGitHub 178a54122f Run yarn (#1675)
Looks like `yarn.lock` wasn't updated properly.
2019-04-09 18:42:41 +01:00
Mertcan MermerkayaandGitHub be0b16536a Delete Hash base class in util (#1657)
Removes the Hash base class that is only used in Sha1 in @firebase/util. It only has a single property and only one class extends from it, so I think it's fair to say that it's not very useful.

The actual reason of me doing this is that Rollup doesn't realize that extended classes that are transpiled to ES5 don't have side effects. Without this change, any package using Rollup that imports anything from @firebase/util (like FirebaseError or ErrorFactory) will also get Sha1 and Hash classes included in their bundle. I suspect that Webpack does something similar but I haven't checked.

After this change, using Rollup, an iife build of a package that only exports ErrorFactory and FirebaseError from @firebase/util went from 1478 bytes to 544 bytes (minified + gzipped).
2019-04-03 21:39:50 +01:00
Mertcan MermerkayaandGitHub ebd64c4b6a Remove "noImplicitAny: false" from the base TSConfig (#1653)
This option is `false` by default, so there is no need to set it to `false` explicitly.

Also because of this, when a package enables the `strict` option, they also need to enable `noImplicitAny` explicitly, even though it is already a part of the `strict` option.
2019-04-02 18:10:12 +01:00
Mertcan MermerkayaandGitHub 535f59bfc8 Improve AppError typings (#1645) 2019-03-28 19:00:30 +00:00
Mertcan MermerkayaandGitHub 2e0b79889d Use a const enum for ErrorCode (#1646) 2019-03-28 18:41:41 +00:00
Mertcan MermerkayaandGitHub f033ccfd92 Fix FCM in Chrome Extensions (#1597)
Prevents sending messages to Chrome Extension background pages, which are always considered visible in Chrome. That causes our SDK try to send the message to the background page and to not show the notification.

I'll also investigate if background page being considered a visible client is a bug in Chrome itself, and try to get it fixed if I can. But for now this seems like a good workaround.
2019-03-12 17:10:20 +00:00
Mertcan MermerkayaandFeiyang 6462331a16 Remove unused Rollup plugins (#699)
* Remove unused Rollup plugins

* Consider submodule imports from dependencies as external

* Use CJS version of promise-polyfill for browserify support
2019-01-03 15:24:42 -08:00
Mertcan MermerkayaandJosh Crowther dca97c5ac7 Add "browser version" to issue template (#925) 2018-06-20 07:35:08 -07:00
Mertcan MermerkayaandGitHub 2645744242 Add FcmOptions interface and link property (#942) 2018-06-18 19:14:55 +01:00
Mertcan MermerkayaandGitHub e897b47b66 Remove Alec from Messaging owners (#893) 2018-06-01 16:06:40 +01:00
Mertcan MermerkayaandGitHub 4f75ac7635 Check if cookies are enabled (#886)
Messaging needs cookies to be enabled.
2018-05-31 16:06:13 +01:00
Mertcan MermerkayaandGitHub 5758ce5d19 Use isArrayBufferEqual to compare VAPID keys (#862)
* Use isArrayBufferEqual to compare VAPID keys

Fixes #860.

* Create a new VAPID key object instead of using the imported object in tests.

This should be close enough to storing and retrieving it from IndexedDB and should prevent === comparison from working.
2018-05-23 18:22:55 +01:00
Mertcan MermerkayaandJosh Crowther 653f496ae1 Update import statements in documentation (#832)
Prevents issues like #820.
2018-05-16 14:59:09 -07:00
Mertcan MermerkayaandGitHub 30c94fd1f5 Rename ControllerInterface, which is a class, to BaseController (#817) 2018-05-15 20:06:13 +01:00
Mertcan MermerkayaandGitHub 9dd79f40c3 Fix messaging being optional and isSupported type definitions (#793)
Fixes firebase.messaging() method being optional in TS types.

Modifies isSupported so it is a namespace export and not a property on the factory function, which is not actually exported.
2018-05-15 18:23:50 +01:00
Mertcan MermerkayaandJosh Crowther 2bee8cb6e6 Update grpc to 1.11.3 (#785)
* Update grpc to 1.11.3

* [AUTOMATED]: Prettier Code Styling
2018-05-11 12:04:44 -06:00
Mertcan MermerkayaandGitHub 897606efc8 Fix variable and class names (#802)
* Fix variable and class names

Fixes abbreviations in variable and class names to match Google TypeScript style guide, which follows the Java style guide: https://google.github.io/styleguide/javaguide.html#s5.3-camel-case

Also changes some variable names in tests.

* [AUTOMATED]: Prettier Code Styling
2018-05-10 17:12:55 +01:00
Mertcan MermerkayaandGitHub 5143fc2d77 Refactoring Messaging (#730)
* Some more async/await

* Remove deprecated callback API

* Make manifestCheck a function
2018-05-09 18:48:41 +01:00
Mertcan MermerkayaandGitHub e84dfeb9d9 Refresh token instead of breaking if VAPID key doesn't exist (#794) 2018-05-09 16:50:32 +01:00
Mertcan MermerkayaandJosh Crowther f5e06de3d9 Add tests for *-types packages (#789) 2018-05-08 13:48:40 -06:00
Mertcan MermerkayaandJosh Crowther 408e8dd326 Update Observer and Messaging types to match internal types (#786)
* Fix Observer and Messaging types

* [AUTOMATED]: Prettier Code Styling

* Add second generic with Error as default
2018-05-08 12:52:43 -06:00
Mertcan MermerkayaandGitHub 22c30dc18c Combine Observer and PartialObserver types (#770)
* Combine Observer and PartialObserver types

Uses Partial from TS to create a PartialObserver from Observer.

* Fix Observer types in messaging

* Fix Observer types in app-types

* [AUTOMATED]: Prettier Code Styling
2018-05-08 14:29:18 +01:00
Mertcan MermerkayaandGitHub c5805304b3 Add types for messaging.isSupported() (#769)
* Add types for messaging.isSupported()

* Change messaging type in app
2018-05-07 20:17:28 +01:00
Mertcan MermerkayaandGitHub 885d51f9dc Enable Messaging tests on Sauce Labs (#773)
* Enable messaging tests on multi-browsers.

* optional: add karma-safari-launcher

* Modify messaging tests to be enabled on Safari.

* Fix issues

* Skip maxAction test on browsers that do not support actions
2018-05-05 00:33:01 +01:00
Mertcan MermerkayaandGitHub c1816292b5 Check browser support before instantiating controllers (#700)
* Check browser support before instantiating controllers

Prevents issues such as #658 by making sure we don't call any unsupported methods by accident.

Also adds some tests for index.ts.

* Skip tests on unsupported browsers

* Ignore 'unsupported-browser' errors in namespace validation

* Check browser support within SW

* Implement isSupported static method

* [AUTOMATED]: Prettier Code Styling
2018-05-03 10:10:49 +01:00
Mertcan MermerkayaandGitHub 2c2243d375 Fix Edge not setting default transaction mode (#762) 2018-05-02 16:40:04 +01:00
Mertcan MermerkayaandGitHub b22964e5f5 Don't overwrite user defined data (#760)
This operation was safe when we didn't allow users to define "data" on their notification. Not anymore.
2018-05-02 13:36:22 +01:00
Mertcan MermerkayaandGitHub 988c9c4985 Add a warning for notifications with too many actions (#731) 2018-04-30 17:39:18 +01:00
Mertcan MermerkayaandGitHub cfb9ca0d7a Do nothing for action clicks (#702)
* Do nothing for action clicks

* [AUTOMATED]: Prettier Code Styling

* Address comment
2018-04-25 12:48:01 +01:00
Mertcan MermerkayaandJosh Crowther 18a9ec4a18 Update grpc to version 1.10.1 (#694)
* Update grpc in firestore

Fixes #515

* Fix tests

Not sure how, but updating grpc made the test start using [email protected], which has some extra properties (https://github.com/dcodeIO/long.js/commit/bc96a70758cf1e431af6956e56d70dd181943162) that broke the deep equals check.

In any case, all dependencies that are referenced should be added to package.json explicitly. I added the relevant tslint rules and also added other missing deps.

* Revert TSLint changes
2018-04-19 14:32:35 -07:00
Mertcan MermerkayaandGitHub 2a22fceedc Lint rules, refactoring and better types (#684)
* Enable TSLint rule "no-any" in src/

* Enable noImplicitAny

* Use the same ErrorFactory object in all of messaging

* Enable TSLint variable-name rule

* Move all testing utils to testing-utils/

* Async/await fixes

* Enable TSLint no-redundant-jsdoc rule

* Use any instead of ts-ignore

* Remove any types from messaging-types

* Add better types for Message Payload

* Remove another any
2018-04-18 11:25:36 +01:00
Mertcan MermerkayaandGitHub 2af5040d4d Add types for Service Worker Controller (#673) 2018-04-12 22:29:55 +01:00
Mertcan MermerkayaandGitHub 524031e077 Upgrade dependencies (#676)
* Run yarn upgrade

* [AUTOMATED]: Prettier Code Styling

* Remove unused dependencies, add mocha in messaging/

* Update @types/mocha

* Remove version ranges from package.json files

* Update most dependencies to their latest versions

* Save exact dependency versions by default

* Revert firestore grpc update
2018-04-12 21:46:35 +01:00
Mertcan MermerkayaandGitHub 8128d65f8c Enable noUnusedLocals in TS compiler options (#672)
* Enable noUnusedLocals in TS compiler options

* [AUTOMATED]: Prettier Code Styling
2018-04-11 19:04:26 +01:00
Mertcan MermerkayaandJosh Crowther 8451e1f11f Use core-js for polyfills (#671)
* Use core-js for polyfills

* Remove DOM polyfill, it's not used

* Only polyfill parts of ES2015 we currently use
2018-04-11 09:39:37 -07:00
Mertcan MermerkayaandGitHub bf57fe9b66 Async/await refactor and test fixes (#660)
* Add async/await to SWController and tests

* Combine IID Model tests and remove duplicated code

* Delete empty test

* Replace Promise calls with async

* [AUTOMATED]: Prettier Code Styling
2018-04-11 15:03:11 +01:00
Mertcan MermerkayaandJosh Crowther 87eb653146 Remove redundant lib declarations (#663)
es2015 includes es5 and es2015.promise

https://github.com/Microsoft/TypeScript/blob/master/lib/lib.es2015.d.ts
2018-04-10 16:54:44 -07:00
Mertcan MermerkayaandGitHub a4359a508d Replace "any" types (#661) 2018-04-10 22:51:30 +01:00
Mertcan MermerkayaandGitHub 14896fb83b Fix TokenDetails in messaging/ (#649)
Makes sure that we use only one type of TokenDetails object, both in the code and in the database.

Updates DB and adds a function to fix the old values.

Fixes and adds tests.
2018-04-10 19:25:19 +01:00
Mertcan MermerkayaandGitHub 9e73645290 Re-enable --strict flag in messaging/ (#643)
* Reenable --strict in messaging/

* Revert "Remove some assertions that are no longer needed as --strict is disabled"

This reverts commit 6ea7e54640ea3c19942a1881a3f738d89b51dafe.

* Fix strict issues in messaging/

* Fix type errors in app/

* Fix errors

* Fix errors
2018-04-07 11:40:34 +01:00
Mertcan MermerkayaandGitHub 52aa813f55 Refactor IndexedDb operations (#645)
* Refactor IndexedDb operations

Simplifies a lot of IndexedDb operations and removes most of the duplicated code. Also refactors tests.

* [AUTOMATED]: Prettier Code Styling

* [AUTOMATED]: License Headers

* Fix failing tests

* Address comments

* Address comments
2018-04-06 19:34:38 +01:00
Mertcan MermerkayaandGitHub 25d32da6e6 Add typedef TSLint rule (#644)
* Add typedef TSLint rule

Requires type definitions for function parameters and signatures, and class/interface member variables.

* Fix errors
2018-04-06 17:22:30 +01:00
Mertcan MermerkayaandGitHub e5bd5fe130 Add TSLint and (mostly uncontroversial) rules (#641)
* Add TSLint and (mostly uncontroversial) rules

Fixed lint errors. Added running TSLint to the test command in package.json.

* Remove some assertions that are no longer needed as --strict is disabled

* [AUTOMATED]: Prettier Code Styling

* Add a few more rules from Google TS style that are already passing

* Fix tests
2018-04-06 13:46:01 +01:00
Mertcan MermerkayaandGitHub f6d5504196 Add types (#637)
* Add types to @firebase/messaging

This makes src/ compatible with --noImplicitAny. test/ still needs work.

* [AUTOMATED]: License Headers

* Remove casts
2018-04-05 22:14:35 +01:00
Mertcan Mermerkayaandpinarx 6aa5672375 Add --strict flag to TSConfig and fix errors (#629)
* Add --strict flag to TSConfig and fix resulting errors

This doesn't really fix anything, but explicit "any"s are still better than implicit "any"s.

* Remove unnecessary 'use strict's

* Add a type-check command and run it as part of tests

* [AUTOMATED]: Prettier Code Styling
2018-04-04 19:10:22 +01:00
Mertcan Mermerkayaandpinarx f090ce417a Refactor default exports into named exports (#622)
Following Google TS best practices.
2018-04-04 11:07:03 +01:00