Slide 15
Slide 15 text
瑬 2 珕 AbemaTV ך㰢ש RxJS
2.2 Ⳃ槆ֿ⫋榟ך׀־⮭㲊 (ꦘ佄䈱: A)
2.2.1 ゖ갭
ⳛ氺ֿ⫙气ך׀־לֹ־ע㝂ׂס API ס篙卸篁ײ⻉י⮿偂םׄףַׄױ
؆ַױ⠥չס API ⺡ַג篙卸ֿ嵣יׂ♧┫סتعٛ٭ّ٬ꫀ俙ֵֿכ
ױ
• regionStore.isRegionAllowed(): Promise
• videoStore.metadata$: Observable<{ isFree: boolean }>
• userStore.subscriptionStatus$: Observable<’free’ | ’premium’>
אבסتعٛ٭ّעⳛ氺⫙气ֹכגכ׀מ API ֿ⺡־י剳偆
סכױױגⳛ氺ֿ⫙气ך׀סע姌ס匛⚂⪢י彸גכ׀ך
• 镄舌ֿ陵⺪יַ㐌㔔־ؓؠجتיַ (isRegionAllowed ס篙卸
ֿ true)
• 摾倣ⳛ氺 (metadata$ ס篙卸ֿ isFree: true) ךֵֵַע劔倣ⳛ氺
(isFree: false) ־ח劔倣⚶〉 (subscriptionStatus$ ס篙卸ֿ premium) ך
ֵ
ⳛ氺ס⫙气 play(): () => void מזי鉿ֹכ׀匛⚂ֿ彸גיַ㖪⻉
סײ⫙气ؤ٭غ剹ַיׂדַ
2.2.2 鉮璻
combineLatest([
from(regionStore.isRegionAllowed()),
videoStore.metadata$,
userStore.subscriptionStatus$,
])
.pipe(
filter(([isAllowed, { isFree }, subscriptionStatus]) => {
if (!isAllowed) {
return false;
}
return isFree || (!isFree && subscriptionStatus === 'premium');
}),
)
.subscribe(() => {
46