-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Respect "expectingInput" in "inputHint" (#2149)
* Use React to start/stop microphone instead of saga * Respecting input hints * Fix * Fix 2 * Fix 3 * Fix 4 * Stop speak on typing * Stop dictate on ignoringInput * Only handle event when supposed to * Fix 5 * Should only mark to speak if not empty * Add comment * Clean up * Rename * Add entry * Add comment * Clean up * Send typing indicator on speech
- Loading branch information
Showing
16 changed files
with
115 additions
and
115 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
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// If true, the activity is in the queue and needs to be spoken. | ||
|
||
export default function speakingActivity(activity) { | ||
return activity.channelData && activity.channelData.speak; | ||
} |
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,19 @@ | ||
import { START_SPEAKING_ACTIVITY } from '../../lib/actions/startSpeakingActivity'; | ||
import { STOP_SPEAKING_ACTIVITY } from '../../lib/actions/stopSpeakingActivity'; | ||
|
||
export default function(state = false, { type }) { | ||
switch (type) { | ||
case START_SPEAKING_ACTIVITY: | ||
state = true; | ||
break; | ||
|
||
case STOP_SPEAKING_ACTIVITY: | ||
state = false; | ||
break; | ||
|
||
default: | ||
break; | ||
} | ||
|
||
return state; | ||
} |
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
17 changes: 0 additions & 17 deletions
17
packages/core/src/sagas/effects/whileSpeakIncomingActivity.js
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
packages/core/src/sagas/markActivityForSpeakOnIncomingActivityFromOthersSaga.js
This file was deleted.
Oops, something went wrong.
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
32 changes: 32 additions & 0 deletions
32
packages/core/src/sagas/speakActivityAndStartDictateOnIncomingActivityFromOthersSaga.js
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,32 @@ | ||
import { put, select, takeEvery } from 'redux-saga/effects'; | ||
|
||
import { INCOMING_ACTIVITY } from '../actions/incomingActivity'; | ||
import markActivity from '../actions/markActivity'; | ||
import shouldSpeakIncomingActivitySelector from '../selectors/shouldSpeakIncomingActivity'; | ||
import speakableActivity from '../definitions/speakableActivity'; | ||
import startDictate from '../actions/startDictate'; | ||
import stopDictate from '../actions/stopDictate'; | ||
import whileConnected from './effects/whileConnected'; | ||
|
||
function* speakActivityAndStartDictateOnIncomingActivityFromOthers({ userID }) { | ||
yield takeEvery(({ payload, type }) => type === INCOMING_ACTIVITY && payload.activity.from.id !== userID, function*({ | ||
payload: { activity } | ||
}) { | ||
const shouldSpeakIncomingActivity = yield select(shouldSpeakIncomingActivitySelector); | ||
const shouldSpeak = speakableActivity(activity) && shouldSpeakIncomingActivity; | ||
|
||
if (shouldSpeak && (activity.speak || activity.text)) { | ||
yield put(markActivity(activity, 'speak', true)); | ||
} | ||
|
||
if (activity.inputHint === 'expectingInput' || (shouldSpeak && activity.inputHint !== 'ignoringInput')) { | ||
yield put(startDictate()); | ||
} else if (activity.inputHint === 'ignoringInput') { | ||
yield put(stopDictate()); | ||
} | ||
}); | ||
} | ||
|
||
export default function* speakActivityAndStartDictateOnIncomingActivityFromOthersSaga() { | ||
yield whileConnected(speakActivityAndStartDictateOnIncomingActivityFromOthers); | ||
} |
37 changes: 0 additions & 37 deletions
37
packages/core/src/sagas/startDictateAfterSpeakActivitySaga.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.