Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
removed the Auth0 as its not working with Ionic RC0, and fixed the la…
Browse files Browse the repository at this point in the history
…youts a bit
  • Loading branch information
smukov committed Oct 1, 2016
1 parent ee69a89 commit 4edd124
Show file tree
Hide file tree
Showing 16 changed files with 272 additions and 254 deletions.
13 changes: 7 additions & 6 deletions Ionic2/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, ViewChild, provide } from '@angular/core';
import { Component, ViewChild } from '@angular/core'; //TODO: provide
import { Platform, MenuController, Nav } from 'ionic-angular';
import { StatusBar } from 'ionic-native';

Expand All @@ -19,21 +19,22 @@ import {UserInfoService} from '../services/userInfo.service';

import {Http} from '@angular/http';
import {AuthHttp, AuthConfig} from 'angular2-jwt';
import {AuthService} from '../services/auth.service';
//TODO: import {AuthService} from '../services/auth.service';
import {Secret} from '../secrets/secret';

@Component({
templateUrl: `app.html`
})
export class MyApp {
@ViewChild('nav') nav: Nav;
@ViewChild('content') nav: Nav;
public primaryPages:any[];
public settingsPages:any[];
public rootPage:any;

constructor(public platform: Platform, public menu: MenuController,
public preferencesService: PreferencesService,
public auth: AuthService, public userInfoService: UserInfoService) {
//TODO: public auth: AuthService,
public userInfoService: UserInfoService) {

this.initializeApp();

Expand All @@ -49,7 +50,7 @@ export class MyApp {
{ title: 'Settings', component: SettingsPage, icon: 'settings' }
];

this.rootPage = LoginPage;
this.rootPage = ProfilePage;//LoginPage;
}

initializeApp() {
Expand All @@ -59,7 +60,7 @@ export class MyApp {
StatusBar.styleDefault();
this.userInfoService.initialize();
this.preferencesService.initializePreferences();
this.auth.startupTokenRefresh();
//TODO: this.auth.startupTokenRefresh();
});
}

Expand Down
2 changes: 1 addition & 1 deletion Ionic2/src/app/app.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<ion-menu [content]="content" >
<ion-toolbar primary>
<ion-toolbar color="primary">
<ion-title >Menu</ion-title>
</ion-toolbar>
<ion-content>
Expand Down
19 changes: 10 additions & 9 deletions Ionic2/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NgModule, provide } from '@angular/core';
import { NgModule } from '@angular/core';//TODO: provide
import { IonicApp, IonicModule } from 'ionic-angular';
import { MyApp } from './app.component';

Expand All @@ -20,7 +20,7 @@ import {ProfileHeader} from '../components/profileHeader';
import {ChatBubble} from '../components/chatBubble/chatBubble';

//services (providers)
import {AuthService} from '../services/auth.service';
//TODO: import {AuthService} from '../services/auth.service';
import {ContactsService} from '../services/contacts.service';
import {PreferencesService} from '../services/preferences.service';
import {StorageService} from '../services/storage.service';
Expand Down Expand Up @@ -71,13 +71,14 @@ import {AuthHttp, AuthConfig} from 'angular2-jwt';
PreferencesService,
StorageService,
UserInfoService,
provide(AuthHttp, {
useFactory: (http) => {
return new AuthHttp(new AuthConfig({noJwtError: true}), http);
},
deps: [Http]
}),
AuthService
//TODO:
// provide(AuthHttp, {
// useFactory: (http) => {
// return new AuthHttp(new AuthConfig({noJwtError: true}), http);
// },
// deps: [Http]
// }),
// AuthService
]
})
export class AppModule {}
Binary file added Ionic2/src/assets/img/hugh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion Ionic2/src/components/profileHeader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class ProfileHeader {

constructor() {
this.fullName = 'Dr. House';
this.profileImage = 'build/img/hugh.png';
this.profileImage = 'assets/img/hugh.png';
}

public setFullName(fullName){
Expand Down
20 changes: 10 additions & 10 deletions Ionic2/src/pages/chatPage/chatPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,63 +16,63 @@ export class ChatPage {

this.messages = [
{
img: 'build/img/hugh.png',
img: 'assets/img/hugh.png',
position: 'left',
content: 'Hello from the other side.',
senderName: 'Gregory',
time: '28-Jun-2016 21:53'
},
{
img: 'build/img/hugh.png',
img: 'assets/img/hugh.png',
position: 'right',
content: 'Hi! How are?',
senderName: 'Me',
time: '28-Jun-2016 21:55'
},
{
img: 'build/img/hugh.png',
img: 'assets/img/hugh.png',
position: 'left',
content: "This is some really long test that I'm writing here. Let's see how it wraps.",
senderName: 'Gregory',
time: '28-Jun-2016 21:57'
},
{
img: 'build/img/hugh.png',
img: 'assets/img/hugh.png',
position: 'right',
content: 'Hi! How are?',
senderName: 'Me',
time: '28-Jun-2016 21:55'
},
{
img: 'build/img/hugh.png',
img: 'assets/img/hugh.png',
position: 'left',
content: "This is some really long test that I'm writing here. Let's see how it wraps.",
senderName: 'Gregory',
time: '28-Jun-2016 21:57'
},
{
img: 'build/img/hugh.png',
img: 'assets/img/hugh.png',
position: 'right',
content: 'Hi! How are?',
senderName: 'Me',
time: '28-Jun-2016 21:55'
},
{
img: 'build/img/hugh.png',
img: 'assets/img/hugh.png',
position: 'left',
content: "This is some really long test that I'm writing here. Let's see how it wraps.",
senderName: 'Gregory',
time: '28-Jun-2016 21:57'
},
{
img: 'build/img/hugh.png',
img: 'assets/img/hugh.png',
position: 'right',
content: 'Hi! How are?',
senderName: 'Me',
time: '28-Jun-2016 21:55'
},
{
img: 'build/img/hugh.png',
img: 'assets/img/hugh.png',
position: 'left',
content: "This is some really long test that I'm writing here. Let's see how it wraps.",
senderName: 'Gregory',
Expand All @@ -89,7 +89,7 @@ export class ChatPage {
this.txtChat.setFocus();

this.messages.push({
img: 'build/img/hugh.png',
img: 'assets/img/hugh.png',
position: 'right',
content: this.txtChat.content,
senderName: 'Me',
Expand Down
9 changes: 6 additions & 3 deletions Ionic2/src/pages/contactPage/contactPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@
</ion-item>
</ion-list>

<button ion-button icon-only fab fab-bottom fab-right secondary (click)='openChat()'>
<ion-icon name="chatboxes"></ion-icon>
</button>
<ion-fab bottom right>
<button ion-fab color="secondary" (click)='openChat()'>
<ion-icon name="chatboxes"></ion-icon>
</button>
</ion-fab>

</ion-content>
22 changes: 12 additions & 10 deletions Ionic2/src/pages/discoverUsersPage/discoverUsersPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@
</ion-slide>
</ion-slides>

<button ion-button icon-only #btnDismiss fab fab-bottom fab-right secondary style="margin-bottom:75px; z-index: 100;"
(click)="onBtnDismissClicked()"
@fabState="btnState">
<ion-icon name="close"></ion-icon>
</button>
<button ion-button icon-only #btnAccept fab fab-bottom fab-right secondary style="z-index: 100;"
(click)="onBtnAcceptClicked()"
@fabState="btnState">
<ion-icon name="checkmark"></ion-icon>
</button>
<ion-fab bottom right>
<button ion-fab #btnDismiss color="secondary" style="margin-bottom:10px; z-index: 100;"
(click)="onBtnDismissClicked()"
[@fabState]="btnState">
<ion-icon name="close"></ion-icon>
</button>
<button ion-fab #btnAccept color="secondary" style="z-index: 100;"
(click)="onBtnAcceptClicked()"
[@fabState]="btnState">
<ion-icon name="checkmark"></ion-icon>
</button>
</ion-fab>
</ion-content>
2 changes: 1 addition & 1 deletion Ionic2/src/pages/loginPage/loginPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="Aligner-item">
<h4 text-center style="margin-bottom:15vh;">Welcome to Ionic</h4><!--separation is 15% of the viewport's height -->
<p text-center secondary-text *ngIf="showLoginButton!=true">Please wait while we try to sign you in...</p>
<button ion-button icon-only color="primary" full (click)="login()" *ngIf="showLoginButton==true">Sign in or register</button>
<button ion-button color="primary" full (click)="login()" *ngIf="showLoginButton==true">Sign in or register</button>
</div>
</div>

Expand Down
46 changes: 26 additions & 20 deletions Ionic2/src/pages/loginPage/loginPage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Component, ViewChild} from '@angular/core';
import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
import {ProfilePage} from '../profilePage/profilePage';
import {AuthService} from '../../services/auth.service';
//TODO: import {AuthService} from '../../services/auth.service';
import {UserInfoService} from '../../services/userInfo.service';


Expand All @@ -13,33 +13,39 @@ export class LoginPage {
public nextPage:any;
public showLoginButton:boolean;

constructor(public nav: NavController, public auth: AuthService, public userInfoService: UserInfoService) {
constructor(public nav: NavController,
//TODO: public auth: AuthService,
public userInfoService: UserInfoService) {
this.nextPage = ProfilePage;
this.showLoginButton = false;
this.showLoginButton = !false;
}

public ionViewWillEnter(){
this.showLoginButton = false;
this.showLoginButton = !false;
}

public ionViewDidEnter(){
if(this.auth.authenticated()){
//give some time for local storage to initialize
setTimeout(() => {
this.nav.setRoot(ProfilePage);
}, 1000)
}else{
this.showLoginButton = true;
}
this.nav.setRoot(ProfilePage);
//TODO:
// if(this.auth.authenticated()){
// //give some time for local storage to initialize
// setTimeout(() => {
// this.nav.setRoot(ProfilePage);
// }, 1000)
// }else{
// this.showLoginButton = true;
// }
}

public login(){
this.auth.login(() =>
setTimeout(() => {
this.nav.setRoot(ProfilePage)
}, 1000)//I need this delay because otherwise the navigation occurs
//before the InAppBrowser closes, and the content ends up under
//the top bar.
);
this.nav.setRoot(ProfilePage);
//TODO:
// this.auth.login(() =>
// setTimeout(() => {
// this.nav.setRoot(ProfilePage)
// }, 1000)//I need this delay because otherwise the navigation occurs
// //before the InAppBrowser closes, and the content ends up under
// //the top bar.
// );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</ion-item>

<ion-item-options side="left">
<button ion-button favorite (click)="acceptInvite(cnt)">Accept</button>
<button ion-button color="favorite" (click)="acceptInvite(cnt)">Accept</button>
</ion-item-options>

<ion-item-options side="right">
Expand Down
11 changes: 7 additions & 4 deletions Ionic2/src/pages/profilePage/profilePage.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@
[disabled]="!isEditMode"></ion-textarea>
</ion-item>

<button ion-button icon-only fab fab-bottom fab-right color="secondary" (click)="edit()" style="position:fixed;">
<ion-icon *ngIf="isEditMode" name="checkmark"></ion-icon>
<ion-icon *ngIf="!isEditMode" name="create"></ion-icon>
</button>
<ion-fab bottom right>
<button ion-fab color="secondary" (click)="edit()">
<ion-icon *ngIf="isEditMode" name="checkmark"></ion-icon>
<ion-icon *ngIf="!isEditMode" name="create"></ion-icon>
</button>
</ion-fab>

</ion-content>
2 changes: 1 addition & 1 deletion Ionic2/src/pages/settingsPage/settingsPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
[ngModel]='preferences[PREF_NOTIFY_INVITES]'
(ionChange)='changePreference($event, PREF_NOTIFY_INVITES)'></ion-toggle>
</ion-item>
<ion-list-header color="secondary">
<ion-list-header>
Account
</ion-list-header>
<button ion-item (click)="logout()">
Expand Down
8 changes: 5 additions & 3 deletions Ionic2/src/pages/settingsPage/settingsPage.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Component} from '@angular/core';
import {NavController} from 'ionic-angular';
import {PreferencesService} from '../../services/preferences.service';
import {AuthService} from '../../services/auth.service';
//TODO: import {AuthService} from '../../services/auth.service';
import {LoginPage} from '../loginPage/loginPage';


Expand All @@ -15,7 +15,9 @@ export class SettingsPage {
public PREF_NOTIFY_MESSAGES:string;
public PREF_NOTIFY_INVITES:string;

constructor(public nav: NavController, public preferencesService:PreferencesService, public auth:AuthService) {
constructor(public nav: NavController, public preferencesService:PreferencesService,
//TODO: public auth:AuthService
) {
this.preferences = {};

this.PREF_DISCOVERABLE = PreferencesService.PREF_DISCOVERABLE;
Expand All @@ -37,6 +39,6 @@ export class SettingsPage {
}

public logout(){
this.auth.logout(() => this.nav.setRoot(LoginPage));
//TODO: this.auth.logout(() => this.nav.setRoot(LoginPage));
}
}
Loading

0 comments on commit 4edd124

Please sign in to comment.