Ver a proveniência

Match details social sharing

master
kj1352 há 4 anos
ascendente
cometimento
746b53cdc6
4 ficheiros alterados com 27 adições e 5 eliminações
  1. +1
    -1
      src/app/home-details/home-details.page.html
  2. +7
    -1
      src/app/home-details/home-details.page.ts
  3. +1
    -1
      src/app/match-details/match-details.page.html
  4. +18
    -2
      src/app/match-details/match-details.page.ts

+ 1
- 1
src/app/home-details/home-details.page.html Ver ficheiro

@@ -36,7 +36,7 @@
</section>

<ion-fab vertical="bottom" horizontal="start" slot="fixed">
<ion-fab-button class="share-button">
<ion-fab-button class="share-button" (click)="share()">
<ion-icon name="share-social-outline"></ion-icon>
</ion-fab-button>
</ion-fab>


+ 7
- 1
src/app/home-details/home-details.page.ts Ver ficheiro

@@ -4,6 +4,7 @@ import { Location } from '@angular/common';
import { DomSanitizer } from '@angular/platform-browser';
import { NewsService, IMAGE_BASE_URL } from '../services/news.service';
import { ToastService } from '../services/toast.service';
import { SocialSharing } from '@ionic-native/social-sharing/ngx';

@Component({
selector: 'app-home-details',
@@ -20,7 +21,8 @@ export class HomeDetailsPage implements OnInit {
private location: Location,
private dom:DomSanitizer,
private newsService: NewsService,
private toastService: ToastService
private toastService: ToastService,
private socialSharing: SocialSharing
) { }

getUrl(url) {
@@ -31,6 +33,10 @@ export class HomeDetailsPage implements OnInit {
return this.dom.bypassSecurityTrustHtml(htmlTextWithStyle += '<style type="text/css">p{ margin: 0px 0px 10px 0px; }</style>');
}

share() {
this.socialSharing.share(this.newsDetails.title, '', IMAGE_BASE_URL + this.newsDetails.image_path + this.newsDetails.image_file_name, this.newsDetails.hls_url ? this.newsDetails.hls_url : '');
}

ngOnInit() {
let alias_title = this.route.snapshot.paramMap.get('alias_title');
let type = this.route.snapshot.paramMap.get('type');


+ 1
- 1
src/app/match-details/match-details.page.html Ver ficheiro

@@ -6,7 +6,7 @@
</div>
<header> {{ currentMatch.Teams[currentMatch.Matchdetail.Team_Home].Name_Short }} v/s {{ currentMatch.Teams[currentMatch.Matchdetail.Team_Away].Name_Short }} <br>
<span> {{ currentMatch.Matchdetail.Venue.Name }} </span> </header>
<div class="action">
<div class="action" (click)="shareMatchDetails()">
<button> <ion-icon name="share-social"></ion-icon> </button>
</div>
</section>


+ 18
- 2
src/app/match-details/match-details.page.ts Ver ficheiro

@@ -4,7 +4,7 @@ import { ActivatedRoute } from '@angular/router';
import { MatchService } from '../services/match.service';
import { ToastService } from '../services/toast.service';
import { RawMatchData } from '../live/live.page';
import { SocialSharing } from '@ionic-native/social-sharing/ngx';

interface RawCommentaryForBall {
Over: string;
@@ -69,9 +69,25 @@ export class MatchDetailsPage implements OnInit {
private location: Location,
private route: ActivatedRoute,
private matchService: MatchService,
private toastService: ToastService
private toastService: ToastService,
private socialSharing: SocialSharing
) { }

shareMatchDetails() {
console.log("Sharing match details...");
let message: string;

if (this.currentMatch.Innings) {
this.currentMatch.Innings.forEach(inning => {
message = this.currentMatch.Teams[inning.Battingteam].Name_Short + ' ' + inning.Total + '/' + inning.Wickets + '(' + inning.Overs + ')' + '\n';
});
} else {
message = 'Match to start on, ' + this.currentMatch.Matchdetail.Match.Date + ' @' + this.currentMatch.Matchdetail.Match.Time + '\n' + this.currentMatch.Teams[this.currentMatch.Matchdetail.Team_Home].Name_Short + ' v/s ' + this.currentMatch.Teams[this.currentMatch.Matchdetail.Team_Away].Name_Short;
}

this.socialSharing.share(message);
}

ngOnInit() {
let match_id = JSON.parse(this.route.snapshot.paramMap.get('match_id'));


Carregando…
Cancelar
Guardar