123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
-
- using Foundation;
- using InABox.Mobile.iOS;
- using Plugin.LocalNotification.Platforms;
- using UIKit;
- using UserNotifications;
- using Xamarin.Forms;
- using Syncfusion.TreeView;
- using Syncfusion.XForms.iOS.TreeView;
- using Syncfusion.XForms.iOS.PopupLayout;
- namespace comal.timesheets.iOS
- {
- // The UIApplicationDelegate for the application. This class is responsible for launching the
- // User Interface of the application, as well as listening (and optionally responding) to
- // application events from iOS.
- [Register("AppDelegate")]
- public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
- {
- //
- // This method is invoked when the application has loaded and is ready to run. In this
- // method you should instantiate the window, load the UI into it and then make the window
- // visible.
- //
- // You have 17 seconds to return from this method, or iOS will terminate your application.
- //
- public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary launchOptions)
- {
- DependencyService.Register<Version_iOS>();
- global::Xamarin.Forms.Forms.Init();
- Syncfusion.XForms.iOS.PopupLayout.SfPopupLayoutRenderer.Init();
- Syncfusion.SfPdfViewer.XForms.iOS.SfPdfDocumentViewRenderer.Init();
- Syncfusion.SfRangeSlider.XForms.iOS.SfRangeSliderRenderer.Init();
- Syncfusion.SfImageEditor.XForms.iOS.SfImageEditorRenderer.Init();
- Syncfusion.SfDataGrid.XForms.iOS.SfDataGridRenderer.Init();
- Syncfusion.XForms.iOS.RichTextEditor.SfRichTextEditorRenderer.Init();
- Syncfusion.SfMaps.XForms.iOS.SfMapsRenderer.Init();
- Syncfusion.XForms.iOS.MaskedEdit.SfMaskedEditRenderer.Init();
- SfTreeViewRenderer.Init();
- Syncfusion.SfSchedule.XForms.iOS.SfScheduleRenderer.Init();
- XF.Material.iOS.Material.Init();
- ZXing.Net.Mobile.Forms.iOS.Platform.Init();
- Xamarin.IQKeyboardManager.SharedManager.Enable = true;
- Syncfusion.XForms.iOS.SignaturePad.SfSignaturePadRenderer.Init();
- if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0))
- {
- // Request notification permissions from the user
- UNUserNotificationCenter.Current.RequestAuthorization(UNAuthorizationOptions.Alert, (approved, err) =>
- {
- // Handle approval
- });
- }
- UNUserNotificationCenter.Current.Delegate = new UserNotificationCenterDelegate();
- if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
- {
- var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes(
- UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null
- );
- uiApplication.RegisterUserNotificationSettings(notificationSettings);
- }
- // check for a notification
- if (launchOptions != null)
- {
- // check for a local notification
- if (launchOptions.ContainsKey(UIApplication.LaunchOptionsLocalNotificationKey))
- {
- var localNotification = launchOptions[UIApplication.LaunchOptionsLocalNotificationKey] as UILocalNotification;
- if (localNotification != null)
- {
- UIAlertController okayAlertController = UIAlertController.Create(localNotification.AlertAction, localNotification.AlertBody, UIAlertControllerStyle.Alert);
- okayAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
- Window.RootViewController.PresentViewController(okayAlertController, true, null);
- // reset our badge
- UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
- }
- }
- }
- LoadApplication(new App());
- return base.FinishedLaunching(uiApplication, launchOptions);
- }
- public override void ReceivedLocalNotification(UIApplication application, UILocalNotification notification)
- {
- // show an alert
- UIAlertController okayAlertController = UIAlertController.Create(notification.AlertAction, notification.AlertBody, UIAlertControllerStyle.Alert);
- okayAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
- UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(okayAlertController, true, null);
- // reset our badge
- UIApplication.SharedApplication.ApplicationIconBadgeNumber = 0;
- }
- public override bool OpenUrl(UIApplication app, NSUrl url, NSDictionary options)
- {
- GlobalVariables.LoadFromLinkString = url.AbsoluteString.Remove(0,17);
- LoadApplication(new App());
-
- return true;
- }
- }
- }
|