NotifyChanges.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using InABox.Mobile;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. using System.Threading;
  6. using System.Threading.Tasks;
  7. using Xamarin.Forms;
  8. namespace comal.timesheets
  9. {
  10. public static class NotifyMobileChanges
  11. {
  12. public static string Notifiy()
  13. {
  14. RemoveOldProperties();
  15. string latestChanges = "";
  16. List<string> changes = new List<string>
  17. {
  18. "- Improvement to Site Manufacturing search",
  19. "- Improve speed + fixes to Store Requis"
  20. };
  21. foreach (string s in changes)
  22. {
  23. latestChanges = s + System.Environment.NewLine + latestChanges;
  24. }
  25. if (App.Current.Properties.ContainsKey("NotifiedOfChanges" + MobileUtils.AppVersion.InstalledVersionNumber))
  26. return "";
  27. else
  28. {
  29. App.Current.Properties.Add("NotifiedOfChanges" + MobileUtils.AppVersion.InstalledVersionNumber, "True");
  30. return latestChanges;
  31. }
  32. }
  33. private static void RemoveOldProperties()
  34. {
  35. if (App.Current.Properties.Count > 0)
  36. {
  37. List<string> toDelete = new List<string>();
  38. foreach (string s in App.Current.Properties.Keys)
  39. {
  40. if (s.Contains("NotifiedOfChanges"))
  41. {
  42. if (!s.Equals("NotifiedOfChanges" + MobileUtils.AppVersion.InstalledVersionNumber))
  43. {
  44. toDelete.Add(s);
  45. }
  46. }
  47. }
  48. foreach (string s in toDelete)
  49. {
  50. App.Current.Properties.Remove(s);
  51. }
  52. }
  53. }
  54. }
  55. }