-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #211 from lovegaoshi/dev
feat: bottom tab
- Loading branch information
Showing
15 changed files
with
2,104 additions
and
3,510 deletions.
There are no files selected for viewing
Submodule MusicFreePlugins
updated
6 files
+1 −1 | dist/_plugins/plugins.json | |
+161 −0 | dist/kuaishou/index.js | |
+0 −1 | dist/qq/index.js | |
+3 −1 | package.json | |
+1 −1 | plugins.json | |
+166 −0 | plugins/kuaishou/index.ts |
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,5 +1,3 @@ | ||
const path = require('path'); | ||
|
||
module.exports = api => { | ||
const isTest = api.env('test'); | ||
if (isTest) { | ||
|
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 |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
"@react-native-async-storage/async-storage": "^1.18.1", | ||
"@react-native-community/netinfo": "^9.3.10", | ||
"@react-native-cookies/cookies": "git+https://github.com/alexhernandez/cookies.git#patch-1", | ||
"@react-native/metro-config": "0.72.9", | ||
"@react-native/metro-config": "^0.74.0", | ||
"@react-navigation/drawer": "^6.6.2", | ||
"@react-navigation/material-top-tabs": "^6.6.2", | ||
"@react-navigation/native": "^6.1.6", | ||
|
@@ -55,10 +55,11 @@ | |
"lottie-react-native": "^6.2.0", | ||
"lru-cache": "7.14.0", | ||
"md5": "^2.3.0", | ||
"metro": "^0.79.1", | ||
"qs": "^6.11.2", | ||
"react": "18.2.0", | ||
"react-i18next": "^12.2.2", | ||
"react-native": "0.72.4", | ||
"react-native": "0.72.6", | ||
"react-native-app-auth": "^7.0.0", | ||
"react-native-background-timer": "git+https://github.com/lovegaoshi/react-native-background-timer.git", | ||
"react-native-blob-jsi-helper": "git+https://github.com/lovegaoshi/react-native-blob-jsi-helper.git", | ||
|
@@ -85,17 +86,21 @@ | |
"react-native-vector-icons": "^9.2.0", | ||
"react-native-video": "^5.2.1", | ||
"react-native-webview": "^13.3.0", | ||
"react-native-windows": "^0.65.0-0", | ||
"react-native-windows": "^0.72.14", | ||
"react-use": "^17.4.0", | ||
"use-debounce": "^9.0.4", | ||
"uuid": "^9.0.0", | ||
"ytdl-core": "git+https://[email protected]/lovegaoshi/node-ytdl-core.git", | ||
"zustand": "^4.3.7" | ||
}, | ||
"resolutions": { | ||
"metro": "^0.79.1" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.22.11", | ||
"@babel/preset-env": "^7.22.10", | ||
"@babel/runtime": "^7.20.0", | ||
"@babel/core": "^7.23.2", | ||
"@babel/preset-env": "^7.23.2", | ||
"@babel/preset-typescript": "^7.23.2", | ||
"@babel/runtime": "^7.23.2", | ||
"@react-native-community/eslint-config": "^3.2.0", | ||
"@tsconfig/react-native": "^2.0.2", | ||
"@types/jest": "^29.2.1", | ||
|
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,121 @@ | ||
import React, { useEffect } from 'react'; | ||
import { NativeModules, Platform, StyleSheet, View } from 'react-native'; | ||
import { IconButton } from 'react-native-paper'; | ||
import { useNavigation, ParamListBase } from '@react-navigation/native'; | ||
import { | ||
DrawerNavigationProp, | ||
getDrawerStatusFromState, | ||
} from '@react-navigation/drawer'; | ||
|
||
import { ViewEnum } from '@enums/View'; | ||
import { useNoxSetting } from '@hooks/useSetting'; | ||
|
||
const { NoxAndroidAutoModule } = NativeModules; | ||
|
||
interface IconProps { | ||
icon: string; | ||
onPress: () => void; | ||
} | ||
const BottomIconButton = ({ icon, onPress }: IconProps) => { | ||
return ( | ||
<IconButton | ||
icon={icon} | ||
style={styles.iconButton} | ||
size={40} | ||
onPress={onPress} | ||
/> | ||
); | ||
}; | ||
|
||
enum Routes { | ||
playlist = 'playlist-music', | ||
music = 'music-note', | ||
explore = 'compass', | ||
setting = 'cog', | ||
} | ||
|
||
interface Props { | ||
navigation?: DrawerNavigationProp<ParamListBase>; | ||
} | ||
const NoxAndroidBottomTab = ({ navigation }: Props) => { | ||
const [gestureMode, setGestureMode] = React.useState(false); | ||
const navigationGlobal = useNavigation(); | ||
const playerStyle = useNoxSetting(state => state.playerStyle); | ||
const [route, setRoute] = React.useState('music'); | ||
|
||
useEffect(() => { | ||
// TODO: how to use await instead of states and useEffect? | ||
if (Platform.OS === 'android') { | ||
NoxAndroidAutoModule.isGestureNavigationMode().then(setGestureMode); | ||
} | ||
}, []); | ||
|
||
const isDrawerOpen = () => { | ||
if (navigation === undefined) return false; | ||
return getDrawerStatusFromState(navigation.getState()) === 'open'; | ||
}; | ||
|
||
const onDrawerPress = () => { | ||
if (navigation === undefined) return; | ||
setRoute(Routes.playlist); | ||
if (isDrawerOpen()) { | ||
navigation.closeDrawer(); | ||
return; | ||
} | ||
navigation.openDrawer(); | ||
}; | ||
|
||
const renderIcon = (icon: Routes) => | ||
route === icon ? icon : `${icon}-outline`; | ||
|
||
if (gestureMode) { | ||
return ( | ||
<View | ||
style={[ | ||
styles.panel, | ||
{ backgroundColor: playerStyle.colors.background }, | ||
]} | ||
> | ||
<BottomIconButton | ||
icon={renderIcon(Routes.playlist)} | ||
onPress={onDrawerPress} | ||
/> | ||
<BottomIconButton | ||
icon={renderIcon(Routes.music)} | ||
onPress={() => { | ||
navigationGlobal.navigate(ViewEnum.PLAYER_HOME as never); | ||
setRoute(Routes.music); | ||
}} | ||
/> | ||
<BottomIconButton | ||
icon={renderIcon(Routes.explore)} | ||
onPress={() => { | ||
navigationGlobal.navigate(ViewEnum.EXPORE as never); | ||
setRoute(Routes.explore); | ||
}} | ||
/> | ||
<BottomIconButton | ||
icon={renderIcon(Routes.setting)} | ||
onPress={() => { | ||
navigationGlobal.navigate(ViewEnum.SETTINGS as never); | ||
setRoute(Routes.setting); | ||
}} | ||
/> | ||
</View> | ||
); | ||
} | ||
return <></>; | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
panel: { | ||
flexDirection: 'row', | ||
}, | ||
iconButton: { | ||
flex: 1, | ||
borderRadius: 30, | ||
marginVertical: 3, | ||
}, | ||
}); | ||
|
||
export default NoxAndroidBottomTab; |
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
Oops, something went wrong.
68317dd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
azusa-player-mobile – ./
azusa-player-mobile.vercel.app
azusa-player-mobile-lovegaoshi.vercel.app
azusa-player-mobile-git-master-lovegaoshi.vercel.app