NotifyChanges.cs 1.9 KB

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