Skip to content

Commit

Permalink
Status bar colour now matches theme
Browse files Browse the repository at this point in the history
  • Loading branch information
Kallahan23 committed Apr 30, 2018
1 parent c21fb73 commit 38df9bc
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 11 deletions.
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.kallahan.alttrack" version="1.1.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="io.kallahan.alttrack" version="1.2.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>AltTrack</name>
<description>Cross platform app for tracking cryptocurrency prices.</description>
<author email="dankalnian23@hotmail.com" href="https://github.com/Kallahan23">Kallahan23</author>
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "AltTrack",
"version": "1.1.2",
"version": "1.2.0",
"author": "Kallahan",
"homepage": "https://github.com/Kallahan23",
"private": true,
Expand Down
16 changes: 13 additions & 3 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';

import { AppState } from './app.global';
import { Storage } from '@ionic/storage';

import { HomePage } from '../pages/home/home';

Expand All @@ -13,14 +14,23 @@ import { HomePage } from '../pages/home/home';
export class MyApp {
rootPage: any = HomePage;

constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, public global: AppState) {
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, public global: AppState, public storage: Storage) {
platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
if (platform.is("cordova")) {
// statusBar.styleDefault();
statusBar.backgroundColorByHexString('488aff');

splashScreen.hide();

// TODO this isn't nice
this.storage.get("theme")
.then(theme => {
if (theme === "dark-theme") {
statusBar.backgroundColorByHexString('24172F');
} else {
statusBar.backgroundColorByHexString('488aff');
}
});
}
});
}
Expand Down
20 changes: 15 additions & 5 deletions src/pages/settings/settings.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Component } from '@angular/core'
import { IonicPage, NavController, NavParams, ViewController, AlertController } from 'ionic-angular'
import { Storage } from '@ionic/storage'
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, ViewController, AlertController, Platform } from 'ionic-angular';
import { Storage } from '@ionic/storage';

import { AppState } from '../../app/app.global'
import { AppState } from '../../app/app.global';

import { StatusBar } from '@ionic-native/status-bar';

import { Portfolio } from '../../entities/portfolio';

Expand Down Expand Up @@ -38,7 +40,9 @@ export class SettingsPage {
public viewCtrl: ViewController,
private storage: Storage,
private alertCtrl: AlertController,
public global: AppState
public global: AppState,
public statusBar: StatusBar,
public platform: Platform
) {
}

Expand Down Expand Up @@ -104,10 +108,16 @@ export class SettingsPage {
if (this.darkThemeSelected) {
this.global.set("theme", "dark-theme");
this.storage.set("theme", "dark-theme");
if (this.platform.is("cordova")) {
this.statusBar.backgroundColorByHexString('24172F');
}

} else {
this.global.set("theme", "light-theme");
this.storage.set("theme", "light-theme");
if (this.platform.is("cordova")) {
this.statusBar.backgroundColorByHexString('488aff');
}
}
}

Expand Down

0 comments on commit 38df9bc

Please sign in to comment.