NotifyChanges.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. "- Update to assignments (use actual/booked)",
  19. "- Improve digital form viewing from tasks",
  20. "- Improve PDF viewer for Androids"
  21. };
  22. foreach (string s in changes)
  23. {
  24. latestChanges = s + System.Environment.NewLine + latestChanges;
  25. }
  26. if (App.Current.Properties.ContainsKey("NotifiedOfChanges" + MobileUtils.AppVersion.InstalledVersionNumber))
  27. return "";
  28. else
  29. {
  30. App.Current.Properties.Add("NotifiedOfChanges" + MobileUtils.AppVersion.InstalledVersionNumber, "True");
  31. return latestChanges;
  32. }
  33. }
  34. private static void RemoveOldProperties()
  35. {
  36. if (App.Current.Properties.Count > 0)
  37. {
  38. List<string> toDelete = new List<string>();
  39. foreach (string s in App.Current.Properties.Keys)
  40. {
  41. if (s.Contains("NotifiedOfChanges"))
  42. {
  43. if (!s.Equals("NotifiedOfChanges" + MobileUtils.AppVersion.InstalledVersionNumber))
  44. {
  45. toDelete.Add(s);
  46. }
  47. }
  48. }
  49. foreach (string s in toDelete)
  50. {
  51. App.Current.Properties.Remove(s);
  52. }
  53. }
  54. }
  55. }
  56. }