-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding preferences for speed control - forgot to add it, oops
- Loading branch information
Showing
10 changed files
with
95 additions
and
67 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,7 +1,13 @@ | ||
import Init from './setup/init' | ||
import { convertersUtils } from './utils/converters.utils' | ||
import { errorUtils } from './utils/errors.utils' | ||
|
||
const Nightcore = async () => { | ||
Init('nightcore') | ||
const converterName = 'nightcore' | ||
const { successToast } = convertersUtils.converters[converterName] | ||
|
||
await Init(converterName) | ||
await errorUtils.showToastSuccess({ title: successToast.title }) | ||
} | ||
|
||
export default Nightcore |
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,7 +1,13 @@ | ||
import Init from './setup/init' | ||
import { convertersUtils } from './utils/converters.utils' | ||
import { errorUtils } from './utils/errors.utils' | ||
|
||
const Reverb = async () => { | ||
Init('reverb') | ||
const converterName = 'reverb' | ||
const { successToast } = convertersUtils.converters[converterName] | ||
|
||
await Init(converterName) | ||
await errorUtils.showToastSuccess({ title: successToast.title }) | ||
} | ||
|
||
export default Reverb |
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,7 +1,13 @@ | ||
import Init from './setup/init' | ||
import { convertersUtils } from './utils/converters.utils' | ||
import { errorUtils } from './utils/errors.utils' | ||
|
||
const SlowedAndReverb = async () => { | ||
Init('slowedAndReverb') | ||
const converterName = 'slowedAndReverb' | ||
const { successToast } = convertersUtils.converters[converterName] | ||
|
||
await Init(converterName) | ||
await errorUtils.showToastSuccess({ title: successToast.title }) | ||
} | ||
|
||
export default SlowedAndReverb |
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,7 +1,13 @@ | ||
import Init from './setup/init' | ||
import { convertersUtils } from './utils/converters.utils' | ||
import { errorUtils } from './utils/errors.utils' | ||
|
||
const Slowed = async () => { | ||
Init('slowed') | ||
const converterName = 'slowed' | ||
const { successToast } = convertersUtils.converters[converterName] | ||
|
||
await Init(converterName) | ||
await errorUtils.showToastSuccess({ title: successToast.title }) | ||
} | ||
|
||
export default Slowed |
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,27 @@ | ||
import { getPreferenceValues } from '@raycast/api' | ||
import { errorUtils } from './errors.utils' | ||
|
||
const getPreference = (key: keyof Preferences): string => { | ||
const { throwError, CONSTANTS } = errorUtils | ||
try { | ||
return getPreferenceValues<Preferences>()[key] | ||
} catch (error) { | ||
throwError(CONSTANTS.noPreferenceKey) | ||
return '' | ||
} | ||
} | ||
|
||
const getDefaultSlowedSpeed = () => getPreference('defaultSlowedSpeed') || '0.8' | ||
const getDefaultNightcoreSpeed = () => getPreference('defaultNightcoreSpeed') || '1.2' | ||
|
||
const getAllDefaultSpeeds = () => ({ | ||
slowed: getDefaultSlowedSpeed(), | ||
nightcore: getDefaultNightcoreSpeed() | ||
}) | ||
|
||
export const preferenceUtils = { | ||
getPreference, | ||
getDefaultSlowedSpeed, | ||
getDefaultNightcoreSpeed, | ||
getAllDefaultSpeeds | ||
} |
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