Skip to content

Commit

Permalink
Merge pull request #99 from himanshu8443/feature
Browse files Browse the repository at this point in the history
Features and bug fixes
  • Loading branch information
Zenda-Cross authored Sep 2, 2024
2 parents 784f716 + 94d4926 commit 43860fb
Show file tree
Hide file tree
Showing 28 changed files with 831 additions and 204 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ android {
applicationId "com.vega"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 53
versionName "2.4.0"
versionCode 54
versionName "2.4.1"
}
signingConfigs {
release {
Expand Down
10 changes: 10 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />

<queries>
<intent>
Expand Down Expand Up @@ -44,5 +46,13 @@
<meta-data
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
android:value="com.reactnative.googlecast.GoogleCastOptionsProvider" />
<service
android:name="com.brentvatne.exoplayer.VideoPlaybackService"
android:exported="false"
android:foregroundServiceType="mediaPlayback">
<intent-filter>
<action android:name="androidx.media3.session.MediaSessionService" />
</intent-filter>
</service>
</application>
</manifest>
27 changes: 14 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vega",
"version": "2.4.0",
"version": "2.4.1",
"private": true,
"scripts": {
"android": "react-native run-android",
Expand All @@ -10,7 +10,7 @@
"test": "jest"
},
"dependencies": {
"@8man/react-native-media-console": "^2.2.4-alpha.5",
"@8man/react-native-media-console": "^2.2.4-alpha.8",
"@dominicvonk/react-native-apk-installer": "^2.2.2",
"@notifee/react-native": "^7.8.2",
"@react-navigation/bottom-tabs": "^6.5.20",
Expand Down
16 changes: 13 additions & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ export type RootStackParamList = {
Player: {
link: string;
type: string;
title: string;
poster: string;
primaryTitle?: string;
secondaryTitle?: string;
poster: {
logo?: string;
poster?: string;
background?: string;
};
file?: string;
providerValue?: string;
};
Expand Down Expand Up @@ -215,7 +220,12 @@ const App = () => {

useEffect(() => {
if (MMKV.getBool('autoCheckUpdate') !== false) {
checkForUpdate(() => {}, MMKV.getBool('autoDownload') || false, false);
checkForUpdate(
() => {},
MMKV.getBool('autoDownload') || false,
false,
primary,
);
}
}, []);

Expand Down
10 changes: 6 additions & 4 deletions src/components/Downloader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ const DownloadComponent = ({
const [servers, setServers] = useState<Stream[]>([]);
const [serverLoading, setServerLoading] = useState(false);

const reqController = new AbortController();

const downloadStore = useDownloadsStore(state => state);

// check if file already exists
Expand Down Expand Up @@ -88,6 +86,7 @@ const DownloadComponent = ({

// choose server
useEffect(() => {
const controller = new AbortController();
if (!downloadModal && !longPressModal) {
return;
}
Expand All @@ -96,7 +95,7 @@ const DownloadComponent = ({
const servers = await manifest[providerValue || provider.value].getStream(
link,
type,
reqController.signal,
controller.signal,
);
const filteredServers = servers.filter(
server =>
Expand All @@ -108,6 +107,10 @@ const DownloadComponent = ({
setServers(filteredServers);
};
getServer();

return () => {
controller.abort();
};
}, [downloadModal, longPressModal]);

// on holdPress external downloader
Expand Down Expand Up @@ -277,7 +280,6 @@ const DownloadComponent = ({
<TouchableOpacity
onPress={() => {
setDownloadModal(false);
reqController.abort();
}}
className="absolute top-2 right-2">
<MaterialIcons name="close" size={20} color="#c1c4c9" />
Expand Down
48 changes: 48 additions & 0 deletions src/components/ProviderDrawer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import {View, Text} from 'react-native';
import React from 'react';
import useContentStore from '../lib/zustand/contentStore';
import {providersList} from '../lib/constants';
import {ScrollView} from 'moti';
import MaterialIcons from '@expo/vector-icons/MaterialIcons';
import useThemeStore from '../lib/zustand/themeStore';
import {TouchableOpacity} from 'react-native';
import {DrawerLayout} from 'react-native-gesture-handler';

const ProviderDrawer = ({
drawerRef,
}: {
drawerRef: React.RefObject<DrawerLayout>;
}) => {
const {provider, setProvider} = useContentStore(state => state);
const {primary} = useThemeStore(state => state);

return (
<View className="px-3">
<View className="mt-6 p-2 flex flex-row justify-center items-center gap-x-3">
<MaterialIcons name="extension" size={24} color={primary} />
<Text className="text-white text-2xl">Providers</Text>
</View>
<ScrollView showsVerticalScrollIndicator={false} className="mb-20">
{providersList.map(item => (
<TouchableOpacity
key={item.value}
onPress={() => {
setProvider(item);
drawerRef.current?.closeDrawer();
}}
className={`bg-black text-white w-48 flex-row justify-start gap-2 items-center px-4 py-1 rounded-s-md border-b border-white/10 border rounded-md ${
provider.value === item.value ? 'bg-quaternary' : ''
} ${item.value === 'lux' ? 'pb-1' : 'pb-3'}`}>
<Text className=" text-white mb-2">
{item.flag}
&nbsp; &nbsp;
{item.name}
</Text>
</TouchableOpacity>
))}
</ScrollView>
</View>
);
};

export default ProviderDrawer;
Loading

0 comments on commit 43860fb

Please sign in to comment.