From: Chocobozzz Date: Fri, 5 Apr 2019 12:16:48 +0000 (+0200) Subject: video add to playlist component -> onpush strategy X-Git-Tag: v1.3.0-rc.1~97 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=8dfceec44a5eec8b0190d1d5076aab0f03a0cb52;p=oweals%2Fpeertube.git video add to playlist component -> onpush strategy --- diff --git a/client/src/app/shared/forms/peertube-checkbox.component.scss b/client/src/app/shared/forms/peertube-checkbox.component.scss index 6e4e20775..ea321ee65 100644 --- a/client/src/app/shared/forms/peertube-checkbox.component.scss +++ b/client/src/app/shared/forms/peertube-checkbox.component.scss @@ -28,4 +28,4 @@ position: relative; top: -2px; } -} \ No newline at end of file +} diff --git a/client/src/app/shared/forms/peertube-checkbox.component.ts b/client/src/app/shared/forms/peertube-checkbox.component.ts index c1a6915e8..9578f5618 100644 --- a/client/src/app/shared/forms/peertube-checkbox.component.ts +++ b/client/src/app/shared/forms/peertube-checkbox.component.ts @@ -1,4 +1,4 @@ -import { Component, forwardRef, Input } from '@angular/core' +import { ChangeDetectorRef, Component, forwardRef, Input, OnChanges, SimpleChanges } from '@angular/core' import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' @Component({ @@ -21,10 +21,19 @@ export class PeertubeCheckboxComponent implements ControlValueAccessor { @Input() helpHtml: string @Input() disabled = false + // FIXME: https://github.com/angular/angular/issues/10816#issuecomment-307567836 + @Input() onPushWorkaround = false + + constructor (private cdr: ChangeDetectorRef) { } + propagateChange = (_: any) => { /* empty */ } writeValue (checked: boolean) { this.checked = checked + + if (this.onPushWorkaround) { + this.cdr.markForCheck() + } } registerOnChange (fn: (_: any) => void) { diff --git a/client/src/app/shared/misc/screen.service.ts b/client/src/app/shared/misc/screen.service.ts index db481204e..af75569d9 100644 --- a/client/src/app/shared/misc/screen.service.ts +++ b/client/src/app/shared/misc/screen.service.ts @@ -18,6 +18,10 @@ export class ScreenService { return this.getWindowInnerWidth() < 500 } + isInTouchScreen () { + return 'ontouchstart' in window || navigator.msMaxTouchPoints + } + // Cache window inner width, because it's an expensive call private getWindowInnerWidth () { if (this.cacheWindowInnerWidthExpired()) this.refreshWindowInnerWidth() diff --git a/client/src/app/shared/video-playlist/video-add-to-playlist.component.html b/client/src/app/shared/video-playlist/video-add-to-playlist.component.html index 6029b3648..648d580fa 100644 --- a/client/src/app/shared/video-playlist/video-add-to-playlist.component.html +++ b/client/src/app/shared/video-playlist/video-add-to-playlist.component.html @@ -42,7 +42,7 @@