Comments (9)
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.
👍local notifications
from coffee.
@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.
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.
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.
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:
- User opens app
- User logs in with Twitter
- 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)
- 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.
I would avoid using twitter login. For http://magicphotos.app we use fetchuserrecordidwithcompletion. For a brief see:the loginless blog post
So basically:
- User opens the app
- App gives us the user's cloudKit token
- If they are not logged into iCloud (like ~0% of users, END)
- App asks user to accept push notifications (again only if we get the token)
- upon accepting App sends push token to server
- app adds them as member of sf-coffee and subscribes them
- Profit.
Do we still need both POST /groups/:id/memberships
and POST /devices
? Maybe the later is PATCH /devices
?
from coffee.
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.
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)
- Use the group's local time zone
- Change default sort order for events HOT 2
- Add "duplicate event" functionality
- Add validation rule for start/end dates HOT 1
- Capture the address of the venue HOT 2
- Smart App Banners HOT 1
- Add `rubocop-performance` and `rubocop-rails` HOT 1
- Add link to download app if not on mobile safari HOT 1
- Image uploads seem to be failing for events, groups HOT 9
- Groups should have owners HOT 2
- Create a POST for creating new events HOT 1
- Hide inactive groups? HOT 5
- Dependabot is broken because it can no longer read GitHub Workflow secrets
- DEPRECATION NOTICE HOT 1
- Event reminder should be rescheduled if the event is rescheduled
- Redis is required to run tests
- Subscribe to calendar should be above the fold HOT 2
- Things blow up when Foursquare does not respond with a valid venue
- Venues should be persisted HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coffee.