diff --git a/src/helpers/notifier/index.js b/src/helpers/notifier/index.js index 2e7f84c..116d273 100644 --- a/src/helpers/notifier/index.js +++ b/src/helpers/notifier/index.js @@ -28,25 +28,24 @@ function notify ({ didSucceed, operation }) { } function genInfo (didSucceed, operation) { - const index = getIndex() const operationText = operation === MERGE ? 'Merge' : 'Conversion' if (didSucceed) { return { title: `${operationText} complete!`, - body: text.success[index], + body: getRandomElement(text.success), icon: `${imgPath}/success.png` } } return { title: `Oh no! ${operationText} failed.`, - body: text.failure[index], + body: getRandomElement(text.failure), icon: `${imgPath}/failure.png` } } -function getIndex () { +function getRandomElement (array) { const rnd = Math.random() - return Math.floor(rnd * text.messageCount) + return array[Math.floor(rnd * array.length)] } diff --git a/src/helpers/notifier/text.json b/src/helpers/notifier/text.json index 0f610ea..226294c 100644 --- a/src/helpers/notifier/text.json +++ b/src/helpers/notifier/text.json @@ -1,5 +1,4 @@ { - "messageCount": 5, "success": [ "Your images are done a'brewin.", "The transmutation was a success.", @@ -14,4 +13,4 @@ "Another deception of the photo sorcerer.", "The night is dark and full of terrors." ] -} \ No newline at end of file +}