diff --git a/src/lib/appManagers/apiUpdatesManager.ts b/src/lib/appManagers/apiUpdatesManager.ts index 8582d2e1..0ba0436c 100644 --- a/src/lib/appManagers/apiUpdatesManager.ts +++ b/src/lib/appManagers/apiUpdatesManager.ts @@ -689,7 +689,7 @@ export class ApiUpdatesManager { if(newVersion) { this.updatesState.syncLoading.then(() => { - fetch('changelogs/' + newVersion + '.md') + fetch('changelogs/' + newVersion.split(' ')[0] + '.md') .then(res => (res.status === 200 && res.ok && res.text()) || Promise.reject()) .then(text => { const pre = `**Telegram Web${App.suffix} was updated to version alpha ${newVersion}**\n\n`; diff --git a/src/lib/appManagers/appStateManager.ts b/src/lib/appManagers/appStateManager.ts index 892c4841..380d53c5 100644 --- a/src/lib/appManagers/appStateManager.ts +++ b/src/lib/appManagers/appStateManager.ts @@ -28,7 +28,7 @@ import compareVersion from '../../helpers/compareVersion'; const REFRESH_EVERY = 24 * 60 * 60 * 1000; // 1 day // const REFRESH_EVERY = 1e3; //const REFRESH_EVERY_WEEK = 24 * 60 * 60 * 1000 * 7; // 7 days -const STATE_VERSION = App.versionFull; +const STATE_VERSION = App.version; const BUILD = App.build; export type Background = { @@ -421,7 +421,7 @@ export class AppStateManager extends EventListenerBase<{ this.pushToState(missingKey, state[missingKey]); }); - if(state.version !== STATE_VERSION/* || true */) { + if(state.version !== STATE_VERSION || state.build !== BUILD/* || true */) { // reset filters and dialogs if version is older if(compareVersion(state.version, '0.8.7') === -1) { this.state.allDialogsLoaded = copy(STATE_INIT.allDialogsLoaded); @@ -431,8 +431,12 @@ export class AppStateManager extends EventListenerBase<{ result.length = 0; } } + + if(compareVersion(state.version, STATE_VERSION) !== 0) { + this.newVersion = STATE_VERSION; + } - this.pushToState('version', this.newVersion = STATE_VERSION); + this.pushToState('version', STATE_VERSION); this.pushToState('build', BUILD); } diff --git a/src/scripts/generate_changelog.js b/src/scripts/generate_changelog.js index 5883a0c3..5e8e8e6b 100644 --- a/src/scripts/generate_changelog.js +++ b/src/scripts/generate_changelog.js @@ -29,5 +29,6 @@ splitted.forEach(text => { } const firstLine = splitted.shift(); - fs.writeFileSync(writeTo.replace('{VERSION}', firstLine.substr(4)), splitted.join('\n') + '\n'); + const version = firstLine.split(' ')[1]; + fs.writeFileSync(writeTo.replace('{VERSION}', version), splitted.join('\n') + '\n'); });