diff --git a/app/assets/icons/Recordings.tsx b/app/assets/icons/Recordings.tsx deleted file mode 100755 index 6689201..0000000 --- a/app/assets/icons/Recordings.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import React from 'react'; -import { Path, Svg } from 'react-native-svg'; - -type Props = { - style?: Object, -}; - -function Recordings(props: Props) { - return ( - - - - ); -} - -export default Recordings; diff --git a/app/components/Body.tsx b/app/components/Body.tsx index d7aadd4..3bad78e 100644 --- a/app/components/Body.tsx +++ b/app/components/Body.tsx @@ -9,7 +9,6 @@ import AdmobBanner from './elements/misc/AdmobBanner'; import RewardsCountdown from './elements/misc/RewardsCountdown'; import Guide from './screens/Guide'; import Home from './screens/Home'; -import Library from './screens/Library'; import Loading from './screens/Loading'; import Rewarded from './screens/Rewarded'; import Settings from './screens/Settings'; @@ -65,7 +64,6 @@ function Body() { } /> } /> - } /> )} /> } /> } /> diff --git a/app/components/blocks/bottom/Bottom.tsx b/app/components/blocks/bottom/Bottom.tsx index e400ad5..1066c50 100644 --- a/app/components/blocks/bottom/Bottom.tsx +++ b/app/components/blocks/bottom/Bottom.tsx @@ -85,91 +85,6 @@ function Bottom() { dispatch(beatActions.resetBeat()); }; - // const handleRecording = () => {}; - - /* Recording Functions - START */ - /* - const startRec = async () => { - let findBeat = false; - for (let i in beats.hihat) { - if ( - beats.hihat[i].checked === true || - beats.snare[i].checked === true || - beats.kick[i].checked === true - ) { - findBeat = true; - break; - } - } - - let status = (await Audio.getPermissionsAsync()).granted; - if (status === true && isPlaying === false && findBeat === true) { - try { - await Audio.setAudioModeAsync({ - allowsRecordingIOS: true, - playsInSilentModeIOS: true, - staysActiveInBackground: false, - shouldDuckAndroid: false, - playThroughEarpieceAndroid: false, - interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX, - interruptionModeAndroid: - Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX, - }); - - await recording.prepareToRecordAsync(RecordingOptions); - await recording.startAsync(); - - start(); - - isRecording = true; - setRecordingStatus(isRecording); - } catch (err) { - console.error(err); - } - } else if (status === true && isPlaying === true && findBeat === true) { - try { - await Audio.setAudioModeAsync({ - allowsRecordingIOS: true, - playsInSilentModeIOS: true, - staysActiveInBackground: false, - shouldDuckAndroid: false, - playThroughEarpieceAndroid: true, - interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX, - interruptionModeAndroid: - Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX, - }); - - await recording.prepareToRecordAsync(RecordingOptions); - await recording.startAsync(); - - isRecording = true; - setRecordingStatus(isRecording); - } catch (err) { - console.error(err); - } - } else if (status === true && isPlaying === false && findBeat === false) { - alertDelay(); - } else { - await Audio.requestPermissionsAsync(); - } - }; - - const stopRec = async () => { - pause(); - - await recording.stopAndUnloadAsync(); - setRecording(new Audio.Recording()); - const uri = recording.getURI(); - - console.log(uri); - // Current Save Folder URL: /Users/dariodumlijan/Library/Developer/CoreSimulator/Devices/B54A7218-4990-45B7-925F-BC578F42FB29/data/Containers/Data/Application/13C70B38-FE6B-4F46-A0C0-CC95AE195051/Library/Caches/ExponentExperienceData/%40ddario%2FRitmo - - isRecording = false; - setRecordingStatus(isRecording); - }; - */ - /* Recording Functions - END */ - return ( @@ -225,17 +140,6 @@ function Bottom() { > {t('bottom.actions.reset')} - {/* - - */} diff --git a/app/components/blocks/navigation/Navigation.tsx b/app/components/blocks/navigation/Navigation.tsx index fc76122..7da279a 100644 --- a/app/components/blocks/navigation/Navigation.tsx +++ b/app/components/blocks/navigation/Navigation.tsx @@ -12,7 +12,6 @@ import { isEqual, map } from 'lodash'; import Exit from '../../../assets/icons/Exit'; import Export from '../../../assets/icons/Export'; import Guide from '../../../assets/icons/Guide'; -import Recordings from '../../../assets/icons/Recordings'; import Settings from '../../../assets/icons/Settings'; import StateTree from '../../../assets/icons/StateTree'; import useLocale from '../../../locales'; @@ -44,10 +43,10 @@ function Navigation() { visible: true, }, { - path: 'library', - label: t('navigation.library'), - icon: , - visible: false, + path: 'export', + label: t('navigation.export'), + icon: , + visible: true, }, { path: 'guide', @@ -131,7 +130,7 @@ function Navigation() { {map(links, (link) => ( - {link.visible && ( + {link.visible && link.path !== 'export' && ( )} + {link.visible && link.path === 'export' && ( + + + {t('navigation.export')} + + + + )} ))} - - - {t('navigation.export')} - - - diff --git a/app/components/screens/Library.tsx b/app/components/screens/Library.tsx deleted file mode 100644 index 4f2637a..0000000 --- a/app/components/screens/Library.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import React from 'react'; -import { SafeAreaView, Text } from 'react-native'; -import { Link } from 'react-router-native'; -import Exit from '../../assets/icons/Exit'; -import colors from '../../styles/colors'; -import mainStyle from '../../styles/main'; - -function Library() { - return ( - - - - - Recordings - - ); -} - -export default Library; diff --git a/app/locales/en.json b/app/locales/en.json index e68c3c0..ffcf964 100644 --- a/app/locales/en.json +++ b/app/locales/en.json @@ -8,10 +8,9 @@ "title": "Redefine Beatmaking", "alert": "Nothing to export!", "settings": "Settings", - "library": "Library", "guide": "Guide", "state_tree": "State Tree", - "export": "Export MIDI" + "export": "Export" }, "bottom": { "preset": { diff --git a/app/midi/index.ts b/app/midi/index.ts index f8312fa..4756463 100644 --- a/app/midi/index.ts +++ b/app/midi/index.ts @@ -1,3 +1,4 @@ +import { Buffer } from 'buffer'; import RNFS from 'react-native-fs'; import Share from 'react-native-share'; import { filter, forEach, times } from 'lodash'; @@ -5,6 +6,9 @@ import MidiWriter from 'midi-writer-js'; import type { Beat, Beats } from '../sound/beats'; import type { TimeSignature } from '../store/globalStore'; +// @ts-ignore +window.Buffer = Buffer; // HACK to fix midi-writer-js: Buffer is not defined + type MidiNote = 'KSH' | 'KS' | 'KH' | 'SH' | 'K' | 'S' | 'H'; type Note = MidiNote | 'R'; type MidiLayout = MidiNote[]; diff --git a/app/store/globalStore.ts b/app/store/globalStore.ts index 2b151c4..b48607c 100644 --- a/app/store/globalStore.ts +++ b/app/store/globalStore.ts @@ -46,7 +46,6 @@ export type TimeSignature = { export type UI = { fileUri?: string, isPlaying: boolean, - isRecording: boolean, navigationOpen?: boolean, personalisedAds?: boolean, selectedReward?: Sample | null, @@ -361,7 +360,6 @@ const resetBeat = (state: State): State => { return merge({}, state, { ui: { isPlaying: false, - isRecording: false, useBPM: 100, useTimeSig: { hihat: timeSig.value, @@ -401,7 +399,6 @@ const loadPreset = (state: State, preset: Preset): State => ({ ui: { ...state.ui, isPlaying: false, - isRecording: false, useBPM: preset.useBPM, useTimeSig: preset.useTimeSig, }, @@ -503,9 +500,11 @@ export const reducer = (state: any, action: ReduxAction) => { return merge({}, state, { ui: { isPlaying: false } }); case GlobalTypes.GB_EXPORT_MIDI_FULFILLED: - case GlobalTypes.GB_EXPORT_MIDI_REJECTED: return exportMIDI(state, action.payload); + case GlobalTypes.GB_EXPORT_MIDI_REJECTED: + return state; + case GlobalTypes.GB_DELETE_MIDI_FILE: return omit(state, 'ui.fileUri'); diff --git a/app/store/index.ts b/app/store/index.ts index 58a2ed0..5a5c99a 100644 --- a/app/store/index.ts +++ b/app/store/index.ts @@ -47,7 +47,6 @@ const initialState = { ui: { showAds: true, isPlaying: false, - isRecording: false, useBPM: 100, useSample: sample, useTimeSig: { diff --git a/app/styles/bottom.ts b/app/styles/bottom.ts index 9c46f4c..226c082 100644 --- a/app/styles/bottom.ts +++ b/app/styles/bottom.ts @@ -79,16 +79,6 @@ const bottomStyle = StyleSheet.create({ fontSize: isTablet ? 20 : 16, textAlign: 'center', }, - btnRecording: { - borderRadius: 10, - paddingHorizontal: 10, - paddingVertical: 10, - }, - iconRecording: { - aspectRatio: 1 / 1, - borderRadius: 10, - width: 16, - }, }); export default bottomStyle; diff --git a/app/utils/hooks.ts b/app/utils/hooks.ts index 037e504..a7196ae 100644 --- a/app/utils/hooks.ts +++ b/app/utils/hooks.ts @@ -88,23 +88,12 @@ export const useReview = () => { return handleReview; }; -export type LocationInfo = { - current: string, - isHome: boolean, - isRewarded: boolean, - isSettings: boolean, - isGuide: boolean, - isLibrary: boolean, - isStateTree: boolean, -}; - -export const useLocationInfo = (): LocationInfo => { +export const useLocationInfo = () => { const location = useLocation(); const isHome = location.pathname === '/'; const isRewarded = location.pathname.includes('/rewarded'); const isSettings = location.pathname === '/settings'; const isGuide = location.pathname === '/guide'; - const isLibrary = location.pathname === '/library'; const isStateTree = location.pathname === '/state-tree'; return { @@ -113,7 +102,6 @@ export const useLocationInfo = (): LocationInfo => { isRewarded, isSettings, isGuide, - isLibrary, isStateTree, }; };