This repository has been archived by the owner on May 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(autoplay): Add autoplay as url parameter
- Loading branch information
1 parent
6c55fe3
commit 7352579
Showing
9 changed files
with
110 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import 'babel-polyfill' | ||
import { params } from 'utils/url' | ||
import { urlParameters } from 'utils/url' | ||
import remoteConfig from 'utils/request' | ||
|
||
import app from '../app' | ||
|
||
remoteConfig(params.episode) | ||
.then(config => Object.assign({}, config, params)) | ||
.then(config => Object.assign({}, config, {display: 'embed'})) | ||
remoteConfig(urlParameters.episode) | ||
.then(config => ({ ...config, display: 'embed' })) | ||
.then(app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import actions from '../actions' | ||
|
||
export default (store, { type, payload }) => { | ||
switch (type) { | ||
case 'SET_URL_PARAMS': | ||
if (payload.playtime) { | ||
store.dispatch(actions.setPlaytime(payload.playtime)) | ||
store.dispatch(actions.idle()) | ||
} | ||
|
||
if (payload.autoplay) { | ||
store.dispatch(actions.play()) | ||
} | ||
break | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import test from 'ava' | ||
import sinon from 'sinon' | ||
|
||
import urlEffects from './url' | ||
|
||
let store | ||
|
||
test.beforeEach(t => { | ||
store = { | ||
dispatch: sinon.stub() | ||
} | ||
}) | ||
|
||
test(`storageEffects: it dispatches autoplay on SET_URL_PARAMS`, t => { | ||
urlEffects(store, { | ||
type: 'SET_URL_PARAMS', | ||
payload: { | ||
autoplay: true | ||
} | ||
}) | ||
|
||
t.deepEqual(store.dispatch.getCall(0).args[0], { | ||
type: 'UI_PLAY' | ||
}) | ||
}) | ||
|
||
test(`storageEffects: it dispatches playtime on SET_URL_PARAMS`, t => { | ||
urlEffects(store, { | ||
type: 'SET_URL_PARAMS', | ||
payload: { | ||
playtime: 10 | ||
} | ||
}) | ||
|
||
t.deepEqual(store.dispatch.getCall(0).args[0], { | ||
type: 'SET_PLAYTIME', | ||
payload: 10 | ||
}) | ||
|
||
t.deepEqual(store.dispatch.getCall(1).args[0], { | ||
type: 'IDLE' | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters