| @@ -16,7 +16,7 @@ import { environment } from '../environments/environment'; | |||||
| import { MyHammerConfig } from './hammer-config'; | import { MyHammerConfig } from './hammer-config'; | ||||
| import { HttpClientModule } from '@angular/common/http'; | import { HttpClientModule } from '@angular/common/http'; | ||||
| import { DataService } from './services/data.service'; | |||||
| import { NewsService } from './services/news.service'; | |||||
| import { GooglePlus } from '@ionic-native/google-plus/ngx'; | import { GooglePlus } from '@ionic-native/google-plus/ngx'; | ||||
| @@ -45,7 +45,7 @@ var firebaseConfig = { | |||||
| StatusBar, | StatusBar, | ||||
| SplashScreen, | SplashScreen, | ||||
| GooglePlus, | GooglePlus, | ||||
| DataService, | |||||
| NewsService, | |||||
| { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }, | { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }, | ||||
| { provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig }, | { provide: HAMMER_GESTURE_CONFIG, useClass: MyHammerConfig }, | ||||
| ], | ], | ||||
| @@ -1,7 +1,7 @@ | |||||
| import { Component, OnInit, ViewChild } from '@angular/core'; | import { Component, OnInit, ViewChild } from '@angular/core'; | ||||
| import { IonSlides, ModalController } from '@ionic/angular'; | import { IonSlides, ModalController } from '@ionic/angular'; | ||||
| import { Router } from '@angular/router'; | import { Router } from '@angular/router'; | ||||
| import { ChatPage } from '../chat/chat.page'; | |||||
| import { NewsService } from '../services/news.service'; | |||||
| export type INews = { | export type INews = { | ||||
| id: string | number, | id: string | number, | ||||
| @@ -50,9 +50,12 @@ export class HomePage implements OnInit { | |||||
| constructor( | constructor( | ||||
| private router: Router, | private router: Router, | ||||
| private modalController: ModalController, | private modalController: ModalController, | ||||
| private newsService: NewsService | |||||
| ) { } | ) { } | ||||
| ngOnInit() { | ngOnInit() { | ||||
| this.newsService.getArticles().then((data) => console.log(data)); | |||||
| this.newsData = [{ | this.newsData = [{ | ||||
| id: 1, | id: 1, | ||||
| image: 'https://www.kxip.in/static-assets/waf-images/c3/b2/7d/16-9/DWWfHZsFg1.jpg', | image: 'https://www.kxip.in/static-assets/waf-images/c3/b2/7d/16-9/DWWfHZsFg1.jpg', | ||||
| @@ -1,25 +0,0 @@ | |||||
| import { Injectable } from '@angular/core'; | |||||
| import { HttpClient, HttpHeaders } from '@angular/common/http'; | |||||
| @Injectable({ | |||||
| providedIn: 'root' | |||||
| }) | |||||
| export class DataService { | |||||
| constructor( | |||||
| private http: HttpClient | |||||
| ) { } | |||||
| getPosts() { | |||||
| const httpOptions = { | |||||
| headers: new HttpHeaders({ | |||||
| 'Access-Control-Allow-Origin': '*', | |||||
| 'Content-Type': 'application/json', | |||||
| }) | |||||
| }; | |||||
| return this.http.get('https://www.kxip.in/api/flowicsproxy?url=https://live.flowics.com/api/content/0.2/flows/d0184b7bd3e021a4b557d6cb2d33a6ec/posts', httpOptions).toPromise(); | |||||
| } | |||||
| } | |||||
| @@ -1,13 +1,13 @@ | |||||
| import { TestBed } from '@angular/core/testing'; | import { TestBed } from '@angular/core/testing'; | ||||
| import { DataService } from './data.service'; | |||||
| import { NewsService } from './news.service'; | |||||
| describe('DataService', () => { | |||||
| let service: DataService; | |||||
| describe('NewsService', () => { | |||||
| let service: NewsService; | |||||
| beforeEach(() => { | beforeEach(() => { | ||||
| TestBed.configureTestingModule({}); | TestBed.configureTestingModule({}); | ||||
| service = TestBed.inject(DataService); | |||||
| service = TestBed.inject(NewsService); | |||||
| }); | }); | ||||
| it('should be created', () => { | it('should be created', () => { | ||||
| @@ -0,0 +1,17 @@ | |||||
| import { Injectable } from '@angular/core'; | |||||
| import { HttpClient, HttpHeaders } from '@angular/common/http'; | |||||
| @Injectable({ | |||||
| providedIn: 'root' | |||||
| }) | |||||
| export class NewsService { | |||||
| constructor( | |||||
| private http: HttpClient | |||||
| ) { } | |||||
| getArticles() { | |||||
| return this.http.get('https://www.punjabkingsipl.in/api/listing?entities=4&otherent=1,8021&pgnum=1&inum=10&pgsize=10').toPromise(); | |||||
| } | |||||
| } | |||||
| @@ -23,7 +23,7 @@ const routes: Routes = [ | |||||
| }, | }, | ||||
| { | { | ||||
| path: '', | path: '', | ||||
| redirectTo: '/tabs/live', | |||||
| redirectTo: '/tabs/home', | |||||
| pathMatch: 'full' | pathMatch: 'full' | ||||
| } | } | ||||
| ]; | ]; | ||||
| @@ -1,7 +1,7 @@ | |||||
| <ion-tabs #tabs (ionTabsDidChange)="setCurrentTab()"> | <ion-tabs #tabs (ionTabsDidChange)="setCurrentTab()"> | ||||
| <ion-tab-bar slot="bottom" [ngClass]="{'live' : selectedTab === 'live', | <ion-tab-bar slot="bottom" [ngClass]="{'live' : selectedTab === 'live', | ||||
| 'dark' : selectedTab === 'player-stats'}"> | 'dark' : selectedTab === 'player-stats'}"> | ||||
| <ion-tab-button tab="home" disabled="true"> | |||||
| <ion-tab-button tab="home"> | |||||
| <ion-icon name="home-outline"></ion-icon> | <ion-icon name="home-outline"></ion-icon> | ||||
| <ion-icon name="home"></ion-icon> | <ion-icon name="home"></ion-icon> | ||||
| </ion-tab-button> | </ion-tab-button> | ||||