wxr
2021-11-24 8655407ab6987bb7268fab55b6380051f26668fe
SiriKit/Data/SceneDateManager.cs
File was renamed from HDL-ON_iOS/Other/Siri/Data/SceneDateManager.cs
@@ -9,26 +9,6 @@
    {
        public SceneDateManager() : base(new UserDefaultsStorageDescriptor(NSUserDefaultsHelper.StorageKeys.OrderHistory), new NSMutableArray<SiriScene>()) { }
        // Converts an `Order` into `OrderSoupIntent` and donates it as an
        // interaction to the system so that this order can be suggested in the
        // future or turned into a voice shortcut for quickly placing the same
        // order in the future.
        void DonateInteraction(SiriScene order)
        {
            var interaction = new INInteraction(order.Intent, null);
            interaction.Identifier = order.Id.ToString();
            interaction.DonateInteraction((error) =>
            {
                if (!(error is null))
                {
                    Console.WriteLine($"Interaction donation failed: {error}");
                }
                else
                {
                    Console.WriteLine("Successfully donated interaction.");
                }
            });
        }
        #region Public API for clients of `SoupOrderDataManager`
        // Convenience method to access the data with a property name that makes 
@@ -41,30 +21,6 @@
            }
        }
        public void PlaceOrder(SiriScene order)
        {
            // Access to `ManagedDataBackingInstance` is only valid on
            // `DataAccessQueue`.
            DataAccessQueue.DispatchSync(() =>
            {
                if (ManagedDataBackingInstance.Count == 0)
                {
                    // Getting an error trying to insert at 0 for an empty
                    // NSMutableArray<Order>
                    ManagedDataBackingInstance.Add(order);
                }
                else
                {
                    ManagedDataBackingInstance.Insert(order, 0);
                }
            });
            // Access to UserDefaults is gated behind a separate access queue.
            WriteData();
            // Donate an interaction to the system.
            DonateInteraction(order);
        }
        #endregion
        #region Support methods for unarchiving saved data