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