Skip to content

Commit

Permalink
Merge pull request #406 from lovegaoshi/dev
Browse files Browse the repository at this point in the history
fix: play store
  • Loading branch information
lovegaoshi authored May 3, 2024
2 parents 7ca0927 + 12c0651 commit 7723ecb
Show file tree
Hide file tree
Showing 46 changed files with 946 additions and 1,244 deletions.
16 changes: 6 additions & 10 deletions __tests__/mediafetch/ytbChannel.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
// GMHikaru
import { fetchYTIChannel } from '../../src/utils/mediafetch/ytbchannel';
import fetcher from '../../src/utils/mediafetch/bilivideo';
test('bilivideo', async () => {
const result = await fetchYTIChannel('@MioriCelesta');
console.log(result);
return;
const content = await fetcher.regexFetch({
import fetcher from '../../src/utils/mediafetch/ytbchannel';
test('YT channel', async () => {
// HACK: due to yti limiatations this only gets up to 30 videos
const result = await fetcher.regexFetch({
reExtracted: fetcher.regexSearchMatch.exec(
'https://www.bilibili.com/video/BV1KW4y1p7oT/?spm_id_from=333.999.0.0'
'https://www.youtube.com/c/@MioriCelesta'
)!,
});
// console.log(content);
expect(content?.songList[0]?.id).not.toBeNull();
expect(result.songList[0]?.id).not.toBeNull();
});
28 changes: 5 additions & 23 deletions metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,16 @@
*
* @format
*/
const path = require('path');
const escape = require('escape-string-regexp');
const exclusionList = require('metro-config/src/defaults/exclusionList');
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');

const {
createSentryMetroSerializer
} = require("@sentry/react-native/dist/js/tools/sentryMetroSerializer");
createSentryMetroSerializer,
} = require('@sentry/react-native/dist/js/tools/sentryMetroSerializer');

const root = path.resolve(__dirname, '..');
const modules = Object.keys({});
const config = {
serializer: {
customSerializer: createSentryMetroSerializer()
}
customSerializer: createSentryMetroSerializer(),
},
};

// This stops "react-native run-windows" from causing the metro server to crash if its already running
const blockList = [
new RegExp(`${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`),
];
// This prevents "react-native run-windows" from hitting: EBUSY: resource busy or locked, open msbuild.ProjectImports.zip
blockList.push(/.*\.ProjectImports\.zip/);

/** build extraNodeModules **/
const extraNodeModules = modules.reduce((acc, name) => {
acc[name] = path.join(__dirname, 'node_modules', name);
return acc;
}, {});

module.exports = mergeConfig(getDefaultConfig(__dirname), config);
module.exports = mergeConfig(getDefaultConfig(__dirname), config);
52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
"@react-native-community/netinfo": "^11.3.1",
"@react-native-cookies/cookies": "^6.2.1",
"@react-native-masked-view/masked-view": "^0.3.1",
"@react-native/babel-preset": "^0.74.81",
"@react-native/metro-config": "^0.74.81",
"@react-native/babel-preset": "^0.74.83",
"@react-native/metro-config": "^0.74.83",
"@react-navigation/drawer": "^6.6.15",
"@react-navigation/material-top-tabs": "^6.6.13",
"@react-navigation/native": "^6.1.17",
"@react-navigation/native-stack": "^6.9.26",
"@sentry/react-native": "^5.22.0",
"@sharcoux/slider": "^7.1.1",
"@sentry/react-native": "^5.22.1",
"@sharcoux/slider": "^7.2.1",
"@shopify/flash-list": "^1.6.4",
"@shopify/react-native-skia": "1.2.3",
"axios": "^1.6.8",
Expand All @@ -51,10 +51,10 @@
"colord": "^2.9.3",
"crypto-js": "^4.2.0",
"d3": "^7.9.0",
"dayjs": "^1.11.10",
"dayjs": "^1.11.11",
"deepmerge": "^4.3.1",
"dropbox": "git+https://[email protected]/lovegaoshi/dropbox-sdk-js.git",
"expo": "^50.0.17",
"expo": "^50.0.18",
"expo-clipboard": "~5.0.1",
"expo-document-picker": "~11.10.1",
"expo-image": "1.10.6",
Expand All @@ -63,32 +63,32 @@
"fflate": "^0.8.2",
"ffmpeg-kit-react-native": "^6.0.2",
"he": "^1.2.0",
"i18next": "^23.11.2",
"i18next": "^23.11.3",
"js-base64": "^3.7.7",
"libmuse": "git+https://github.com/lovegaoshi/muse.git#apm-release",
"lottie-react-native": "^6.7.2",
"lru-cache": "7.14.0",
"md5": "^2.3.0",
"metro": "^0.80.8",
"metro": "^0.80.9",
"patch-package": "^8.0.0",
"postinstall-postinstall": "^2.1.0",
"qs": "^6.12.1",
"react": "18.2.0",
"react": "18.3.1",
"react-i18next": "^14.1.1",
"react-native": "0.73.7",
"react-native": "0.73.8",
"react-native-app-auth": "^7.1.3",
"react-native-background-timer": "git+https://github.com/lovegaoshi/react-native-background-timer.git",
"react-native-blob-jsi-helper": "^0.3.1",
"react-native-blob-util": "^0.19.9",
"react-native-device-info": "^10.13.2",
"react-native-draggable-flatlist": "^4.0.1",
"react-native-gesture-handler": "2.16.0",
"react-native-gesture-handler": "2.16.1",
"react-native-get-random-values": "^1.11.0",
"react-native-image-colors": "^2.4.0",
"react-native-lyric": "git+https://github.com/lovegaoshi/react-native-lyric.git#dev",
"react-native-pager-view": "^6.3.1",
"react-native-paper": "^5.12.3",
"react-native-qrcode-svg": "^6.3.0",
"react-native-qrcode-svg": "^6.3.1",
"react-native-reanimated": "^3.8.1",
"react-native-safe-area-context": "^4.10.1",
"react-native-screens": "3.31.1",
Expand All @@ -100,42 +100,42 @@
"react-native-text-ticker": "git+https://[email protected]/lovegaoshi/react-native-text-ticker.git",
"react-native-track-player": "git+https://[email protected]/lovegaoshi/react-native-track-player.git#APM",
"react-native-url-polyfill": "^2.0.0",
"react-native-vector-icons": "^10.0.3",
"react-native-vector-icons": "^10.1.0",
"react-native-video": "git+https://github.com/lovegaoshi/react-native-video.git#dev-android-cache",
"react-native-webview": "^13.8.6",
"react-native-webview": "^13.8.7",
"sp-react-native-in-app-updates": "^1.4.0",
"use-debounce": "^10.0.0",
"uuid": "^9.0.1",
"youtubei.js": "^9.3.0",
"youtubei.js": "^9.4.0",
"ytdl-core": "git+https://[email protected]/lovegaoshi/node-ytdl-core.git",
"zustand": "^4.5.2"
},
"resolutions": {
"metro": "^0.80.8"
"metro": "^0.80.9"
},
"devDependencies": {
"@babel/core": "^7.24.4",
"@babel/core": "^7.24.5",
"@babel/plugin-syntax-import-attributes": "^7.24.1",
"@babel/preset-env": "^7.24.4",
"@babel/preset-env": "^7.24.5",
"@babel/preset-typescript": "^7.24.1",
"@babel/runtime": "^7.24.4",
"@babel/runtime": "^7.24.5",
"@react-native-community/eslint-config": "^3.2.0",
"@tsconfig/react-native": "^3.0.5",
"@types/base-64": "^1.0.2",
"@types/d3": "^7.4.3",
"@types/he": "^1.2.3",
"@types/jest": "^29.5.12",
"@types/md5": "^2.3.5",
"@types/node": "^20.12.7",
"@types/react": "^18.2.79",
"@types/node": "^20.12.8",
"@types/react": "^18.3.1",
"@types/react-native": "^0.73.0",
"@types/react-native-background-timer": "^2.0.2",
"@types/react-native-share-menu": "^5.0.5",
"@types/react-native-video": "^5.0.20",
"@types/react-test-renderer": "^18.0.7",
"@types/react-test-renderer": "^18.3.0",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@typescript-eslint/parser": "^7.8.0",
"@welldone-software/why-did-you-render": "^8.0.1",
"argparse": "^2.0.1",
"babel-jest": "^29.7.0",
Expand All @@ -149,14 +149,14 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-hooks": "^4.6.2",
"gts": "^5.3.0",
"jest": "^29.7.0",
"metro-react-native-babel-preset": "0.77.0",
"prettier": "^3.2.5",
"react-native-clean-project": "^4.0.3",
"react-native-dotenv": "^3.4.11",
"react-test-renderer": "18.2.0",
"react-test-renderer": "18.3.1",
"reactotron-react-native": "^5.1.6",
"rimraf": "^5.0.5",
"typescript": "5.4.5"
Expand Down
13 changes: 13 additions & 0 deletions patches/react-native-tab-view+3.5.2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/react-native-tab-view/src/TabBar.tsx b/node_modules/react-native-tab-view/src/TabBar.tsx
index e8d0b4c..8773976 100644
--- a/node_modules/react-native-tab-view/src/TabBar.tsx
+++ b/node_modules/react-native-tab-view/src/TabBar.tsx
@@ -448,7 +448,7 @@ export function TabBar<T extends Route>({
{renderTabBarItem ? (
renderTabBarItem(props)
) : (
- <TabBarItem {...props} />
+ <TabBarItem {...props} key={props.key} />
)}
</>
);
19 changes: 0 additions & 19 deletions patches/react-native-vector-icons+10.0.3.patch

This file was deleted.

8 changes: 5 additions & 3 deletions src/components/setting/appearances/SkinSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,8 @@ const SkinSettings = () => {
const getThemeID = (skin: NoxTheme.Style) =>
`${skin.metaData.themeName}.${skin.metaData.themeAuthor}`;
const [checked, setChecked] = React.useState(getThemeID(playerStyle));
const scrollViewRef = React.useRef<FlatList | null>(null);
// TODO: fix type
const scrollViewRef = React.useRef<typeof FlatList>();

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const loadCustomSkin = async (skins: any) => {
Expand All @@ -240,6 +241,7 @@ const SkinSettings = () => {
theme => getThemeID(theme) === checked
);
if (currentThemeIndex > -1) {
// @ts-expect-error
scrollViewRef.current?.scrollToIndex({
index: currentThemeIndex,
viewOffset: 414,
Expand Down Expand Up @@ -267,10 +269,10 @@ const SkinSettings = () => {
})}
renderItem={({ item }) => (
<SkinItem
skin={item}
skin={item as DisplayTheme}
checked={checked}
setChecked={setChecked}
key={getThemeID(item)}
key={getThemeID(item as DisplayTheme)}
/>
)}
/>
Expand Down
4 changes: 4 additions & 0 deletions src/hooks/usePlayback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { NoxRepeatMode } from '@enums/RepeatMode';
import noxPlayingList, { setPlayingIndex } from '@stores/playingList';
import noxCache, { noxCacheKey } from '@utils/Cache';
import useDataSaver from './useDataSaver';
import useSnack from '@stores/useSnack';

const PLAYLIST_MEDIAID = 'playlist-';

Expand Down Expand Up @@ -48,6 +49,7 @@ const usePlayback = () => {
state => state.setCurrentPlayingList
);
const { isDataSaving } = useDataSaver();
const setSnack = useSnack(state => state.setSnack);

const playFromPlaylist = async ({
playlist,
Expand Down Expand Up @@ -200,6 +202,8 @@ const usePlayback = () => {
}
}
}
setSnack({ snackMsg: { success: t('AndroidAuto.PlayingShuffle') } });
shuffleAll();
};

const buildBrowseTree = () => {
Expand Down
3 changes: 2 additions & 1 deletion src/localization/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@
},
"AndroidAuto": {
"PlaylistTab": "Playlists",
"Permission": "Hi! APM is technically limited that only by enabling the \"display over other apps\" permission ensures properly functionalities on Android Auto. For the best experience please press OK and enable it if you intend to use APM with a car."
"Permission": "Hi! APM is technically limited that only by enabling the \"display over other apps\" permission ensures properly functionalities on Android Auto. For the best experience please press OK and enable it if you intend to use APM with a car.",
"PlayingShuffle": "No match! Shuffling instead..."
},
"PlaylistRegex": {
"absoluteMatch": "Absolute Match",
Expand Down
8 changes: 4 additions & 4 deletions src/utils/BiliFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ export const customReqHeader = (
if (
/bilibili/.exec(url) ||
/bilivideo/.exec(url) ||
/akamaized.net/.exec(url)
/akamaized\.net/.exec(url)
) {
reqHeader.referer = 'https://www.bilibili.com/';
} else if (/y.qq.com/.exec(url)) {
} else if (/y\.qq\.com/.exec(url)) {
reqHeader.referer = 'https://y.qq.com/';
} else if (/u.qq.com/.exec(url)) {
} else if (/u\.qq\.com/.exec(url)) {
reqHeader.referer = 'https://u.qq.com/';
} else if (/i.qq.com/.exec(url)) {
} else if (/i\.qq\.com/.exec(url)) {
reqHeader.referer = 'https://i.qq.com/';
}
reqHeader['User-Agent'] = DEFAULT_UA;
Expand Down
24 changes: 13 additions & 11 deletions src/utils/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,20 @@ export const seconds2MMSS = (sec_num: number) => {
};

export const timestampToSeconds = (timestamp: string) => {
const timeArray = timestamp.split(':').map(parseFloat);
let seconds = 0;
if (timeArray.length === 1) {
// check if both hours and minutes components are missing
seconds = timeArray[0]; // the timestamp only contains seconds
} else if (timeArray.length === 2) {
// check if hours component is missing
seconds = timeArray[0] * 60 + timeArray[1]; // calculate seconds from minutes and seconds
} else if (timeArray.length === 3) {
seconds = timeArray[0] * 3600 + timeArray[1] * 60 + timeArray[2]; // calculate total seconds
try {
const timeArray = timestamp.split(':').map(parseFloat);
switch (timeArray.length) {
case 1:
return timeArray[0];
case 2:
return timeArray[0] * 60 + timeArray[1];
case 3:
return timeArray[0] * 3600 + timeArray[1] * 60 + timeArray[2];
}
} catch (e) {
console.error(e);
}
return seconds;
return 0;
};

export const randomNumber = (v: number) => {
Expand Down
Loading

0 comments on commit 7723ecb

Please sign in to comment.