@ofidj/generator-fidj 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/generators/app/index.js +200 -0
- package/generators/app/templates/app2018/.travis.yml +35 -0
- package/generators/app/templates/app2018/LICENSE +21 -0
- package/generators/app/templates/app2018/Procfile +1 -0
- package/generators/app/templates/app2018/README.md +49 -0
- package/generators/app/templates/app2018/config.xml +91 -0
- package/generators/app/templates/app2018/gulpfile.js +63 -0
- package/generators/app/templates/app2018/ionic.config.json +9 -0
- package/generators/app/templates/app2018/package.json +90 -0
- package/generators/app/templates/app2018/platforms/README.md +1 -0
- package/generators/app/templates/app2018/resources/README.md +6 -0
- package/generators/app/templates/app2018/resources/icon.png +0 -0
- package/generators/app/templates/app2018/resources/marketing-01-ipad.png +0 -0
- package/generators/app/templates/app2018/resources/marketing-01-iphone.png +0 -0
- package/generators/app/templates/app2018/resources/marketing-02-ipad.png +0 -0
- package/generators/app/templates/app2018/resources/marketing-02-iphone.png +0 -0
- package/generators/app/templates/app2018/resources/marketing-03-ipad.png +0 -0
- package/generators/app/templates/app2018/resources/marketing-03-iphone.png +0 -0
- package/generators/app/templates/app2018/resources/marketing.json +19 -0
- package/generators/app/templates/app2018/resources/splash.png +0 -0
- package/generators/app/templates/app2018/src/app/app.component.ts +88 -0
- package/generators/app/templates/app2018/src/app/app.html +19 -0
- package/generators/app/templates/app2018/src/app/app.module.ts +40 -0
- package/generators/app/templates/app2018/src/app/app.scss +16 -0
- package/generators/app/templates/app2018/src/app/main.ts +5 -0
- package/generators/app/templates/app2018/src/app/shared/card.model.ts +10 -0
- package/generators/app/templates/app2018/src/app/shared/profile.service.ts +46 -0
- package/generators/app/templates/app2018/src/app/shared/shared.module.ts +35 -0
- package/generators/app/templates/app2018/src/app/shared/storage.service.ts +11 -0
- package/generators/app/templates/app2018/src/app/shared/version.const.ts +5 -0
- package/generators/app/templates/app2018/src/assets/icon/favicon.ico +0 -0
- package/generators/app/templates/app2018/src/assets/imgs/gg.png +0 -0
- package/generators/app/templates/app2018/src/assets/imgs/github.png +0 -0
- package/generators/app/templates/app2018/src/assets/imgs/login.svg +5668 -0
- package/generators/app/templates/app2018/src/assets/imgs/logo.png +0 -0
- package/generators/app/templates/app2018/src/index.html +49 -0
- package/generators/app/templates/app2018/src/manifest.json +13 -0
- package/generators/app/templates/app2018/src/pages/home/home.html +56 -0
- package/generators/app/templates/app2018/src/pages/home/home.scss +3 -0
- package/generators/app/templates/app2018/src/pages/home/home.ts +126 -0
- package/generators/app/templates/app2018/src/pages/login/login.html +56 -0
- package/generators/app/templates/app2018/src/pages/login/login.scss +44 -0
- package/generators/app/templates/app2018/src/pages/login/login.ts +59 -0
- package/generators/app/templates/app2018/src/pages/profile/profile.html +33 -0
- package/generators/app/templates/app2018/src/pages/profile/profile.scss +3 -0
- package/generators/app/templates/app2018/src/pages/profile/profile.ts +36 -0
- package/generators/app/templates/app2018/src/service-worker.js +31 -0
- package/generators/app/templates/app2018/src/theme/variables.scss +88 -0
- package/generators/app/templates/app2018/tests/karma.unit-tests.conf.js +84 -0
- package/generators/app/templates/app2018/tests/unit/app.test.js +10 -0
- package/generators/app/templates/app2018/tsconfig.json +28 -0
- package/generators/app/templates/app2018/tslint.json +8 -0
- package/generators/app/templates/app2018/web.js +21 -0
- package/generators/app/templates/app2021/.travis.yml +32 -0
- package/generators/app/templates/app2021/LICENSE +21 -0
- package/generators/app/templates/app2021/Procfile +1 -0
- package/generators/app/templates/app2021/README.md +45 -0
- package/generators/app/templates/app2021/angular.json +188 -0
- package/generators/app/templates/app2021/browserslist +12 -0
- package/generators/app/templates/app2021/ionic.config.json +9 -0
- package/generators/app/templates/app2021/karma.conf.js +31 -0
- package/generators/app/templates/app2021/package-lock.json +5 -0
- package/generators/app/templates/app2021/package.json +77 -0
- package/generators/app/templates/app2021/platforms/README.md +1 -0
- package/generators/app/templates/app2021/resources/README.md +6 -0
- package/generators/app/templates/app2021/resources/icon.png +0 -0
- package/generators/app/templates/app2021/resources/marketing-01-ipad.png +0 -0
- package/generators/app/templates/app2021/resources/marketing-01-iphone.png +0 -0
- package/generators/app/templates/app2021/resources/marketing-02-ipad.png +0 -0
- package/generators/app/templates/app2021/resources/marketing-02-iphone.png +0 -0
- package/generators/app/templates/app2021/resources/marketing-03-ipad.png +0 -0
- package/generators/app/templates/app2021/resources/marketing-03-iphone.png +0 -0
- package/generators/app/templates/app2021/resources/marketing.json +19 -0
- package/generators/app/templates/app2021/resources/splash.png +0 -0
- package/generators/app/templates/app2021/src/app/app-routing.module.ts +25 -0
- package/generators/app/templates/app2021/src/app/app.component.html +3 -0
- package/generators/app/templates/app2021/src/app/app.component.scss +0 -0
- package/generators/app/templates/app2021/src/app/app.component.spec.ts +50 -0
- package/generators/app/templates/app2021/src/app/app.component.ts +28 -0
- package/generators/app/templates/app2021/src/app/app.module.ts +24 -0
- package/generators/app/templates/app2021/src/app/content/content-routing.module.ts +16 -0
- package/generators/app/templates/app2021/src/app/content/content.module.ts +20 -0
- package/generators/app/templates/app2021/src/app/content/content.page.html +31 -0
- package/generators/app/templates/app2021/src/app/content/content.page.scss +0 -0
- package/generators/app/templates/app2021/src/app/content/content.page.ts +26 -0
- package/generators/app/templates/app2021/src/app/explore-container/explore-container.component.html +4 -0
- package/generators/app/templates/app2021/src/app/explore-container/explore-container.component.scss +4 -0
- package/generators/app/templates/app2021/src/app/explore-container/explore-container.component.spec.ts +24 -0
- package/generators/app/templates/app2021/src/app/explore-container/explore-container.component.ts +16 -0
- package/generators/app/templates/app2021/src/app/explore-container/explore-container.module.ts +14 -0
- package/generators/app/templates/app2021/src/app/my/my-routing.module.ts +36 -0
- package/generators/app/templates/app2021/src/app/my/my.module.ts +19 -0
- package/generators/app/templates/app2021/src/app/my/my.page.html +15 -0
- package/generators/app/templates/app2021/src/app/my/my.page.scss +1 -0
- package/generators/app/templates/app2021/src/app/my/my.page.spec.ts +26 -0
- package/generators/app/templates/app2021/src/app/my/my.page.ts +25 -0
- package/generators/app/templates/app2021/src/app/profile/profile-routing.module.ts +16 -0
- package/generators/app/templates/app2021/src/app/profile/profile.module.ts +20 -0
- package/generators/app/templates/app2021/src/app/profile/profile.page.html +49 -0
- package/generators/app/templates/app2021/src/app/profile/profile.page.scss +0 -0
- package/generators/app/templates/app2021/src/app/profile/profile.page.spec.ts +25 -0
- package/generators/app/templates/app2021/src/app/profile/profile.page.ts +44 -0
- package/generators/app/templates/app2021/src/app/shared/const.ts +3 -0
- package/generators/app/templates/app2021/src/app/signin/signin-routing.module.ts +16 -0
- package/generators/app/templates/app2021/src/app/signin/signin.module.ts +18 -0
- package/generators/app/templates/app2021/src/app/signin/signin.page.html +53 -0
- package/generators/app/templates/app2021/src/app/signin/signin.page.scss +36 -0
- package/generators/app/templates/app2021/src/app/signin/signin.page.ts +69 -0
- package/generators/app/templates/app2021/src/assets/icon/favicon.png +0 -0
- package/generators/app/templates/app2021/src/assets/shapes.svg +1 -0
- package/generators/app/templates/app2021/src/environments/environment.prod.ts +3 -0
- package/generators/app/templates/app2021/src/environments/environment.ts +16 -0
- package/generators/app/templates/app2021/src/global.scss +26 -0
- package/generators/app/templates/app2021/src/index.html +26 -0
- package/generators/app/templates/app2021/src/main.ts +12 -0
- package/generators/app/templates/app2021/src/polyfills.ts +67 -0
- package/generators/app/templates/app2021/src/test.ts +20 -0
- package/generators/app/templates/app2021/src/theme/variables.scss +232 -0
- package/generators/app/templates/app2021/src/zone-flags.ts +5 -0
- package/generators/app/templates/app2021/tests/protractor.conf.js +36 -0
- package/generators/app/templates/app2021/tests/src/app.e2e-spec.ts +14 -0
- package/generators/app/templates/app2021/tests/src/app.po.ts +11 -0
- package/generators/app/templates/app2021/tests/tsconfig.json +13 -0
- package/generators/app/templates/app2021/tsconfig.app.json +18 -0
- package/generators/app/templates/app2021/tsconfig.json +23 -0
- package/generators/app/templates/app2021/tsconfig.spec.json +18 -0
- package/generators/app/templates/app2021/tslint.json +149 -0
- package/generators/app/templates/app2021/web.js +21 -0
- package/package.json +41 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
2
|
+
import { TestBed, async } from '@angular/core/testing';
|
|
3
|
+
|
|
4
|
+
import { Platform } from '@ionic/angular';
|
|
5
|
+
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
|
|
6
|
+
import { StatusBar } from '@ionic-native/status-bar/ngx';
|
|
7
|
+
|
|
8
|
+
import { AppComponent } from './app.component';
|
|
9
|
+
|
|
10
|
+
describe('AppComponent', () => {
|
|
11
|
+
|
|
12
|
+
let statusBarSpy;
|
|
13
|
+
let splashScreenSpy;
|
|
14
|
+
let platformReadySpy;
|
|
15
|
+
let platformSpy;
|
|
16
|
+
|
|
17
|
+
beforeEach(async(() => {
|
|
18
|
+
statusBarSpy = jasmine.createSpyObj('StatusBar', ['styleDefault']);
|
|
19
|
+
splashScreenSpy = jasmine.createSpyObj('SplashScreen', ['hide']);
|
|
20
|
+
platformReadySpy = Promise.resolve();
|
|
21
|
+
platformSpy = jasmine.createSpyObj('Platform', { ready: platformReadySpy });
|
|
22
|
+
|
|
23
|
+
TestBed.configureTestingModule({
|
|
24
|
+
declarations: [AppComponent],
|
|
25
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
26
|
+
providers: [
|
|
27
|
+
{ provide: StatusBar, useValue: statusBarSpy },
|
|
28
|
+
{ provide: SplashScreen, useValue: splashScreenSpy },
|
|
29
|
+
{ provide: Platform, useValue: platformSpy },
|
|
30
|
+
],
|
|
31
|
+
}).compileComponents();
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
it('should create the app', () => {
|
|
35
|
+
const fixture = TestBed.createComponent(AppComponent);
|
|
36
|
+
const app = fixture.debugElement.componentInstance;
|
|
37
|
+
expect(app).toBeTruthy();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should initialize the app', async () => {
|
|
41
|
+
TestBed.createComponent(AppComponent);
|
|
42
|
+
expect(platformSpy.ready).toHaveBeenCalled();
|
|
43
|
+
await platformReadySpy;
|
|
44
|
+
expect(statusBarSpy.styleDefault).toHaveBeenCalled();
|
|
45
|
+
expect(splashScreenSpy.hide).toHaveBeenCalled();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// TODO: add more tests!
|
|
49
|
+
|
|
50
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {Component} from '@angular/core';
|
|
2
|
+
import {Platform} from '@ionic/angular';
|
|
3
|
+
import {SplashScreen} from '@ionic-native/splash-screen/ngx';
|
|
4
|
+
import {StatusBar} from '@ionic-native/status-bar/ngx';
|
|
5
|
+
import {FidjService} from 'fidj';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'app-root',
|
|
9
|
+
templateUrl: 'app.component.html',
|
|
10
|
+
styleUrls: ['app.component.scss']
|
|
11
|
+
})
|
|
12
|
+
export class AppComponent {
|
|
13
|
+
constructor(
|
|
14
|
+
private platform: Platform,
|
|
15
|
+
private splashScreen: SplashScreen,
|
|
16
|
+
private statusBar: StatusBar,
|
|
17
|
+
private fidjService: FidjService
|
|
18
|
+
) {
|
|
19
|
+
this.initializeApp();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async initializeApp() {
|
|
23
|
+
await this.platform.ready();
|
|
24
|
+
await this.fidjService.init('<%= appId %>' <%= appOptions %>);
|
|
25
|
+
this.statusBar.styleDefault();
|
|
26
|
+
this.splashScreen.hide();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
3
|
+
import { RouteReuseStrategy } from '@angular/router';
|
|
4
|
+
|
|
5
|
+
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
|
|
6
|
+
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
|
|
7
|
+
import { StatusBar } from '@ionic-native/status-bar/ngx';
|
|
8
|
+
|
|
9
|
+
import { AppRoutingModule } from './app-routing.module';
|
|
10
|
+
import { AppComponent } from './app.component';
|
|
11
|
+
import {FidjModule} from "fidj";
|
|
12
|
+
|
|
13
|
+
@NgModule({
|
|
14
|
+
declarations: [AppComponent],
|
|
15
|
+
entryComponents: [],
|
|
16
|
+
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule, FidjModule],
|
|
17
|
+
providers: [
|
|
18
|
+
StatusBar,
|
|
19
|
+
SplashScreen,
|
|
20
|
+
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
|
|
21
|
+
],
|
|
22
|
+
bootstrap: [AppComponent]
|
|
23
|
+
})
|
|
24
|
+
export class AppModule {}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { RouterModule, Routes } from '@angular/router';
|
|
3
|
+
import { ContentPage } from './content.page';
|
|
4
|
+
|
|
5
|
+
const routes: Routes = [
|
|
6
|
+
{
|
|
7
|
+
path: '',
|
|
8
|
+
component: ContentPage,
|
|
9
|
+
}
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
@NgModule({
|
|
13
|
+
imports: [RouterModule.forChild(routes)],
|
|
14
|
+
exports: [RouterModule]
|
|
15
|
+
})
|
|
16
|
+
export class ContentPageRoutingModule {}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IonicModule } from '@ionic/angular';
|
|
2
|
+
import { NgModule } from '@angular/core';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
import { FormsModule } from '@angular/forms';
|
|
5
|
+
import { ContentPage } from './content.page';
|
|
6
|
+
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
|
|
7
|
+
|
|
8
|
+
import { ContentPageRoutingModule } from './content-routing.module';
|
|
9
|
+
|
|
10
|
+
@NgModule({
|
|
11
|
+
imports: [
|
|
12
|
+
IonicModule,
|
|
13
|
+
CommonModule,
|
|
14
|
+
FormsModule,
|
|
15
|
+
ExploreContainerComponentModule,
|
|
16
|
+
ContentPageRoutingModule
|
|
17
|
+
],
|
|
18
|
+
declarations: [ContentPage]
|
|
19
|
+
})
|
|
20
|
+
export class ContentPageModule {}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<ion-header [translucent]="true">
|
|
2
|
+
<ion-toolbar>
|
|
3
|
+
<ion-title>
|
|
4
|
+
<img src="assets/icon/favicon.png" height="15em"> Home
|
|
5
|
+
</ion-title>
|
|
6
|
+
</ion-toolbar>
|
|
7
|
+
</ion-header>
|
|
8
|
+
|
|
9
|
+
<ion-content [fullscreen]="true">
|
|
10
|
+
<!-- Default Refresher -->
|
|
11
|
+
<ion-refresher slot="fixed" (ionRefresh)="refresh($event)">
|
|
12
|
+
<ion-refresher-content></ion-refresher-content>
|
|
13
|
+
</ion-refresher>
|
|
14
|
+
|
|
15
|
+
<ion-header collapse="condense">
|
|
16
|
+
<ion-toolbar>
|
|
17
|
+
<ion-title size="large">Home</ion-title>
|
|
18
|
+
</ion-toolbar>
|
|
19
|
+
</ion-header>
|
|
20
|
+
|
|
21
|
+
<ion-grid>
|
|
22
|
+
<ion-row>
|
|
23
|
+
<ion-col size-md="8" offset-md="2" size-sm="12">
|
|
24
|
+
|
|
25
|
+
<app-explore-container content="<%= appContent %>"></app-explore-container>
|
|
26
|
+
|
|
27
|
+
</ion-col>
|
|
28
|
+
</ion-row>
|
|
29
|
+
</ion-grid>
|
|
30
|
+
|
|
31
|
+
</ion-content>
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {Component} from '@angular/core';
|
|
2
|
+
import {Router} from '@angular/router';
|
|
3
|
+
import {EndpointInterface, FidjService} from 'fidj';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'app-content',
|
|
7
|
+
templateUrl: 'content.page.html',
|
|
8
|
+
styleUrls: ['content.page.scss']
|
|
9
|
+
})
|
|
10
|
+
export class ContentPage {
|
|
11
|
+
|
|
12
|
+
constructor(
|
|
13
|
+
private router: Router,
|
|
14
|
+
private fidjService: FidjService) {
|
|
15
|
+
|
|
16
|
+
this.refresh(null);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async refresh(event) {
|
|
20
|
+
|
|
21
|
+
if (event) {
|
|
22
|
+
event.target.complete();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { IonicModule } from '@ionic/angular';
|
|
3
|
+
|
|
4
|
+
import { ExploreContainerComponent } from './explore-container.component';
|
|
5
|
+
|
|
6
|
+
describe('ExploreContainerComponent', () => {
|
|
7
|
+
let component: ExploreContainerComponent;
|
|
8
|
+
let fixture: ComponentFixture<ExploreContainerComponent>;
|
|
9
|
+
|
|
10
|
+
beforeEach(async(() => {
|
|
11
|
+
TestBed.configureTestingModule({
|
|
12
|
+
declarations: [ ExploreContainerComponent ],
|
|
13
|
+
imports: [IonicModule.forRoot()]
|
|
14
|
+
}).compileComponents();
|
|
15
|
+
|
|
16
|
+
fixture = TestBed.createComponent(ExploreContainerComponent);
|
|
17
|
+
component = fixture.componentInstance;
|
|
18
|
+
fixture.detectChanges();
|
|
19
|
+
}));
|
|
20
|
+
|
|
21
|
+
it('should create', () => {
|
|
22
|
+
expect(component).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
});
|
package/generators/app/templates/app2021/src/app/explore-container/explore-container.component.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Component, OnInit, Input } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'app-explore-container',
|
|
5
|
+
templateUrl: './explore-container.component.html',
|
|
6
|
+
styleUrls: ['./explore-container.component.scss'],
|
|
7
|
+
})
|
|
8
|
+
export class ExploreContainerComponent implements OnInit {
|
|
9
|
+
@Input() name: string;
|
|
10
|
+
@Input() content: string;
|
|
11
|
+
|
|
12
|
+
constructor() { }
|
|
13
|
+
|
|
14
|
+
ngOnInit() {}
|
|
15
|
+
|
|
16
|
+
}
|
package/generators/app/templates/app2021/src/app/explore-container/explore-container.module.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { FormsModule } from '@angular/forms';
|
|
4
|
+
|
|
5
|
+
import { IonicModule } from '@ionic/angular';
|
|
6
|
+
|
|
7
|
+
import { ExploreContainerComponent } from './explore-container.component';
|
|
8
|
+
|
|
9
|
+
@NgModule({
|
|
10
|
+
imports: [ CommonModule, FormsModule, IonicModule],
|
|
11
|
+
declarations: [ExploreContainerComponent],
|
|
12
|
+
exports: [ExploreContainerComponent]
|
|
13
|
+
})
|
|
14
|
+
export class ExploreContainerComponentModule {}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { RouterModule, Routes } from '@angular/router';
|
|
3
|
+
import { MyPage } from './my.page';
|
|
4
|
+
|
|
5
|
+
const routes: Routes = [
|
|
6
|
+
{
|
|
7
|
+
path: '',
|
|
8
|
+
component: MyPage,
|
|
9
|
+
children: [
|
|
10
|
+
{
|
|
11
|
+
path: 'content',
|
|
12
|
+
loadChildren: () => import('../content/content.module').then(m => m.ContentPageModule)
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
path: 'profile',
|
|
16
|
+
loadChildren: () => import('../profile/profile.module').then(m => m.ProfilePageModule)
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
path: '',
|
|
20
|
+
redirectTo: '/my/content',
|
|
21
|
+
pathMatch: 'full'
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
path: '',
|
|
27
|
+
redirectTo: '/my/content',
|
|
28
|
+
pathMatch: 'full'
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
@NgModule({
|
|
33
|
+
imports: [RouterModule.forChild(routes)],
|
|
34
|
+
exports: [RouterModule]
|
|
35
|
+
})
|
|
36
|
+
export class MyPageRoutingModule {}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IonicModule } from '@ionic/angular';
|
|
2
|
+
import { NgModule } from '@angular/core';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
import { FormsModule } from '@angular/forms';
|
|
5
|
+
|
|
6
|
+
import { MyPageRoutingModule } from './my-routing.module';
|
|
7
|
+
|
|
8
|
+
import { MyPage } from './my.page';
|
|
9
|
+
|
|
10
|
+
@NgModule({
|
|
11
|
+
imports: [
|
|
12
|
+
IonicModule,
|
|
13
|
+
CommonModule,
|
|
14
|
+
FormsModule,
|
|
15
|
+
MyPageRoutingModule
|
|
16
|
+
],
|
|
17
|
+
declarations: [MyPage]
|
|
18
|
+
})
|
|
19
|
+
export class MyPageModule {}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<ion-tabs>
|
|
2
|
+
<ion-tab-bar slot="bottom">
|
|
3
|
+
|
|
4
|
+
<ion-tab-button tab="content">
|
|
5
|
+
<ion-icon name="leaf-outline"></ion-icon>
|
|
6
|
+
<ion-label>Content</ion-label>
|
|
7
|
+
</ion-tab-button>
|
|
8
|
+
|
|
9
|
+
<ion-tab-button tab="profile">
|
|
10
|
+
<ion-icon name="person-circle-outline"></ion-icon>
|
|
11
|
+
<ion-label>Profile</ion-label>
|
|
12
|
+
</ion-tab-button>
|
|
13
|
+
|
|
14
|
+
</ion-tab-bar>
|
|
15
|
+
</ion-tabs>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
2
|
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
3
|
+
|
|
4
|
+
import { MyPage } from './my.page';
|
|
5
|
+
|
|
6
|
+
describe('MyPage', () => {
|
|
7
|
+
let component: MyPage;
|
|
8
|
+
let fixture: ComponentFixture<MyPage>;
|
|
9
|
+
|
|
10
|
+
beforeEach(async(() => {
|
|
11
|
+
TestBed.configureTestingModule({
|
|
12
|
+
declarations: [MyPage],
|
|
13
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
14
|
+
}).compileComponents();
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
fixture = TestBed.createComponent(MyPage);
|
|
19
|
+
component = fixture.componentInstance;
|
|
20
|
+
fixture.detectChanges();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should create', () => {
|
|
24
|
+
expect(component).toBeTruthy();
|
|
25
|
+
});
|
|
26
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import {Router} from '@angular/router';
|
|
3
|
+
import { FidjService } from 'fidj';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'app-my',
|
|
7
|
+
templateUrl: 'my.page.html',
|
|
8
|
+
styleUrls: ['my.page.scss']
|
|
9
|
+
})
|
|
10
|
+
export class MyPage {
|
|
11
|
+
|
|
12
|
+
constructor(
|
|
13
|
+
private router: Router,
|
|
14
|
+
private fidjService: FidjService) {}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
ngOnInit() {
|
|
18
|
+
if (this.fidjService.isLoggedIn()) {
|
|
19
|
+
} else {
|
|
20
|
+
console.log('not logged in');
|
|
21
|
+
return this.router.navigateByUrl('/signin');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { RouterModule, Routes } from '@angular/router';
|
|
3
|
+
import { ProfilePage } from './profile.page';
|
|
4
|
+
|
|
5
|
+
const routes: Routes = [
|
|
6
|
+
{
|
|
7
|
+
path: '',
|
|
8
|
+
component: ProfilePage,
|
|
9
|
+
}
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
@NgModule({
|
|
13
|
+
imports: [RouterModule.forChild(routes)],
|
|
14
|
+
exports: [RouterModule]
|
|
15
|
+
})
|
|
16
|
+
export class ProfilePageRoutingModule {}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IonicModule } from '@ionic/angular';
|
|
2
|
+
import { NgModule } from '@angular/core';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
import { FormsModule } from '@angular/forms';
|
|
5
|
+
import { ProfilePage } from './profile.page';
|
|
6
|
+
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
|
|
7
|
+
|
|
8
|
+
import { ProfilePageRoutingModule } from './profile-routing.module';
|
|
9
|
+
|
|
10
|
+
@NgModule({
|
|
11
|
+
imports: [
|
|
12
|
+
IonicModule,
|
|
13
|
+
CommonModule,
|
|
14
|
+
FormsModule,
|
|
15
|
+
ExploreContainerComponentModule,
|
|
16
|
+
ProfilePageRoutingModule
|
|
17
|
+
],
|
|
18
|
+
declarations: [ProfilePage]
|
|
19
|
+
})
|
|
20
|
+
export class ProfilePageModule {}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<ion-header [translucent]="true">
|
|
2
|
+
<ion-toolbar>
|
|
3
|
+
<ion-title>
|
|
4
|
+
<img src="assets/icon/favicon.png" height="15em"> My profile
|
|
5
|
+
</ion-title>
|
|
6
|
+
</ion-toolbar>
|
|
7
|
+
</ion-header>
|
|
8
|
+
|
|
9
|
+
<ion-content [fullscreen]="true">
|
|
10
|
+
<!-- Default Refresher -->
|
|
11
|
+
<ion-refresher slot="fixed" (ionRefresh)="refresh($event)">
|
|
12
|
+
<ion-refresher-content></ion-refresher-content>
|
|
13
|
+
</ion-refresher>
|
|
14
|
+
|
|
15
|
+
<ion-header collapse="condense">
|
|
16
|
+
<ion-toolbar>
|
|
17
|
+
<ion-title size="large">Profile</ion-title>
|
|
18
|
+
</ion-toolbar>
|
|
19
|
+
</ion-header>
|
|
20
|
+
|
|
21
|
+
<form #profileForm="ngForm">
|
|
22
|
+
<ion-grid>
|
|
23
|
+
<ion-row>
|
|
24
|
+
<ion-col size-md="8" offset-md="2" size-sm="12">
|
|
25
|
+
<ion-row>
|
|
26
|
+
<ion-col>
|
|
27
|
+
<ion-item>
|
|
28
|
+
<ion-label>User</ion-label>
|
|
29
|
+
<ion-input id="profileUsername"
|
|
30
|
+
[(ngModel)]="profileUsername" name="profileUsername" disabled></ion-input>
|
|
31
|
+
</ion-item>
|
|
32
|
+
<ion-item>
|
|
33
|
+
<pre><small>App is using <a href="https://fidj.ovh">Fidj service</a> that take care of GDPR concerns.</small></pre>
|
|
34
|
+
</ion-item>
|
|
35
|
+
</ion-col>
|
|
36
|
+
</ion-row>
|
|
37
|
+
|
|
38
|
+
<ion-row>
|
|
39
|
+
<ion-col>
|
|
40
|
+
<ion-button color="danger" expand="block" (click)="logout()">Logout</ion-button>
|
|
41
|
+
</ion-col>
|
|
42
|
+
</ion-row>
|
|
43
|
+
|
|
44
|
+
</ion-col>
|
|
45
|
+
</ion-row>
|
|
46
|
+
</ion-grid>
|
|
47
|
+
</form>
|
|
48
|
+
|
|
49
|
+
</ion-content>
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { IonicModule } from '@ionic/angular';
|
|
3
|
+
import { ExploreContainerComponentModule } from '../explore-container/explore-container.module';
|
|
4
|
+
|
|
5
|
+
import { ProfilePage } from './profile.page';
|
|
6
|
+
|
|
7
|
+
describe('ProfilePage', () => {
|
|
8
|
+
let component: ProfilePage;
|
|
9
|
+
let fixture: ComponentFixture<ProfilePage>;
|
|
10
|
+
|
|
11
|
+
beforeEach(async(() => {
|
|
12
|
+
TestBed.configureTestingModule({
|
|
13
|
+
declarations: [ProfilePage],
|
|
14
|
+
imports: [IonicModule.forRoot(), ExploreContainerComponentModule]
|
|
15
|
+
}).compileComponents();
|
|
16
|
+
|
|
17
|
+
fixture = TestBed.createComponent(ProfilePage);
|
|
18
|
+
component = fixture.componentInstance;
|
|
19
|
+
fixture.detectChanges();
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
it('should create', () => {
|
|
23
|
+
expect(component).toBeTruthy();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {Component} from '@angular/core';
|
|
2
|
+
import {Router} from '@angular/router';
|
|
3
|
+
import {Base64, FidjService} from 'fidj';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'app-profile',
|
|
7
|
+
templateUrl: 'profile.page.html',
|
|
8
|
+
styleUrls: ['profile.page.scss']
|
|
9
|
+
})
|
|
10
|
+
export class ProfilePage {
|
|
11
|
+
|
|
12
|
+
public profileUsername: string;
|
|
13
|
+
|
|
14
|
+
constructor(
|
|
15
|
+
private router: Router,
|
|
16
|
+
private fidjService: FidjService) {
|
|
17
|
+
this.refresh(null);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async refresh(event) {
|
|
21
|
+
try {
|
|
22
|
+
const idToken = await this.fidjService.getIdToken();
|
|
23
|
+
const payload = idToken.split('.')[1];
|
|
24
|
+
const payloadInfo = JSON.parse(Base64.decode(payload));
|
|
25
|
+
console.log(typeof payloadInfo, payloadInfo.name);
|
|
26
|
+
this.profileUsername = payloadInfo.name;
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.warn(error);
|
|
29
|
+
if (error.code === 401 || error.code === 403) {
|
|
30
|
+
await this.logout();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (event) {
|
|
35
|
+
event.target.complete();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async logout() {
|
|
40
|
+
await this.fidjService.logout();
|
|
41
|
+
await this.router.navigateByUrl('/');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { RouterModule, Routes } from '@angular/router';
|
|
3
|
+
import { SigninPage } from './signin.page';
|
|
4
|
+
|
|
5
|
+
const routes: Routes = [
|
|
6
|
+
{
|
|
7
|
+
path: '',
|
|
8
|
+
component: SigninPage,
|
|
9
|
+
},
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
@NgModule({
|
|
13
|
+
imports: [RouterModule.forChild(routes)],
|
|
14
|
+
exports: [RouterModule]
|
|
15
|
+
})
|
|
16
|
+
export class SigninPageRoutingModule {}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {IonicModule} from '@ionic/angular';
|
|
2
|
+
import {NgModule} from '@angular/core';
|
|
3
|
+
import {CommonModule} from '@angular/common';
|
|
4
|
+
import {FormsModule} from '@angular/forms';
|
|
5
|
+
import {SigninPage} from './signin.page';
|
|
6
|
+
import {SigninPageRoutingModule} from "./signin-routing.module";
|
|
7
|
+
|
|
8
|
+
@NgModule({
|
|
9
|
+
imports: [
|
|
10
|
+
IonicModule,
|
|
11
|
+
CommonModule,
|
|
12
|
+
FormsModule,
|
|
13
|
+
SigninPageRoutingModule
|
|
14
|
+
],
|
|
15
|
+
declarations: [SigninPage]
|
|
16
|
+
})
|
|
17
|
+
export class SigninPageModule {
|
|
18
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<ion-content>
|
|
2
|
+
<ion-grid>
|
|
3
|
+
<ion-row>
|
|
4
|
+
<ion-col size-md="8" offset-md="2" size-sm="12">
|
|
5
|
+
<ion-card>
|
|
6
|
+
<ion-card-header>
|
|
7
|
+
<h1><%= appName %> </h1>
|
|
8
|
+
<p><%= appWelcome %></p>
|
|
9
|
+
</ion-card-header>
|
|
10
|
+
<ion-card-content>
|
|
11
|
+
<form #heroForm="ngForm" (ngSubmit)="login(userLoginEmail, userLoginPassword)"
|
|
12
|
+
(keyup.enter)="login(userLoginEmail, userLoginPassword)">
|
|
13
|
+
<ion-item [hidden]="!loginError">
|
|
14
|
+
<ion-label color="danger">{{loginError}}</ion-label>
|
|
15
|
+
</ion-item>
|
|
16
|
+
<ion-item>
|
|
17
|
+
<ion-input
|
|
18
|
+
id="userLoginEmail"
|
|
19
|
+
type="text" placeholder="valid.email@required.com" required
|
|
20
|
+
[(ngModel)]="userLoginEmail" name="userLoginEmail"
|
|
21
|
+
pattern=".{1,}@[_a-z0-9A-Z]+(\.[a-z0-9A-Z]+)+"
|
|
22
|
+
></ion-input>
|
|
23
|
+
</ion-item>
|
|
24
|
+
<ion-item>
|
|
25
|
+
<ion-input
|
|
26
|
+
id="userLoginPassword"
|
|
27
|
+
type="password" placeholder="password"
|
|
28
|
+
[(ngModel)]="userLoginPassword" name="userLoginPassword"
|
|
29
|
+
required></ion-input>
|
|
30
|
+
</ion-item>
|
|
31
|
+
|
|
32
|
+
<div style="padding-top:20px">
|
|
33
|
+
<ion-button color="medium"
|
|
34
|
+
id="userLoginButton"
|
|
35
|
+
(click)="login(userLoginEmail, userLoginPassword)"
|
|
36
|
+
[disabled]="!userLoginEmail || !heroForm.form.valid || !userLoginPassword">
|
|
37
|
+
Login
|
|
38
|
+
</ion-button>
|
|
39
|
+
<ion-button color="medium" fill="clear"
|
|
40
|
+
(click)="loginAsDemo()">
|
|
41
|
+
Enter anonymously
|
|
42
|
+
</ion-button>
|
|
43
|
+
</div>
|
|
44
|
+
</form>
|
|
45
|
+
</ion-card-content>
|
|
46
|
+
</ion-card>
|
|
47
|
+
</ion-col>
|
|
48
|
+
</ion-row>
|
|
49
|
+
</ion-grid>
|
|
50
|
+
|
|
51
|
+
<span style="float:right;font-size:10px;">version: <%= appVersion %></span>
|
|
52
|
+
|
|
53
|
+
</ion-content>
|