internal static void OnReceivedRemoteNotification(iOSNotificationData data)
        {
            var notification = new iOSNotification(data.identifier);

            notification.data = data;
            s_OnRemoteNotificationReceived(notification);
        }
        internal static void onSentNotification(iOSNotificationData data)
        {
            var notification = new iOSNotification(data.identifier);

            notification.data = data;
            onNotificationReceived(notification);
        }
Пример #3
0
        static iOSNotificationWithUserInfo NotificationDataToDataWithUserInfo(iOSNotificationData data)
        {
            iOSNotificationWithUserInfo ret;

            ret.data          = data;
            ret.data.userInfo = IntPtr.Zero;
            ret.userInfo      = NSDictionaryToCs(data.userInfo);
            return(ret);
        }
        public static void ScheduleLocalNotification(iOSNotificationData data)
        {
#if UNITY_IOS && !UNITY_EDITOR
            IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(data));
            Marshal.StructureToPtr(data, ptr, false);

            _ScheduleLocalNotification(ptr);
#endif
        }
Пример #5
0
        public static iOSNotificationData?GetLastNotificationData()
        {
#if UNITY_IOS && !UNITY_EDITOR
            if (_GetAppOpenedUsingNotification())
            {
                IntPtr ptr = _GetLastNotificationData();

                if (ptr != IntPtr.Zero)
                {
                    iOSNotificationData data = (iOSNotificationData)Marshal.PtrToStructure(ptr, typeof(iOSNotificationData));
                    _FreeUnmanagediOSNotificationDataArray(ptr, 1);
                    return(data);
                }
            }
#endif
            return(null);
        }
Пример #6
0
        static iOSNotificationData[] MarshalAndFreeNotificationDataArray(IntPtr ptr, int count)
        {
            if (count == 0 || ptr == IntPtr.Zero)
            {
                return(null);
            }

            var dataArray  = new iOSNotificationData[count];
            var structSize = Marshal.SizeOf(typeof(iOSNotificationData));
            var next       = ptr;

            for (var i = 0; i < count; ++i)
            {
                dataArray[i] = (iOSNotificationData)Marshal.PtrToStructure(next, typeof(iOSNotificationData));
                next         = next + structSize;
            }
            _FreeUnmanagediOSNotificationDataArray(ptr, count);

            return(dataArray);
        }
        /// <summary>
        /// Specify a <see cref="iOSNotification.Identifier"/> and create a notification object with all optional fields set to default values.
        /// </summary>
        /// <param name="identifier">  Unique identifier for the local notification tha can later be used to track or change it's status.</param>
        public iOSNotification(string identifier)
        {
            data                    = new iOSNotificationData();
            data.identifier         = identifier;
            data.title              = "";
            data.body               = "";
            data.badge              = -1;
            data.subtitle           = "";
            data.categoryIdentifier = "";
            data.threadIdentifier   = "";

            data.data             = "";
            data.showInForeground = false;
            data.showInForegroundPresentationOptions = (int)(PresentationOption.Alert |
                                                             PresentationOption.Sound);

            data.triggerType = -1;
            data.repeats     = false;

            //Time trigger
            data.timeTriggerInterval = -1;

            //Calendar trigger
            data.calendarTriggerYear   = -1;
            data.calendarTriggerMonth  = -1;
            data.calendarTriggerDay    = -1;
            data.calendarTriggerHour   = -1;
            data.calendarTriggerMinute = -1;
            data.calendarTriggerSecond = -1;

            //Location trigger
            data.locationTriggerCenterX       = 0f;
            data.locationTriggerCenterY       = 0f;
            data.locationTriggerRadius        = 2f;
            data.locationTriggerNotifyOnEntry = true;
            data.locationTriggerNotifyOnExit  = false;
        }
 internal iOSNotification(iOSNotificationData data)
 {
     this.data = data;
 }
Пример #9
0
 private static extern void _ScheduleLocalNotification(iOSNotificationData data);
Пример #10
0
        public static void NotificationReceived(iOSNotificationData data)
        {
#if UNITY_IOS && !UNITY_EDITOR
            iOSNotificationCenter.OnSentNotification(NotificationDataToDataWithUserInfo(data));
#endif
        }
Пример #11
0
        public static void ScheduleLocalNotification(iOSNotificationData data)
        {
#if UNITY_IOS && !UNITY_EDITOR
            _ScheduleLocalNotification(data);
#endif
        }
Пример #12
0
        public static void RemoteNotificationReceived(iOSNotificationData data)
        {
#if UNITY_IOS && !UNITY_EDITOR
            iOSNotificationCenter.OnReceivedRemoteNotification(data);
#endif
        }
Пример #13
0
        internal static void OnSentNotification(iOSNotificationData data)
        {
            var notification = new iOSNotification(data);

            s_OnNotificationReceived(notification);
        }