Skip to content

Commit

Permalink
fix pickers section
Browse files Browse the repository at this point in the history
  • Loading branch information
NickIliev committed Jun 3, 2020
1 parent 77a02b1 commit 5eb9dc5
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 27 deletions.
Empty file.
5 changes: 0 additions & 5 deletions app/App_Resources/Android/settings.json

This file was deleted.

4 changes: 2 additions & 2 deletions app/App_Resources/Android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="__PACKAGE__"
android:versionCode="31"
android:versionName="2.9.4">
android:versionCode="32"
android:versionName="3.0.2">

<supports-screens
android:smallScreens="true"
Expand Down
5 changes: 5 additions & 0 deletions app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ declare let TKSideDrawerShadowModeHostview: any;
declare let TKSideDrawerBlurTypeNone: any;
declare let TKSolidFill: any;

import { EnvironmentManagerService } from "./services/environment.service";

@Component({
selector: "cosmos-app",
templateUrl: "app.component.html",
Expand All @@ -39,6 +41,7 @@ export class AppComponent implements OnInit, AfterViewInit {
isUserLogged: boolean = false; // hide & show LOGOUT button option

constructor(
private _enviromentManager: EnvironmentManagerService,
private _changeDetectionRef: ChangeDetectorRef,
private _routerExtensions: RouterExtensions,
private _drawerService: AppService
Expand All @@ -52,6 +55,8 @@ export class AppComponent implements OnInit, AfterViewInit {
"android.permission.ACCESS_NETWORK_STATE"
], "I need these permissions");
}

console.log(`>>>>>>>> _enviromentManager isDev: ${this._enviromentManager.isDev()}`)
}

onRadLoaded(args) {
Expand Down
4 changes: 3 additions & 1 deletion app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { MainComponent } from "./pages/main/main.component";
import { ApodService } from "./services/apod.service";
import { appCenter } from "./shared/app-center-initializer";

import { EnvironmentManagerService } from "./services/environment.service"

registerElement("CardView", () => require("nativescript-cardview").CardView);

@NgModule({
Expand All @@ -23,7 +25,7 @@ registerElement("CardView", () => require("nativescript-cardview").CardView);
NativeScriptUISideDrawerModule
],
declarations: [AppComponent, LoginComponent, MainComponent],
providers: [ApodService, AppService, { provide: AppCenter, useValue: appCenter }],
providers: [ApodService, AppService, EnvironmentManagerService, { provide: AppCenter, useValue: appCenter }],
schemas: [NO_ERRORS_SCHEMA]
})
/*
Expand Down
9 changes: 7 additions & 2 deletions app/pages/rovers/pickers/pickers.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ export class PickersComponent {
constructor(private _page: Page, private _router: RouterExtensions, private _roverService: RoverPhotosService) {
this._today = new Date(); // temp

this._year = this._today.getFullYear();
this._month = this._today.getMonth();
this._day = this._today.getDay();

this._roverService.getCuriosityManifest().subscribe(manifest => {
this.curiosity_obj = manifest;
this.manifest_obj = this.curiosity_obj;
Expand Down Expand Up @@ -110,9 +114,10 @@ export class PickersComponent {

// remember the chosen date & rover on navigation backwards
this.selectedRover = this.rovers[this._selectedIndex].toLowerCase();
// console.log(`this._year ${this._year}, this._month - 1 ${this._month - 1}, this._day + 1 ${this._day + 1}`)
this._today = new Date(this._year, this._month - 1, this._day + 1); // e.g. new Date(2018, 4 + 1, 9);
console.log(`goToPhotos this.selectedRover ${this.selectedRover}`); // TODO use this to change the default loaded rover
console.log(`goToPhotos this_today: ${this._today}`);
// console.log(`goToPhotos this.selectedRover ${this.selectedRover}`); // TODO use this to change the default loaded rover
// console.log(`goToPhotos this_today: ${this._today}`);
}

onStackListLoaded(args) {
Expand Down
37 changes: 37 additions & 0 deletions app/services/environment.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { Injectable } from '@angular/core';

declare var process: any;

@Injectable()
export class EnvironmentManagerService {
private getEnvironmentVars(key: string): string {
if (process.env) {
return process.env[key];
} else {
return "";
}
}

// public getGoogleMapsKey(): string {
// return this.getEnvironmentVars("gmapsKey");
// }

// public getStripePublishableKey(): string {
// return this.getEnvironmentVars("stripeKey");
// }

public isDev(): boolean {
return this.getEnvironmentVars("envtype") === "dev";
}


public isProduction(): boolean {
return this.getEnvironmentVars("envtype") !== "dev";
}


/*
FOR EXAMPLE
--env.envtype="dev" --env.gmapsKey="KEY_HERE" --env.stripeKey="KEY_HERE"
*/
}
2 changes: 1 addition & 1 deletion firebase.nativescript.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"remote_config": false,
"performance_monitoring": false,
"messaging": true,
"crashlytics": true,
"crashlytics": false,
"crash_reporting": false,
"storage": false,
"functions": false,
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"nativescript": {
"id": "org.nativescript.curiosity",
"tns-android": {
"version": "6.3.1"
"version": "6.5.1"
}
},
"dependencies": {
Expand All @@ -19,17 +19,17 @@
"@angular/platform-browser": "~8.2.0",
"@angular/platform-browser-dynamic": "~8.2.0",
"@angular/router": "~8.2.0",
"nativescript-angular": "~8.20.4",
"nativescript-angular": "~8.21.0",
"nativescript-app-center": "~1.0.3",
"nativescript-cardview": "~3.2.0",
"nativescript-permissions": "~1.3.8",
"nativescript-plugin-firebase": "~10.3.3",
"nativescript-social-share": "~1.5.2",
"nativescript-permissions": "~1.3.9",
"nativescript-plugin-firebase": "~10.5.2",
"nativescript-social-share": "~1.6.0",
"nativescript-theme-core": "~1.0.6",
"nativescript-ui-sidedrawer": "~8.0.0",
"nativescript-ui-sidedrawer": "~8.0.1",
"reflect-metadata": "~0.1.13",
"rxjs": "^6.3.3",
"tns-core-modules": "~6.3.2",
"tns-core-modules": "~6.5.2",
"zone.js": "^0.9.1"
},
"devDependencies": {
Expand All @@ -42,8 +42,8 @@
"mocha": "~5.2.0",
"mochawesome": "~3.1.2",
"nativescript-dev-appium": "next",
"nativescript-dev-webpack": "~1.4.1",
"tns-platform-declarations": "~6.3.2",
"nativescript-dev-webpack": "~1.5.1",
"tns-platform-declarations": "~6.2.2",
"tslint": "~5.19.0",
"typescript": "~3.5.3"
},
Expand Down
20 changes: 13 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ const hashSalt = Date.now().toString();

module.exports = env => {
// Add your custom Activities, Services and other Android app components here.
const appComponents = [
const appComponents = env.appComponents || [];
appComponents.push(...[
"tns-core-modules/ui/frame",
"tns-core-modules/ui/frame/activity",
];
]);

const platform = env && (env.android && "android" || env.ios && "ios");
const platform = env && (env.android && "android" || env.ios && "ios" || env.platform);
if (!platform) {
throw new Error("You need to provide a target platform!");
}
Expand Down Expand Up @@ -65,9 +66,8 @@ module.exports = env => {
const hasRootLevelScopedModules = nsWebpack.hasRootLevelScopedModules({ projectDir: projectRoot });
const hasRootLevelScopedAngular = nsWebpack.hasRootLevelScopedAngular({ projectDir: projectRoot });
let coreModulesPackageName = "tns-core-modules";
const alias = {
'~': appFullPath
};
const alias = env.alias || {};
alias['~'] = appFullPath;

const compilerOptions = getCompilerOptionsFromTSConfig(tsConfigPath);
if (hasRootLevelScopedModules) {
Expand All @@ -84,7 +84,9 @@ module.exports = env => {
const appResourcesFullPath = resolve(projectRoot, appResourcesPath);
const entryModule = `${nsWebpack.getEntryModule(appFullPath, platform)}.ts`;
const entryPath = `.${sep}${entryModule}`;
const entries = { bundle: entryPath };
const entries = env.entries || {};
entries.bundle = entryPath;

const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some(e => e.indexOf("tns-core-modules") > -1);
if (platform === "ios" && !areCoreModulesExternal) {
entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules";
Expand Down Expand Up @@ -295,11 +297,15 @@ module.exports = env => {
new webpack.DefinePlugin({
"global.TNS_WEBPACK": "true",
"process": "global.process",
'process.env': {
'envtype': JSON.stringify(env && env.envtype ? env.envtype : "")
}
}),
// Remove all files from the out dir.
new CleanWebpackPlugin(itemsToClean, { verbose: !!verbose }),
// Copy assets to out dir. Add your own globs as needed.
new CopyWebpackPlugin([
{ from: { glob: "settings.json"} }, // HERE
{ from: { glob: "fonts/**" } },
{ from: { glob: "**/*.jpg" } },
{ from: { glob: "**/*.png" } },
Expand Down

0 comments on commit 5eb9dc5

Please sign in to comment.