private void OnOfflinePackProgressChanged(NSNotification notification)
        {
            MGLOfflinePack pack      = notification.Object as MGLOfflinePack;
            var            hash      = pack.GetNativeHash();
            var            completed = pack.State == MGLOfflinePackState.Complete || (pack.Progress.countOfResourcesExpected == pack.Progress.countOfResourcesCompleted);
            OfflinePack    formsPack;

            if (tempPacks.ContainsKey(hash))
            {
                formsPack          = tempPacks[hash];
                formsPack.Progress = pack.Progress.ToFormsProgress();
                formsPack.State    = (OfflinePackState)pack.State;
                if (completed)
                {
                    tempPacks.Remove(hash);
                }
            }
            else
            {
                formsPack = pack.ToFormsPack();
                if (!completed)
                {
                    tempPacks.Add(hash, formsPack);
                }
            }
            OfflinePackProgressChanged?.Invoke(this, new OSSEventArgs()
            {
                OfflinePack = formsPack
            });
        }
        private void OnMaximumMapboxTilesReached(NSNotification notification)
        {
            MGLOfflinePack pack = notification.Object as MGLOfflinePack;

            var         maximumCount = notification.UserInfo[MGLOfflinePackKeys.UserInfoKeyMaximumCount] as NSNumber;
            var         hash         = pack.GetNativeHash();
            OfflinePack formsPack;

            if (tempPacks.ContainsKey(hash))
            {
                formsPack       = tempPacks[hash];
                formsPack.State = (OfflinePackState)pack.State;
                tempPacks.Remove(hash);
            }
            else
            {
                formsPack = pack.ToFormsPack();
            }

            MaximumMapboxTilesReached?.Invoke(this, new OSSMaximumMapboxTilesReachedEventArgs()
            {
                OfflinePack  = formsPack,
                MaximumCount = maximumCount.UInt64Value
            });
        }
        private void OnOfflinePackProgressChanged(NSNotification notification)
        {
            if (downloadDelegate == null)
            {
                return;
            }

            MGLOfflinePack pack      = notification.Object as MGLOfflinePack;
            var            hash      = pack.GetNativeHash();
            var            completed = pack.State == MGLOfflinePackState.Complete || (pack.Progress.countOfResourcesExpected == pack.Progress.countOfResourcesCompleted);
            OfflinePack    formsPack;

            if (tempPacks.ContainsKey(hash))
            {
                formsPack          = tempPacks[hash];
                formsPack.Progress = pack.Progress.ToFormsProgress();
                formsPack.State    = (OfflinePackState)pack.State;
                if (completed)
                {
                    tempPacks.Remove(hash);
                }
            }
            else
            {
                formsPack = pack.ToFormsPack();
                if (!completed)
                {
                    tempPacks.Add(hash, formsPack);
                }
            }
            downloadDelegate.OfflinePackProgressDidChange(formsPack);
        }
        private void OnOfflinePackError(NSNotification notification)
        {
            MGLOfflinePack pack  = notification.Object as MGLOfflinePack;
            NSError        error = notification.UserInfo[MGLOfflinePackKeys.UserInfoKeyError] as NSError;
            OfflinePack    formsPack;
            var            hash = pack.GetNativeHash();

            if (tempPacks.ContainsKey(hash))
            {
                formsPack       = tempPacks[hash];
                formsPack.State = (OfflinePackState)pack.State;
                tempPacks.Remove(hash);
            }
            else
            {
                formsPack = pack.ToFormsPack();
            }
            OfflinePackGotError?.Invoke(this, new OSSErrorEventArgs()
            {
                OfflinePack  = formsPack,
                ErrorMessage = error.LocalizedFailureReason
            });
        }
        private void OnOfflinePackError(NSNotification notification)
        {
            if (downloadDelegate == null)
            {
                return;
            }
            MGLOfflinePack pack  = notification.Object as MGLOfflinePack;
            NSError        error = notification.UserInfo[MGLOfflinePackKeys.UserInfoKeyError] as NSError;
            OfflinePack    formsPack;
            var            hash = pack.GetNativeHash();

            if (tempPacks.ContainsKey(hash))
            {
                formsPack       = tempPacks[hash];
                formsPack.State = (OfflinePackState)pack.State;
                tempPacks.Remove(hash);
            }
            else
            {
                formsPack = pack.ToFormsPack();
            }
            downloadDelegate.OfflinePackDidGetError(formsPack, error.LocalizedFailureReason);
        }
        private void OnMaximumMapboxTilesReached(NSNotification notification)
        {
            if (downloadDelegate == null)
            {
                return;
            }
            MGLOfflinePack pack = notification.Object as MGLOfflinePack;

            var         maximumCount = notification.UserInfo[MGLOfflinePackKeys.UserInfoKeyMaximumCount] as NSNumber;
            var         hash         = pack.GetNativeHash();
            OfflinePack formsPack;

            if (tempPacks.ContainsKey(hash))
            {
                formsPack       = tempPacks[hash];
                formsPack.State = (OfflinePackState)pack.State;
                tempPacks.Remove(hash);
            }
            else
            {
                formsPack = pack.ToFormsPack();
            }
            downloadDelegate.MaximumMapboxTilesWasReached(formsPack, maximumCount.UInt64Value);
        }