feature: add platform layer

This commit is contained in:
Baptiste Grob
2020-08-12 14:31:40 +02:00
parent d9e204fb66
commit 78031eed24
6 changed files with 132 additions and 87 deletions

View File

@@ -26,6 +26,7 @@ import {
} from '@/services';
import { AppState } from '@/ui_models/app_state';
import { SNWebCrypto } from 'sncrypto/dist/sncrypto-web';
import { Platform } from '@/services/platform';
type WebServices = {
appState: AppState
@@ -54,10 +55,15 @@ export class WebApplication extends SNApplication {
$compile: ng.ICompileService,
$timeout: ng.ITimeoutService,
scope: ng.IScope,
onDeinit: (app: WebApplication) => void
onDeinit: (app: WebApplication) => void,
platform: Platform,
) {
const namespace = '';
const deviceInterface = new WebDeviceInterface(namespace, $timeout);
const deviceInterface = new WebDeviceInterface(
namespace,
$timeout,
platform
);
super(
Environment.Web,
platformFromString(getPlatformString()),

View File

@@ -11,6 +11,7 @@ import {
ThemeManager
} from '@/services';
import { AppState } from '@/ui_models/app_state';
import { Platform } from '@/services/platform';
type AppManagerChangeCallback = () => void
@@ -27,7 +28,8 @@ export class ApplicationGroup {
constructor(
$compile: ng.ICompileService,
$rootScope: ng.IRootScopeService,
$timeout: ng.ITimeoutService
$timeout: ng.ITimeoutService,
private platform: Platform
) {
this.$compile = $compile;
this.$timeout = $timeout;
@@ -68,7 +70,8 @@ export class ApplicationGroup {
this.$compile,
this.$timeout,
scope,
this.onApplicationDeinit
this.onApplicationDeinit,
this.platform
);
const appState = new AppState(
this.$rootScope,