Skip to content

Commit

Permalink
Merge pull request #24 from himanshu8443/with-Expo
Browse files Browse the repository at this point in the history
Update 2.0.5
  • Loading branch information
Zenda-Cross authored Jun 9, 2024
2 parents 0ab90ae + 2938cd5 commit 24b5f50
Show file tree
Hide file tree
Showing 40 changed files with 1,187 additions and 192 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 20
versionName "2.0.0"
versionCode 25
versionName "2.0.5"
}
signingConfigs {
release {
Expand Down
12 changes: 12 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"expo": {
"name": "vega",
"slug": "vega",
"version": "2.0.2",
"sdkVersion": "51.0.0",
"platforms": [
"ios",
"android"
]
}
}
31 changes: 29 additions & 2 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vega",
"version": "2.0.0",
"version": "2.0.5",
"private": true,
"scripts": {
"android": "react-native run-android",
Expand All @@ -18,7 +18,9 @@
"babel-plugin-module-resolver": "^5.0.2",
"cheerio": "^1.0.0-rc.12",
"expo": "^51.0.0",
"expo-blur": "~13.0.2",
"expo-intent-launcher": "~11.0.1",
"expo-system-ui": "~3.0.4",
"moti": "^0.28.1",
"nativewind": "^2.0.11",
"react": "18.2.0",
Expand Down
10 changes: 8 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ import Entypo from '@expo/vector-icons/Entypo';
import 'react-native-reanimated';
import 'react-native-gesture-handler';
import WebView from './screens/WebView';
import SearchResults from './screens/SearchResults';
import * as SystemUI from 'expo-system-ui';

export type HomeStackParamList = {
Home: undefined;
Info: {link: string; provider?: string; poster?: string};
ScrollList: {filter: string; title?: string};
ScrollList: {filter: string; title?: string; providerValue?: string};
Webview: {link: string};
};

Expand All @@ -36,8 +38,9 @@ export type RootStackParamList = {

export type SearchStackParamList = {
Search: undefined;
ScrollList: {filter: string; title?: string};
ScrollList: {filter: string; title?: string; providerValue?: string};
Info: {link: string; provider?: string; poster?: string};
SearchResults: {filter: string};
};

export type WatchListStackParamList = {
Expand All @@ -51,6 +54,8 @@ const App = () => {
const SearchStack = createNativeStackNavigator<SearchStackParamList>();
const WatchListStack = createNativeStackNavigator<WatchListStackParamList>();

SystemUI.setBackgroundColorAsync('black');

function HomeStackScreen() {
return (
<HomeStack.Navigator
Expand Down Expand Up @@ -80,6 +85,7 @@ const App = () => {
<SearchStack.Screen name="Search" component={Search} />
<SearchStack.Screen name="ScrollList" component={ScrollList} />
<SearchStack.Screen name="Info" component={Info} />
<SearchStack.Screen name="SearchResults" component={SearchResults} />
</SearchStack.Navigator>
);
}
Expand Down
3 changes: 2 additions & 1 deletion src/app.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"name": "Vega",
"displayName": "Vega"
"displayName": "Vega",
"backgroundColor": "#000000"
}
80 changes: 73 additions & 7 deletions src/components/Downloader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
import {Skeleton} from 'moti/skeleton';
import useContentStore from '../lib/zustand/contentStore';
import {manifest} from '../lib/Manifest';
import * as IntentLauncher from 'expo-intent-launcher';

const DownloadComponent = ({
link,
Expand All @@ -43,6 +44,7 @@ const DownloadComponent = ({
);
const [deleteModal, setDeleteModal] = useState(false);
const [downloadModal, setDownloadModal] = useState(false);
const [longPressModal, setLongPressModal] = useState(false);
const [servers, setServers] = useState<Stream[]>([]);
const [serverLoading, setServerLoading] = useState(false);

Expand Down Expand Up @@ -171,9 +173,10 @@ const DownloadComponent = ({

// choose server
useEffect(() => {
if (!downloadModal) {
if (!downloadModal && !longPressModal) {
return;
}

const getServer = async () => {
setServerLoading(true);
const url = await manifest[providerValue || provider.value].getStream(
Expand All @@ -184,13 +187,25 @@ const DownloadComponent = ({
setServers(url);
};
getServer();
}, [downloadModal]);
}, [downloadModal, longPressModal]);

// on holdPress external downloader
const longPressDownload = async (link: string) => {
try {
await IntentLauncher.startActivityAsync('android.intent.action.VIEW', {
data: link,
type: 'application/octet-stream',
});
} catch (error) {
console.log(error);
}
};

return (
<View className="flex-row items-center mt-1 justify-between rounded-full bg-white/30 p-1">
{alreadyDownloaded ? (
<TouchableOpacity onPress={() => setDeleteModal(true)} className="mx-1">
<MaterialIcons name="file-download-done" size={27} color="#c1c4c9" />
<MaterialIcons name="delete-outline" size={27} color="#c1c4c9" />
</TouchableOpacity>
) : isDownloading ? (
<MotiView
Expand All @@ -210,11 +225,19 @@ const DownloadComponent = ({
onPress={() => {
setDownloadModal(true);
}}
onLongPress={() => {
ReactNativeHapticFeedback.trigger('effectHeavyClick', {
enableVibrateFallback: true,
ignoreAndroidSystemSettings: false,
});
setLongPressModal(true);
}}
className="mx-2">
<Octicons name="download" size={25} color="#c1c4c9" />
</TouchableOpacity>
)}
{deleteModal && (
{/* delete modal */}
{
<Modal animationType="fade" visible={deleteModal} transparent={true}>
<View className="flex-1 bg-black/10 justify-center items-center p-4">
<View className="bg-tertiary p-3 w-80 rounded-md justify-center items-center">
Expand All @@ -237,9 +260,9 @@ const DownloadComponent = ({
</View>
</View>
</Modal>
)}
}
{/* download modal */}
{downloadModal && (
{
<Modal animationType="fade" visible={downloadModal} transparent={true}>
<View className="flex-1 bg-black/10 justify-center items-center p-4">
<View className="bg-tertiary p-3 w-full rounded-md justify-center items-center">
Expand Down Expand Up @@ -305,7 +328,50 @@ const DownloadComponent = ({
</View>
</View>
</Modal>
)}
}
{/* long press modal */}
{
<Modal animationType="fade" visible={longPressModal} transparent={true}>
<View className="flex-1 bg-black/10 justify-center items-center p-4">
<View className="bg-tertiary p-3 w-full rounded-md justify-center items-center">
<Text className="text-lg font-semibold my-3 text-white">
Select a server to open
</Text>
<View className="flex-row items-center flex-wrap gap-1 justify-evenly w-full my-5">
{!serverLoading
? servers?.map((server, index) => (
<TouchableOpacity
key={server.server + index}
onPress={() => {
setLongPressModal(false);
longPressDownload(server.link);
}}
className="bg-primary p-2 rounded-md m-1">
<Text className="text-white text-xs rounded-md capitalize px-1">
{server.server}
</Text>
</TouchableOpacity>
))
: Array.from({length: 3}).map((_, index) => (
<Skeleton
key={index}
show={true}
colorMode="dark"
height={30}
width={90}
/>
))}
</View>
{/* close modal */}
<TouchableOpacity
onPress={() => setLongPressModal(false)}
className="absolute top-2 right-2">
<MaterialIcons name="close" size={20} color="#c1c4c9" />
</TouchableOpacity>
</View>
</View>
</Modal>
}
</View>
);
};
Expand Down
Loading

0 comments on commit 24b5f50

Please sign in to comment.