refactor: use new backend version (2.x.x)

Close #74
This commit is contained in:
Jovan Krunić
2020-11-25 14:25:03 +01:00
parent 987f9d45f5
commit 6647750a6c
6 changed files with 13 additions and 15 deletions

View File

@@ -268,7 +268,7 @@ export const sampleIndexResponse: SCIndexResponse = {
], ],
}, },
backend: { backend: {
SCVersion: '1.0.0', SCVersion: '2.0.0',
externalRequestTimeout: 5000, externalRequestTimeout: 5000,
hiddenTypes: [ hiddenTypes: [
SCThingType.DateSeries, SCThingType.DateSeries,

View File

@@ -81,7 +81,7 @@ describe('ConfigProvider', () => {
expect(await configProvider.getValue('name')).toEqual(sampleIndexResponse.app.name); expect(await configProvider.getValue('name')).toEqual(sampleIndexResponse.app.name);
}); });
it('should init from storage with remote fails', async () => { it('should init from storage when remote fails', async () => {
storageProviderSpy.has.and.returnValue(Promise.resolve(true)); storageProviderSpy.has.and.returnValue(Promise.resolve(true));
storageProviderSpy.get.and.returnValue(Promise.resolve(sampleIndexResponse)); storageProviderSpy.get.and.returnValue(Promise.resolve(sampleIndexResponse));
spyOn(configProvider.client, 'handshake').and.throwError(''); spyOn(configProvider.client, 'handshake').and.throwError('');
@@ -122,7 +122,7 @@ describe('ConfigProvider', () => {
} catch (err) { } catch (err) {
error = err; error = err;
} }
expect(error).toEqual(new WrongConfigVersionInStorage('1.0.0', '0.1.0')); expect(error).toEqual(new WrongConfigVersionInStorage('2.0.0', '0.1.0'));
}); });
it('should throw error on saved app configuration not available', async () => { it('should throw error on saved app configuration not available', async () => {
@@ -230,7 +230,7 @@ const sampleIndexResponse: SCIndexResponse = {
], ],
}, },
backend: { backend: {
SCVersion: '1.0.0', SCVersion: '2.0.0',
externalRequestTimeout: 5000, externalRequestTimeout: 5000,
hiddenTypes: [ hiddenTypes: [
SCThingType.DateSeries, SCThingType.DateSeries,

View File

@@ -38,11 +38,9 @@ export class DataProvider {
*/ */
private _storagePrefix = 'stapps.data'; private _storagePrefix = 'stapps.data';
/** /**
* TODO * Version of the app (used for the header in communication with the backend)
*
* @TODO: get backendUrl and appVersion and storagePrefix from config (module)
*/ */
appVersion = '1.0.6'; appVersion = environment.backend_version;
/** /**
* TODO * TODO
*/ */
@@ -58,7 +56,7 @@ export class DataProvider {
/** /**
* TODO * TODO
* *
* @param stAppsWebHttpClient TODO * @param stAppsWebHttpClient TODO
* @param storageProvider TODO * @param storageProvider TODO
*/ */

View File

@@ -13,8 +13,8 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
export const environment = { export const environment = {
backend_url: 'http://localhost:3000', backend_url: 'https://mobile.server.uni-frankfurt.de',
backend_version: '1.0.0', backend_version: '2.0.0',
use_fake_backend: false, use_fake_backend: false,
production: true, production: true,
}; };

View File

@@ -17,8 +17,8 @@
// `ng build --env=prod` then `environment.prod.ts` will be used instead. // `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`. // The list of which env maps to which file can be found in `.angular-cli.json`.
export const environment = { export const environment = {
backend_url: 'http://localhost:3000', backend_url: 'https://mobile.server.uni-frankfurt.de',
backend_version: '1.0.0', backend_version: '2.0.0',
use_fake_backend: false, use_fake_backend: false,
production: false, production: false,
}; };

View File

@@ -13,8 +13,8 @@
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
export const environment = { export const environment = {
backend_url: 'http://localhost:3000', backend_url: 'https://mobile.server.uni-frankfurt.de',
backend_version: '1.0.0', backend_version: '2.0.0',
use_fake_backend: true, use_fake_backend: true,
production: false, production: false,
}; };