Skip to content

Commit

Permalink
fix: disable flip animation on radio down-vote (flicker)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohrstrom committed Jan 9, 2023
1 parent c0e4846 commit 40517c3
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 12 deletions.
1 change: 1 addition & 0 deletions docs/gcp/03-http-image-resizer.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ gcloud functions deploy \
--source ./functions/http-image-resizer/ \
--set-env-vars SOURCE=gs://ch-openbroadcast-media \
--allow-unauthenticated \
--memory 1024MB \
--trigger-http
```
23 changes: 22 additions & 1 deletion src/app-bridge/appBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@ import { useQueueStore } from "@/stores/queue";
import { useSettingsStore } from "@/stores/settings";
// import { useScheduleStore } from "@/stores/schedule";

// how often the web-app sends a heartbeat to swift-app
const HEARTBEAT_INTERVAL = 1000;

// configuration for swift-app
const HEARTBEAT_APP_ACTIVE_DELAY = 1.0;
const HEARTBEAT_APP_FOREGROUND_DELAY = 1.0;
const HEARTBEAT_HEARTBEAT_DELAY = 1.0;

// for channel options see:
// obr-app/obrapp/modules/OBRWebView.swift

// channels SENDING data TO swift-app
type sendChannel =
| "heartbeat"
| "heartbeat:setDelays"
| "heartbeat:shutdown"
| "global:init"
// queue
Expand Down Expand Up @@ -81,6 +88,8 @@ type ReceivedEvent = Event & {
};

class AppBridge {
pauseHeartbeat = (): void => {};

constructor() {
const { isWeb } = useDevice();
if (isWeb) {
Expand All @@ -91,18 +100,29 @@ class AppBridge {
this.init().then(() => {
log.debug("AppBridge - initialized");
});
useIntervalFn(
const { pause: pauseHeartbeat } = useIntervalFn(
async () => {
await this.heartbeat();
},
HEARTBEAT_INTERVAL,
{ immediateCallback: true }
);
this.pauseHeartbeat = async () => {
log.debug("AppBridge - pauseHeartbeat");
pauseHeartbeat();
await this.send("heartbeat:shutdown");
};
window.addEventListener("appBridge", this.onReceive.bind(this));
}
async init(): Promise<void> {
log.debug("AppBridge - init");
await this.send("global:init");
const delays = {
appActiveDelay: HEARTBEAT_APP_ACTIVE_DELAY,
appForegroundDelay: HEARTBEAT_APP_FOREGROUND_DELAY,
heartbeatDelay: HEARTBEAT_HEARTBEAT_DELAY,
};
await this.send("heartbeat:setDelays", delays);
}
async heartbeat(): Promise<void> {
// log.debug("AppBridge - heartbeat");
Expand Down Expand Up @@ -169,6 +189,7 @@ class AppBridge {
break;
}
case "schedule:update": {
console.debug("schedule", data.schedule);
// const { setSchedule } = useScheduleStore();
// await setSchedule(data.schedule);
break;
Expand Down
4 changes: 2 additions & 2 deletions src/components/account/auth/SocialLogin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default defineComponent({
// window.appBridge?.send("browser:navigate", {
// url: `${document.location.origin}${location}`,
// });
await window.appBridge?.send("heartbeat:shutdown");
window.appBridge.pauseHeartbeat();
setTimeout(() => {
window.location.href = location;
}, 200);
Expand Down Expand Up @@ -167,7 +167,7 @@ export default defineComponent({
border-color: #1877f2;
}
&:hover {
@include responsive.on-hover {
border-radius: 4px;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/components/account/settings/Social.vue
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ export default defineComponent({
margin-left: 0.5rem;
@include responsive.bp-medium {
display: none;
margin-left: 0;
}
}
Expand Down
10 changes: 2 additions & 8 deletions src/components/broadcast/radio/rating/Rating.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default defineComponent({
showPrompt();
await flipIcon(value);
} else {
await flipIcon(value);
await setRating(objKey.value, value);
}
},
Expand Down Expand Up @@ -143,14 +144,7 @@ export default defineComponent({
</div>
<div>
<CircleButton @click="rate(rating === -1 ? null : -1)" :outlined="true">
<div
class="flip-container"
:class="{
'is-flipped': isFlipped === -1,
}"
>
<IconFlash :outlined="rating !== -1" color-var="--c-page-fg" />
</div>
<IconFlash :outlined="rating !== -1" color-var="--c-page-fg" />
</CircleButton>
</div>
<div class="total">?</div>
Expand Down
6 changes: 5 additions & 1 deletion src/components/player/mobile/Player.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ export default defineComponent({
const panelVisible = ref(false);
const hidePanel = () => (panelVisible.value = false);
const togglePanel = () => {
// when both panel & queue are visible: close the queue
// when both panel & queue are visible: close the queue (but keep the panel)
if (queueVisible.value && panelVisible.value) {
hideQueue();
} else {
panelVisible.value = !panelVisible.value;
// hide queue in case panel becomes visible
if (panelVisible.value) {
hideQueue();
}
}
};
const fgColor = computed(() => {
Expand Down
2 changes: 2 additions & 0 deletions src/components/ui/panel/OverlayPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ export default defineComponent({
@include responsive.bp-medium {
box-shadow: 0 -4px 8px 4px rgb(0 0 0 / 10%);
border-top-left-radius: 28px;
border-top-right-radius: 28px;
}
&::-webkit-scrollbar {
Expand Down

0 comments on commit 40517c3

Please sign in to comment.