Skip to content

Commit 2e7ec48

Browse files
committed
Some fixes
1 parent ae7bb67 commit 2e7ec48

File tree

5 files changed

+24
-18
lines changed

5 files changed

+24
-18
lines changed

[email protected]/extension.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,10 @@ export default class GithubActionsExtension extends Extension {
7272
onBuildCompleted: (owner, repo, conclusion) => {
7373
NotificationController.showCompletedBuild(owner, repo, conclusion)
7474
},
75-
onReloadCallback: () => {
75+
onReloadCallback: async () => {
7676
this.extensionController.stopRefreshing()
7777
this.disposeExtension()
78+
await new Promise((resolve) => setTimeout(resolve, 2000))
7879
this.initExtension()
7980
this.extensionController.startRefreshing()
8081
},

[email protected]/lib/extension_controller.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -168,23 +168,23 @@ export class ExtensionController {
168168
}
169169
}
170170

171-
refresh() {
171+
async refresh() {
172172
if (this.indicator === null || this.indicator === undefined) {
173173
return
174174
}
175175

176176
this.indicator.initMenu()
177177

178178
try {
179-
this._checkErrors()
180-
this._fetchStatus()
181-
this._fetchData()
179+
await this._checkErrors()
180+
await this._fetchStatus()
181+
await this._fetchData()
182182
} catch (error) {
183183
logError(error)
184184
}
185185
}
186186

187-
startRefreshing() {
187+
async startRefreshing() {
188188
if (this.isStarted === true) {
189189
return
190190
}
@@ -194,11 +194,13 @@ export class ExtensionController {
194194
this.observeSettings(this.settingsRepository)
195195

196196
try {
197-
const settingsRepository = this.settingsRepository
198-
this.refresh()
197+
await new Promise((resolve) => setTimeout(resolve, 2000))
198+
await this.refresh()
199+
await new Promise((resolve) => setTimeout(resolve, 5000))
199200

201+
const settingsRepository = this.settingsRepository
200202
this.stateRefreshInterval = setInterval(() => this._checkErrors(), 1 * 1000)
201-
this.githubActionsRefreshInterval = setInterval(() => this._fetchStatus(), settingsRepository.fetchRefreshTime() * 1000)
203+
this.statusRefreshInterval = setInterval(() => this._fetchStatus(), settingsRepository.fetchRefreshTime() * 1000)
202204
this.dataRefreshInterval = setInterval(() => this._fetchData(), settingsRepository.fetchRefreshFullUpdateTime() * 60 * 1000)
203205
} catch (error) {
204206
logError(error)
@@ -217,8 +219,8 @@ export class ExtensionController {
217219
clearInterval(this.stateRefreshInterval)
218220
this.stateRefreshInterval = null
219221

220-
clearInterval(this.githubActionsRefreshInterval)
221-
this.githubActionsRefreshInterval = null
222+
clearInterval(this.statusRefreshInterval)
223+
this.statusRefreshInterval = null
222224

223225
clearInterval(this.dataRefreshInterval)
224226
this.dataRefreshInterval = null
@@ -408,7 +410,7 @@ export class ExtensionController {
408410
}
409411
}
410412

411-
_checkErrors() {
413+
async _checkErrors() {
412414
if (this.indicator == undefined) {
413415
return
414416
}
@@ -422,7 +424,7 @@ export class ExtensionController {
422424
return
423425
}
424426

425-
this.extensionRepository.checkErrors({
427+
await this.extensionRepository.checkErrors({
426428
onNotInstalledCli: () => {
427429
this.indicator.setState({ state: ExtensionState.NOT_INSTALLED_CLI, forceUpdate: true })
428430
},
@@ -439,7 +441,7 @@ export class ExtensionController {
439441
})
440442
}
441443

442-
_fetchStatus() {
444+
async _fetchStatus() {
443445
if (this.indicator == undefined) {
444446
return
445447
}
@@ -454,7 +456,7 @@ export class ExtensionController {
454456

455457
const { owner, repo } = this.settingsRepository.ownerAndRepo()
456458

457-
this.extensionRepository.fetchStatus({
459+
await this.extensionRepository.fetchStatus({
458460
owner,
459461
repo,
460462
onNoInternet: () => {
@@ -518,7 +520,7 @@ export class ExtensionController {
518520
this.indicator.initMenu()
519521
}
520522

521-
this.extensionRepository.fetchData({
523+
await this.extensionRepository.fetchData({
522524
type,
523525
settingsRepository: this.settingsRepository,
524526
onUserDownloaded: (userObject) => {

[email protected]/lib/file_controller.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ export class FileController {
2727
try {
2828
const [success, content] = GLib.file_get_contents(`${this.extensionDir()}/${filename}`)
2929

30+
3031
if (success) {
31-
return content.toString()
32+
const decoder = new TextDecoder(`utf-8`)
33+
return decoder.decode(content)
3234
}
3335

3436
return null

[email protected]/lib/status_bar_indicator.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,7 @@ export class StatusBarIndicator extends PanelMenu.Button {
10181018
"text": e[`name`].slice(0, textLengthLimiter),
10191019
"callback": () => openUrl(repositoryUrl),
10201020
"endIconName": e[`protected`] ? `changes-prevent-symbolic` : `network-workgroup-symbolic`,
1021+
"endIconCallback": () => {}
10211022
}
10221023
}
10231024

[email protected]/lib/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const VERSION = `3.39.0`
1+
export const VERSION = `3.40.0`

0 commit comments

Comments
 (0)