is there support to mark events as read-only either in CalDAV or ical (icalendar) - ios

I've searched the iCalendar spec https://www.rfc-editor.org/rfc/rfc5545 and the CalDAV spec https://www.rfc-editor.org/rfc/rfc4791 looking for insight on how to mark an event that is sent from our calendar server to an iPhone as "read-only" (non-editable) when the iPhone connects to our server using the CalDAV protocol. But the answer is not jumping out at me.
In other words, the iPhone user is receiving, via a CalDAV account a bunch of events. Normally, they can edit any of these events. However, we want to be able to mark a few as read-only. I know that we can use the iPhone ability to add an .ics subscription account, but we don't really want to do this, because it requires the iPhone user to add BOTH a CalDAV and an .ics subscription account.
We are using SabreDAV as our CalDAV server.
My technical co-worker has asked me to look into this, so I am asking for help from the Stackoverflow community.
Any help or hints will be greatly appreciated.

Once you've sent the file to the user it's theirs to deal with so...
I would say there isn't a way to protect the appointment/event from modification.
What you can however do is host the whole calendar yourself and if the user has Outlook or similiar, to subscribe to that RSS feed.
It's one idea... but for protecting what you send them? Highly doubtful. Just take heart they are only modifying their copy of your data, not the source data itself.

1/ You can use shared calendars and invite the user as a read-only. However, the user will have 2 calendars: its own and the shared calendar. Still, it's the same CalDAV account so the user has just one checkbox to click to opt in.
2/ I've not tried ACL but maybe you can play with it.
3/ As a dirtly last resort, you can edit Sabre\CalDAV\Backend\PDO::updateCalendarObject and deleteCalendarObject and add your conditions. But that's very low-level at this point (this class doesn't even know who's doing the change). I don't recommend it.

Related

Swift : Upload pdf as "admin user" and send notification to other "normal users" that pdf is uploaded

I'm a swift beginner.
I'm trying to create an app that essentially does the following :
Users can sign up and login to the app to receive a new recipe weekly in a pdf (or word doc) format. Once the new recipe of the week is ready to be viewed the users will receive a notification that "recipe of the week is ready for viewing" and they can then login and access the new recipe (as well as recipes from previous weeks).
One admin user will be able to login and upload these pdfs/word doc that contain the recipe and once the upload is complete, the other normal users are notified of this new recipe.
My question :
1) Is it possible to have different users in one app? (ie normal users and admin users). I just want to make the app easy to use for the admin (a friend who is not a tech and who just want to upload recipes) without having to touch the codes or needing me to upload them manually. If its not possible, what could be an alternative way of doing this, so that an ordinary admin user can just upload into the app for other users viewing pleasure?
2) I just thought pdf/word doc might be an easier way for the friend to upload the recipes into app (the recipe might contain pics, tables, graphs etc), if there is a different way of doing this, open to suggestions :) At first I thought maybe putting the recipes on a shared directory and getting Apple's DirectoryMonitor.swift to monitor the directory so that everytime the friend uploads something to the directory, the app will detect this and send notifications to other users....but I thought maybe this isnt the best way to do it, not to mention it might send false notifications (ie when files are removed insteaf of added..)
I do know the basics of Swift, or think I do.So hopefully if you can provide me enough hints (ie framework or SDK or classes to use etc etc) I can use your suggestions to do further research on the subject.
If you need more details or clarifications, please let me know. Thanks!
You must use web services (server) to achieve this stuff.
Design api for login like if admin user login then you return something like this is admin and shows admin screens in your app like upload dishes etc.
If normal user will login then your api (web service) will return you that this is a normal user then show stuff regarding it in your app.
You required web services for uploading and retrieving recipes.
You can easily manage notification if admin upload new recipe to server.
So, it's basically depends on your server and mobile both side of proper management. Your database will take place server side. that's it.

Add Invitees to calendar event programmatically iOS

I've been trying to look for the answer to this quite some time.
Apple EventKit documentation isn't allowing changing meeting invitees programmatically since those properties in an EKEvent are read-only.
I'm trying to find a way to create a calendar meeting (not necessary using EventKit), adding invitees to the meeting and setting it programatically.
Any solution will be great,
Thanks!
As you already figured out you cannot currently write meeting fields in iOS (AFAIK EventKit is the only API giving you access to the calendar database on iOS).
If you know what kind of account it is (and get the credentials from the user), you could sidetrack EventKit and directly create meetings on the server. Eg using EWS when the account is on Exchange or CalDAV when the account is on iCloud or Apple Calendar Server etc.
And finally you always have the option to send out meeting invites via iMIP. Though you would still need to get the event into the users calendar (so that replies have a target). Depends on your useless whether this is useful.

How to share links via FB App when I am offline

I am developing an mobile app for iPhone. The app will primary used by people who are on holiday in a different country and will be offline most of the time, due to high costs for internet traffic.
However, the company for which I am developing the app wants to users to be able to use the "Facebook Share" functionality also when people are not connected to the internet.
It should work on a way that they click the SHARE link button in the app, but then get a message that they are offline and the link will get shared as soon as they are online again.
I am trying to figure out how to do this. Can I pass the link I want to share to the official FB App via fb:// protocol (or whatever) and the FB App handles the post/share as soon as it is online again?
Or do I have to do it on my own, put the links I want to share in a internal database and then post them to the wall when I am online again?
Or any other ways??
Any suggestions would be welcome, I would prefer a very quick solution and hope someone maybe has an idea how to do this. I was hoping I can pass the share-link to the official FB App and this one handles everything when it goes online again !?
Thanks for your ideas!
Your approach should be to make your link-sharing code automatically cache requests until they are sent. The app then doesn't need to concern itself with the details - it can just post the link and get a 'failed', 'success', or 'postponed' response from your API and notify the user accordingly.
Your link-sharing code can then internally check if it can currently post to FB and if not (either because the user is currently offline or perhaps the Facebook token is expired) it will store it for later. This class will then re-check periodically (for example when the app comes to the foreground or when the class is initialised the next time the app starts) for connectivity and then it will check if the token is still valid and perform FB login if required. Once it has a valid token it can then iterate through the pending requests and act upon them.
If you really want to make it nice and clean, you can separate out the code that accepts incoming requests to do something, checks if it can be performed now, does it or stores it for later, and periodically checks any requests in the pending queue. This class will not have any idea what the requests do or how they are performed, it will work with another class that implements a protocol to do the actual work and knows about facebook, etc. There may even be an existing design pattern for such a setup, but I don't know what it's called if there is.
Update: I did some research and found this is very similar to the "Fire-and-Forget Pattern".

Send an invitation to a list same app

I am pretty new with iOS 5 and I am thinking in writing an app.
I would have a list of people inside the app who has it. Then I would invite them to an event.
I don't need any code right now I just wanted to know the concept behind this.
First, how an app can recognise who has my it installed, so it can show a list of people.
Second, after creating an event with a group of people how can I send an invitation to them.
Thanks
From a very general standpoint, what you need is a back-end server to interact with your app and store user/event info. You can either build your own or try to use a service like Parse.

How to Add Phone With twitter using Third Party tool

I need a script that will add my phone with Twitter for All latest notification.
I found this page Twitter but i need to create script for my own application.
I goggled but i didn't get any solution For this.Please Help me to find this answer.
Thanks a lot in advance.
First Edit
This is a twitter's new feature Send notification to Phone. Actually I want to create an app that will allow users to register there phone with twitter via my application. Ie I need a script to implement send notification to phone.
The question that others are asking you Pankaj is what platform is your application being written for. You keep saying you want a "script" to do this, but what kind of script?
Giving us more insight to what your application is (a console application written in C#, or an ASP.NET web application) would lend more detail and raise the chances of someone being able to help you. :)
Regardless of your app's platform though, you're probably going to need to look into the Twitter API for setting this up. This is the normal method to interact with Twitter from 3rd party applications. So all the suggestions above, specifically the list of API's available, is probably what you're looking for.
Hey, can you give some more information? What kind of Phone are you developing for?
Maybe that helps solving your Problem.
If you are just searching for a way connecting your Phone to Twitter, here is the Twitter FAQ for Phone connecting:
http://support.twitter.com/articles/14014-twitter-phone-faqs
Maybe it helps, or give you more keywords for your search.
I don't believe there's a way to get or set the notification phone number using the API, however if a phone is already setup on the profile you want to configure, you can do the following to get notification from all user friends.
The user will need to authorize your application to access her account. This flow uses OAuth, and begins here:
http://api.twitter.com/oauth/request_token
Once the user has granted your app access, and your application has all the required OAuth credentials, turn on notifications using account/update_delivery_device:
http://api.twitter.com/1/account/update_delivery_device.json?device=sms
Next, fetch all the IDs for your user's friends using the friends/ids API call. Be sure to study the documentation; this call uses cursors, so you will have to manage those if the user has over 5,000 friends. Store these IDs for use in the next step. Here's an example call:
http://api.twitter.com/1/friends/ids.json?cursor=-1
Once you have all of the friend IDs, you can call notifications/follow repeatedly to enable notifications on your mobile device whenever your friend makes an update:
http://api.twitter.com/1/notifications/follow.xml?user_id=12345
This approach will burn one API call for each user that you enable notifications for; there's no way currently to manage notifications en masse.

Resources