IMainModel.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using System;
  2. using Unity.Cloud.Collaborate.Models.Structures;
  3. using JetBrains.Annotations;
  4. namespace Unity.Cloud.Collaborate.Models
  5. {
  6. internal interface IMainModel : IModel
  7. {
  8. /// <summary>
  9. /// Signal when the local state switches between conflicted or not.
  10. /// </summary>
  11. event Action<bool> ConflictStatusChange;
  12. /// <summary>
  13. /// Signal when an operation with progress has started or stopped.
  14. /// </summary>
  15. event Action<bool> OperationStatusChange;
  16. /// <summary>
  17. /// Signal with incremental details of the operation in progress.
  18. /// </summary>
  19. event Action<IProgressInfo> OperationProgressChange;
  20. /// <summary>
  21. /// Signal when an error has occurred.
  22. /// </summary>
  23. event Action<IErrorInfo> ErrorOccurred;
  24. /// <summary>
  25. /// Signal when the error has cleared.
  26. /// </summary>
  27. event Action ErrorCleared;
  28. /// <summary>
  29. /// Signal whether or not the there are remote revisions to be fetched.
  30. /// </summary>
  31. event Action<bool> RemoteRevisionsAvailabilityChange;
  32. /// <summary>
  33. /// Signal when the state of the back button is updated. For example: clearing it or showing a new one.
  34. /// The string included is the new label for the back navigation button. If that value is null, clear the back
  35. /// navigation.
  36. /// </summary>
  37. event Action<string> BackButtonStateUpdated;
  38. /// <summary>
  39. /// Returns true if there are remote revisions available.
  40. /// </summary>
  41. bool RemoteRevisionsAvailable { get; }
  42. /// <summary>
  43. /// Returns true if there's a conflict locally.
  44. /// </summary>
  45. bool Conflicted { get; }
  46. /// <summary>
  47. /// Returns progress info if there is any.
  48. /// </summary>
  49. [CanBeNull]
  50. IProgressInfo ProgressInfo { get; }
  51. /// <summary>
  52. /// Returns error info if there is any.
  53. /// </summary>
  54. [CanBeNull]
  55. IErrorInfo ErrorInfo { get; }
  56. /// <summary>
  57. /// Current tab index being displayed.
  58. /// </summary>
  59. int CurrentTabIndex { get; set; }
  60. /// <summary>
  61. /// Returns a history model.
  62. /// </summary>
  63. /// <returns>Singleton history model for this main model.</returns>
  64. [NotNull]
  65. IHistoryModel ConstructHistoryModel();
  66. /// <summary>
  67. /// Returns a Changes model.
  68. /// </summary>
  69. /// <returns>Singleton change model for this main model.</returns>
  70. [NotNull]
  71. IChangesModel ConstructChangesModel();
  72. /// <summary>
  73. /// Clears any set error.
  74. /// </summary>
  75. void ClearError();
  76. /// <summary>
  77. /// Sync to latest revision.
  78. /// </summary>
  79. void RequestSync();
  80. /// <summary>
  81. /// Request cancel current job.
  82. /// </summary>
  83. void RequestCancelJob();
  84. /// <summary>
  85. /// Returns the current back navigation. Null if none exists presently.
  86. /// </summary>
  87. /// <returns>Current back navigation id, text, and action.</returns>
  88. (string id, string text, Action backAction)? GetBackNavigation();
  89. /// <summary>
  90. /// Register back navigation to be made available to the user to navigate backwards in the UI.
  91. /// </summary>
  92. /// <param name="id">Id for the back event.</param>
  93. /// <param name="text">Text for the back label.</param>
  94. /// <param name="backAction">Action to perform to go back.</param>
  95. void RegisterBackNavigation(string id, string text, Action backAction);
  96. /// <summary>
  97. /// Unregister back navigation if the given id matches the currently displayed back navigation.
  98. /// </summary>
  99. /// <param name="id">Id for the back event.</param>
  100. /// <returns>True if id matched.</returns>
  101. bool UnregisterBackNavigation(string id);
  102. }
  103. }