public static void RequestEventStorePermission(EKEntityType entityType, bool assert_granted = false) { TestRuntime.AssertMacSystemVersion(10, 9, throwIfOtherPlatform: false); var status = EKEventStore.GetAuthorizationStatus(entityType); Console.WriteLine("EKEventStore.GetAuthorizationStatus ({1}): {0}", status, entityType); switch (status) { case EKAuthorizationStatus.Authorized: case EKAuthorizationStatus.Restricted: return; case EKAuthorizationStatus.NotDetermined: // There's an instance method on EKEventStore to request permission, // but creating the instance can end up blocking the app showing a permission dialog... // (on Mavericks at least) if (TestRuntime.CheckMacSystemVersion(10, 10)) { return; // Crossing fingers that this won't hang. } NUnit.Framework.Assert.Ignore("This test requires permission to access events, but there's no API to request access without potentially showing dialogs."); break; case EKAuthorizationStatus.Denied: if (assert_granted) { NUnit.Framework.Assert.Ignore("This test requires permission to access events."); } break; } }
public EventListController(EKCalendarItem[] events, EKEntityType eventType) : base(UITableViewStyle.Plain, null, true) { this.events = events; this.eventType = eventType; Section section; if (events == null) { section = new Section() { new StringElement("No calendar events") }; } else { section = new Section() { from items in this.events select(Element) new StringElement(items.Title) }; } itemListRoot.Add(section); // set our element root this.InvokeOnMainThread(() => { this.Root = itemListRoot; }); }
protected async Task <(bool granted, NSError error)> RequestAccess(EKEntityType type) { return(await Task.Run(() => { var t = new TaskCompletionSource <(bool granted, NSError error)>(); CalendarEvent.EventStore.RequestAccess(type, (granted, error) => t.TrySetResult((granted, error))); return t.Task; })); }
public CalendarListController ( EKEntityType storeType ) : base ( UITableViewStyle.Plain, null, true) { entityType = storeType; // request access will popup a dialog to the user asking them if they // want to grant calendar access to the application. as such, this method // is asynchronous and you need to pass a completion handler that will get // called once the user has made a decision App.Current.EventStore.RequestAccess ( entityType, (bool granted, NSError e) => { PopulateCalendarList ( granted, e ); } ); }
public CalendarListController(EKEntityType storeType) : base(UITableViewStyle.Plain, null, true) { entityType = storeType; // request access will popup a dialog to the user asking them if they // want to grant calendar access to the application. as such, this method // is asynchronous and you need to pass a completion handler that will get // called once the user has made a decision App.Current.EventStore.RequestAccess(entityType, (bool granted, NSError e) => { PopulateCalendarList(granted, e); }); }
internal static PermissionStatus CheckPermissionStatus(EKEntityType entityType) { var status = EKEventStore.GetAuthorizationStatus(entityType); return(status switch { EKAuthorizationStatus.Authorized => PermissionStatus.Granted, EKAuthorizationStatus.Denied => PermissionStatus.Denied, EKAuthorizationStatus.Restricted => PermissionStatus.Restricted, _ => PermissionStatus.Unknown, });
/// <summary> /// A convenience method that requests access to the appropriate calendar and /// shows an alert if access is not granted, otherwise executes the completion /// method. /// </summary> protected void RequestAccess ( EKEntityType type, Action completion ) { App.Current.EventStore.RequestAccess (type, (bool granted, NSError e) => { InvokeOnMainThread ( () => { if (granted) completion.Invoke (); else new UIAlertView ( "Access Denied", "User Denied Access to Calendars/Reminders", null, "ok", null).Show (); }); } ); }
public void RequestEventStoreAccess(EKEntityType type) { if (eventStore == null) { eventStore = new EKEventStore(); } eventStore.RequestAccess(type, delegate(bool granted, NSError error) { ShowAlert(type == EKEntityType.Event ? DataClass.Calendars : DataClass.Reminders, granted ? "granted" : "denied"); }); }
async Task <PermissionStatus> RequestEventPermission(EKEntityType eventType) { if (GetEventPermissionStatus(eventType) == PermissionStatus.Granted) { return(PermissionStatus.Granted); } eventStore = new EKEventStore(); var results = await eventStore.RequestAccessAsync(eventType).ConfigureAwait(false); return(results.Item1 ? PermissionStatus.Granted : PermissionStatus.Denied); }
/// <summary> /// A convenience method that requests access to the appropriate calendar and /// shows an alert if access is not granted, otherwise executes the completion /// method. /// </summary> protected void RequestAccess(EKEntityType type, Action completion) { App.Current.EventStore.RequestAccess(type, (bool granted, NSError e) => { if (granted) { InvokeOnMainThread(() => { completion.Invoke(); }); } else { new UIAlertView("Access Denied", "User Denied Access to Calendars/Reminders", null, "ok", null).Show(); } }); }
public EventListController ( EKCalendarItem[] events, EKEntityType eventType ) : base ( UITableViewStyle.Plain, null, true) { this.events = events; this.eventType = eventType; // add elements to the dialog root for each item itemListRoot.Add ( new Section ( ) { from items in this.events select ( Element ) new StringElement ( items.Title ) } ); // set our element root this.InvokeOnMainThread ( () => { this.Root = itemListRoot; } ); }
protected void RequestAccess(EKEntityType type, Action completion) { AppHelper.Current.EventStore.RequestAccess(type, (bool granted, NSError e) => { InvokeOnMainThread(() => { if (granted) { completion.Invoke(); } else { new MessageDialog().SendToast("Acceso denegado, no tienes acceso a el calendario"); } }); }); }
public EventListController(EKCalendarItem[] events, EKEntityType eventType) : base(UITableViewStyle.Plain, null, true) { this.events = events; this.eventType = eventType; // add elements to the dialog root for each item itemListRoot.Add( new Section( ) { from items in this.events select(Element) new StringElement(items.Title) } ); // set our element root this.InvokeOnMainThread(() => { this.Root = itemListRoot; }); }
public EventListController ( EKCalendarItem[] events, EKEntityType eventType ) : base ( UITableViewStyle.Plain, null, true) { this.events = events; this.eventType = eventType; Section section; if (events == null) { section = new Section () { new StringElement ("No calendar events") }; } else { section = new Section () { from items in this.events select ( Element ) new StringElement ( items.Title ) }; } itemListRoot.Add (section); // set our element root this.InvokeOnMainThread ( () => { this.Root = itemListRoot; } ); }
PermissionStatus GetEventPermissionStatus(EKEntityType eventType) { var status = EKEventStore.GetAuthorizationStatus(eventType); switch (status) { case EKAuthorizationStatus.Authorized: return(PermissionStatus.Granted); case EKAuthorizationStatus.Denied: return(PermissionStatus.Denied); case EKAuthorizationStatus.Restricted: return(PermissionStatus.Restricted); default: return(PermissionStatus.Unknown); } }
public void RequestAccess(EKEntityType type, Action completion) { try{ Apps.Current.EventStore.RequestAccess(type, (bool granted, NSError e) => { //NSObject.InvokeOnMainThread (() => { if (granted) { completion.Invoke(); } else { new UIAlertView("Access Denied", "User Denied Access to Calendars/Reminders", null, "ok", null).Show(); } //}); }); } catch (Exception ex) { Services.Logs.Insights.Send("GetDateTimeMS", ex); } }
public void CheckEventStoreAccess(EKEntityType type) { EKAuthorizationStatus status = EKEventStore.GetAuthorizationStatus(type); DataClass dc = type == EKEntityType.Event ? DataClass.Calendars : DataClass.Reminders; switch (status) { case EKAuthorizationStatus.NotDetermined: ShowAlert(dc, "not determined"); break; case EKAuthorizationStatus.Restricted: ShowAlert(dc, "restricted"); break; case EKAuthorizationStatus.Denied: ShowAlert(dc, "denied"); break; case EKAuthorizationStatus.Authorized: ShowAlert(dc, "granted"); break; } }
public EKEntityPrivacyManager(EKEntityType entityType) { type = entityType; }
public EKEntityPrivacyManager (EKEntityType entityType) { type = entityType; }
protected void LaunchCalendarListScreen( EKEntityType calendarStore ) { calendarListScreen = new CalendarListController ( calendarStore ); NavigationController.PushViewController ( calendarListScreen, true ); }
PermissionStatus GetEventPermissionStatus(EKEntityType eventType) { var status = EKEventStore.GetAuthorizationStatus(eventType); switch (status) { case EKAuthorizationStatus.Authorized: return PermissionStatus.Granted; case EKAuthorizationStatus.Denied: return PermissionStatus.Denied; case EKAuthorizationStatus.Restricted: return PermissionStatus.Restricted; default: return PermissionStatus.Unknown; } }
/// <summary> /// A convenience method that requests access to the appropriate calendar and /// shows an alert if access is not granted, otherwise executes the completion /// method. /// </summary> protected void RequestAccessToCalendar( EKEntityType type, Action completion ) { IPhoneServiceLocator.CurrentDelegate.EventStore.RequestAccess (type, (bool granted, NSError e) => { if (granted) { UIApplication.SharedApplication.InvokeOnMainThread ( () => { completion.Invoke(); } ); } else { INotification notificationService = (INotification)IPhoneServiceLocator.GetInstance ().GetService ("notify"); if (notificationService != null) { notificationService.StartNotifyAlert ("Access Denied", "User Denied Access to Calendars/Reminders. Go to Privacy Settings to change it.", "OK"); } } } ); }
async Task<PermissionStatus> RequestEventPermission(EKEntityType eventType) { if (GetEventPermissionStatus(eventType) == PermissionStatus.Granted) return PermissionStatus.Granted; if (eventStore == null) eventStore = new EKEventStore(); var results = await eventStore.RequestAccessAsync(eventType).ConfigureAwait(false); return results.Item1 ? PermissionStatus.Granted : PermissionStatus.Denied; }
protected void LaunchCalendarListScreen(EKEntityType calendarStore) { calendarListScreen = new Calendars.Screens.CalendarList.CalendarListController(calendarStore); NavigationController.PushViewController(calendarListScreen, true); }
string CheckEventStoreAccess(EKEntityType type) { return(EKEventStore.GetAuthorizationStatus(type).ToString()); }
public void RequestEventStoreAccess(EKEntityType type) { eventStore.RequestAccess(type, delegate(bool granted, NSError error) { InvokeOnMainThread(() => accessStatus.Text = "Access " + (granted ? "allowed" : "denied")); }); }
public EKEntityPrivacyController(EKEntityType entityType) { CheckAccess = () => CheckEventStoreAccess(entityType); RequestAccess = () => RequestEventStoreAccess(entityType); }
protected void LaunchCalendarListScreen(EKEntityType calendarStore) { calendarListScreen = new CalenderEventVC(calendarStore); NavigationController.PushViewController (calendarListScreen, true); //PresentViewController(calendarListScreen, true,null); }
public void CheckEventStoreAccess (EKEntityType type) { EKAuthorizationStatus status = EKEventStore.GetAuthorizationStatus (type); DataClass dc = type == EKEntityType.Event ? DataClass.Calendars : DataClass.Reminders; switch (status) { case EKAuthorizationStatus.NotDetermined: ShowAlert (dc, "not determined"); break; case EKAuthorizationStatus.Restricted: ShowAlert (dc, "restricted"); break; case EKAuthorizationStatus.Denied: ShowAlert (dc, "denied"); break; case EKAuthorizationStatus.Authorized: ShowAlert (dc, "granted"); break; } }
public void RequestEventStoreAccess (EKEntityType type) { if (eventStore == null) eventStore = new EKEventStore (); eventStore.RequestAccess (type, delegate (bool granted, NSError error) { ShowAlert (type == EKEntityType.Event ? DataClass.Calendars : DataClass.Reminders, granted ? "granted" : "denied"); }); }
public EKEntityPrivacyController(EKEntityType entityType) { type = entityType; }