Skip to content

Commit

Permalink
remove legacy code (overlay, electron, app2)
Browse files Browse the repository at this point in the history
  • Loading branch information
denniske committed Oct 31, 2024
1 parent c4ee20b commit d902070
Show file tree
Hide file tree
Showing 38 changed files with 573 additions and 5,503 deletions.
1,139 changes: 0 additions & 1,139 deletions app/App2.tsx

This file was deleted.

43 changes: 6 additions & 37 deletions app/src/app/(more)/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { appVariants } from '../../styles';
import Space from '@app/view/components/space';
import { createStylesheet } from '../../theming-new';
import { getTranslation } from '../../helper/translate';
import { doCheckForUpdateElectronAsync, getElectronVersion, isElectron } from '../../helper/electron';
import { openLink } from '../../helper/url';
import { appConfig } from '@nex/dataset';
import { channel, manifest, updateId, runtimeVersion } from 'expo-updates';
Expand All @@ -29,21 +28,8 @@ export default function AboutPage() {
const [debugUpdate, setDebugUpdate] = useState('');
const [debugStoreUpdate, setDebugStoreUpdate] = useState('');
const [debugManifest, setDebugManifest] = useState('');
const [electronVersion, setElectronVersion] = useState('');
const [versionClickCount, setVersionClickCount] = useState(0);
const mutate = useMutate();
const navigation = useNavigation();

const checkForUpdateElectron = async () => {
setState('checkingForUpdate');
const update = await doCheckForUpdateElectronAsync();
if (update) {
mutate(setUpdateElectronManifest(update));
setState('checked');
return;
}
setState('upToDate');
};

const checkForUpdate = async () => {
setState('checkingForUpdate');
Expand Down Expand Up @@ -159,16 +145,6 @@ export default function AboutPage() {
await Linking.openURL(url!);
};

const init = async () => {
if (isElectron()) {
setElectronVersion(await getElectronVersion());
}
};

useEffect(() => {
init();
});

// console.log('Constants.expoConfig2', JSON.stringify(Constants.expoConfig2, null, 2));

return (
Expand Down Expand Up @@ -256,17 +232,10 @@ export default function AboutPage() {

<MyText style={styles.heading}>{getTranslation('about.heading.version')}</MyText>
<TouchableOpacity onPress={incrementVersionClickCount}>
{/*{*/}
{/* isElectron() &&*/}
{/* <MyText style={styles.content}>{Constants.expoConfig?.releaseChannel || 'dev'}-{Constants.expoConfig?.version}n{electronVersion}</MyText>*/}
{/*}*/}

{!isElectron() && (
<MyText style={styles.content}>
{channel || 'dev'} {Constants.expoConfig?.version || Constants.expoConfig?.extra?.expoClient?.version} (
{runtimeVersion || 'dev'})
</MyText>
)}
<MyText style={styles.content}>
{channel || 'dev'} {Constants.expoConfig?.version || Constants.expoConfig?.extra?.expoClient?.version} (
{runtimeVersion || 'dev'})
</MyText>
<MyText style={styles.content}>
n{nativeApplicationVersion}+{nativeBuildVersion}
</MyText>
Expand All @@ -277,10 +246,10 @@ export default function AboutPage() {
{/*<MyText style={styles.content}>{(Constants.expoConfig2?.metadata as any)?.branchName || 'dev'}</MyText>*/}
{/*<MyText style={styles.content}>{(Constants.expoConfig2?.metadata as any)?.updateGroup || 'dev'}</MyText>*/}

{(Platform.OS !== 'web' || isElectron()) && state === '' && (
{Platform.OS !== 'web' && state === '' && (
<View>
<Space />
<Button onPress={isElectron() ? checkForUpdateElectron : checkForUpdate} mode="contained" dark={true}>
<Button onPress={checkForUpdate} mode="contained" dark={true}>
{getTranslation('about.update.checkforupdate')}
</Button>
</View>
Expand Down
30 changes: 7 additions & 23 deletions app/src/app/(more)/changelog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@ import React from 'react';
import { StyleSheet, View, ViewStyle } from 'react-native';
import { MyText } from '@app/view/components/my-text';
import { changelog, changelog4, IChange } from '../../changelog';
import { RouteProp, useRoute } from '@react-navigation/native';
import { RootStackParamList } from '../../../App2';
import { lt } from 'semver';
import { createStylesheet } from '../../theming-new';
import { useSelector } from '../../redux/reducer';
import { moProfileId } from '@nex/data';
import { useTheme } from '../../theming';
import { appVariants } from '../../styles';
import { isElectron } from '../../helper/electron';
import { openLink } from '../../helper/url';
import { appConfig } from '@nex/dataset';
import { Stack } from 'expo-router';
import { Stack, useLocalSearchParams } from 'expo-router';
import { getTranslation } from '@app/helper/translate';
import { FlatList } from '@app/components/flat-list';

Expand All @@ -22,12 +17,14 @@ interface IChangelogEntry {
changes: IChange[];
}

export type IChangelogPageParams = {
changelogLastVersionRead?: string
}

export default function ChangelogPage() {
const appStyles = useTheme(appVariants);
const styles = useStyles();
const route = useRoute<RouteProp<RootStackParamList, 'Changelog'>>();
const changelogLastVersionRead = route.params?.changelogLastVersionRead;
const auth = useSelector((state) => state.auth);
const { changelogLastVersionRead } = useLocalSearchParams<IChangelogPageParams>();

const labelStyle = (change: IChange): ViewStyle => {
const colors = {
Expand Down Expand Up @@ -73,18 +70,6 @@ export default function ChangelogPage() {
{changelogLastVersionRead && lt(changelogLastVersionRead, version) && <MyText style={styles.headingNote}> (new)</MyText>}
</View>

{version === '21.0.8' && auth?.profile_id === moProfileId && (
<View style={styles.row}>
<View style={[styles.labelContainer, labelStyle({ type: 'feature', title: '' })]}>
<MyText style={styles.label}>feature</MyText>
</View>
<View style={styles.textContainer}>
<MyText style={styles.title}>Prepare for Sihing Mo's birthday</MyText>
<MyText style={styles.content}> </MyText>
</View>
</View>
)}

{changes.map((change) => (
<View key={change.title} style={styles.row}>
<View style={[styles.labelContainer, labelStyle(change)]}>
Expand All @@ -95,7 +80,6 @@ export default function ChangelogPage() {
{change.content && <MyText style={styles.content2}>{change.content}</MyText>}
{
change.author && <MyText style={styles.content}>by {formatTitle(change.author)}</MyText>
// <MyText style={styles.content}>(by {formatTitle(change.author)})</MyText>
}
</View>
</View>
Expand All @@ -104,7 +88,7 @@ export default function ChangelogPage() {
);

const changelogEntries = Object.entries(appConfig.game === 'aoe2de' ? changelog : changelog4).map(([version, changes]) => ({ version, changes }));
const filteredChangelogEntries = isElectron() ? changelogEntries : changelogEntries.filter((e) => !e.version.includes('+'));
const filteredChangelogEntries = changelogEntries.filter((e) => !e.version.includes('+'));

return (
<>
Expand Down
27 changes: 5 additions & 22 deletions app/src/app/(more)/push.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ import { useSelector } from '../../redux/reducer';
import Space from '@app/view/components/space';
import { createStylesheet } from '../../theming-new';
import { getTranslation } from '../../helper/translate';
import { RootStackParamList } from '../../../App2';
import { getRootNavigation } from '../../service/navigation';
import { sendTestPushNotificationElectron, sendTestPushNotificationWeb } from '../../api/following';
import { sendTestPushNotificationWeb } from '../../api/following';
import { initPusher } from '../../helper/pusher';
import { getElectronPushToken, isElectron } from '../../helper/electron';
import { Stack, router } from 'expo-router';
import { ScrollView } from '@app/components/scroll-view';
import * as Device from 'expo-device';
Expand Down Expand Up @@ -115,24 +112,14 @@ export default function PushPage() {
return await initPusher();
};

const registerForPushNotificationsElectronAsync = async () => {
return await getElectronPushToken();
};

useEffect(() => {
log('registerForPushNotificationsAsync');

if (Device.isDevice) {
if (Platform.OS === 'web') {
if (isElectron()) {
registerForPushNotificationsElectronAsync()
.then((token) => setPushToken(token))
.catch((e) => log(e, e.message));
} else {
registerForPushNotificationsWebAsync()
.then((token) => setPushToken(token))
.catch((e) => log(e, e.message));
}
registerForPushNotificationsWebAsync()
.then((token) => setPushToken(token))
.catch((e) => log(e, e.message));
} else {
registerForPushNotificationsAsync()
.then((token) => setPushToken(token))
Expand Down Expand Up @@ -195,11 +182,7 @@ export default function PushPage() {
mode="outlined"
onPress={async () => {
if (Platform.OS === 'web') {
if (isElectron()) {
await sendTestPushNotificationElectron(pushToken);
} else {
await sendTestPushNotificationWeb(pushToken);
}
await sendTestPushNotificationWeb(pushToken);
} else {
await sendTestPushNotification(pushToken);
}
Expand Down
Loading

0 comments on commit d902070

Please sign in to comment.