diff --git a/Binaries/GoToBed.apk b/Binaries/GoToBed.apk index d2b8a65..3b336d2 100644 Binary files a/Binaries/GoToBed.apk and b/Binaries/GoToBed.apk differ diff --git a/Binaries/GoToBed.exe b/Binaries/GoToBed.exe index 08187a1..85f36b9 100644 Binary files a/Binaries/GoToBed.exe and b/Binaries/GoToBed.exe differ diff --git a/Client/android/app/src/main/res/xml/config.xml b/Client/android/app/src/main/res/xml/config.xml index d6d87b2..68dea4d 100644 --- a/Client/android/app/src/main/res/xml/config.xml +++ b/Client/android/app/src/main/res/xml/config.xml @@ -11,10 +11,6 @@ - - - - diff --git a/Client/src/app/app-store.module.ts b/Client/src/app/app-store.module.ts index 10b07bf..ca71c0e 100644 --- a/Client/src/app/app-store.module.ts +++ b/Client/src/app/app-store.module.ts @@ -1,14 +1,9 @@ import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; +import { RouterModule } from '@angular/router'; import { StoreRouterConnectingModule } from '@ngrx/router-store'; import { StoreModule } from '@ngrx/store'; import { gotobedReducer } from './store/gotobed.reducer'; -const routes: Routes = [ - { - path: '', - loadChildren: () => import('./components/menu/menu.module').then(page => page.MenuPageModule) - } -]; + @NgModule({ imports: [ StoreModule.forFeature('Gotobed', gotobedReducer), StoreRouterConnectingModule.forRoot(), diff --git a/Client/src/app/app.component.spec.ts b/Client/src/app/app.component.spec.ts index 161e57d..c0e4e14 100644 --- a/Client/src/app/app.component.spec.ts +++ b/Client/src/app/app.component.spec.ts @@ -19,5 +19,4 @@ describe('AppComponent', () => { expect(app).toBeTruthy(); }); // TODO: add more tests! - }); diff --git a/Client/src/app/app.component.ts b/Client/src/app/app.component.ts index ee57019..f639c2c 100644 --- a/Client/src/app/app.component.ts +++ b/Client/src/app/app.component.ts @@ -1,9 +1,4 @@ import { Component } from '@angular/core'; -import { StorageService } from './services/storage.service'; -import { ProtocolStorageKey, PortStorageKey, AddressStorageKey } from './gotobed.models'; -import { GotobedState, initialGotoBedState } from './store/gotobed.state'; -import { Store } from '@ngrx/store'; -import { ProtocolSettingsChanged } from './store/gotobed.actions'; @Component({ selector: 'app-root', @@ -12,10 +7,5 @@ import { ProtocolSettingsChanged } from './store/gotobed.actions'; }) export class AppComponent { - constructor(private storage: StorageService, private _store: Store) { - //this.storage.initializeStorage(); - // this._store.dispatch(new ProtocolSettingsChanged(await this.storage.fetchFromStorage(ProtocolStorageKey).then(protocol => protocol))); - // this.storage.fetchFromStorage(PortStorageKey).then(port => (initialGotoBedState.port = port)); - // this.storage.fetchFromStorage(AddressStorageKey).then(address => (initialGotoBedState.address = address)); - } + constructor() { } } diff --git a/Client/src/app/app.module.ts b/Client/src/app/app.module.ts index 9670d8b..997c03a 100644 --- a/Client/src/app/app.module.ts +++ b/Client/src/app/app.module.ts @@ -5,7 +5,6 @@ import { BrowserModule } from '@angular/platform-browser'; import { RouteReuseStrategy } from '@angular/router'; import { Drivers } from '@ionic/storage'; import { IonicModule, IonicRouteStrategy } from '@ionic/angular'; - import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { MenuPage } from './components/menu/menu.page'; @@ -16,17 +15,17 @@ import { HttpClientModule } from '@angular/common/http'; import { AppStoreModule } from './app-store.module'; import { EffectsModule } from '@ngrx/effects'; import { GotobedStoreModule } from './store/gotobed.store.module'; -import { GotobedEffects } from './store/gotoved.effects'; +import { GotobedEffects } from './store/gotobed.effects'; import { IonicStorageModule } from '@ionic/storage-angular'; -import * as CordovaSQLLiteDriver from 'localforage-cordovasqlitedriver' +import * as CordovaSQLLiteDriver from 'localforage-cordovasqlitedriver'; import { SettingsPage } from './components/settings/settings.page'; import { HTTP } from '@awesome-cordova-plugins/http/ngx'; const components = [ AppComponent, - MenuPage, - ServerSettingsComponent, - SettingsPage, + MenuPage, + ServerSettingsComponent, + SettingsPage, ExploreContainerComponent ]; diff --git a/Client/src/app/components/explore-container/explore-container.component.scss b/Client/src/app/components/explore-container/explore-container.component.scss index 8993e7c..115c06d 100644 --- a/Client/src/app/components/explore-container/explore-container.component.scss +++ b/Client/src/app/components/explore-container/explore-container.component.scss @@ -1,6 +1,5 @@ #container { text-align: center; - position: absolute; left: 0; right: 0; diff --git a/Client/src/app/components/explore-container/explore-container.component.spec.ts b/Client/src/app/components/explore-container/explore-container.component.spec.ts index 77e2dd2..86e7422 100644 --- a/Client/src/app/components/explore-container/explore-container.component.spec.ts +++ b/Client/src/app/components/explore-container/explore-container.component.spec.ts @@ -1,6 +1,5 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { IonicModule } from '@ionic/angular'; - import { ExploreContainerComponent } from './explore-container.component'; describe('ExploreContainerComponent', () => { diff --git a/Client/src/app/components/explore-container/explore-container.component.ts b/Client/src/app/components/explore-container/explore-container.component.ts index 60554cb..c8e4f86 100644 --- a/Client/src/app/components/explore-container/explore-container.component.ts +++ b/Client/src/app/components/explore-container/explore-container.component.ts @@ -11,5 +11,4 @@ export class ExploreContainerComponent implements OnInit { constructor() { } ngOnInit() {} - } diff --git a/Client/src/app/components/explore-container/explore-container.module.ts b/Client/src/app/components/explore-container/explore-container.module.ts index 4376296..cf1f0ff 100644 --- a/Client/src/app/components/explore-container/explore-container.module.ts +++ b/Client/src/app/components/explore-container/explore-container.module.ts @@ -1,9 +1,7 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; - import { IonicModule } from '@ionic/angular'; - import { ExploreContainerComponent } from './explore-container.component'; @NgModule({ diff --git a/Client/src/app/components/home/home.module.ts b/Client/src/app/components/home/home.module.ts index 5ebc501..a15738a 100644 --- a/Client/src/app/components/home/home.module.ts +++ b/Client/src/app/components/home/home.module.ts @@ -4,7 +4,6 @@ import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { HomePage } from './home.page'; import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; - import { HomePageRoutingModule } from './home-routing.module'; import { RouterModule } from '@angular/router'; diff --git a/Client/src/app/components/home/home.page.html b/Client/src/app/components/home/home.page.html index 8aa5769..9e1dcd5 100644 --- a/Client/src/app/components/home/home.page.html +++ b/Client/src/app/components/home/home.page.html @@ -1,8 +1,6 @@ - - Home - + Home @@ -17,7 +15,7 @@ - + Shutdown @@ -30,7 +28,7 @@ - + Sleep @@ -40,7 +38,7 @@ - + Reboot @@ -52,7 +50,7 @@ - + Logout diff --git a/Client/src/app/components/home/home.page.spec.ts b/Client/src/app/components/home/home.page.spec.ts index 40a4a74..42550e7 100644 --- a/Client/src/app/components/home/home.page.spec.ts +++ b/Client/src/app/components/home/home.page.spec.ts @@ -1,7 +1,6 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { IonicModule } from '@ionic/angular'; import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; - import { HomePage } from './home.page'; describe('HomePage', () => { diff --git a/Client/src/app/components/home/home.page.ts b/Client/src/app/components/home/home.page.ts index 7cb2f35..794da22 100644 --- a/Client/src/app/components/home/home.page.ts +++ b/Client/src/app/components/home/home.page.ts @@ -12,17 +12,16 @@ import { getAddress, getCommandType, getPort, getProtocol } from '../../store/go }) export class HomePage implements OnInit{ + commandtype$ = this.store.select(getCommandType); + port = null; + address = ''; + protocol = ''; constructor( public alertController: AlertController, private httpCommand: NetworkRequestsService, - private store: Store) {} - - commandtype$ = this.store.select(getCommandType); - - port = null; - address = ""; - protocol = ""; + private store: Store + ) {} ngOnInit() { this.store @@ -38,27 +37,21 @@ export class HomePage implements OnInit{ .subscribe(protocol => (this.protocol = protocol)); } - async presentAlert(commandType) { + async commandAlert(commandValue) { const alert = await this.alertController.create({ - cssClass: 'my-custom-class', + cssClass: 'alert', header: 'Are you sure?', - message: `You are about to send a ${commandType} command to the device.`, + message: `You are about to send a ${commandValue} command to the device.`, buttons: [ { text: 'Cancel', role: 'cancel', - cssClass: 'secondary', - handler: (blah) => { - console.log('Confirm Cancel: blah'); - this.commandtype$.subscribe(commandType => { - console.log(commandType); - }); - } + cssClass: 'secondary' }, { text: 'Send', handler: () => { - this.store.dispatch(new SendCommandChanged(commandType)); - this.httpCommand.sendCommand(commandType, this.address, this.port, this.protocol); + this.store.dispatch(new SendCommandChanged(commandValue)); + this.httpCommand.sendCommand(commandValue, this.address, this.port, this.protocol); } } ] diff --git a/Client/src/app/components/menu/menu.page.html b/Client/src/app/components/menu/menu.page.html index 3517edf..6bbb91a 100644 --- a/Client/src/app/components/menu/menu.page.html +++ b/Client/src/app/components/menu/menu.page.html @@ -1,5 +1,4 @@ - @@ -16,5 +15,4 @@ Settings - - + \ No newline at end of file diff --git a/Client/src/app/components/menu/menu.page.ts b/Client/src/app/components/menu/menu.page.ts index 0f46599..909d473 100644 --- a/Client/src/app/components/menu/menu.page.ts +++ b/Client/src/app/components/menu/menu.page.ts @@ -7,7 +7,5 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; changeDetection: ChangeDetectionStrategy.OnPush, }) export class MenuPage { - constructor() {} - } diff --git a/Client/src/app/components/searchHost/searchHost.module.ts b/Client/src/app/components/searchHost/searchHost.module.ts index 26b0459..b956852 100644 --- a/Client/src/app/components/searchHost/searchHost.module.ts +++ b/Client/src/app/components/searchHost/searchHost.module.ts @@ -1,11 +1,9 @@ import { IonicModule } from '@ionic/angular'; -import { RouterModule } from '@angular/router'; import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { SearchHostPage } from './searchHost.page'; import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; - import { SearchHostPageRoutingModule } from './searchHost-routing.module'; @NgModule({ diff --git a/Client/src/app/components/searchHost/searchHost.page.html b/Client/src/app/components/searchHost/searchHost.page.html index c560309..c015f18 100644 --- a/Client/src/app/components/searchHost/searchHost.page.html +++ b/Client/src/app/components/searchHost/searchHost.page.html @@ -1,17 +1,15 @@ - - Search Host - + Search Host - Tab 2 + WOL - + diff --git a/Client/src/app/components/searchHost/searchHost.page.spec.ts b/Client/src/app/components/searchHost/searchHost.page.spec.ts index 98edc87..8505839 100644 --- a/Client/src/app/components/searchHost/searchHost.page.spec.ts +++ b/Client/src/app/components/searchHost/searchHost.page.spec.ts @@ -1,7 +1,6 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { IonicModule } from '@ionic/angular'; import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; - import { SearchHostPage } from './searchHost.page'; describe('SearchHostPage', () => { diff --git a/Client/src/app/components/searchHost/searchHost.page.ts b/Client/src/app/components/searchHost/searchHost.page.ts index 42d7770..43353bc 100644 --- a/Client/src/app/components/searchHost/searchHost.page.ts +++ b/Client/src/app/components/searchHost/searchHost.page.ts @@ -1,29 +1,8 @@ import { Component } from '@angular/core'; @Component({ - selector: 'app-searchHost', + selector: 'app-searchhost', templateUrl: 'searchHost.page.html', styleUrls: ['searchHost.page.scss'] }) -export class SearchHostPage { - - constructor() {} - testText = ''; - - test() { - // console.log("!test") - // // Zeroconf.watchAddressFamily = 'ipv4'; - // // Zeroconf.watch('_http._tcp.', 'local.').subscribe(result => { - // // this.testText = JSON.stringify(result.service.ipv4Addresses); - // // console.log(JSON.stringify(result.service.ipv4Addresses)) - // // }); - - // ServiceDiscovery.getNetworkServices('ssdp:all') - // .then(devices => { - // console.log(JSON.stringify(devices)) - // this.testText = JSON.stringify(devices) - // }) - // .catch(error => console.error(error)); - - } -} +export class SearchHostPage { } diff --git a/Client/src/app/components/settings/serverSettings/serverSettings.component.html b/Client/src/app/components/settings/serverSettings/serverSettings.component.html index 882ccea..3846716 100644 --- a/Client/src/app/components/settings/serverSettings/serverSettings.component.html +++ b/Client/src/app/components/settings/serverSettings/serverSettings.component.html @@ -1,6 +1,6 @@ - Remote Server Settings + Remote Server Settings Protocol diff --git a/Client/src/app/components/settings/serverSettings/serverSettings.component.spec.ts b/Client/src/app/components/settings/serverSettings/serverSettings.component.spec.ts index 88d1a1e..7b1a66d 100644 --- a/Client/src/app/components/settings/serverSettings/serverSettings.component.spec.ts +++ b/Client/src/app/components/settings/serverSettings/serverSettings.component.spec.ts @@ -1,8 +1,4 @@ -/* tslint:disable:no-unused-variable */ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - import { ServerSettingsComponent } from './serverSettings.component'; describe('ServerSettingsComponent', () => { diff --git a/Client/src/app/components/settings/serverSettings/serverSettings.component.ts b/Client/src/app/components/settings/serverSettings/serverSettings.component.ts index e1753bb..794d40b 100644 --- a/Client/src/app/components/settings/serverSettings/serverSettings.component.ts +++ b/Client/src/app/components/settings/serverSettings/serverSettings.component.ts @@ -1,6 +1,5 @@ import { getAddress, getPort, getProtocol } from './../../../store/gotobed.selectors'; import { Store } from '@ngrx/store'; - import { Component, OnInit } from '@angular/core'; import { PortSettingsChanged, ProtocolSettingsChanged, SaveAddressSettings } from 'src/app/store/gotobed.actions'; import { GotobedState } from 'src/app/store/gotobed.state'; @@ -12,38 +11,37 @@ import { InputCustomEvent } from 'src/app/gotobed.models'; styleUrls: ['./serverSettings.component.scss'] }) export class ServerSettingsComponent implements OnInit{ - - constructor(private _store: Store) { } - port = null; - address = ""; - protocol = ""; + address = ''; + protocol = ''; + + constructor(private store: Store) { } ngOnInit() { - console.log("#Render server settings"); - this._store + console.log('#Render server settings'); + this.store .select(getPort) .subscribe(port => (this.port = port)); - this._store + this.store .select(getAddress) .subscribe(address => (this.address = address)); - this._store + this.store .select(getProtocol) .subscribe(protocol => (this.protocol = protocol)); } onProtocolChange(protocol: InputCustomEvent){ - console.log(protocol.detail.value) - this._store.dispatch(new ProtocolSettingsChanged(protocol.detail.value)); + console.log(protocol.detail.value); + this.store.dispatch(new ProtocolSettingsChanged(protocol.detail.value)); } onAddressChange(address: InputCustomEvent){ - console.log(address.detail.value) - this._store.dispatch(new SaveAddressSettings(address.detail.value)); + console.log(address.detail.value); + this.store.dispatch(new SaveAddressSettings(address.detail.value)); } onPortChange(port: InputCustomEvent){ - console.log(port.detail.value) - this._store.dispatch(new PortSettingsChanged(port.detail.value)); + console.log(port.detail.value); + this.store.dispatch(new PortSettingsChanged(port.detail.value)); } } diff --git a/Client/src/app/components/settings/settings.module.ts b/Client/src/app/components/settings/settings.module.ts index 46350e1..339504d 100644 --- a/Client/src/app/components/settings/settings.module.ts +++ b/Client/src/app/components/settings/settings.module.ts @@ -6,7 +6,6 @@ import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; import { SettingsPage } from './settings.page'; import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; - import { SettingsPageRoutingModule } from './settings-routing.module'; @NgModule({ diff --git a/Client/src/app/components/settings/settings.page.html b/Client/src/app/components/settings/settings.page.html index c1ebfaa..c5d0ac8 100644 --- a/Client/src/app/components/settings/settings.page.html +++ b/Client/src/app/components/settings/settings.page.html @@ -1,12 +1,10 @@ - - Settings - + Settings -< + Settings diff --git a/Client/src/app/components/settings/settings.page.spec.ts b/Client/src/app/components/settings/settings.page.spec.ts index f0df195..b39fd4b 100644 --- a/Client/src/app/components/settings/settings.page.spec.ts +++ b/Client/src/app/components/settings/settings.page.spec.ts @@ -1,7 +1,6 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { IonicModule } from '@ionic/angular'; import { ExploreContainerComponentModule } from '../explore-container/explore-container.module'; - import { SettingsPage } from './settings.page'; describe('SettingsPage', () => { diff --git a/Client/src/app/components/settings/settings.page.ts b/Client/src/app/components/settings/settings.page.ts index 2d22982..82d5faa 100644 --- a/Client/src/app/components/settings/settings.page.ts +++ b/Client/src/app/components/settings/settings.page.ts @@ -5,8 +5,4 @@ import { Component } from '@angular/core'; templateUrl: 'settings.page.html', styleUrls: ['settings.page.scss'] }) -export class SettingsPage { - - constructor() {} - -} +export class SettingsPage { } diff --git a/Client/src/app/gotobed.models.ts b/Client/src/app/gotobed.models.ts index db4e1ec..83332f7 100644 --- a/Client/src/app/gotobed.models.ts +++ b/Client/src/app/gotobed.models.ts @@ -1,13 +1,13 @@ -export const AddressStorageKey = "AddressKey"; -export const PortStorageKey = "PortKey"; -export const ProtocolStorageKey = "ProtocolKey"; -export const CommandStorageKey = "CommandKey"; +export const addressStorageKey = 'AddressKey'; +export const portStorageKey = 'PortKey'; +export const protocolStorageKey = 'ProtocolKey'; +export const commandStorageKey = 'CommandKey'; export interface InputChangeEventDetail { value: string | undefined | null; } - + export interface InputCustomEvent extends CustomEvent { detail: InputChangeEventDetail; target: HTMLIonInputElement; @@ -15,4 +15,4 @@ export interface InputCustomEvent extends CustomEvent { export interface NetRequest{ command: string; -} \ No newline at end of file +} diff --git a/Client/src/app/services/dialog.service.ts b/Client/src/app/services/dialog.service.ts deleted file mode 100644 index e69de29..0000000 diff --git a/Client/src/app/services/networkRequests.service.ts b/Client/src/app/services/networkRequests.service.ts index ba9bc42..0893118 100644 --- a/Client/src/app/services/networkRequests.service.ts +++ b/Client/src/app/services/networkRequests.service.ts @@ -8,18 +8,18 @@ import { HttpErrorResponse } from '@angular/common/http'; providedIn: 'root' }) export class NetworkRequestsService { - constructor(private readonly _httpClient: HTTP, public toastController: ToastController) { } + constructor(private readonly httpClient: HTTP, public toastController: ToastController) { } public sendCommand(command: string, address: string, port: number, connectionProtocol?: string,) { const request: NetRequest = { - command: command, - } + command, + }; - this._httpClient.setDataSerializer('json'); - this._httpClient.setServerTrustMode('nocheck'); + this.httpClient.setDataSerializer('json'); + this.httpClient.setServerTrustMode('nocheck'); - this._httpClient.post(encodeURI(`${connectionProtocol ?? 'http'}://${address + ":" + port}/commandbridge`), request, { - ContentType: 'text/html;' + this.httpClient.post(encodeURI(`${connectionProtocol ?? 'http'}://${address + ':' + port}/commandbridge`), request, { + contentType: 'text/html;' }).catch(response => { this.showErrorMessage(response); }); @@ -34,4 +34,4 @@ export class NetworkRequestsService { }); toast.present(); } -} \ No newline at end of file +} diff --git a/Client/src/app/services/storage.service.ts b/Client/src/app/services/storage.service.ts index 363151e..9eb6399 100644 --- a/Client/src/app/services/storage.service.ts +++ b/Client/src/app/services/storage.service.ts @@ -1,19 +1,19 @@ -import { Injectable } from "@angular/core"; -import { Storage } from "@ionic/storage-angular"; -import * as cordovaSQLiteDriver from "localforage-cordovasqlitedriver"; -import { BehaviorSubject, from, of } from "rxjs"; -import { filter, switchMap, tap } from "rxjs/operators"; +import { Injectable } from '@angular/core'; +import { Storage } from '@ionic/storage-angular'; +import * as cordovaSQLiteDriver from 'localforage-cordovasqlitedriver'; +import { BehaviorSubject, from, of } from 'rxjs'; +import { filter, switchMap, tap } from 'rxjs/operators'; @Injectable({ - providedIn: "root" + providedIn: 'root' }) export class StorageService { - constructor(private storage: Storage) { - //this.initializeStorage(); - } - private isStorageLoaded = new BehaviorSubject(false); + constructor(private storage: Storage) { + //this.initializeStorage(); TO BE USED ONCE MIGRATING TO NATIVE STORAGE + } + async initializeStorage() { await this.storage.defineDriver(cordovaSQLiteDriver); await this.storage.create(); @@ -39,4 +39,4 @@ export class StorageService { const newData = currentData.pipe(tap(existingData => existingData.splice(data, 1))); this.storage.set(key, newData); } -} \ No newline at end of file +} diff --git a/Client/src/app/store/gotobed.actions.ts b/Client/src/app/store/gotobed.actions.ts index 3bfa987..620b671 100644 --- a/Client/src/app/store/gotobed.actions.ts +++ b/Client/src/app/store/gotobed.actions.ts @@ -2,41 +2,41 @@ import { Action } from '@ngrx/store'; import { LoadSettingsState } from './gotobed.state'; export enum EGotobedActions { - SendCommandChanged = '[GOTOBED] Command changed', - AddressSettingsChanged = '[GOTOBED] Address settings changed', - ProtocolSettingsChanged = '[GOTOBED] Protocol settings changed', - PortSettingsChanged = '[GOTOBED] Port settings changed', - AppInitialized = '[GOTOBED] App initialized', + sendCommandChanged = '[GOTOBED] Command changed', + addressSettingsChanged = '[GOTOBED] Address settings changed', + protocolSettingsChanged = '[GOTOBED] Protocol settings changed', + portSettingsChanged = '[GOTOBED] Port settings changed', + appInitialized = '[GOTOBED] App initialized', } export class SendCommandChanged implements Action { - public readonly type = EGotobedActions.SendCommandChanged; + public readonly type = EGotobedActions.sendCommandChanged; constructor(public payload: string) { } } export class SaveAddressSettings implements Action { - public readonly type = EGotobedActions.AddressSettingsChanged; + public readonly type = EGotobedActions.addressSettingsChanged; constructor(public payload: string) { } } export class ProtocolSettingsChanged implements Action { - public readonly type = EGotobedActions.ProtocolSettingsChanged; + public readonly type = EGotobedActions.protocolSettingsChanged; constructor(public payload: string) { } } export class PortSettingsChanged implements Action { - public readonly type = EGotobedActions.PortSettingsChanged; + public readonly type = EGotobedActions.portSettingsChanged; constructor(public payload: string) { } } export class AppInitialized implements Action { - public readonly type = EGotobedActions.AppInitialized; + public readonly type = EGotobedActions.appInitialized; constructor(public payload: LoadSettingsState) { } } -export type GotobedActions = +export type GotobedActions = SendCommandChanged | -ProtocolSettingsChanged | +ProtocolSettingsChanged | PortSettingsChanged | -SaveAddressSettings | +SaveAddressSettings | AppInitialized; diff --git a/Client/src/app/store/gotobed.effects.ts b/Client/src/app/store/gotobed.effects.ts new file mode 100644 index 0000000..a683444 --- /dev/null +++ b/Client/src/app/store/gotobed.effects.ts @@ -0,0 +1,57 @@ +import { portStorageKey } from '../gotobed.models'; +import { Injectable } from '@angular/core'; +import { Actions, createEffect, ofType, concatLatestFrom, ROOT_EFFECTS_INIT } from '@ngrx/effects'; +import { Store } from '@ngrx/store'; +import { map, tap, withLatestFrom } from 'rxjs/operators'; +import { addressStorageKey, protocolStorageKey } from '../gotobed.models'; +import { StorageService } from '../services/storage.service'; +import { AppInitialized, EGotobedActions, ProtocolSettingsChanged, SaveAddressSettings } from './gotobed.actions'; + +@Injectable() +export class GotobedEffects { + + init$ = createEffect(() => + this.actions$.pipe( + ofType(ROOT_EFFECTS_INIT), + concatLatestFrom(() => this.store), + map(async ([action]) => { + this.storage.initializeStorage(); + return action.payload = { + address: localStorage.getItem(addressStorageKey), + port: localStorage.getItem(portStorageKey), + protocol: localStorage.getItem(protocolStorageKey), + }; + }) + ), { dispatch: false } + ); + + saveAddressSettings$ = createEffect(() => this.actions$.pipe( + ofType(EGotobedActions.addressSettingsChanged), + withLatestFrom(this.store), + tap(([action]) => { + localStorage.setItem(addressStorageKey, action.payload); + }) + ), { dispatch: false }); + + saveProtocolSettings$ = createEffect(() => this.actions$.pipe( + ofType(EGotobedActions.protocolSettingsChanged), + withLatestFrom(this.store), + tap(([action]) => { + localStorage.setItem(protocolStorageKey, action.payload); + }) + ), { dispatch: false }); + + savePortSettings$ = createEffect(() => this.actions$.pipe( + ofType(EGotobedActions.portSettingsChanged), + withLatestFrom(this.store), + tap(([action]) => { + localStorage.setItem(portStorageKey, action.payload); + }) + ), { dispatch: false }); + + constructor( + private readonly actions$: Actions, + private readonly store: Store, + private storage: StorageService + ) { } +} diff --git a/Client/src/app/store/gotobed.reducer.ts b/Client/src/app/store/gotobed.reducer.ts index 3392393..d5deb04 100644 --- a/Client/src/app/store/gotobed.reducer.ts +++ b/Client/src/app/store/gotobed.reducer.ts @@ -3,22 +3,22 @@ import { GotobedState, initialGotoBedState } from './gotobed.state'; export function gotobedReducer(state = initialGotoBedState, action: GotobedActions): GotobedState { switch (action.type) { - case EGotobedActions.SendCommandChanged: + case EGotobedActions.sendCommandChanged: return { ...state, command: action.payload, }; - case EGotobedActions.ProtocolSettingsChanged: + case EGotobedActions.protocolSettingsChanged: return { ...state, protocol: action.payload, }; - case EGotobedActions.AddressSettingsChanged: + case EGotobedActions.addressSettingsChanged: return { ...state, address: action.payload, }; - case EGotobedActions.PortSettingsChanged: + case EGotobedActions.portSettingsChanged: return { ...state, port: action.payload, @@ -26,4 +26,4 @@ export function gotobedReducer(state = initialGotoBedState, action: GotobedActio default: return state; } -} +}; diff --git a/Client/src/app/store/gotobed.state.ts b/Client/src/app/store/gotobed.state.ts index c8bfaa2..a648c77 100644 --- a/Client/src/app/store/gotobed.state.ts +++ b/Client/src/app/store/gotobed.state.ts @@ -1,8 +1,7 @@ -import { AddressStorageKey, PortStorageKey, ProtocolStorageKey } from "../gotobed.models"; +import { addressStorageKey, portStorageKey, protocolStorageKey } from '../gotobed.models'; export const storeName = 'Gotobed'; - export interface GotobedState { command: string; isLoading: boolean; @@ -15,9 +14,9 @@ export interface GotobedState { export const initialGotoBedState: GotobedState = { command: '', isLoading: false, - protocol: localStorage.getItem(ProtocolStorageKey) ?? "http", - port: localStorage.getItem(PortStorageKey) ?? '3000', - address: localStorage.getItem(AddressStorageKey) ?? 'localhost:8080', + protocol: localStorage.getItem(protocolStorageKey) ?? 'http', + port: localStorage.getItem(portStorageKey) ?? '3000', + address: localStorage.getItem(addressStorageKey) ?? 'localhost:8080', isConnected: false, }; @@ -25,4 +24,4 @@ export interface LoadSettingsState { protocol: string; port: string; address: string; -} \ No newline at end of file +} diff --git a/Client/src/app/store/gotobed.store.module.ts b/Client/src/app/store/gotobed.store.module.ts index 78ecaab..4e31a85 100644 --- a/Client/src/app/store/gotobed.store.module.ts +++ b/Client/src/app/store/gotobed.store.module.ts @@ -2,7 +2,7 @@ import { NgModule } from '@angular/core'; import { EffectsModule } from '@ngrx/effects'; import { StoreModule } from '@ngrx/store'; import { gotobedReducer } from './gotobed.reducer'; -import { GotobedEffects } from './gotoved.effects'; +import { GotobedEffects } from './gotobed.effects'; @NgModule({ imports: [ diff --git a/Client/src/app/store/gotoved.effects.ts b/Client/src/app/store/gotoved.effects.ts deleted file mode 100644 index bd1815c..0000000 --- a/Client/src/app/store/gotoved.effects.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { PortStorageKey } from './../gotobed.models'; -import { Injectable } from '@angular/core'; -import { Actions, createEffect, ofType, concatLatestFrom, ROOT_EFFECTS_INIT } from '@ngrx/effects'; -import { Store } from '@ngrx/store'; -import { map, tap, withLatestFrom } from 'rxjs/operators'; -import { AddressStorageKey, ProtocolStorageKey } from '../gotobed.models'; -import { StorageService } from '../services/storage.service'; -import { AppInitialized, EGotobedActions, ProtocolSettingsChanged, SaveAddressSettings, SendCommandChanged } from './gotobed.actions'; - -@Injectable() -export class GotobedEffects { - - init$ = createEffect(() => - this._actions$.pipe( - ofType(ROOT_EFFECTS_INIT), - concatLatestFrom(() => this._store), - map(async ([action]) => { - this.storage.initializeStorage(); - console.log("Loading# Srorage") - return action.payload = { - address: localStorage.getItem(AddressStorageKey), - port: localStorage.getItem(PortStorageKey), - protocol: localStorage.getItem(ProtocolStorageKey), - } - }) - ), { dispatch: false } - ); - - saveAddressSettings$ = createEffect(() => this._actions$.pipe( - ofType(EGotobedActions.AddressSettingsChanged), - withLatestFrom(this._store), - tap(([action, state]) => { - //this.storage.addToStorage(ProtocolStorageKey, action.payload); - localStorage.setItem(AddressStorageKey, action.payload); - }) - ), { dispatch: false }); - - logCommand$ = createEffect(() => this._actions$.pipe( - ofType(EGotobedActions.SendCommandChanged), - withLatestFrom(this._store), - tap(([action, state]) => { - //this.storage.addToStorage(AddressStorageKey, action.payload); - }) - ), { dispatch: false }); - - saveProtocolSettings$ = createEffect(() => this._actions$.pipe( - ofType(EGotobedActions.ProtocolSettingsChanged), - withLatestFrom(this._store), - tap(([action, state]) => { - //this.storage.addToStorage(ProtocolStorageKey, action.payload); - localStorage.setItem(ProtocolStorageKey, action.payload); - }) - ), { dispatch: false }); - - savePortSettings$ = createEffect(() => this._actions$.pipe( - ofType(EGotobedActions.PortSettingsChanged), - withLatestFrom(this._store), - tap(([action, state]) => { - //this.storage.addToStorage(PortStorageKey, action.payload); - localStorage.setItem(PortStorageKey, action.payload); - }) - ), { dispatch: false }); - - constructor( - private readonly _actions$: Actions, - private readonly _store: Store, - private storage: StorageService - ) { } -} diff --git a/Client/src/global.scss b/Client/src/global.scss index ff85e21..e858ceb 100644 --- a/Client/src/global.scss +++ b/Client/src/global.scss @@ -1,28 +1,10 @@ -/* - * App Global CSS - * ---------------------------------------------------------------------------- - * Put style rules here that you want to apply globally. These styles are for - * the entire app and not just one component. Additionally, this file can be - * used as an entry point to import other CSS/Sass files to be included in the - * output CSS. - * For more information on global stylesheets, visit the documentation: - * https://ionicframework.com/docs/layout/global-stylesheets - */ - -/* Core CSS required for Ionic components to work properly */ @import "~@ionic/angular/css/core.css"; - -/* Basic CSS for apps built with Ionic */ @import "~@ionic/angular/css/normalize.css"; @import "~@ionic/angular/css/structure.css"; @import "~@ionic/angular/css/typography.css"; @import '~@ionic/angular/css/display.css'; - -/* Optional CSS utils that can be commented out */ @import "~@ionic/angular/css/padding.css"; @import "~@ionic/angular/css/float-elements.css"; @import "~@ionic/angular/css/text-alignment.css"; @import "~@ionic/angular/css/text-transformation.css"; -@import "~@ionic/angular/css/flex-utils.css"; - -// $nb-enable-css-custom-properties: false; // <-- enable css custom properties +@import "~@ionic/angular/css/flex-utils.css"; \ No newline at end of file diff --git a/Client/src/index.html b/Client/src/index.html index 2ad11c5..75192dc 100644 --- a/Client/src/index.html +++ b/Client/src/index.html @@ -1,26 +1,19 @@ - - - - GOTOBED - - - - - - - - - - - - - - - - - - - + + + GOTOBED + + + + + + + + + + + + + diff --git a/Client/src/main.ts b/Client/src/main.ts index 91ec6da..0da3f9e 100644 --- a/Client/src/main.ts +++ b/Client/src/main.ts @@ -1,6 +1,5 @@ import { enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; - import { AppModule } from './app/app.module'; import { environment } from './environments/environment'; diff --git a/Client/src/theme/variables.scss b/Client/src/theme/variables.scss index a90b066..f32a91b 100644 --- a/Client/src/theme/variables.scss +++ b/Client/src/theme/variables.scss @@ -1,10 +1,4 @@ - -// Ionic Variables and Theming. For more info, please see: -// http://ionicframework.com/docs/theming/ - -/** Ionic CSS Variables **/ :root { - /** primary **/ --ion-color-primary: #3880ff; --ion-color-primary-rgb: 56, 128, 255; --ion-color-primary-contrast: #ffffff; @@ -379,396 +373,5 @@ --ion-color-shade: var(--ion-color-academind-shade); --ion-color-tint: var(--ion-color-academind-tint); } -// } - - -// // Ionic Variables and Theming. For more info, please see: -// // http://ionicframework.com/docs/theming/ - -// /** Ionic CSS Variables **/ -// :root { -// /** primary **/ -// --ion-color-primary: #3880FF; -// --ion-color-primary-rgb: 56, 128, 255; -// --ion-color-primary-contrast: #ffffff; -// --ion-color-primary-contrast-rgb: 255, 255, 255; -// --ion-color-primary-shade: #3171e0; -// --ion-color-primary-tint: #4c8dff; - -// /** secondary **/ -// --ion-color-secondary: #3dc2ff; -// --ion-color-secondary-rgb: 61, 194, 255; -// --ion-color-secondary-contrast: #ffffff; -// --ion-color-secondary-contrast-rgb: 255, 255, 255; -// --ion-color-secondary-shade: #36abe0; -// --ion-color-secondary-tint: #50c8ff; - -// /** tertiary **/ -// --ion-color-tertiary: #5260ff; -// --ion-color-tertiary-rgb: 82, 96, 255; -// --ion-color-tertiary-contrast: #ffffff; -// --ion-color-tertiary-contrast-rgb: 255, 255, 255; -// --ion-color-tertiary-shade: #4854e0; -// --ion-color-tertiary-tint: #6370ff; - -// /** success **/ -// --ion-color-success: #2dd36f; -// --ion-color-success-rgb: 45, 211, 111; -// --ion-color-success-contrast: #ffffff; -// --ion-color-success-contrast-rgb: 255, 255, 255; -// --ion-color-success-shade: #28ba62; -// --ion-color-success-tint: #42d77d; - -// /** warning **/ -// --ion-color-warning: #ffc409; -// --ion-color-warning-rgb: 255, 196, 9; -// --ion-color-warning-contrast: #000000; -// --ion-color-warning-contrast-rgb: 0, 0, 0; -// --ion-color-warning-shade: #e0ac08; -// --ion-color-warning-tint: #ffca22; - -// /** danger **/ -// --ion-color-danger: #eb445a; -// --ion-color-danger-rgb: 235, 68, 90; -// --ion-color-danger-contrast: #ffffff; -// --ion-color-danger-contrast-rgb: 255, 255, 255; -// --ion-color-danger-shade: #cf3c4f; -// --ion-color-danger-tint: #ed576b; - -// /** dark **/ -// --ion-color-dark: #222428; -// --ion-color-dark-rgb: 34, 36, 40; -// --ion-color-dark-contrast: #ffffff; -// --ion-color-dark-contrast-rgb: 255, 255, 255; -// --ion-color-dark-shade: #1e2023; -// --ion-color-dark-tint: #383a3e; - -// /** medium **/ -// --ion-color-medium: #92949c; -// --ion-color-medium-rgb: 146, 148, 156; -// --ion-color-medium-contrast: #ffffff; -// --ion-color-medium-contrast-rgb: 255, 255, 255; -// --ion-color-medium-shade: #808289; -// --ion-color-medium-tint: #9d9fa6; - -// /** light **/ -// --ion-color-light: #f4f5f8; -// --ion-color-light-rgb: 244, 245, 248; -// --ion-color-light-contrast: #000000; -// --ion-color-light-contrast-rgb: 0, 0, 0; -// --ion-color-light-shade: #d7d8da; -// --ion-color-light-tint: #f5f6f9; -// } - -// @media (prefers-color-scheme: dark) { -// /* -// * Dark Colors -// * ------------------------------------------- -// */ - -// body { -// --ion-color-primary: #afccff; -// --ion-color-primary-rgb: 175, 204, 255; -// --ion-color-primary-contrast: #000000; -// --ion-color-primary-contrast-rgb: 0, 0, 0; -// --ion-color-primary-shade: #9ab4e0; -// --ion-color-primary-tint: #b7d1ff; - -// --ion-color-secondary: #50c8ff; -// --ion-color-secondary-rgb: 80,200,255; -// --ion-color-secondary-contrast: #ffffff; -// --ion-color-secondary-contrast-rgb: 255,255,255; -// --ion-color-secondary-shade: #46b0e0; -// --ion-color-secondary-tint: #62ceff; - -// --ion-color-tertiary: #6a64ff; -// --ion-color-tertiary-rgb: 106,100,255; -// --ion-color-tertiary-contrast: #ffffff; -// --ion-color-tertiary-contrast-rgb: 255,255,255; -// --ion-color-tertiary-shade: #5d58e0; -// --ion-color-tertiary-tint: #7974ff; - -// --ion-color-success: #2fdf75; -// --ion-color-success-rgb: 47,223,117; -// --ion-color-success-contrast: #000000; -// --ion-color-success-contrast-rgb: 0,0,0; -// --ion-color-success-shade: #29c467; -// --ion-color-success-tint: #44e283; - -// --ion-color-warning: #ffd534; -// --ion-color-warning-rgb: 255,213,52; -// --ion-color-warning-contrast: #000000; -// --ion-color-warning-contrast-rgb: 0,0,0; -// --ion-color-warning-shade: #e0bb2e; -// --ion-color-warning-tint: #ffd948; - -// --ion-color-danger: #ff4961; -// --ion-color-danger-rgb: 255,73,97; -// --ion-color-danger-contrast: #ffffff; -// --ion-color-danger-contrast-rgb: 255,255,255; -// --ion-color-danger-shade: #e04055; -// --ion-color-danger-tint: #ff5b71; - -// --ion-color-dark: #f4f5f8; -// --ion-color-dark-rgb: 244,245,248; -// --ion-color-dark-contrast: #000000; -// --ion-color-dark-contrast-rgb: 0,0,0; -// --ion-color-dark-shade: #d7d8da; -// --ion-color-dark-tint: #f5f6f9; - -// --ion-color-medium: #989aa2; -// --ion-color-medium-rgb: 152,154,162; -// --ion-color-medium-contrast: #000000; -// --ion-color-medium-contrast-rgb: 0,0,0; -// --ion-color-medium-shade: #86888f; -// --ion-color-medium-tint: #a2a4ab; - -// --ion-color-light: #222428; -// --ion-color-light-rgb: 34,36,40; -// --ion-color-light-contrast: #ffffff; -// --ion-color-light-contrast-rgb: 255,255,255; -// --ion-color-light-shade: #1e2023; -// --ion-color-light-tint: #383a3e; -// } - -// /* -// * iOS Dark Theme -// * ------------------------------------------- -// */ - -// .ios body { -// --ion-background-color: #1b1b38; -// --ion-background-color-rgb: 0,0,0; - -// --ion-text-color: #ffffff; -// --ion-text-color-rgb: 255,255,255; - -// --ion-color-step-50: #0d0d0d; -// --ion-color-step-100: #1a1a1a; -// --ion-color-step-150: #262626; -// --ion-color-step-200: #333333; -// --ion-color-step-250: #404040; -// --ion-color-step-300: #4d4d4d; -// --ion-color-step-350: #595959; -// --ion-color-step-400: #666666; -// --ion-color-step-450: #737373; -// --ion-color-step-500: #808080; -// --ion-color-step-550: #8c8c8c; -// --ion-color-step-600: #999999; -// --ion-color-step-650: #a6a6a6; -// --ion-color-step-700: #b3b3b3; -// --ion-color-step-750: #bfbfbf; -// --ion-color-step-800: #cccccc; -// --ion-color-step-850: #d9d9d9; -// --ion-color-step-900: #e6e6e6; -// --ion-color-step-950: #f2f2f2; - -// --ion-item-background: #000000; - -// --ion-card-background: #1c1c1d; -// } - -// .ios ion-modal { -// --ion-background-color: var(--ion-color-step-100); -// --ion-toolbar-background: var(--ion-color-step-150); -// --ion-toolbar-border-color: var(--ion-color-step-250); -// } - - -// /* -// * Material Design Dark Theme -// * ------------------------------------------- -// */ - -// .md body { -// --ion-background-color: #121212; -// --ion-background-color-rgb: 18,18,18; - -// --ion-text-color: #ffffff; -// --ion-text-color-rgb: 255,255,255; - -// --ion-border-color: #222222; - -// --ion-color-step-50: #1e1e1e; -// --ion-color-step-100: #2a2a2a; -// --ion-color-step-150: #363636; -// --ion-color-step-200: #414141; -// --ion-color-step-250: #4d4d4d; -// --ion-color-step-300: #595959; -// --ion-color-step-350: #656565; -// --ion-color-step-400: #717171; -// --ion-color-step-450: #7d7d7d; -// --ion-color-step-500: #898989; -// --ion-color-step-550: #949494; -// --ion-color-step-600: #a0a0a0; -// --ion-color-step-650: #acacac; -// --ion-color-step-700: #b8b8b8; -// --ion-color-step-750: #c4c4c4; -// --ion-color-step-800: #d0d0d0; -// --ion-color-step-850: #dbdbdb; -// --ion-color-step-900: #e7e7e7; -// --ion-color-step-950: #f3f3f3; - -// --ion-item-background: #1e1e1e; - -// --ion-toolbar-background: #1f1f1f; - -// --ion-tab-bar-background: #1f1f1f; - -// --ion-card-background: #1e1e1e; -// } -// } - -// body.dark { -// --ion-color-primary: #428cff; -// --ion-color-primary-rgb: 66, 140, 255; -// --ion-color-primary-contrast: #ffffff; -// --ion-color-primary-contrast-rgb: 255, 255, 255; -// --ion-color-primary-shade: #3a7be0; -// --ion-color-primary-tint: #5598ff; - -// --ion-color-secondary: #50c8ff; -// --ion-color-secondary-rgb: 80, 200, 255; -// --ion-color-secondary-contrast: #ffffff; -// --ion-color-secondary-contrast-rgb: 255, 255, 255; -// --ion-color-secondary-shade: #46b0e0; -// --ion-color-secondary-tint: #62ceff; - -// --ion-color-tertiary: #6a64ff; -// --ion-color-tertiary-rgb: 106, 100, 255; -// --ion-color-tertiary-contrast: #ffffff; -// --ion-color-tertiary-contrast-rgb: 255, 255, 255; -// --ion-color-tertiary-shade: #5d58e0; -// --ion-color-tertiary-tint: #7974ff; - -// --ion-color-success: #2fdf75; -// --ion-color-success-rgb: 47, 223, 117; -// --ion-color-success-contrast: #000000; -// --ion-color-success-contrast-rgb: 0, 0, 0; -// --ion-color-success-shade: #29c467; -// --ion-color-success-tint: #44e283; - -// --ion-color-warning: #ffd534; -// --ion-color-warning-rgb: 255, 213, 52; -// --ion-color-warning-contrast: #000000; -// --ion-color-warning-contrast-rgb: 0, 0, 0; -// --ion-color-warning-shade: #e0bb2e; -// --ion-color-warning-tint: #ffd948; - -// --ion-color-danger: #ff4961; -// --ion-color-danger-rgb: 255, 73, 97; -// --ion-color-danger-contrast: #ffffff; -// --ion-color-danger-contrast-rgb: 255, 255, 255; -// --ion-color-danger-shade: #e04055; -// --ion-color-danger-tint: #ff5b71; - -// --ion-color-dark: #f4f5f8; -// --ion-color-dark-rgb: 244, 245, 248; -// --ion-color-dark-contrast: #000000; -// --ion-color-dark-contrast-rgb: 0, 0, 0; -// --ion-color-dark-shade: #d7d8da; -// --ion-color-dark-tint: #f5f6f9; - -// --ion-color-medium: #989aa2; -// --ion-color-medium-rgb: 152, 154, 162; -// --ion-color-medium-contrast: #000000; -// --ion-color-medium-contrast-rgb: 0, 0, 0; -// --ion-color-medium-shade: #86888f; -// --ion-color-medium-tint: #a2a4ab; - -// --ion-color-light: #222428; -// --ion-color-light-rgb: 34, 36, 40; -// --ion-color-light-contrast: #ffffff; -// --ion-color-light-contrast-rgb: 255, 255, 255; -// --ion-color-light-shade: #1e2023; -// --ion-color-light-tint: #383a3e; -// } - -// /* -// * iOS Dark Theme -// * ------------------------------------------- -// */ - -// .ios body.dark { -// --ion-background-color: #000000; -// --ion-background-color-rgb: 0, 0, 0; - -// --ion-text-color: #ffffff; -// --ion-text-color-rgb: 255, 255, 255; - -// --ion-color-step-50: #0d0d0d; -// --ion-color-step-100: #1a1a1a; -// --ion-color-step-150: #262626; -// --ion-color-step-200: #333333; -// --ion-color-step-250: #404040; -// --ion-color-step-300: #4d4d4d; -// --ion-color-step-350: #595959; -// --ion-color-step-400: #666666; -// --ion-color-step-450: #737373; -// --ion-color-step-500: #808080; -// --ion-color-step-550: #8c8c8c; -// --ion-color-step-600: #999999; -// --ion-color-step-650: #a6a6a6; -// --ion-color-step-700: #b3b3b3; -// --ion-color-step-750: #bfbfbf; -// --ion-color-step-800: #cccccc; -// --ion-color-step-850: #d9d9d9; -// --ion-color-step-900: #e6e6e6; -// --ion-color-step-950: #f2f2f2; - -// --ion-item-background: #000000; - -// --ion-card-background: #1c1c1d; -// } - -// .ios body.dark ion-modal { -// --ion-background-color: var(--ion-color-step-100); -// --ion-toolbar-background: var(--ion-color-step-150); -// --ion-toolbar-border-color: var(--ion-color-step-250); -// --ion-item-background: var(--ion-color-step-150); -// } - -// /* -// * Material Design Dark Theme -// * ------------------------------------------- -// */ - -// .md body.dark { -// --ion-background-color: #121212; -// --ion-background-color-rgb: 18, 18, 18; - -// --ion-text-color: #ffffff; -// --ion-text-color-rgb: 255, 255, 255; - -// --ion-border-color: #222222; - -// --ion-color-step-50: #1e1e1e; -// --ion-color-step-100: #2a2a2a; -// --ion-color-step-150: #363636; -// --ion-color-step-200: #414141; -// --ion-color-step-250: #4d4d4d; -// --ion-color-step-300: #595959; -// --ion-color-step-350: #656565; -// --ion-color-step-400: #717171; -// --ion-color-step-450: #7d7d7d; -// --ion-color-step-500: #898989; -// --ion-color-step-550: #949494; -// --ion-color-step-600: #a0a0a0; -// --ion-color-step-650: #acacac; -// --ion-color-step-700: #b8b8b8; -// --ion-color-step-750: #c4c4c4; -// --ion-color-step-800: #d0d0d0; -// --ion-color-step-850: #dbdbdb; -// --ion-color-step-900: #e7e7e7; -// --ion-color-step-950: #f3f3f3; - -// --ion-item-background: #1e1e1e; - -// --ion-toolbar-background: #1f1f1f; - -// --ion-tab-bar-background: #1f1f1f; - -// --ion-card-background: #1e1e1e; -// } @import 'themes'; \ No newline at end of file diff --git a/Server/.gitignore b/Server/.gitignore new file mode 100644 index 0000000..416fc4c --- /dev/null +++ b/Server/.gitignore @@ -0,0 +1,31 @@ +# Specifies intentionally untracked files to ignore when using Git +# http://git-scm.com/docs/gitignore + +*~ +*.sw[mnpcod] +.tmp +*.tmp +*.tmp.* +*.sublime-project +*.sublime-workspace +.DS_Store +Thumbs.db +UserInterfaceState.xcuserstate +$RECYCLE.BIN/ + +*.log +log.txt +npm-debug.log* + +/.idea +/.ionic +/.sass-cache +/.sourcemaps +/.versions +/.vscode +/coverage +/dist +/node_modules +/platforms +/plugins +/www diff --git a/Server/dist/GoToBed.exe b/Server/dist/GoToBed.exe index 08187a1..85f36b9 100644 Binary files a/Server/dist/GoToBed.exe and b/Server/dist/GoToBed.exe differ diff --git a/Server/dist/builder-debug.yml b/Server/dist/builder-debug.yml index 10aaaa6..ee6e6a2 100644 --- a/Server/dist/builder-debug.yml +++ b/Server/dist/builder-debug.yml @@ -10,4 +10,4 @@ x64: - '!.editorconfig' nodeModuleFilePatterns: [] nsis: - script: "!include \"C:\\Users\\Ludvi\\AppData\\Roaming\\npm\\node_modules\\electron-builder\\node_modules\\app-builder-lib\\templates\\nsis\\include\\StdUtils.nsh\"\n!addincludedir \"C:\\Users\\Ludvi\\AppData\\Roaming\\npm\\node_modules\\electron-builder\\node_modules\\app-builder-lib\\templates\\nsis\\include\"\n!macro _isUpdated _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"updated\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isUpdated `\"\" isUpdated \"\"`\n\n!macro _isForceRun _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"force-run\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForceRun `\"\" isForceRun \"\"`\n\n!macro _isKeepShortcuts _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"keep-shortcuts\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isKeepShortcuts `\"\" isKeepShortcuts \"\"`\n\n!macro _isNoDesktopShortcut _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"no-desktop-shortcut\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isNoDesktopShortcut `\"\" isNoDesktopShortcut \"\"`\n\n!macro _isDeleteAppData _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"delete-app-data\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isDeleteAppData `\"\" isDeleteAppData \"\"`\n\n!macro _isForAllUsers _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"allusers\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForAllUsers `\"\" isForAllUsers \"\"`\n\n!macro _isForCurrentUser _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"currentuser\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForCurrentUser `\"\" isForCurrentUser \"\"`\n\n!macro addLangs\n !insertmacro MUI_LANGUAGE \"English\"\n !insertmacro MUI_LANGUAGE \"German\"\n !insertmacro MUI_LANGUAGE \"French\"\n !insertmacro MUI_LANGUAGE \"SpanishInternational\"\n !insertmacro MUI_LANGUAGE \"SimpChinese\"\n !insertmacro MUI_LANGUAGE \"TradChinese\"\n !insertmacro MUI_LANGUAGE \"Japanese\"\n !insertmacro MUI_LANGUAGE \"Korean\"\n !insertmacro MUI_LANGUAGE \"Italian\"\n !insertmacro MUI_LANGUAGE \"Dutch\"\n !insertmacro MUI_LANGUAGE \"Danish\"\n !insertmacro MUI_LANGUAGE \"Swedish\"\n !insertmacro MUI_LANGUAGE \"Norwegian\"\n !insertmacro MUI_LANGUAGE \"Finnish\"\n !insertmacro MUI_LANGUAGE \"Russian\"\n !insertmacro MUI_LANGUAGE \"Portuguese\"\n !insertmacro MUI_LANGUAGE \"PortugueseBR\"\n !insertmacro MUI_LANGUAGE \"Polish\"\n !insertmacro MUI_LANGUAGE \"Ukrainian\"\n !insertmacro MUI_LANGUAGE \"Czech\"\n !insertmacro MUI_LANGUAGE \"Slovak\"\n !insertmacro MUI_LANGUAGE \"Hungarian\"\n !insertmacro MUI_LANGUAGE \"Arabic\"\n !insertmacro MUI_LANGUAGE \"Turkish\"\n !insertmacro MUI_LANGUAGE \"Thai\"\n !insertmacro MUI_LANGUAGE \"Vietnamese\"\n!macroend\n\n!include \"C:\\Users\\Ludvi\\AppData\\Local\\Temp\\t-6b9X7N\\0-messages.nsh\"\n!addplugindir /x86-unicode \"C:\\Users\\Ludvi\\AppData\\Local\\electron-builder\\Cache\\nsis\\nsis-resources-3.4.1\\plugins\\x86-unicode\"\n\n!include \"common.nsh\"\n!include \"extractAppPackage.nsh\"\n\n# https://github.com/electron-userland/electron-builder/issues/3972#issuecomment-505171582\nCRCCheck off\nWindowIcon Off\nAutoCloseWindow True\nRequestExecutionLevel ${REQUEST_EXECUTION_LEVEL}\n\nSilentInstall silent\n\nFunction .onInit\n !insertmacro check64BitAndSetRegView\nFunctionEnd\n\nSection\n StrCpy $INSTDIR \"$TEMP\\${UNPACK_DIR_NAME}\"\n RMDir /r $INSTDIR\n\tSetOutPath $INSTDIR\n\n\t!ifdef APP_DIR_64\n !ifdef APP_DIR_32\n ${if} ${RunningX64}\n File /r \"${APP_DIR_64}\\*.*\"\n ${else}\n File /r \"${APP_DIR_32}\\*.*\"\n ${endIf}\n !else\n File /r \"${APP_DIR_64}\\*.*\"\n !endif\n !else\n !ifdef APP_DIR_32\n File /r \"${APP_DIR_32}\\*.*\"\n !else\n !insertmacro extractEmbeddedAppPackage\n !endif\n !endif\n\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_DIR\", \"$EXEDIR\").r0'\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_FILE\", \"$EXEPATH\").r0'\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_APP_FILENAME\", \"${APP_FILENAME}\").r0'\n ${StdUtils.GetAllParameters} $R0 0\n\tExecWait \"$INSTDIR\\${APP_EXECUTABLE_FILENAME} $R0\" $0\n SetErrorLevel $0\n\n SetOutPath $PLUGINSDIR\n\tRMDir /r $INSTDIR\nSectionEnd\n" + script: "!include \"C:\\Users\\Ludvi\\AppData\\Roaming\\npm\\node_modules\\electron-builder\\node_modules\\app-builder-lib\\templates\\nsis\\include\\StdUtils.nsh\"\n!addincludedir \"C:\\Users\\Ludvi\\AppData\\Roaming\\npm\\node_modules\\electron-builder\\node_modules\\app-builder-lib\\templates\\nsis\\include\"\n!macro _isUpdated _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"updated\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isUpdated `\"\" isUpdated \"\"`\n\n!macro _isForceRun _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"force-run\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForceRun `\"\" isForceRun \"\"`\n\n!macro _isKeepShortcuts _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"keep-shortcuts\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isKeepShortcuts `\"\" isKeepShortcuts \"\"`\n\n!macro _isNoDesktopShortcut _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"no-desktop-shortcut\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isNoDesktopShortcut `\"\" isNoDesktopShortcut \"\"`\n\n!macro _isDeleteAppData _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"delete-app-data\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isDeleteAppData `\"\" isDeleteAppData \"\"`\n\n!macro _isForAllUsers _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"allusers\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForAllUsers `\"\" isForAllUsers \"\"`\n\n!macro _isForCurrentUser _a _b _t _f\n ${StdUtils.TestParameter} $R9 \"currentuser\"\n StrCmp \"$R9\" \"true\" `${_t}` `${_f}`\n!macroend\n!define isForCurrentUser `\"\" isForCurrentUser \"\"`\n\n!macro addLangs\n !insertmacro MUI_LANGUAGE \"English\"\n !insertmacro MUI_LANGUAGE \"German\"\n !insertmacro MUI_LANGUAGE \"French\"\n !insertmacro MUI_LANGUAGE \"SpanishInternational\"\n !insertmacro MUI_LANGUAGE \"SimpChinese\"\n !insertmacro MUI_LANGUAGE \"TradChinese\"\n !insertmacro MUI_LANGUAGE \"Japanese\"\n !insertmacro MUI_LANGUAGE \"Korean\"\n !insertmacro MUI_LANGUAGE \"Italian\"\n !insertmacro MUI_LANGUAGE \"Dutch\"\n !insertmacro MUI_LANGUAGE \"Danish\"\n !insertmacro MUI_LANGUAGE \"Swedish\"\n !insertmacro MUI_LANGUAGE \"Norwegian\"\n !insertmacro MUI_LANGUAGE \"Finnish\"\n !insertmacro MUI_LANGUAGE \"Russian\"\n !insertmacro MUI_LANGUAGE \"Portuguese\"\n !insertmacro MUI_LANGUAGE \"PortugueseBR\"\n !insertmacro MUI_LANGUAGE \"Polish\"\n !insertmacro MUI_LANGUAGE \"Ukrainian\"\n !insertmacro MUI_LANGUAGE \"Czech\"\n !insertmacro MUI_LANGUAGE \"Slovak\"\n !insertmacro MUI_LANGUAGE \"Hungarian\"\n !insertmacro MUI_LANGUAGE \"Arabic\"\n !insertmacro MUI_LANGUAGE \"Turkish\"\n !insertmacro MUI_LANGUAGE \"Thai\"\n !insertmacro MUI_LANGUAGE \"Vietnamese\"\n!macroend\n\n!addplugindir /x86-unicode \"C:\\Users\\Ludvi\\AppData\\Local\\electron-builder\\Cache\\nsis\\nsis-resources-3.4.1\\plugins\\x86-unicode\"\n!include \"C:\\Users\\Ludvi\\AppData\\Local\\Temp\\t-sumJl9\\0-messages.nsh\"\n\n!include \"common.nsh\"\n!include \"extractAppPackage.nsh\"\n\n# https://github.com/electron-userland/electron-builder/issues/3972#issuecomment-505171582\nCRCCheck off\nWindowIcon Off\nAutoCloseWindow True\nRequestExecutionLevel ${REQUEST_EXECUTION_LEVEL}\n\nSilentInstall silent\n\nFunction .onInit\n !insertmacro check64BitAndSetRegView\nFunctionEnd\n\nSection\n StrCpy $INSTDIR \"$TEMP\\${UNPACK_DIR_NAME}\"\n RMDir /r $INSTDIR\n\tSetOutPath $INSTDIR\n\n\t!ifdef APP_DIR_64\n !ifdef APP_DIR_32\n ${if} ${RunningX64}\n File /r \"${APP_DIR_64}\\*.*\"\n ${else}\n File /r \"${APP_DIR_32}\\*.*\"\n ${endIf}\n !else\n File /r \"${APP_DIR_64}\\*.*\"\n !endif\n !else\n !ifdef APP_DIR_32\n File /r \"${APP_DIR_32}\\*.*\"\n !else\n !insertmacro extractEmbeddedAppPackage\n !endif\n !endif\n\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_DIR\", \"$EXEDIR\").r0'\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_FILE\", \"$EXEPATH\").r0'\n System::Call 'Kernel32::SetEnvironmentVariable(t, t)i (\"PORTABLE_EXECUTABLE_APP_FILENAME\", \"${APP_FILENAME}\").r0'\n ${StdUtils.GetAllParameters} $R0 0\n\tExecWait \"$INSTDIR\\${APP_EXECUTABLE_FILENAME} $R0\" $0\n SetErrorLevel $0\n\n SetOutPath $PLUGINSDIR\n\tRMDir /r $INSTDIR\nSectionEnd\n" diff --git a/Server/dist/builder-effective-config.yaml b/Server/dist/builder-effective-config.yaml index 4053f26..398884c 100644 --- a/Server/dist/builder-effective-config.yaml +++ b/Server/dist/builder-effective-config.yaml @@ -6,7 +6,7 @@ productName: GoToBed copyright: Copyright © 2021 mac: category: public.app-category.utilities - icon: assets/icon.icns + icon: buildResources/icon.icns target: - zip - dmg diff --git a/Server/index.js b/Server/index.js index 18ebfbc..709f170 100644 --- a/Server/index.js +++ b/Server/index.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, dialog } = require('electron') +const { app, dialog } = require('electron') const system = require('electron-shutdown-command'); const express = require('express') const cors = require('cors'); @@ -9,6 +9,8 @@ const firstRun = require('electron-first-run'); const autoLaunch = new AutoLaunch({ name: 'GoToBed Server', + path: process.env.PORTABLE_EXECUTABLE_DIR + '/GoToBed.exe', + }); const paramPort = app.commandLine.getSwitchValue("port") == "" ? "3000" : app.commandLine.getSwitchValue("port"); const isFirstRun = firstRun(); @@ -27,7 +29,6 @@ server.use(cors({ exposedHeaders: ['Access-Control-Allow-Origin', '*'], })) server.post('/commandbridge', function (req, res) { - console.log(req.body.command) switch (req.body.command) { case 'shutdown': console.log('shutting down') diff --git a/Server/package-lock.json b/Server/package-lock.json index 90ea8b7..69a0cbc 100644 --- a/Server/package-lock.json +++ b/Server/package-lock.json @@ -914,11 +914,6 @@ "extract-zip": "^1.0.3" } }, - "electron-browser-storage": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/electron-browser-storage/-/electron-browser-storage-1.0.7.tgz", - "integrity": "sha512-/5aNIqo0Y1TS3UWs9EVLfiaY3Dio1xaFn5FRAQFDfjE92ObhClrgxWN3MtO9MDMriCkqcY+hO5F1m7sfK5D5fQ==" - }, "electron-builder": { "version": "21.2.0", "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-21.2.0.tgz",