diff --git a/AnimeGo/src/component/cell/AnimeCell.js b/AnimeGo/src/component/cell/AnimeCell.js
index d95dde4..828c772 100644
--- a/AnimeGo/src/component/cell/AnimeCell.js
+++ b/AnimeGo/src/component/cell/AnimeCell.js
@@ -45,13 +45,13 @@ class AnimeCell extends PureComponent {
buttonPressed = () => {
if (this.data.link.includes('-episode-')) {
// Only NewRelease redirects you to that new episode
- Actions.WatchAnime({title: this.title, link: this.data.link, fromInfo: false, headerTintColor: 'white'});
+ Actions.WatchAnime({title: this.title, link: this.data.link, fromInfo: false});
} else if (this.data.link == 'Error') {
// No anime found go back
Linking.openURL('https://www.google.com/search?q=' + this.data.name + ' gogoanime');
} else {
// AnimeDetail will be shown here
- Actions.AnimeDetail({title: 'Loading...', link: this.data.link, headerTintColor: 'white'})
+ Actions.AnimeDetail({title: 'Loading...', link: this.data.link})
}
}
}
diff --git a/AnimeGo/src/component/list/SourceList.js b/AnimeGo/src/component/list/SourceList.js
index ffa2e5f..8e42d7f 100755
--- a/AnimeGo/src/component/list/SourceList.js
+++ b/AnimeGo/src/component/list/SourceList.js
@@ -1,10 +1,10 @@
import React, { Component } from 'react';
-import { View, Text, Button, FlatList, Dimensions } from 'react-native';
+import { View, Text, Button, FlatList, Dimensions, Alert } from 'react-native';
import AnimeSourceLoader from '../../helper/core/AnimeSourceLoader';
import SourceCell from '../cell/SourceCell';
import { LoadingIndicator } from '../../component';
import { Actions } from 'react-native-router-flux';
-import { SecondaryColour, RedColour, GreenColour } from '../../value';
+import { SecondaryColour, RedColour, GreenColour, AnimeGoColour } from '../../value';
import { styles } from './SourceListStyles';
class SourceList extends Component {
@@ -16,18 +16,19 @@ class SourceList extends Component {
this.state = {
data: [],
name: '', link: '',
+ prev: '', next: ''
}
}
componentWillMount() {
let source = new AnimeSourceLoader(this.props.link);
- source.loadSource().then((animeSource) => {
- // console.log(animeSource);
+ source.loadSource().then(([animeSource, prev, next]) => {
if (animeSource.length == 0) return;
this.setState({
data: animeSource,
name: animeSource[1].animeName,
link: animeSource[1].infoLink,
+ prev: prev, next: next
})
})
.catch((error) => {
@@ -42,7 +43,7 @@ class SourceList extends Component {
return (
} />
+ data={data} renderItem={({item}) => }/>
)
}
@@ -53,14 +54,40 @@ class SourceList extends Component {
}
renderHeader = () => {
- const { headerViewStyle, textStyle } = styles;
+ const { headerViewStyle, textStyle, buttonGroupStyle, buttonStyle } = styles;
return (
Anime Detail
)
}
+
+ prevEpisode = () => {
+ const { prev } = this.state;
+ if (prev == '') Alert.alert('First Episode', 'this is the first episode of this anime');
+ else {
+ Actions.pop();
+ Actions.WatchAnime({title: 'Episode ' + prev.split('-').pop(), link: prev, fromInfo: false});
+ }
+ }
+
+ nextEpisode = () => {
+ const { next } = this.state;
+ if (next == '') Alert.alert('Last Episode', 'this is currently the last episode of this anime');
+ else {
+ Actions.pop();
+ Actions.WatchAnime({title: 'Episode ' + next.split('-').pop(), link: next, fromInfo: false});
+ }
+ }
infoBtnPressed = () => {
// In case user wants infinite loop
diff --git a/AnimeGo/src/component/list/SourceListStyles.ios.js b/AnimeGo/src/component/list/SourceListStyles.ios.js
deleted file mode 100644
index 07e828b..0000000
--- a/AnimeGo/src/component/list/SourceListStyles.ios.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import { StyleSheet } from 'react-native';
-
-export const styles = StyleSheet.create({
- headerViewStyle: {
- margin: 2,
- },
- textStyle: {
- fontSize: 20,
- fontWeight: 'bold',
- textAlign: 'center',
- color: 'black',
- padding: 4
- },
- adStyle: {
- padding: 8, fontSize: 12,
- textAlign: 'center'
- }
-})
\ No newline at end of file
diff --git a/AnimeGo/src/component/list/SourceListStyles.js b/AnimeGo/src/component/list/SourceListStyles.js
index ba546fa..ca81979 100644
--- a/AnimeGo/src/component/list/SourceListStyles.js
+++ b/AnimeGo/src/component/list/SourceListStyles.js
@@ -12,6 +12,15 @@ export const styles = StyleSheet.create({
padding: 4
},
adStyle: {
- padding: 8, fontSize: 12
+ padding: 8, fontSize: 12,
+ textAlign: 'center'
+ },
+ buttonGroupStyle: {
+ flexDirection: 'row', justifyContent: 'space-around',
+ flex: 1, paddingTop: 4
+ },
+ buttonStyle: {
+ flex: 1,
+ padding: 1
}
})
\ No newline at end of file
diff --git a/AnimeGo/src/helper/core/AnimeSourceLoader.js b/AnimeGo/src/helper/core/AnimeSourceLoader.js
index 938377e..c6115b0 100755
--- a/AnimeGo/src/helper/core/AnimeSourceLoader.js
+++ b/AnimeGo/src/helper/core/AnimeSourceLoader.js
@@ -1,5 +1,5 @@
-import { MajorLink } from '../../value';
import { Alert } from 'react-native';
+import { MajorLink } from '../../value';
export default class AnimeSourceLoader {
@@ -15,18 +15,20 @@ export default class AnimeSourceLoader {
.then((html) => html.text())
.then((htmlText) => {
var HTMLParser = require('fast-html-parser');
+ var prev = ''; var next = '';
var root = HTMLParser.parse(htmlText);
var animeSources = root.querySelector('.anime_muti_link');
// Somwhow it does not exist
- if (animeSources == null) success([]);
+ if (animeSources == null) success([[], prev, next]);
var items = animeSources.childNodes[0].childNodes;
// console.log(items);
var animeData = [];
var length = items.length;
+
// Somwhow it does not have any sources
- if (length == 0) success([]);
+ if (length == 0) success([[], prev, next]);
// Getting anime information
animeInfoLink = '';
@@ -55,7 +57,19 @@ export default class AnimeSourceLoader {
animeData.push({source: animeSource, name: sourceName, animeName: animeName, infoLink: animeInfoLink});
}
// console.log(animeData);
- success(animeData);
+
+ // Getting next and prev info
+ var nextPrev = root.querySelector('.anime_video_body_episodes');
+ if (nextPrev != null) {
+ prev = nextPrev.childNodes[0].childNodes[1];
+ next = nextPrev.childNodes[2].childNodes[1];
+ if (prev != null) prev = MajorLink.MainURL + prev.attributes.href;
+ else prev = '';
+ if (next != null) next = MajorLink.MainURL + next.attributes.href;
+ else next = '';
+ }
+
+ success([animeData, prev, next]);
})
.catch((error) => {
// console.error(error);
diff --git a/AnimeGo/src/value.js b/AnimeGo/src/value.js
index 38292c4..0babc41 100644
--- a/AnimeGo/src/value.js
+++ b/AnimeGo/src/value.js
@@ -34,12 +34,12 @@ export const ScreenIndex = {
}
export const MajorLink = {
- MainURL: 'https://ww5.gogoanime.io',
- NewRelease: 'https://ww5.gogoanime.io/page-recent-release.html?page=',
- NewSeason: 'https://ww5.gogoanime.io/sub-category/',
- Movie: 'https://ww5.gogoanime.io/anime-movies.html?page=',
- Genre: 'https://ww5.gogoanime.io/genre/',
- Search: 'https://ww5.gogoanime.io/search.html?keyword=',
- Episode: 'https://ww5.gogoanime.io/load-list-episode?ep_start=',
- Popular: 'https://ww5.gogoanime.io/popular.html?page=',
+ MainURL: 'https://gogoanime.se',
+ NewRelease: 'https://gogoanime.se/page-recent-release.html?page=',
+ NewSeason: 'https://gogoanime.se/sub-category/',
+ Movie: 'https://gogoanime.se/anime-movies.html?page=',
+ Genre: 'https://gogoanime.se/genre/',
+ Search: 'https://gogoanime.se/search.html?keyword=',
+ Episode: 'https://gogoanime.se/load-list-episode?ep_start=',
+ Popular: 'https://gogoanime.se/popular.html?page=',
}
\ No newline at end of file