Skip to content

Commit

Permalink
Merge pull request #21 from DeekyJay/debounce
Browse files Browse the repository at this point in the history
Debounce Play for Analytics, Electron Update, Better OAuth Window, & Wording Fix
  • Loading branch information
DeekyJay authored Dec 11, 2016
2 parents d571152 + d84215a commit a969a27
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 331 deletions.
1 change: 0 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ app.on('ready', () => {

// Load IPC handler
require(utilsPath + '/ipcHandler')
require(utilsPath + '/interactive')

mainWindow.on('closed', () => {
mainWindow = null
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SoundwaveInteractive",
"version": "0.9.8",
"version": "0.9.9",
"description": "Soundwave Interactive Beam Soundboard",
"main": "main.js",
"engines": {
Expand Down Expand Up @@ -183,7 +183,7 @@
"cssnano": "^3.3.2",
"debug": "^2.2.0",
"devtron": "^1.3.0",
"electron": "^1.4.8",
"electron": "^1.4.12",
"electron-builder": "9.1.0",
"electron-debug": "^0.5.2",
"electron-devtools-installer": "^2.0.1",
Expand Down
2 changes: 1 addition & 1 deletion src/app.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

// const DEV_API_PATH = 'http://localhost:3000'
// const DEV_API_PATH = 'http://localhost:3000/api/v1'
const DEV_API_PATH = 'http://soundwave.deek.io/api/v1'
const PROD_API_PATH = 'http://soundwave.deek.io/api/v1'
const API_BASE_URL = process.env.NODE_ENV === 'development' ? DEV_API_PATH : PROD_API_PATH
Expand Down
10 changes: 3 additions & 7 deletions src/containers/Changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@ export class Changelog extends React.Component {
<div className='info-container'>
<div className='info-title'>Changelog</div>
<div className='info-wrapper'>
<InfoGroup title='Some New Stuff' className='new'
text={'Here are some new features we\'ve recently added.'}>
<InfoBullet text='Kill Playing Sounds - Accidentally let users trigger some really long and annoying sounds? You can now stop all the sounds!' />
</InfoGroup>
<InfoGroup title='Some Changed Stuff' className='change'
text={'Here are some changes we\'ve made since the last release.'}>
<InfoBullet text='Various tweaks to the audio library to handle audio playback issues.' />
<InfoBullet text='Icon sizing issues on Windows.' />
<InfoBullet text='Handle reconnect on timeout errors.' />
<InfoBullet text='Core update to possibly fix issue with sounds not playing until restart.' />
<InfoBullet text='Tweaked behaviour of the window for logging in.' />
<InfoBullet text='Minor tweaks and changes to wording in the tutorial.' />
</InfoGroup>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/Soundboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class Soundboard extends React.Component {
'Drag and drop a sound onto it!'
case 5:
return 'Connection - Here are a couple different options for cooldown. Hover over them see what they do! ' +
'Sometimes your board can disconnect. You can enabled auto-reconnect and give it a time for when it ' +
'Sometimes your board can disconnect. You can enable auto-reconnect and give it a time for when it ' +
'it should reconnect.'
case 6:
return 'Finally, once you\'ve done all this, click Connect!'
Expand Down
1 change: 1 addition & 0 deletions src/redux/modules/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const actions = {
ipcDispatch = dispatch
console.log(data)
if (data.globalVolume) Howler.volume(parseInt(data.globalVolume) * 0.01)
if (data.selectedOutput) dispatch(actions.setAudioDevice(data.selectedOutput))
dispatch({
type: constants.APP_INITIALIZE,
payload: data
Expand Down
27 changes: 11 additions & 16 deletions src/redux/modules/Sounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,24 +51,19 @@ export const actions = {
const state = getState()
let sounds = Object.assign([], state.sounds.sounds)
files.map((file) => {
if (!_.find(sounds, (sound) => { return sound.path === file.path })) {
let splitName = file.name.split('.')
let name = ''
if (splitName.length > 1) {
delete splitName[splitName.length - 1]
let tempName = splitName.join('.')
name = tempName.substring(0, tempName.length - 1)
} else if (splitName.length === 1) {
name = splitName[0]
} else {
name = file.name
}
sounds.push({ id: cuid(), name: name, path: file.path, cooldown: state.sounds.default_cooldown,
sparks: state.sounds.default_sparks, volume: state.sounds.default_volume })
let splitName = file.name.split('.')
let name = ''
if (splitName.length > 1) {
delete splitName[splitName.length - 1]
let tempName = splitName.join('.')
name = tempName.substring(0, tempName.length - 1)
} else if (splitName.length === 1) {
name = splitName[0]
} else {
toastr.warning('Duplicate Detected',
file.path + ' already exists in your library.')
name = file.name
}
sounds.push({ id: cuid(), name: name, path: file.path, cooldown: state.sounds.default_cooldown,
sparks: state.sounds.default_sparks, volume: state.sounds.default_volume })
})
dispatch({
type: constants.ADD_SOUNDS,
Expand Down
23 changes: 17 additions & 6 deletions src/redux/utils/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,26 @@ export function updateSoundCount (currentSounds) {
}
}

export function play (sparks) {
let playTimeout
let plays = 0
let sparks = 0
export function play (sprk) {
if (shouldAnalytics) {
console.log('PLAY SOUND')
const data = {
stat: {
sparks_spent: sparks
plays++
sparks += sprk
clearTimeout(playTimeout)
playTimeout = setTimeout(() => {
const data = {
stat: {
sparks_spent: sparks,
plays: plays
}
}
}
fetch.post(`${config.API_BASE_URL}/stats/play`, data)
fetch.post(`${config.API_BASE_URL}/stats/play`, data)
plays = 0
sparks = 0
}, 3000)
}
}

Expand Down
96 changes: 0 additions & 96 deletions utils/BeamAuth.js

This file was deleted.

25 changes: 0 additions & 25 deletions utils/OAuthWindow.js

This file was deleted.

Loading

0 comments on commit a969a27

Please sign in to comment.