Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improve installation object Parse.Installation.currentInstallation to support web push notifications #2119

Merged
merged 4 commits into from
May 4, 2024

Conversation

dplewis
Copy link
Member

@dplewis dplewis commented May 3, 2024

Pull Request

Issue

Other Parse SDKs (Swift/Kotlin, etc) supports the Installation object to handle push notifications etc. There seems in the JS SDK there is just a minimal implementation.

Closes: #2112

Approach

  • Improve existing Parse.Installation objects
  • Add retrieving the current installation
  • Improve documentation
  • Add ability to override the installationController with custom controller
  • Convert installation to TS
const installation = await Parse.Installation.currentInstallation();
installation.set('deviceToken', '123');
installation.set('deviceType', 'web');
installation.set('user', Parse.User.current());
await installation.save();

Tasks

  • Add tests
  • Add changes to documentation (guides, repository pages, code comments)

Copy link

Thanks for opening this pull request!

@dplewis dplewis requested a review from a team May 3, 2024 03:05
Copy link

codecov bot commented May 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (72bc9ac) to head (3803596).
Report is 21 commits behind head on alpha.

Additional details and impacted files
@@             Coverage Diff             @@
##            alpha     #2119      +/-   ##
===========================================
+ Coverage   99.98%   100.00%   +0.01%     
===========================================
  Files          61        64       +3     
  Lines        6185      6275      +90     
  Branches     1499      1508       +9     
===========================================
+ Hits         6184      6275      +91     
+ Misses          1         0       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dplewis dplewis requested a review from mtrezza May 3, 2024 21:01
@mtrezza mtrezza changed the title feat: Add Parse.Installation.currentInstallation feat: Improve installation object Parse.Installation.currentInstallation to support web push notifications May 4, 2024
@mtrezza mtrezza merged commit 4fc62ce into parse-community:alpha May 4, 2024
9 of 10 checks passed
parseplatformorg pushed a commit that referenced this pull request May 4, 2024
# [5.1.0-alpha.9](5.1.0-alpha.8...5.1.0-alpha.9) (2024-05-04)

### Features

* Improve installation object `Parse.Installation.currentInstallation` to support web push notifications ([#2119](#2119)) ([4fc62ce](4fc62ce))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.1.0-alpha.9

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label May 4, 2024
@mortenmo
Copy link
Contributor

mortenmo commented May 8, 2024

@dplewis This might be a general problem and not related to this PR/Web, but I accidentally deleted an installation in the database and it gets into a state where nothing works and it doesn't seem to be a way to get out of it.

The InstallationController never checks for server changes to object, so save() just fails since the local object has an id. And beyond cleaning the cache keys manually out of storage, there is no way to reset the installation locally.

Rest seems to work great though! and this is an edge case for sure. I just cleaned up the wrong things.

@dplewis
Copy link
Member Author

dplewis commented May 10, 2024

@mortenmo That seems to be a problem. I was looking at the iOS SDK and this SDK should match it closely.

Installations cannot be deleted

We always want [currentInstallation save] to succeed.

@dplewis dplewis deleted the installation-support branch May 10, 2024 15:41
parseplatformorg pushed a commit that referenced this pull request May 16, 2024
# [5.1.0-beta.1](5.0.0...5.1.0-beta.1) (2024-05-16)

### Bug Fixes

* `Parse.GeoPoint.current` returns `undefined` ([#2127](#2127)) ([3860535](3860535))
* Chrome browser console warning about unsafe header `access-control-expose-headers` when calling Cloud Function ([#2095](#2095)) ([7b73c03](7b73c03))
* Live Query not working on Expo React Native ([#2109](#2109)) ([7a89665](7a89665))
* Local datastore throws error when `Parse.Query.notEqualTo` is set to `null` ([#2102](#2102)) ([6afd32a](6afd32a))
* Multiple object updates of nested keys overwrite each other ([#1451](#1451)) ([fa4341a](fa4341a))
* Pending updates to nested field causes `ParseObject.toJSON()` to return incorrect object ([#1453](#1453)) ([23cc573](23cc573))
* Remove circular dependencies ([#2125](#2125)) ([b415165](b415165))

### Features

* Add password validation for user with unverified email via `Parse.User.verifyPassword` using master key and option `ignoreEmailVerification: true` ([#2076](#2076)) ([b0adf7e](b0adf7e))
* Add support for setting `Parse.ACL` from json ([#2097](#2097)) ([72bc9ac](72bc9ac))
* Allow setting custom queue for handling offline operations via `Parse.EventuallyQueue` ([#2106](#2106)) ([f92e4d4](f92e4d4))
* Improve installation object `Parse.Installation.currentInstallation` to support web push notifications ([#2119](#2119)) ([4fc62ce](4fc62ce))
* Lazy load `Parse.CoreManager` controllers to add support for swappable `CryptoController`, `LocalDatastoreController`, `StorageController`, `WebSocketController`, `ParseLiveQuery` ([#2100](#2100)) ([fbd0ab1](fbd0ab1))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.1.0-beta.1

@parseplatformorg parseplatformorg added the state:released-beta Released as beta version label May 16, 2024
parseplatformorg pushed a commit that referenced this pull request May 16, 2024
# [5.1.0](5.0.0...5.1.0) (2024-05-16)

### Bug Fixes

* `Parse.GeoPoint.current` returns `undefined` ([#2127](#2127)) ([3860535](3860535))
* Chrome browser console warning about unsafe header `access-control-expose-headers` when calling Cloud Function ([#2095](#2095)) ([7b73c03](7b73c03))
* Live Query not working on Expo React Native ([#2109](#2109)) ([7a89665](7a89665))
* Local datastore throws error when `Parse.Query.notEqualTo` is set to `null` ([#2102](#2102)) ([6afd32a](6afd32a))
* Multiple object updates of nested keys overwrite each other ([#1451](#1451)) ([fa4341a](fa4341a))
* Pending updates to nested field causes `ParseObject.toJSON()` to return incorrect object ([#1453](#1453)) ([23cc573](23cc573))
* Remove circular dependencies ([#2125](#2125)) ([b415165](b415165))

### Features

* Add password validation for user with unverified email via `Parse.User.verifyPassword` using master key and option `ignoreEmailVerification: true` ([#2076](#2076)) ([b0adf7e](b0adf7e))
* Add support for setting `Parse.ACL` from json ([#2097](#2097)) ([72bc9ac](72bc9ac))
* Allow setting custom queue for handling offline operations via `Parse.EventuallyQueue` ([#2106](#2106)) ([f92e4d4](f92e4d4))
* Improve installation object `Parse.Installation.currentInstallation` to support web push notifications ([#2119](#2119)) ([4fc62ce](4fc62ce))
* Lazy load `Parse.CoreManager` controllers to add support for swappable `CryptoController`, `LocalDatastoreController`, `StorageController`, `WebSocketController`, `ParseLiveQuery` ([#2100](#2100)) ([fbd0ab1](fbd0ab1))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 5.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state:released Released as stable version state:released-alpha Released as alpha version state:released-beta Released as beta version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Installation support for JS SDK
4 participants