NotifyChanges.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. "- Stability improvements to connections"
  19. };
  20. foreach (string s in changes)
  21. {
  22. latestChanges = s + System.Environment.NewLine + latestChanges;
  23. }
  24. if (App.Current.Properties.ContainsKey("NotifiedOfChanges" + MobileUtils.AppVersion.InstalledVersionNumber))
  25. return "";
  26. else
  27. {
  28. App.Current.Properties.Add("NotifiedOfChanges" + MobileUtils.AppVersion.InstalledVersionNumber, "True");
  29. return latestChanges;
  30. }
  31. }
  32. private static void RemoveOldProperties()
  33. {
  34. if (App.Current.Properties.Count > 0)
  35. {
  36. List<string> toDelete = new List<string>();
  37. foreach (string s in App.Current.Properties.Keys)
  38. {
  39. if (s.Contains("NotifiedOfChanges"))
  40. {
  41. if (!s.Equals("NotifiedOfChanges" + MobileUtils.AppVersion.InstalledVersionNumber))
  42. {
  43. toDelete.Add(s);
  44. }
  45. }
  46. }
  47. foreach (string s in toDelete)
  48. {
  49. App.Current.Properties.Remove(s);
  50. }
  51. }
  52. }
  53. }
  54. }