Skip to content

Commit 9d5850d

Browse files
mgurgelShane Osbourne
andauthored
New states in Release Notes (#1105)
Co-authored-by: Shane Osbourne <[email protected]> Co-authored-by: Marcos Gurgel <[email protected]>
1 parent 9a2d05d commit 9d5850d

26 files changed

+1100
-150
lines changed
Lines changed: 196 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,210 @@
11
{
22
"$schema": "http://json-schema.org/draft-07/schema#",
3-
"type": "object",
43
"title": "UpdateMessage",
54
"additionalProperties": false,
65
"description": "Message sent from browser when release notes are updated",
7-
"properties": {
8-
"status": {
9-
"description": "Current status of version check",
10-
"type": "string",
11-
"enum": ["loading", "loaded", "updateReady"]
12-
},
13-
"currentVersion": {
14-
"description": "Current version of the app",
15-
"type": "string"
6+
"type": "object",
7+
"oneOf": [
8+
{
9+
"type": "object",
10+
"title": "Loading State",
11+
"description": "Loading release notes",
12+
"required": ["status", "currentVersion", "lastUpdate"],
13+
"properties": {
14+
"status": {
15+
"type": "string",
16+
"const": "loading"
17+
},
18+
"currentVersion": {
19+
"description": "Current version of the app",
20+
"type": "string"
21+
},
22+
"lastUpdate": {
23+
"description": "Timestamp of last check for version updates",
24+
"type": "number"
25+
}
26+
}
1627
},
17-
"latestVersion": {
18-
"description": "Latest version of the app. May be the same as currentVersion",
19-
"type": "string"
28+
{
29+
"type": "object",
30+
"title": "Release Notes Loaded State",
31+
"description": "Release notes loaded. Browser is up-to-date",
32+
"required": ["status", "currentVersion", "latestVersion", "lastUpdate"],
33+
"properties": {
34+
"status": {
35+
"type": "string",
36+
"const": "loaded"
37+
},
38+
"currentVersion": {
39+
"description": "Current version of the app",
40+
"type": "string"
41+
},
42+
"latestVersion": {
43+
"description": "Latest version of the app. May be the same as currentVersion",
44+
"type": "string"
45+
},
46+
"lastUpdate": {
47+
"description": "Timestamp of last check for version updates",
48+
"type": "number"
49+
},
50+
"releaseTitle": {
51+
"description": "Name of the current release (e.g. April 26 2024)",
52+
"type": "string"
53+
},
54+
"releaseNotes": {
55+
"description": "Array containing notes for the latest release",
56+
"type": "array",
57+
"items": {
58+
"type": "string"
59+
}
60+
},
61+
"releaseNotesPrivacyPro": {
62+
"description": "Array containing Privacy Pro notes for the latest release",
63+
"type": "array",
64+
"items": {
65+
"type": "string"
66+
}
67+
}
68+
}
2069
},
21-
"lastUpdate": {
22-
"description": "Timestamp of last check for version updates",
23-
"type": "number"
70+
{
71+
"type": "object",
72+
"title": "Update Ready State",
73+
"description": "Update downloaded and installed. Restart to update",
74+
"required": ["status", "automaticUpdate", "currentVersion", "latestVersion", "lastUpdate"],
75+
"properties": {
76+
"status": {
77+
"type": "string",
78+
"enum": ["updateReady", "criticalUpdateReady"]
79+
},
80+
"automaticUpdate": {
81+
"type": "boolean"
82+
},
83+
"currentVersion": {
84+
"description": "Current version of the app",
85+
"type": "string"
86+
},
87+
"latestVersion": {
88+
"description": "Latest version of the app. May be the same as currentVersion",
89+
"type": "string"
90+
},
91+
"lastUpdate": {
92+
"description": "Timestamp of last check for version updates",
93+
"type": "number"
94+
},
95+
"releaseTitle": {
96+
"description": "Name of the current release (e.g. April 26 2024)",
97+
"type": "string"
98+
},
99+
"releaseNotes": {
100+
"description": "Array containing notes for the latest release",
101+
"type": "array",
102+
"items": {
103+
"type": "string"
104+
}
105+
},
106+
"releaseNotesPrivacyPro": {
107+
"description": "Array containing Privacy Pro notes for the latest release",
108+
"type": "array",
109+
"items": {
110+
"type": "string"
111+
}
112+
}
113+
}
24114
},
25-
"releaseTitle": {
26-
"description": "Name of the current release (e.g. April 26 2024)",
27-
"type": "string"
115+
{
116+
"type": "object",
117+
"title": "Update Error State",
118+
"description": "An error occurred during the update process",
119+
"required": ["status", "currentVersion", "latestVersion", "lastUpdate"],
120+
"properties": {
121+
"status": {
122+
"type": "string",
123+
"const": "updateError"
124+
},
125+
"currentVersion": {
126+
"description": "Current version of the app",
127+
"type": "string"
128+
},
129+
"latestVersion": {
130+
"description": "Latest version of the app. May be the same as currentVersion",
131+
"type": "string"
132+
},
133+
"lastUpdate": {
134+
"description": "Timestamp of last check for version updates",
135+
"type": "number"
136+
},
137+
"releaseTitle": {
138+
"description": "Name of the current release (e.g. April 26 2024)",
139+
"type": "string"
140+
},
141+
"releaseNotes": {
142+
"description": "Array containing notes for the latest release",
143+
"type": "array",
144+
"items": {
145+
"type": "string"
146+
}
147+
},
148+
"releaseNotesPrivacyPro": {
149+
"description": "Array containing Privacy Pro notes for the latest release",
150+
"type": "array",
151+
"items": {
152+
"type": "string"
153+
}
154+
}
155+
}
28156
},
29-
"releaseNotes": {
30-
"description": "Array containing notes for the latest release",
31-
"type": "array",
32-
"items": {
33-
"type": "string"
157+
{
158+
"type": "object",
159+
"title": "Downloading Update State",
160+
"description": "An update is available and being downloaded",
161+
"required": ["status", "currentVersion", "latestVersion", "lastUpdate", "downloadProgress"],
162+
"properties": {
163+
"status": {
164+
"type": "string",
165+
"const": "updateDownloading"
166+
},
167+
"currentVersion": {
168+
"description": "Current version of the app",
169+
"type": "string"
170+
},
171+
"latestVersion": {
172+
"description": "Latest version of the app. May be the same as currentVersion",
173+
"type": "string"
174+
},
175+
"lastUpdate": {
176+
"description": "Timestamp of last check for version updates",
177+
"type": "number"
178+
},
179+
"downloadProgress": {
180+
"description": "Download progress of new version as a decimal number from 0 to 1, where 1 is fully downloaded",
181+
"type": "number"
182+
}
34183
}
35184
},
36-
"releaseNotesPrivacyPro": {
37-
"description": "Array containing Privacy Pro notes for the latest release",
38-
"type": "array",
39-
"items": {
40-
"type": "string"
185+
{
186+
"type": "object",
187+
"title": "Preparing Update State",
188+
"description": "An update has been downloaded and is being installed",
189+
"required": ["status", "currentVersion", "latestVersion", "lastUpdate"],
190+
"properties": {
191+
"status": {
192+
"type": "string",
193+
"const": "updatePreparing"
194+
},
195+
"currentVersion": {
196+
"description": "Current version of the app",
197+
"type": "string"
198+
},
199+
"latestVersion": {
200+
"description": "Latest version of the app. May be the same as currentVersion",
201+
"type": "string"
202+
},
203+
"lastUpdate": {
204+
"description": "Timestamp of last check for version updates",
205+
"type": "number"
206+
}
41207
}
42208
}
43-
},
44-
"required": ["currentVersion", "lastUpdate", "status"]
209+
]
45210
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"type": "object",
4+
"title": "RetryUpdate",
5+
"additionalProperties": false,
6+
"description": "Notifies browser that user has requested to retry a failed update"
7+
}

special-pages/pages/release-notes/app/Components.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,22 @@ export function Components () {
5757
<UpdateStatus status="loading" version="1.0.1" timestamp={yesterdayInMilliseconds}/>
5858
<UpdateStatus status="loaded" version="1.0.1" timestamp={todayInMilliseconds}/>
5959
<UpdateStatus status="updateReady" version="1.2.0" timestamp={todayInMilliseconds}/>
60+
<UpdateStatus status="criticalUpdateReady" version="1.2.0" timestamp={todayInMilliseconds}/>
61+
<UpdateStatus status="updateError" version="1.2.0" timestamp={todayInMilliseconds}/>
62+
<UpdateStatus status="updateDownloading" version="1.2.0" timestamp={todayInMilliseconds} progress={0.35}/>
63+
<UpdateStatus status="updatePreparing" version="1.2.0" timestamp={todayInMilliseconds}/>
6064
<hr/>
6165

62-
<h2>Restart Button</h2>
66+
<h2>Update Buttons</h2>
6367
<div>
6468
<Button>{t('restartToUpdate')}</Button>
6569
</div>
70+
<div>
71+
<Button>{t('updateBrowser')}</Button>
72+
</div>
73+
<div>
74+
<Button>{t('retryUpdate')}</Button>
75+
</div>
6676
<hr/>
6777

6878
<h2>Content Placeholder</h2>
@@ -91,16 +101,31 @@ export function Components () {
91101

92102
<h2>Release Notes Inside a Card</h2>
93103
<Card className={styles.card}>
94-
<ReleaseNotesContent status="updateReady" title="May 10 2024" version="1.2.0" notes={sampleNotesData} />
104+
<ReleaseNotesContent title="May 10 2024" currentVersion="1.0.1" latestVersion="1.2.0" notes={sampleNotesData} />
95105
</Card>
96106

97107
<ReleaseNotes releaseData={sampleData.loading} />
98108
<LoadingThen>
99109
<ReleaseNotes releaseData={sampleData.loaded} />
100110
</LoadingThen>
111+
<LoadingThen>
112+
<ReleaseNotes releaseData={sampleData.updateDownloading} />
113+
</LoadingThen>
114+
<LoadingThen>
115+
<ReleaseNotes releaseData={sampleData.updatePreparing} />
116+
</LoadingThen>
117+
<LoadingThen>
118+
<ReleaseNotes releaseData={sampleData.updateError} />
119+
</LoadingThen>
101120
<LoadingThen>
102121
<ReleaseNotes releaseData={sampleData.updateReady} />
103122
</LoadingThen>
123+
<LoadingThen>
124+
<ReleaseNotes releaseData={sampleData.criticalUpdateReady} />
125+
</LoadingThen>
126+
<LoadingThen>
127+
<ReleaseNotes releaseData={/** @type {import('../../../types/release-notes').UpdateMessage} */({ ...sampleData.updateReady, automaticUpdate: false })} />
128+
</LoadingThen>
104129
</main>
105130
)
106131
}

0 commit comments

Comments
 (0)