Commit de8de822 by Alen Jose

aug-1

parent 13c25bbd
......@@ -414,6 +414,16 @@
"localforage-cordovasqlitedriver": "1.5.0"
}
},
"@ngx-translate/core": {
"version": "9.1.1",
"resolved": "https://registry.npmjs.org/@ngx-translate/core/-/core-9.1.1.tgz",
"integrity": "sha1-rhA5KINrip4Gn9Li52+iGYzH5ig="
},
"@ngx-translate/http-loader": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@ngx-translate/http-loader/-/http-loader-2.0.1.tgz",
"integrity": "sha1-qmd4jmS/qGUmkad7Ais7QDEgkRM="
},
"@types/localforage": {
"version": "0.0.30",
"resolved": "https://registry.npmjs.org/@types/localforage/-/localforage-0.0.30.tgz",
......
......@@ -36,6 +36,8 @@
"@ionic-native/status-bar": "4.8.0",
"@ionic-native/toast": "^4.9.0",
"@ionic/storage": "2.1.3",
"@ngx-translate/core": "^9.1.1",
"@ngx-translate/http-loader": "^2.0.1",
"angularfire2": "^5.0.0-rc.11",
"com-sarriaroman-photoviewer": "^1.1.18",
"cordova-android": "^7.1.0",
......@@ -93,4 +95,4 @@
"android"
]
}
}
\ No newline at end of file
}
......@@ -12,6 +12,7 @@ import * as firebase from 'firebase';
import { LocalNotifications } from '@ionic-native/local-notifications';
import { dataService } from "../providers/common.service";
import { Geolocation } from '@ionic-native/geolocation';
import { TranslateService } from '@ngx-translate/core';
@Component({
templateUrl: 'app.html'
......@@ -27,8 +28,13 @@ export class MyApp {
status: boolean
pushId: string
locSubs: any;
lang: string = 'en';
title: string
msg: string
quit: string
cancel: string
constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen, private network: Network, private alertCtrl: AlertController, private oneSignal: OneSignal, private locationAccuracy: LocationAccuracy, private storage: Storage, private myservice: Myservice, public events: Events, private localNotifications: LocalNotifications, private data: dataService, private geolocation: Geolocation) {
constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen, private network: Network, private alertCtrl: AlertController, private oneSignal: OneSignal, private locationAccuracy: LocationAccuracy, private storage: Storage, private myservice: Myservice, public events: Events, private localNotifications: LocalNotifications, private data: dataService, private geolocation: Geolocation, private translate: TranslateService) {
this.initializeApp();
}
......@@ -40,20 +46,25 @@ export class MyApp {
// this.initOnesignal();
// this.enableLoc()
this.languageTrans();
this.events.subscribe('user:lang', data => {
this.languageTrans();
})
this.network.onDisconnect().subscribe(() => {
const alert = this.alertCtrl.create({
title: 'Network Error',
message: 'No Internet Connection',
title: this.title,
message: this.msg,
buttons: [
{
text: 'Quit',
text: this.quit,
handler: data => {
this.platform.exitApp();
}
}, {
text: 'Cancel',
text: this.cancel,
role: 'cancel'
},
}
]
});
alert.present();
......@@ -222,4 +233,26 @@ export class MyApp {
})
}
languageTrans() {
this.storage.get('lang').then(data => {
if (data) {
this.translate.use(data);
this.lang = data;
}
else {
this.translate.setDefaultLang('en');
}
this.lang_trans()
})
}
lang_trans() {
this.translate.get(['sidemenu.Network Error', 'sidemenu.No Internet Connection', 'sidemenu.Quit', 'sidemenu.Cancel']).subscribe(value => {
this.title = value["sidemenu.Network Error"]
this.msg = value["sidemenu.No Internet Connection"]
this.quit = value["sidemenu.Quit"]
this.cancel = value["sidemenu.Cancel"]
})
}
}
......@@ -10,16 +10,16 @@
</div>
<ion-list>
<ion-item class="item_cstm">
<ion-label>Online</ion-label>
<ion-label>{{'sidemenu.Online'|translate}}</ion-label>
<ion-toggle #toggle [(ngModel)]="status" (ionChange)=statusChange()></ion-toggle>
</ion-item>
</ion-list>
<div class="cab_sidemenu_list">
<ul>
<li menuClose (click)="openPage('HomePage')">My Rides</li>
<li menuClose (click)="openPage('UploaddocPage')">Documents</li>
<li menuClose (click)="openPage('ChangepassPage')">Change Password</li>
<li menuClose (click)="openPage('LandingPage')">Logout</li>
<li menuClose (click)="openPage('HomePage')">{{'sidemenu.My Rides'|translate}}</li>
<li menuClose (click)="openPage('UploaddocPage')">{{'sidemenu.Documents'|translate}}</li>
<li menuClose (click)="openPage('ChangepassPage')">{{'sidemenu.Change Password'|translate}}</li>
<li menuClose (click)="openPage('LandingPage')">{{'sidemenu.Logout'|translate}}</li>
</ul>
</div>
</div>
......
......@@ -27,6 +27,9 @@ import { PhotoViewer } from '@ionic-native/photo-viewer';
import { FileOpener } from '@ionic-native/file-opener';
import { FileTransfer } from '@ionic-native/file-transfer';
import { File } from '@ionic-native/file';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { HttpClientModule, HttpClient } from '@angular/common/http';
export const firebaseConfig = {
apiKey: "AIzaSyDLrbLd4RCCh86xuTVu7-cfJ28We_cG1sU",
......@@ -38,6 +41,10 @@ export const firebaseConfig = {
};
firebase.initializeApp(firebaseConfig);
export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}
@NgModule({
declarations: [
MyApp
......@@ -48,6 +55,14 @@ firebase.initializeApp(firebaseConfig);
HttpModule,
IonicStorageModule.forRoot(),
AngularFireModule.initializeApp(firebaseConfig),
HttpClientModule,
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: HttpLoaderFactory,
deps: [HttpClient]
}
})
],
bootstrap: [IonicApp],
entryComponents: [
......
{
"sidemenu": {
"Network Error": "Network Error",
"No Internet Connection": "No Internet Connection",
"Quit": "Quit",
"Cancel": "Cancel",
"Online":"Online",
"My Rides":"My Rides",
"Documents":"Documents",
"Change Password":"Change Password",
"Logout": "Logout"
},
"home":{
"My Rides":"My Rides",
"Upcoming":"Upcoming",
"Completed":"Completed",
"No rides found":"No rides found",
"Please try again!":"Please try again!",
"Secret key miss match" :"Secret key miss match"
},
"ridedetail":{
"Ride Details":"Ride Details",
"Pick Up":"Pick Up"
}
}
\ No newline at end of file
......@@ -3,17 +3,17 @@
<ion-icon name="menu"></ion-icon>
</button>
<div class="nav_header_title floatLeft">
My Rides
{{'home.My Rides'|translate}}
</div>
<div class="clear"></div>
<div class="rides_tab">
<li [class.active]="tab=='active'" (click)="tab_swap('active')">Upcoming
<li [class.active]="tab=='active'" (click)="tab_swap('active')">{{'home.Upcoming'|translate}}
<div class="arrow-up"></div>
</li>
<!-- <li [class.active]="tab=='inactive'" (click)="tab_swap('inactive')">Ongoing
<div class="arrow-up"></div>
</li> -->
<li [class.active]="tab=='inactive1'" (click)="tab_swap('inactive1')">Completed
<li [class.active]="tab=='inactive1'" (click)="tab_swap('inactive1')">{{'home.Completed'|translate}}
<div class="arrow-up"></div>
</li>
</div>
......@@ -37,7 +37,7 @@
<div class="clear"></div>
</li>
</ul>
<p *ngIf="upcoming?.length==0" class="blank">No rides found</p>
<p *ngIf="upcoming?.length==0" class="blank">{{'home.No rides found'|translate}}</p>
</div>
<!-- <div class="home_content_tab" [hidden]="tab != 'inactive'">
3
......@@ -60,6 +60,6 @@
<div class="clear"></div>
</li>
</ul>
<p *ngIf="completed?.length==0" class="blank">No rides found</p>
<p *ngIf="completed?.length==0" class="blank">{{'home.No rides found'|translate}}</p>
</div>
</ion-content>
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { HomePage } from './home';
import { TranslateModule } from "@ngx-translate/core";
@NgModule({
declarations: [
......@@ -8,6 +9,7 @@ import { HomePage } from './home';
],
imports: [
IonicPageModule.forChild(HomePage),
TranslateModule
],
})
export class HomePageModule {}
......@@ -3,6 +3,7 @@ import { IonicPage, NavController, NavParams, Events } from 'ionic-angular';
import { Storage } from "@ionic/storage";
import { Myservice } from "../../providers/myservice";
import { dataService } from "../../providers/common.service";
import { TranslateService } from "@ngx-translate/core";
@IonicPage()
@Component({
......@@ -14,17 +15,20 @@ export class HomePage {
upcoming: any;
completed: any;
baseurl = this.myservice.base_url
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private storage: Storage, private myservice: Myservice, private data: dataService, public events: Events) {
constructor(public navCtrl: NavController, public navParams: NavParams, private storage: Storage, private myservice: Myservice, private data: dataService, public events: Events, private translate: TranslateService) {
}
ionViewDidEnter() {
this.events.publish('driver:locOn', '');
this.langTrans()
if (this.navParams.get('id'))
if (this.navParams.get('id')){
this.navCtrl.push('QuickridePage', { id: this.navParams.get('id'), from: this.navParams.get('from') })
else {
}
else {
this.myservice.show_loader()
this.storage.get('driver_data').then(data => {
if (data) {
......@@ -34,12 +38,28 @@ export class HomePage {
this.upcoming = response.data.upcoming
this.completed = response.data.completed
}
else
this.myservice.show_alert('',response.message)
else{
this.translate.get(['home.' + response.message]).subscribe(value => {
this.myservice.show_alert('', value['home.' + response.message])
})
}
})
}
})
}
}
langTrans(){
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
this.lang = lang;
}
else {
this.translate.use('en')
}
})
}
ionViewDidLoad() {
......
......@@ -3,7 +3,7 @@
<ion-icon name="ios-arrow-back" (click)="back()"></ion-icon>
</button>
<div class="nav_header_title floatLeft">
Ride Details
{{'ridedetail.Ride Details'|translate}}
</div>
<div class="clear"></div>
</ion-header>
......@@ -43,7 +43,7 @@
</div>
<div class="jr_bottom_button_bay" *ngIf="details.status=='Booking' && temp">
<button ion-button class="cab_footer_btn" (click)="pick()">Pick Up</button>
<button ion-button class="cab_footer_btn" (click)="pick()">{{'ridedetail.Pick Up'|translate}}</button>
</div>
</div>
......
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { RidedetailsPage } from './ridedetails';
import { TranslateModule } from "@ngx-translate/core";
@NgModule({
declarations: [
......@@ -8,6 +9,7 @@ import { RidedetailsPage } from './ridedetails';
],
imports: [
IonicPageModule.forChild(RidedetailsPage),
TranslateModule
],
})
export class RidedetailsPageModule {}
......@@ -3,6 +3,8 @@ import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { Myservice } from "../../providers/myservice";
import { dataService } from "../../providers/common.service";
import { DatePipe } from '@angular/common';
import { TranslateService } from "@ngx-translate/core";
import { Storage } from "@ionic/storage";
@IonicPage()
@Component({
......@@ -15,12 +17,16 @@ export class RidedetailsPage {
now:any;
// rideDate:any
temp:boolean = false;
lang: string = 'en';
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private data: dataService, private datePipe: DatePipe) {
constructor(public navCtrl: NavController, public navParams: NavParams, private myservice: Myservice, private data: dataService, private datePipe: DatePipe, private translate: TranslateService, private storage:Storage) {
}
ionViewDidEnter(){
this.langTrans()
this.now = this.datePipe.transform(new Date(), 'MM/dd/yyyy')
if (this.now == this.details.pickup_date){
......@@ -53,4 +59,16 @@ export class RidedetailsPage {
this.navCtrl.push('UserlocationPage')
}
langTrans() {
this.storage.get('lang').then(lang => {
if (lang != null) {
this.translate.use(lang)
this.lang = lang;
}
else {
this.translate.use('en')
}
})
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment