Giter Site home page Giter Site logo

Comments (9)

jamescmartinez avatar jamescmartinez commented on July 24, 2024 1

Definitely.

You'd start by persisting the list of events -- could be Core Data, but really a KV store would be sufficient; PinCache is one I used to use several years ago, though I'm not sure what the best is in 2019. You'd then implement background refresh which would fetch the most recent events, persist them in the store, and if there are changes/updates send a notification to the user.

☝️ Overcast does notifications this way, for example.

from coffee.

jerrytdev avatar jerrytdev commented on July 24, 2024 1

👍local notifications

from coffee.

jamescmartinez avatar jamescmartinez commented on July 24, 2024 1

@drewvolz suggested this article when we discussed this approach at lunch today: https://blog.githawk.com/2018/10/02/Notifications-and-Background-Fetch.html

from coffee.

jamescmartinez avatar jamescmartinez commented on July 24, 2024

This is a tough one since we allow multiple groups the site but the coffee app is only for the SF Coffee group.

Traditionally, this would be done on a user-subscription basis. For example, assuming Roderic is a member of SF Coffee and SF Beer, we would send notifications to Roderic for those two groups; this is in a PR that @stratigos and I worked on but never finished.

The quick and dirty solution for the SF Coffee app, however, might be to hardcode the SF Coffee meetup as the only one that sends pushes. This would solve our problem for now, but it would be a nightmare to maintain (both on server and on iOS) if we ever want to add support for multiple group notifications. I don’t like this but it would work.

A third solution would be a sort of hybrid where we have people login to the iOS app, subscribe them to the SF Coffee group in the app, and then continue with the “traditional” implementation above. This would require a new API and some additional work on the app, but the code and data server-side would remain clean.

Thoughts?

from coffee.

rodericj avatar rodericj commented on July 24, 2024

Couldn't you just have a push notification per group and have users in app individually subscribe on a per feed basis? Like: "I only want to hear from SF-Coffee", then whenever an event is created in that group you send out the push to all of the tokens that have requested to be sent notifications for that group?

Regarding the third solution: We would most definitely need a new API in order to get the APNS token from the device. Login can be done through CloudKit with no UI changes.

I'm going to re-read this but I'm kind of thinking the user-subscription basis works. How far along did y'all get?

from coffee.

jamescmartinez avatar jamescmartinez commented on July 24, 2024

Yes, you're exactly right. It would be on a channel-by-channel basis with the channel, in this case, being a "group".

The hybrid option I'm thinking of in more detail is really the first option above but having the app take care of the subscribing automagically ✨. Here's what that might look like:

  1. User opens app
  2. User logs in with Twitter
  3. The app automagically ✨, behind the scenes, adds the user as a "member" of SF Coffee and subscribes them to notifications. This prevents the user from needing to select the group (as they currently need to do on the website)
  4. Profit

The new endpoints would be something like POST /groups/:id/memberships to create a new membership, and POST /devices with the device push identifier to create a new device for push notification subscriptions.

from coffee.

rodericj avatar rodericj commented on July 24, 2024

I would avoid using twitter login. For http://magicphotos.app we use fetchuserrecordidwithcompletion. For a brief see:the loginless blog post

So basically:

  1. User opens the app
  2. App gives us the user's cloudKit token
    • If they are not logged into iCloud (like ~0% of users, END)
  3. App asks user to accept push notifications (again only if we get the token)
  4. upon accepting App sends push token to server
  5. app adds them as member of sf-coffee and subscribes them
  6. Profit.

Do we still need both POST /groups/:id/memberships and POST /devices? Maybe the later is PATCH /devices?

from coffee.

jamescmartinez avatar jamescmartinez commented on July 24, 2024

The reason we use Twitter login is to have a concept of a "user" which supports group membership and other, undeveloped, features. I'm not saying this is the best method (other things could work here), but it's the one we have. I'm open to changing this.

The iCloud method/blog post you linked only works on iOS; the coffee site is available on the web as well, with other groups that aren't iOS Coffee (or even iOS specific at all). I want to continue to support these diverse use cases. If we use this method for the iOS app, then the site would have to support a one-off exception specific to this app which is more inline with the second "hardcoded" option I described above. As I mentioned before I don't love this, but I'm also not 100% opposed to it.

Yet ANOTHER solution™️ would be local notifications based on background fetching the updated API, watching for changes, and sending a local notification when there's a change. 🤷‍♂️

from coffee.

rodericj avatar rodericj commented on July 24, 2024

I would be super interested in the local notification approach. It limits implementation on the server significantly. I wonder how reliable that is. I’d like to look into that.

I get the iCloud concern tho

from coffee.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.