()
| 155 | } |
| 156 | |
| 157 | fetchInstalled(): Promise<boolean> { |
| 158 | const appStore = AppStore() |
| 159 | return new Promise((resolve) => { |
| 160 | if (this.installedFetched) { |
| 161 | this._fetchInstalledResolves.forEach((f) => f(true)) |
| 162 | this._fetchInstalledResolves.splice(0) |
| 163 | resolve(true) |
| 164 | return |
| 165 | } |
| 166 | if (this.fetchInstalleding) { |
| 167 | this._fetchInstalledResolves.push(resolve) |
| 168 | return |
| 169 | } |
| 170 | console.trace('fetchInstalled run: ', this.typeFlag) |
| 171 | this.fetchInstalleding = true |
| 172 | const setup = JSON.parse(JSON.stringify(appStore.config.setup)) |
| 173 | IPC.send('app-fork:version', 'allInstalledVersions', [this.typeFlag], setup).then( |
| 174 | async (key: string, res: any) => { |
| 175 | IPC.off(key) |
| 176 | const versions: { [key in AppModuleEnum]: Array<SoftInstalled> } = res?.data ?? {} |
| 177 | if (Object.prototype.hasOwnProperty.call(versions, this.typeFlag)) { |
| 178 | await this.applyInstalledVersions(versions[this.typeFlag] ?? []) |
| 179 | } |
| 180 | this._fetchInstalledResolves.forEach((f) => f(true)) |
| 181 | this._fetchInstalledResolves.splice(0) |
| 182 | resolve(true) |
| 183 | } |
| 184 | ) |
| 185 | }) |
| 186 | } |
| 187 | |
| 188 | fetchBrew() { |
| 189 | if (this.brewFetching) { |
no test coverage detected