static void PickFiles([NotNull] string[] fileTypes, Action <List <string> > onSuccess, Action onCancel, bool allowMultiple, FilePickerMode mode, string path) { if (fileTypes == null) { throw new ArgumentNullException("fileTypes"); } if (fileTypes.Length == 0) { throw new ArgumentException("At least one file type must be provided"); } if (IGUtils.IsIosCheck()) { return; } Action <string> onSuccessStr = s => { var paths = s.SplitString(); onSuccess(paths.ToList()); }; _iosGoodiesPickFiles(fileTypes.JoinByComma(), IGUtils.ActionStringCallback, IGUtils.ActionVoidCallback, onSuccessStr.GetPointer(), onCancel.GetPointer(), allowMultiple, (int)mode, path); }
/// <summary> /// Displays action sheet with cancel and destructive button and provided options. /// </summary> /// <param name="title">Action sheet title</param> /// <param name="cancelBtnTitle">Action sheet cancel button title</param> /// <param name="onCancelClicked">Action sheet cancel button callback</param> /// <param name="destructiveButtonTitle">Action sheet destructive button title</param> /// <param name="onDestructiveButtonClicked">Action sheet destructive button callback</param> /// <param name="otherButtonTitles">Titles of other buttons</param> /// <param name="onOtherButtonClicked"> /// Action sheet other button callback, index is the same as index array passed to /// method /// </param> /// <param name="message"> Optional message to be displayed on the action sheet. </param> /// <param name="iPadScreenPosition">Position of the arrow on iPad screen. Positioning zero is at top left screen point. </param> public static void ShowActionSheet(string title, string cancelBtnTitle, Action onCancelClicked, string destructiveButtonTitle, Action onDestructiveButtonClicked, [CanBeNull] string[] otherButtonTitles, Action <int> onOtherButtonClicked, string message = null, Vector2 iPadScreenPosition = default(Vector2)) { if (IGUtils.IsIosCheck()) { return; } if (message == null) { message = string.Empty; } if (otherButtonTitles == null) { otherButtonTitles = new string[] { }; } var posX = IGUtils.ClampXScreenPos(iPadScreenPosition); var posY = IGUtils.ClampYScreenPos(iPadScreenPosition); _showActionSheet(title, message, cancelBtnTitle, destructiveButtonTitle, string.Join("|", otherButtonTitles), posX, posY, IGUtils.ActionIntCallback, onOtherButtonClicked.GetPointer(), IGUtils.ActionVoidCallback, onCancelClicked.GetPointer(), onDestructiveButtonClicked.GetPointer()); }
static void SocialShare(SLServiceType type, Action onSuccess, Action onFailure, string text, Texture2D image = null) { if (IGUtils.IsIosCheck()) { return; } if (!IsAvailableForServiceType(type)) { Debug.LogError("Social share for " + type + " is not available on the current device"); } if (image != null) { var imageBuffer = image.EncodeToPNG(); var handle = GCHandle.Alloc(imageBuffer, GCHandleType.Pinned); _goodiesSocialShare((int)type, text, handle.AddrOfPinnedObject(), imageBuffer.Length, IGUtils.ActionVoidCallback, onSuccess.GetPointer(), onFailure.GetPointer()); handle.Free(); return; } // Just text _goodiesSocialShare((int)type, text, EmptyByteArray.GetPointer(), EmptyByteArray.Length, IGUtils.ActionVoidCallback, onSuccess.GetPointer(), onFailure.GetPointer()); }
/// <summary> /// Share the specified text with optional image. /// </summary> /// <param name="onFinished">Callback invoked when sharing finished.</param> /// <param name="onError">Callback invoked when error happened while shairng.</param> /// <param name="text">Text to share.</param> /// <param name="image">Image to share.</param> /// <param name="iPadScreenPosition">Position of the arrow on iPad screen. Positioning zero is at top left screen point. </param> public static void Share(Action <string> onFinished, Action <string> onError, string text, Texture2D image = null, Vector2 iPadScreenPosition = default(Vector2)) { if (IGUtils.IsIosCheck()) { return; } Check.Argument.IsNotNull(onFinished, "onFinished"); Check.Argument.IsNotNull(onError, "onError"); var posX = IGUtils.ClampXScreenPos(iPadScreenPosition); var posY = IGUtils.ClampYScreenPos(iPadScreenPosition); if (image != null) { var imageBuffer = image.EncodeToPNG(); var handle = GCHandle.Alloc(imageBuffer, GCHandleType.Pinned); _showShareMessageWithImage(text, handle.AddrOfPinnedObject(), imageBuffer.Length, posX, posY, IGUtils.ActionStringCallaback, onFinished.GetPointer(), onError.GetPointer()); handle.Free(); return; } // Just text _showShareMessageWithImage(text, EmptyByteArray.GetPointer(), EmptyByteArray.Length, posX, posY, IGUtils.ActionStringCallaback, onFinished.GetPointer(), onError.GetPointer()); }
public static void Vibrate() { if (IGUtils.IsIosCheck()) { return; } _goodiesVibrate(); }
public static void EnableFlashlight(bool enable) { if (IGUtils.IsIosCheck()) { return; } _goodiesEnableFlashlight(enable); }
/// <summary> /// Shows native loading dialog. Call <see cref="Dismiss"/> to dismiss. /// </summary> public static void Show() { if (IGUtils.IsIosCheck()) { return; } _showLoadingDialog(); }
/// <summary> /// Dismisses native loading dialog, created using <see cref="Show"/> /// </summary> public static void Dismiss() { if (IGUtils.IsIosCheck()) { return; } _dismissLoadingDialog(); }
public static void OpenAppSettings() { if (IGUtils.IsIosCheck()) { return; } _goodiesOpenAppSettings(); }
/// <summary> /// Whether video at provided path can be edited /// </summary> /// <param name="videoPath">Path to the video to check whether it can be edited</param> public static bool CanEditVideoAtPath([NotNull] string videoPath) { if (IGUtils.IsIosCheck()) { return(false); } return(_canEditVideoAtPath(videoPath)); }
public static void OpenDialer(string phoneNumber) { Check.Argument.IsStrNotNullOrEmpty(phoneNumber, "phoneNumber"); if (IGUtils.IsIosCheck()) { return; } IGUtils._openUrl(string.Format("tel:{0}", phoneNumber)); }
public static void StartFaceTimeAudioCall(string userId) { Check.Argument.IsStrNotNullOrEmpty(userId, "userId"); if (IGUtils.IsIosCheck()) { return; } IGUtils._openUrl(string.Format("facetime-audio:{0}", userId)); }
public static void OpenYoutubeVideo(string videoId) { Check.Argument.IsStrNotNullOrEmpty(videoId, "videoId"); if (IGUtils.IsIosCheck()) { return; } _openYouTubeVideo(videoId); }
public static void OpenYoutubeVideo(string videoId) { Check.Argument.IsStrNotNullOrEmpty(videoId, "videoId"); if (IGUtils.IsIosCheck()) { return; } IGUtils._openUrl(Device.systemVersion.StartsWith("11") ? string.Format("youtube://{0}", videoId) : string.Format("http://www.youtube.com/watch?v={0}", videoId)); }
/// <summary> /// Displays message dialog with positive button only /// </summary> /// <param name="title">Dialog title</param> /// <param name="message">Dialog message</param> /// <param name="confirmButtonTitle">Text for positive button</param> /// <param name="onConfirmButtonClick">Positive button callback</param> public static void ShowOneBtnDialog(string title, string message, string confirmButtonTitle, Action onConfirmButtonClick) { if (IGUtils.IsIosCheck()) { return; } _showConfirmationDialog(title, message, confirmButtonTitle, IGUtils.ActionVoidCallback, onConfirmButtonClick.GetPointer()); }
public static void SetFlashlightIntensity(float intensity) { intensity = Mathf.Clamp01(intensity); if (IGUtils.IsIosCheck()) { return; } _goodiesSetFlashlightLevel(intensity); }
/// <summary> /// Request biometric user authentication. /// Evaluating a policy may involve prompting the user for various kinds of interaction or authentication. /// The actual behavior is dependent on the evaluated policy and the device type. /// The behavior can also be affected by installed configuration profiles. /// </summary> /// <param name="reason">Description in the appearing authentication dialog.</param> /// <param name="policy">Authentication policy.</param> /// <param name="onSuccess">Action to perform after successful authentication.</param> /// <param name="onFailure">Action to perform using a string with error description.</param> public static void AuthenticateWithBiometrics(string reason, Policy policy, Action onSuccess, Action <LocalAuthenticationError> onFailure) { if (IGUtils.IsIosCheck()) { return; } _authenticateWithBiometrics(reason, (int)policy, IGUtils.ActionVoidCallback, LocalAuthenticationErrorCallback, onSuccess.GetPointer(), onFailure.GetPointer()); }
/// <summary> /// Creates a calendar event with specified start/end dates and title. /// </summary> /// <param name="title"> Event name.</param> /// <param name="notes"> Event notes.</param> /// <param name="startDate"> Start date of the event.</param> /// <param name="endDate"> End date of the event.</param> /// <param name="onSuccess"> Action to be performed with the unique identifier of the event.</param> /// <param name="onError"> Action to be performed with the error description. </param> public static void CreateCalendarEvent(Action <string> onSuccess, Action <string> onError, string title, DateTime startDate, DateTime endDate, string notes = null) { if (IGUtils.IsIosCheck()) { return; } _createCalendarEvent(title, notes, startDate.Year, startDate.Month, startDate.Day, startDate.Hour, startDate.Minute, endDate.Year, endDate.Month, endDate.Day, endDate.Hour, endDate.Minute, IGUtils.ActionStringCallback, onSuccess.GetPointer(), onError.GetPointer()); }
/// <summary> /// Creates a reminder with given parameters. /// </summary> /// <param name="title"> Reminder title. </param> /// <param name="startDate"> Start date of the reminder. </param> /// <param name="dueDate"> Due date of the reminder. </param> /// <param name="onSuccess"> Action to be performed with the unique identifier of the reminder.</param> /// <param name="onError"> Action to be performed with the error description. </param> public static void CreateReminder(Action <string> onSuccess, Action <string> onError, string title, DateTime startDate, DateTime dueDate) { if (IGUtils.IsIosCheck()) { return; } _createReminder(title, startDate.Year, startDate.Month, startDate.Day, startDate.Hour, startDate.Minute, dueDate.Year, dueDate.Month, dueDate.Day, dueDate.Hour, dueDate.Minute, IGUtils.ActionStringCallback, onSuccess.GetPointer(), onError.GetPointer()); }
/// <summary> /// Displays date, hour, minute, and optionally AM/PM designation depending on the locale setting (e.g. Wed Nov 15 | 6 /// | 53 | PM) /// All the input will be blocked until the date and time is picked. /// </summary> /// <param name="year">Year.</param> /// <param name="month">Month.</param> /// <param name="day">Day.</param> /// <param name="hourOfDay">Hour of day.</param> /// <param name="minute">Minute.</param> /// <param name="dateTimePickerCallback">Date time picker callback.</param> /// <param name="onCancel">Callback when user cancelled picking</param> public static void ShowDateAndTimePicker(int year, int month, int day, int hourOfDay, int minute, Action <DateTime> dateTimePickerCallback, Action onCancel) { if (IGUtils.IsIosCheck()) { return; } Check.Argument.IsNotNull(dateTimePickerCallback, "dateTimePickerCallback"); _showDatePickerWithInitialValue(year, month, day, hourOfDay, minute, dateTimePickerCallback.GetPointer(), OnDateTimeSelectedCallback, onCancel.GetPointer(), IGUtils.ActionVoidCallback, (int)UIDatePickerMode.DateAndTime); }
/// <summary> /// Displays date, hour, minute, and optionally AM/PM designation depending on the locale setting (e.g. Wed Nov 15 | 6 /// | 53 | PM) /// All the input will be blocked until the date and time is picked. /// </summary> /// <param name="dateTimePickerCallback">Date time picker callback.</param> /// <param name="onCancel">Callback when user cancelled picking</param> public static void ShowDateAndTimePicker(Action <DateTime> dateTimePickerCallback, Action onCancel) { if (IGUtils.IsIosCheck()) { return; } Check.Argument.IsNotNull(dateTimePickerCallback, "dateTimePickerCallback"); _showDatePicker(dateTimePickerCallback.GetPointer(), OnDateTimeSelectedCallback, onCancel.GetPointer(), IGUtils.ActionVoidCallback, (int)UIDatePickerMode.DateAndTime); }
/// <summary> /// Displays alert dialog with input field, confirmation and cancellation buttons. /// </summary> /// <param name="title">The title of alert dialog.</param> /// <param name="text">Text body of alert dialog.</param> /// <param name="inputPlaceHolder">Input field text place holder.</param> /// <param name="buttonOkTitle">Confirmation button title.</param> /// <param name="buttonCancelTitle">Cancellation button title.</param> /// <param name="onCancelClick">Action to be performed after user taps cancellation button.</param> /// <param name="onConfirmClick">Action to be performed after user taps confirmation button.</param> public static void ShowInputFieldDialog(string title, string text, string inputPlaceHolder, string buttonOkTitle, string buttonCancelTitle, Action onCancelClick, Action <string> onConfirmClick) { if (IGUtils.IsIosCheck()) { return; } _showInputFieldDialog(title, text, inputPlaceHolder, buttonOkTitle, buttonCancelTitle, IGUtils.ActionVoidCallback, IGUtils.ActionStringCallback, onCancelClick.GetPointer(), onConfirmClick.GetPointer()); }
public static void SendSmsViaController(string phoneNumber, string body, Action onSuccess, Action onCancel, Action onFailure) { if (IGUtils.IsIosCheck()) { return; } _sendSms(phoneNumber, body, IGUtils.ActionVoidCallback, onSuccess.GetPointer(), onCancel.GetPointer(), onFailure.GetPointer()); }
/// <summary> /// Shows the two button dialog. /// </summary> /// <param name="title">Dialog title</param> /// <param name="message">Dialog message</param> /// <param name="okButtonTitle">Ok button title.</param> /// <param name="onOkButtonClick">Ok button callback.</param> /// <param name="cancelButtonTitle">Cancel button title.</param> /// <param name="onCancelButtonClick">Cancel button callback.</param> public static void ShowTwoBtnDialog( string title, string message, string okButtonTitle, Action onOkButtonClick, string cancelButtonTitle, Action onCancelButtonClick) { if (IGUtils.IsIosCheck()) { return; } _showQuestionDialog(title, message, okButtonTitle, cancelButtonTitle, IGUtils.ActionVoidCallback, onOkButtonClick.GetPointer(), onCancelButtonClick.GetPointer()); }
/// <summary> /// Performs the search in apple maps application. /// </summary> /// <param name="query"> /// The query. This parameter is treated as if its value had been typed into the Maps search field by /// the user. /// </param> /// <param name="viewType">Map view type.</param> public static void PerformSearch(string query, MapViewType viewType = MapViewType.Standard) { if (IGUtils.IsIosCheck()) { return; } Check.Argument.IsStrNotNullOrEmpty(query, "query"); var url = FormatMapsUrl("q={0}&t={1}", UnityWebRequest.EscapeURL(query), _mapViews[viewType]); IGUtils._openUrl(url); }
public static void OpenAppOnAppStore(string appId) { Check.Argument.IsStrNotNullOrEmpty(appId, "appId"); if (IGUtils.IsIosCheck()) { return; } var iTunesUrl = string.Format("itms://itunes.apple.com/us/app/apple-store/id{0}?mt=8", appId); IGUtils._openUrl(iTunesUrl); }
public static void ShowTimePickerWithRestrains(int currentHour, int currentMinute, Action <DateTime> dateTimePickerCallback, Action onCancel, int minHour, int minMinute, int maxHour, int maxMinute) { if (IGUtils.IsIosCheck()) { return; } Check.Argument.IsNotNull(dateTimePickerCallback, "dateTimePickerCallback"); _showDatePickerWithRestrains(0, 0, 0, currentHour, currentMinute, dateTimePickerCallback.GetPointer(), OnDateTimeSelectedCallback, onCancel.GetPointer(), IGUtils.ActionVoidCallback, (int)UIDatePickerMode.Time, 0, 0, 0, minHour, minMinute, 0, 0, 0, maxHour, maxMinute); }
/// <summary> /// Displays hour and minute (e.g. 1 | 53). /// All the input will be blocked until the date and time is picked. /// </summary> /// <param name="dateTimePickerCallback">Date time picker callback.</param> /// <param name="onCancel">Callback when user cancelled picking</param> public static void ShowCountDownTimer(Action <DateTime> dateTimePickerCallback, Action onCancel) { if (IGUtils.IsIosCheck()) { return; } Check.Argument.IsNotNull(dateTimePickerCallback, "dateTimePickerCallback"); _showDatePickerWithInitialValue( 0, 0, 0, 0, 1, dateTimePickerCallback.GetPointer(), OnDateTimeSelectedCallback, onCancel.GetPointer(), IGUtils.ActionVoidCallback, (int)UIDatePickerMode.CountDownTimer); }
/// <summary> /// Opens the sms app with provided phone number. /// You can specify message body with this method but its not documented and NOT guaranteed to work. /// </summary> /// <param name="phoneNumber">Phone number.</param> /// <param name="body">Message body. NOT GUARANTEED TO WORK!</param> public static void SendSmsViaDefaultApp(string phoneNumber, string body = null) { if (IGUtils.IsIosCheck()) { return; } var url = string.Format("sms:{0}", phoneNumber); if (!string.IsNullOrEmpty(body)) { url += string.Format("&body={0}", body.Escape()); } IGUtils._openUrl(url); }
/// <summary> /// Creates a repeating calendar event. /// </summary> /// <param name="title"> Event name.</param> /// <param name="notes"> Event notes.</param> /// <param name="startDate"> Start date of the event.</param> /// <param name="endDate"> End date of the event.</param> /// <param name="repeatUntilDate"> Date the event should be repeated until.</param> /// <param name="ruleType"> The pattern for event repetition (one of <see cref="RecurrenceRuleType")/></param> /// <param name="interval"> The number of <see cref="RecurrenceRuleType"/> instances to be skipped until event repetition. /// For example, if you choose <see cref="RecurrenceRuleType.Daily"/> and pass 5 as interval, /// the event will be repeated every 5 days.</param> /// <param name="onSuccess"> Action to be performed with the unique identifier of the event.</param> /// <param name="onError"> Action to be performed with the error description. </param> public static void CreateRepeatingCalendarEvent(Action <string> onSuccess, Action <string> onError, string title, DateTime startDate, DateTime endDate, DateTime repeatUntilDate, RecurrenceRuleType ruleType = RecurrenceRuleType.Daily, int interval = 1, [CanBeNull] string notes = null) { if (IGUtils.IsIosCheck()) { return; } _createRepeatingEvent(title, notes, startDate.Year, startDate.Month, startDate.Day, startDate.Hour, startDate.Minute, endDate.Year, endDate.Month, endDate.Day, endDate.Hour, endDate.Minute, repeatUntilDate.Year, repeatUntilDate.Month, repeatUntilDate.Day, repeatUntilDate.Hour, repeatUntilDate.Minute, IGUtils.ActionStringCallback, onSuccess.GetPointer(), onError.GetPointer(), (int)ruleType, interval); }