Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #25 #31

Merged
merged 9 commits into from
Jul 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,12 @@
<plugin name="cordova-plugin-camera" spec="^2.4.1" />
<plugin name="cordova-plugin-console" spec="^1.0.7" />
<plugin name="cordova-plugin-device" spec="^1.1.6" />
<plugin name="cordova-plugin-file" spec="^4.0.0" />
<plugin name="cordova-plugin-file-transfer" spec="^1.6.3" />
<plugin name="cordova-plugin-filechooser" spec="^1.0.1" />
<plugin name="cordova-plugin-filepath" spec="^1.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
<plugin name="cordova-plugin-statusbar" spec="^2.2.3" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.2" />
<plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
<plugin name="cordova-plugin-camera" spec="^2.4.1" />
</widget>
5 changes: 5 additions & 0 deletions ionic.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "prisma-frontend",
"app_id": "e0fc6bde",
"type": "ionic-angular"
}
16 changes: 13 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve",
"install": "ionic cordova plugin add cordova-plugin-camera"
"install": "ionic cordova plugin add cordova-plugin-camera --save && ionic cordova plugin add cordova-plugin-file-transfer --save && ionic cordova plugin add cordova-plugin-file"
},
"dependencies": {
"@angular/common": "4.1.3",
Expand All @@ -21,18 +21,25 @@
"@angular/http": "4.1.3",
"@angular/platform-browser": "4.1.3",
"@angular/platform-browser-dynamic": "4.1.3",
"@ionic-native/camera": "^3.7.0",
"@ionic-native/camera": "^3.14.0",
"@ionic-native/core": "3.12.1",
"@ionic-native/file": "^4.0.1",
"@ionic-native/file-chooser": "^4.0.0",
"@ionic-native/file-path": "^4.0.1",
"@ionic-native/file-transfer": "^4.0.1",
"@ionic-native/splash-screen": "3.12.1",
"@ionic-native/status-bar": "3.12.1",
"@ionic-native/transfer": "^3.14.0",
"@ionic/storage": "^2.0.1",
"cordova-android": "^6.2.3",
"cordova-plugin-camera": "^2.4.1",
"cordova-plugin-compat": "^1.1.0",
"cordova-plugin-console": "^1.0.7",
"cordova-plugin-device": "^1.1.6",
"cordova-plugin-file": "^4.0.0",
"cordova-plugin-file-transfer": "^1.6.3",
"cordova-plugin-filechooser": "^1.0.1",
"cordova-plugin-filepath": "^1.0.2",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.3",
"cordova-plugin-whitelist": "^1.3.2",
Expand Down Expand Up @@ -60,7 +67,10 @@
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-camera": {}
"cordova-plugin-camera": {},
"cordova-plugin-file-transfer": {},
"cordova-plugin-file": {},
"cordova-plugin-filepath": {}
},
"platforms": [
"android"
Expand Down
25 changes: 18 additions & 7 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import {Component} from "@angular/core";
import {Platform} from "ionic-angular";
import {StatusBar} from "@ionic-native/status-bar";
import {SplashScreen} from "@ionic-native/splash-screen";

import { TabsPage } from '../pages/tabs/tabs';
import {TutorialPage} from "../pages/tutorial/tutorial";
import {PatientService} from "../services/back-end/user.service";
import {env} from "./environment";
import {User} from "../dto/user";

@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any = TutorialPage;
rootPage: any = TutorialPage;

constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, public patientService: PatientService) {
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.
statusBar.styleDefault();
splashScreen.hide();
this.patientService.getPatient("1").toPromise().then(res => localStorage.setItem(env.temp.fakePatient, JSON.stringify(res)));
let fakeUser: User = new User();
fakeUser.email = "prisma@mail.com";
fakeUser.password = "prisma";
fakeUser.firstName = "Frederik";
fakeUser.lastName = "Jinx";
localStorage.setItem(env.temp.fakeUser, JSON.stringify(fakeUser));
// this.patientService.addUser(fakeUser).toPromise().then(res => localStorage.setItem(env.temp.fakeUser,JSON.stringify(res)));
//this.patientService.getUser("1").toPromise().then(res => localStorage.setItem(env.temp.fakeUser,JSON.stringify(res)));
});
}
}
27 changes: 20 additions & 7 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {ErrorHandler, NgModule} from "@angular/core";
import {BrowserModule} from "@angular/platform-browser";
import {IonicApp, IonicErrorHandler, IonicModule} from "ionic-angular";
import { IonicStorageModule } from '@ionic/storage';
import {IonicStorageModule} from "@ionic/storage";
import {MyApp} from "./app.component";

import {StoriesPage} from "../pages/stories/stories";
import {BrowsePage} from "../pages/browse/browse";
import {PatientProfilePage} from "../pages/patientprofile/patientprofile";
import {TabsPage} from "../pages/tabs/tabs";

import {StatusBar} from "@ionic-native/status-bar";
import {SplashScreen} from "@ionic-native/splash-screen";
Expand All @@ -18,23 +17,33 @@ import {PatientService} from "../services/back-end/user.service";
import {HttpModule} from "@angular/http";
import {StoryService} from "../services/back-end/story.service";
import {TutorialPage} from "../pages/tutorial/tutorial";
import { Camera } from '@ionic-native/camera';
import {Camera} from "@ionic-native/camera";
import {NewStoryPage} from "../pages/new-story/new-story";
import {FileChooser} from "@ionic-native/file-chooser";
import {UtilService} from "../services/util-service";

import { QuestionsPage } from "../pages/questions/questions";
import { QuestionPage } from "../pages/question/question";
import {QuestionsPage} from "../pages/questions/questions";
import {QuestionPage} from "../pages/question/question";
import {NewStorySelectionPage} from "../pages/new-story-selection/new-story-selection";
import {EmptyPage} from "../pages/empty/empty";
import {ApiTestingPage} from "../pages/api-testing/api-testing";

import {FileTransfer} from "@ionic-native/file-transfer";
import {File} from "@ionic-native/file";
import {Transfer} from "@ionic-native/transfer";
import {FilePath} from "@ionic-native/file-path";

import {AlbumsPage} from "../pages/albums/albums";
import {AlbumDetailPage} from "../pages/album-detail/album-detail";


@NgModule({
declarations: [
MyApp,
TutorialPage,
StoriesPage,
AlbumsPage,
AlbumDetailPage,
BrowsePage,
PatientProfilePage,
StoryDetailsPage,
Expand All @@ -44,7 +53,6 @@ import {ApiTestingPage} from "../pages/api-testing/api-testing";
EmptyPage,
NewStorySelectionPage,
ApiTestingPage,
TabsPage
],
imports: [
BrowserModule,
Expand All @@ -57,6 +65,8 @@ import {ApiTestingPage} from "../pages/api-testing/api-testing";
MyApp,
TutorialPage,
StoriesPage,
AlbumsPage,
AlbumDetailPage,
BrowsePage,
PatientProfilePage,
StoryDetailsPage,
Expand All @@ -66,7 +76,6 @@ import {ApiTestingPage} from "../pages/api-testing/api-testing";
EmptyPage,
NewStorySelectionPage,
ApiTestingPage,
TabsPage
],
providers: [
StatusBar,
Expand All @@ -77,7 +86,11 @@ import {ApiTestingPage} from "../pages/api-testing/api-testing";
StoryService,
PatientService,
Camera,
File,
FileTransfer,
FileChooser,
Transfer,
FilePath,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
Expand Down
39 changes: 34 additions & 5 deletions src/app/app.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// http://ionicframework.com/docs/v2/theming/


// App Global Sass
// --------------------------------------------------
// Put style rules here that you want to apply globally. These
Expand All @@ -15,12 +14,42 @@
// for the .md, .ios, or .wp mode classes. The mode class is
// automatically applied to the <body> element in the app.


@font-face {
font-family: Varela;
src: url('../assets/fonts/varela.woff2') format('woff2');
font-family: Varela;
src: url('../assets/fonts/varela.woff2') format('woff2');
}

h1, h2, h3, .toolbar-title, ion-list-header .label, .tab-button-text {
font-family: Varela,'Noto Sans';
font-family: Varela, 'Noto Sans';
}

// PAGE HEADER

.page-header {
padding: 2em 6em;
//background-color: map-get($colors, 'primary');

}

.page-header h2 {
font-size: map-get($sizes, 'large');
line-height: 33px;
text-align: center;
font-family: $prisma-ff;
color: map-get($colors, 'dark-text');
}

// TOOLBAR

.toolbar-background-md {

background-color: map-get($colors, 'primary');

.toolbar-title-md {
color: #fff;
}

.bar-button {
color: #fff;
}
}
12 changes: 7 additions & 5 deletions src/app/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,24 @@
* Created by Jean on 10-07-17.
*/

export const BACKEND: string = 'http://146.185.145.169';
export const BACKEND: string = 'https://prisma.care';
export const API_URL: string = BACKEND + '/api/v1';


export const env = {
production: false,
jwtToken: 'id_token',
localstorage: {
},
localstorage: {},
api: {
getPatient: 'patient',
getAlbum: 'album',
getStory: 'story',
getAsset: 'asset'
getAsset: 'asset',
getUser: 'user'
},
temp: {
albums:"albums"
albums: "albums",
fakeUser: "user",
fakePatient: "patient"
}
};
4 changes: 2 additions & 2 deletions src/app/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";

import { AppModule } from './app.module';
import {AppModule} from "./app.module";

platformBrowserDynamic().bootstrapModule(AppModule);
3 changes: 2 additions & 1 deletion src/assets/json/users_id.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
{
"type": "grandson",
"userId": "12121"
}]
}
]
}
4 changes: 2 additions & 2 deletions src/dto/abstract-story.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export abstract class AbstractStory {
this.dateHappened = new Date(json.dateHappened);
this.likes = json.likes;
if (json.comments)
json.comments.forEach(comment => this.comments.push(new Comment(comment)));
json.comments.forEach(comment => this.comments.push(new Comment(comment)));
if (json.categories)
json.categories.forEach(category => this.categories.push(new Category(category)));
json.categories.forEach(category => this.categories.push(new Category(category)));
}
}
8 changes: 4 additions & 4 deletions src/dto/album.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ export class Album {
id: string;
title: string;
description: string;
stories: UserStory[]=[];
stories: UserStory[] = [];

constructor(json?) {
if(!json)
if (!json)
return;
this.id = json.id;
this.title = json.title;
this.description = json.description;
if(json.stories) // TODO: these are not full stories
json.stories.push(story => new UserStory(story));
if (json.stories) // TODO: these are not full stories
json.stories.push(story => new UserStory(story));
}
}
2 changes: 1 addition & 1 deletion src/dto/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class Comment {


constructor(json?) {
if(!json)
if (!json)
return;
this.id = json.id;
this.storyId = json.storyId;
Expand Down
2 changes: 1 addition & 1 deletion src/dto/heritage-story.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AbstractStory } from './abstract-story';
import {AbstractStory} from "./abstract-story";

export class HeritageStory extends AbstractStory {
// TODO: specific heritage properties
Expand Down
1 change: 0 additions & 1 deletion src/dto/patient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {AbstractUser} from "./abstract-user";
import {WorkPlace} from "./work-place";
import {Relation} from "./relation";
import {Category} from "./category";
import { UserStory } from "./user-story";

export class Patient extends AbstractUser {
careHome: string;
Expand Down
28 changes: 17 additions & 11 deletions src/dto/user-story.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import { AbstractStory } from './abstract-story';

export class UserStory extends AbstractStory {
albumId: string;
originId: string; // heritage origin story
date: Date;

export class UserStory {
id: string;
albumId: number;
description: string;
title: string;
happened_at: Date;
creatorId: number; // heritage origin story
favorited: boolean;
source: string;

constructor(json?) {
super(json);
if(!json)
if (!json)
return;
this.id = json.id;
this.albumId = json.albumId;
this.originId = json.originId;
this.date = new Date(json.date);
this.creatorId = json.creatorId;
this.description = json.description;
this.source = json.source;
this.favorited = json.favorited;
if (json.happened_at)
this.happened_at = new Date(json.happened_at);
}
}
1 change: 1 addition & 0 deletions src/dto/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export class User extends AbstractUser {
email: string;
password: string;
relations: Relation[] = [];

constructor(json?) {
super(json);
if (!json)
Expand Down
Loading