Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3 from SmashinFries:experimental
Browse files Browse the repository at this point in the history
Hotfix #2
  • Loading branch information
SmashinFries committed Nov 3, 2021
2 parents b23b95c + ee8bd8d commit 2377706
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 9 deletions.
5 changes: 3 additions & 2 deletions Components/usercomp.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,21 @@ export const Following = ({route}) => {
}
}

return( (following.length > 0) ?
return(
<View style={{flex:1}}>
<FlatList
data={following}
renderItem={({item}) => <RenderFollowing item={item} routeName={routeName} isAuth={true}/> }
keyExtractor={(item, index) => index.toString()}
ListEmptyComponent={() => <Text style={{textAlign:'center', fontSize:35, fontWeight:'bold', paddingTop:5, color:colors.text}}>{`Not following anyone!${'\n'}(◕︵◕)`}</Text>}
numColumns={3}
contentContainerStyle={{paddingTop:10}}
onRefresh={onRefresh}
refreshing={refresh}
onEndReached={getMore}
onEndReachedThreshold={.4}
/>
</View> : <Text style={{textAlign:'center', fontSize:35, fontWeight:'bold', paddingTop:5, color:colors.text}}>{`Not following anyone!${'\n'}(◕︵◕)`}</Text>
</View>
);
}

Expand Down
9 changes: 6 additions & 3 deletions Notifications/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import { getToken } from '../Storages/getstorage';
import { fetchAiringNotification } from '../Data Handler/getdata';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { textDecider } from '../Utils/dataprocess';
import { useTheme } from '@react-navigation/native';

const setNotifs = async(unreadNum, data, latest) => {
let items = await data.slice(0, unreadNum);
const newItems = items.sort((a, b) => a.createdAt - b.createdAt);
for (let notifNum in newItems) {
const { bottomText, topText, time, image, rawTime, notifData } = textDecider(newItems[notifNum]);
const { bottomText, topText, time, image, banner, rawTime, notifData } = textDecider(newItems[notifNum]);
const message = notifData.body;
PushNotification.localNotification({
channelId: 'UserNotification',
Expand All @@ -20,18 +21,20 @@ const setNotifs = async(unreadNum, data, latest) => {
when: rawTime,
message: message,
largeIconUrl: image,
bigPictureUrl: banner,
color: '#28c922',
group: 'Notif',
vibrate: true,
groupSummary: false
});
}
await PushNotification.getDeliveredNotifications((notifs) => {
if (notifs.length <= unreadNum && notifs.length > 1) {
if (notifs.length <= unreadNum) {
PushNotification.localNotification({
channelId:'UserNotification',
group:'Notif',
message:'',
color:'#28c922',
groupSummary:true,
});
}
Expand All @@ -49,7 +52,7 @@ const sendNotification = async() => {
const unreadNum = Number(notifData.Viewer.unreadNotificationCount);
const latest = notifData.Page.notifications[0].id;
if (typeof lastNotif === 'string') {
if (unreadNum === 0 && latest === Number(lastNotif)) {
if (unreadNum !== 0 && latest !== Number(lastNotif)) {
await setNotifs(unreadNum, notifData.Page.notifications, latest);
} else if (unreadNum === 0 && latest !== Number(lastNotif)) {
await AsyncStorage.setItem('@LASTNOTIF', `${latest}`)
Expand Down
2 changes: 2 additions & 0 deletions Queries/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ createdAt
media {
id
meanScore
bannerImage
coverImage {
extraLarge
}
Expand Down Expand Up @@ -787,6 +788,7 @@ query ($page:Int, $perPage:Int, $type:NotificationType) {
media {
id
meanScore
bannerImage
mediaListEntry {
status
}
Expand Down
4 changes: 2 additions & 2 deletions Screens/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Stack = createStackNavigator();
export const ThemeContext = React.createContext({theme: {theme: 'Light', object:LightTheme, title:'Default'}, setTheme: () => {}});
const android = RNFetchBlob.android;
let dirs = RNFetchBlob.fs.dirs
export const VERSION = 'v1.2.5-beta';
export const VERSION = 'v1.2.6-beta';

export const downloadUpdate = (link) => {
Vibration.vibrate(100);
Expand All @@ -35,7 +35,7 @@ export const downloadUpdate = (link) => {
mime : 'application/vnd.android.package-archive',
mediaScannable : true,
notification : true,
path: dirs.DownloadDir + `/goraku.apk`,
path: dirs.DownloadDir + `/goraku-${VERSION}.apk`,
}
})
.fetch('GET', `${link}`)
Expand Down
4 changes: 3 additions & 1 deletion Utils/dataprocess.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const textDecider = (data) => {
let bottomText = '';
let topText = '';
let image = '';
let banner = '';
let notifData = {title:'', body:''};
let rawTime = data.createdAt * 1000;

Expand All @@ -21,6 +22,7 @@ export const textDecider = (data) => {
topText = `${data.contexts[0]}${data.episode}${data.contexts[1]}${data.media.title.userPreferred}`;
bottomText = `${data.contexts[2].replace(' ', '')}`;
image = data.media.coverImage.extraLarge;
banner = (data.media.bannerImage !== null) ? data.media.bannerImage : '';
notifData = {title:data.media.title.userPreferred, body:`${data.contexts[0]}${data.episode}${data.contexts[2]}`};
} else if (typename === 'FollowingNotification') {
topText = `${data.user.name}${data.context}`;
Expand Down Expand Up @@ -52,7 +54,7 @@ export const textDecider = (data) => {
image = data.messenger.avatar.large;
}

return({bottomText, topText, time, image, rawTime, notifData});
return({bottomText, topText, time, image, banner, rawTime, notifData});
}

export const FocusAwareStatusBar = (props) => {
Expand Down
24 changes: 23 additions & 1 deletion Utils/themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const themeColors = {
ocean: 'rgba(11, 168, 189, 1)',
crimson: 'rgba(153, 0, 0, 1)',
spooky: 'rgba(255, 132, 0, 1)',
flamingo: 'rgba(252, 142, 172,1)',
};

// Light Theme
Expand Down Expand Up @@ -49,6 +50,16 @@ export const CrimsonLightTheme = {
}
};

export const FlamingoLightTheme = {
...DefaultTheme,
dark: false,
colors: {
...DefaultTheme.colors,
primary: themeColors.flamingo,
inactive: '#000',
}
};

// Dark Theme
export const DimTheme = {
...DarkTheme,
Expand Down Expand Up @@ -90,17 +101,28 @@ export const CrimsonDarkTheme = {
}
};

export const FlamingoDarkTheme = {
...DarkTheme,
dark: true,
colors: {
...DarkTheme.colors,
primary: themeColors.flamingo,
inactive: '#d1d1d1',
}
};

// Theme Array
export const themes = [
{ theme: 'Light', object:LightTheme, title:'Default'},
{ theme: 'Light Crimson', object:CrimsonLightTheme, title:'Crimson'},
{ theme: 'Light Ocean', object:OceanLightTheme, title:'Ocean'},
{ theme: 'Light Spooky', object:SpookyLightTheme, title:'Spooky'},
{ theme: 'Light Flamingo', object:FlamingoLightTheme, title:'Flamingo'},
{ theme: 'Dark', object:DimTheme, title:'Default'},
{ theme: 'Dark Crimson', object:CrimsonDarkTheme, title:'Crimson'},
{ theme: 'Dark Ocean', object:OceanDarkTheme, title:'Ocean'},
{ theme: 'Dark Spooky', object:SpookyDarkTheme, title:'Spooky'},

{ theme: 'Dark Flamingo', object:FlamingoDarkTheme, title:'Flamingo'},
];

// Get Theme
Expand Down

0 comments on commit 2377706

Please sign in to comment.