Skip to content

Commit

Permalink
Quick fix (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkmalmgren committed Sep 16, 2017
1 parent 2bea93a commit 4585c71
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "bolingbrook-church",
"version": "1.2.11",
"version": "1.2.12",
"license": "MIT",
"angular-cli": {},
"scripts": {
Expand Down
8 changes: 8 additions & 0 deletions src/app/components/pages/sermons/sermon.html
@@ -1,5 +1,13 @@
<bc-header></bc-header>
<main>
<section *ngIf="youtube_live_issues && live">
<h2>Experiencing Issues</h2>
<p>
Unfortunately, we are having techincal issues with our live streaming. We are working hard to address
the issue and will be back soon.
</p>
</section>

<section class="video">
<iframe *ngIf="youtube_url"
id="sermonVideo"
Expand Down
27 changes: 20 additions & 7 deletions src/app/components/pages/sermons/sermon.spec.ts
Expand Up @@ -8,6 +8,7 @@ import {
SeriesImageService,
Sermon,
SermonService,
TogglesService,
VideoState,
YoutubeService
} from 'app/services';
Expand All @@ -25,7 +26,11 @@ describe('SermonComponent', () => {
.with('params', Observable.empty())
.build();

const sermon = new SermonComponent(activatedRoute, null, null, null, null, null, youtubeService);
const togglesService = MockBuilder.of(TogglesService)
.withStub('getToggles', Observable.empty())
.build();

const sermon = new SermonComponent(activatedRoute, null, null, null, null, null, togglesService, youtubeService);

sermon.ngOnInit();

Expand All @@ -48,7 +53,11 @@ describe('SermonComponent', () => {
.withSpy('event')
.build();

const sermon = new SermonComponent(activatedRoute, analytics, null, null, null, null, youtubeService);
const togglesService = MockBuilder.of(TogglesService)
.withStub('getToggles', Observable.empty())
.build();

const sermon = new SermonComponent(activatedRoute, analytics, null, null, null, null, togglesService, youtubeService);
sermon.analyticsInterval = 5;
sermon.videoState = VideoState.PLAYING;
sermon.sermon = { youtube: 'Jesus4Life' } as Sermon;
Expand Down Expand Up @@ -76,7 +85,10 @@ describe('SermonComponent', () => {
.withSpy('event')
.build();

const sermon = new SermonComponent(activatedRoute, analytics, null, null, null, null, youtubeService);
const togglesService = MockBuilder.of(TogglesService)
.withStub('getToggles', Observable.empty())
.build();
const sermon = new SermonComponent(activatedRoute, analytics, null, null, null, null, togglesService, youtubeService);
sermon.analyticsInterval = 5;
sermon.videoState = VideoState.PLAYING;
sermon.live = true;
Expand Down Expand Up @@ -110,7 +122,11 @@ describe('SermonComponent', () => {
.withSpy('event')
.build();

const sermon = new SermonComponent(activatedRoute, analytics, null, null, null, null, youtubeService);
const togglesService = MockBuilder.of(TogglesService)
.withStub('getToggles', Observable.empty())
.build();

const sermon = new SermonComponent(activatedRoute, analytics, null, null, null, null, togglesService, youtubeService);
sermon.analyticsInterval = 5;
sermon.videoState = state;
sermon.sermon = { youtube: 'Jesus4Life' } as Sermon;
Expand All @@ -124,9 +140,6 @@ describe('SermonComponent', () => {
}));
});




});

});
10 changes: 10 additions & 0 deletions src/app/components/pages/sermons/sermon.ts
Expand Up @@ -10,6 +10,7 @@ import {
SeriesImageService,
Sermon,
SermonService,
TogglesService,
VideoState,
YoutubeService
} from '../../../services';
Expand All @@ -24,6 +25,7 @@ export class SermonComponent extends Autoclean implements OnInit {
sermon: Sermon;
live: boolean = false;
youtube_url: SafeResourceUrl;
youtube_live_issues: boolean = false;
icon: SafeStyle;

videoState: VideoState = VideoState.UNSTARTED;
Expand All @@ -36,6 +38,7 @@ export class SermonComponent extends Autoclean implements OnInit {
private meta: Meta,
private sanitizer: DomSanitizer,
private service: SermonService,
private togglesService: TogglesService,
private youtubeService: YoutubeService
) {
super();
Expand All @@ -50,6 +53,13 @@ export class SermonComponent extends Autoclean implements OnInit {
this.videoState = state;
}));

/* Handle issues if youtube is having issues */
this.autoclean(
this.togglesService.getToggles()
.subscribe((toggles) => {
this.youtube_live_issues = !!toggles.youtube_live_issues;
}));

/* Record Analytics when Playing */
this.autoclean(
Observable.interval(this.analyticsInterval)
Expand Down
1 change: 1 addition & 0 deletions src/app/services/toggles.service.ts
Expand Up @@ -4,6 +4,7 @@ import { Observable } from './observable';

export interface FeatureToggles {
youtube_live: boolean;
youtube_live_issues: boolean;
}

@Injectable()
Expand Down

0 comments on commit 4585c71

Please sign in to comment.