refactor: initialise settings from config module and persist only the values

Closes #30, #59
This commit is contained in:
Sebastian Lange
2019-04-29 14:04:25 +02:00
parent e1039aa226
commit 235693a9e2
14 changed files with 1673 additions and 256 deletions

View File

@@ -15,7 +15,7 @@
import {HTTP_INTERCEPTORS, HttpClient,
HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {SCIndexResponse, SCThingType} from '@openstapps/core';
import {SCIndexResponse, SCThingOriginType, SCThingType} from '@openstapps/core';
import {Observable, of} from 'rxjs';
import {map, delay} from 'rxjs/operators';
import {SampleThings} from './data/sample-things';
@@ -55,7 +55,102 @@ const sampleIndexResponse: SCIndexResponse = {
menus: [],
name: 'StApps - Technische Universität Berlin',
privacyPolicyUrl: 'https://stappsbe01.innocampus.tu-berlin.de/_static/privacy.md',
settings: [],
settings: [
{
categories: ['profile'],
description: '',
input: {
defaultValue: 'student',
inputType: 'singleChoice',
values: ['student', 'employee', 'guest'],
},
name: 'group',
order: 1,
origin: {
indexed: '2018-09-11T12:30:00Z',
name: 'Dummy',
type: SCThingOriginType.Remote,
},
translations: {
de: {
categories: ['Benutzer'],
description: 'Mit welcher Benutzergruppe soll die App verwendet werden?'
+ ' Die Einstellung wird beispielsweise für die Vorauswahl der Preiskategorie der Mensa verwendet.',
name: 'Gruppe',
},
en: {
categories: ['User'],
description: 'The user group the app is going to be used.'
+ 'This settings for example is getting used for the predefined price category of mensa meals.',
name: 'Group',
},
},
type: SCThingType.Setting,
uid: '',
},
{
categories: ['profile'],
description: '',
input: {
defaultValue: 'en',
inputType: 'singleChoice',
values: ['en', 'de'],
},
name: 'language',
order: 0,
origin: {
indexed: '2018-09-11T12:30:00Z',
name: 'Dummy',
type: SCThingOriginType.Remote,
},
translations: {
de: {
categories: ['Benutzer'],
description: 'Die Sprache in der die App angezeigt werden soll',
name: 'Sprache',
},
en: {
categories: ['User'],
description: 'The language this app is going to use',
name: 'Language',
},
},
type: SCThingType.Setting,
uid: '',
},
{
categories: ['privacy'],
description: '',
input: {
defaultValue: false,
inputType: 'singleChoice',
values: [true, false],
},
name: 'geoLocation',
order: 0,
origin: {
indexed: '2018-09-11T12:30:00Z',
name: 'Dummy',
type: SCThingOriginType.Remote,
},
translations: {
de: {
categories: ['Privatsphäre'],
description: 'Berechtigung für die Verwendung des Ortungsdienstes, für die Anzeige der aktuellen ' +
'Position \'\n auf der Karte und zur Berechnung der Entfernung zu Gebäuden und Orten des Campus',
name: 'Position',
},
en: {
categories: ['Privacy'],
description: 'Allow the App to use the device location to provide additional informationsbased ' +
'on your actual location',
name: 'Position',
},
},
type: SCThingType.Setting,
uid: '',
},
],
},
backend: {
SCVersion: '1.0.0',