🔧 chore(deploy.yaml): add new GitHub Actions workflow for building APK
Some checks failed
Building APK / build-apk (push) Failing after 2m35s

🔄 refactor(ClipView.tsx, NotifView.tsx): reorder tabs to show 'Remote' before 'Local'
🌐 fix(ClipViewRemote.tsx, NotifViewRemote.tsx): change API calls from http to https
🔤 fix(ClipViewLocal.tsx, NotifViewLocal.tsx): translate button text to English
🔇 fix(ClipViewRemote.tsx, NotifViewRemote.tsx): remove unnecessary toast messages
🔧 chore(NotifViewLocal.tsx): add platform check to disable feature on non-Android platforms
🔤 fix(NotifViewLocal.tsx): translate button text to English
🔧 chore(reducers.tsx): remove unused action parameters in clear functions
This commit is contained in:
Djalim Simaila 2024-04-12 12:43:10 +02:00
parent a1f46812ab
commit 9d8cf5730f
8 changed files with 86 additions and 22 deletions

View File

@ -0,0 +1,51 @@
name: Building APK
run-name: Build APK
on: [push]
jobs:
build-apk:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Setup bun
uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun install
- name: Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
packager: bun
- name: Build Website
run: bunx expo export --platform web
- name: Upload disk ZIP
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
- name: Create SSH key
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
echo "${{ secrets.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
- name: Deploy with rsync
run: rsync -rav --delete dist/ www-data@simailadjalim.fr:/var/www/clipsync-webapp

View File

@ -48,12 +48,12 @@ export default function ClipView() {
</View> </View>
{layout == 'compact' ? ( {layout == 'compact' ? (
<Tab.Navigator tabBarPosition="bottom"> <Tab.Navigator tabBarPosition="bottom">
<Tab.Screen name="Local" options={{title: 'local'}}>
{() => <ClipViewLocal />}
</Tab.Screen>
<Tab.Screen name="Remote" options={{title: 'distant'}}> <Tab.Screen name="Remote" options={{title: 'distant'}}>
{() => <ClipViewRemote />} {() => <ClipViewRemote />}
</Tab.Screen> </Tab.Screen>
<Tab.Screen name="Local" options={{title: 'local'}}>
{() => <ClipViewLocal />}
</Tab.Screen>
</Tab.Navigator> </Tab.Navigator>
) : ( ) : (
<ScrollView <ScrollView
@ -63,8 +63,8 @@ export default function ClipView() {
height: '100%', height: '100%',
padding: ps(30), padding: ps(30),
}}> }}>
<ClipViewLocal />
<ClipViewRemote /> <ClipViewRemote />
<ClipViewLocal />
</ScrollView> </ScrollView>
)} )}
</> </>

View File

@ -45,7 +45,7 @@ export default function ClipViewLocal({}) {
onPress={() => { onPress={() => {
dispatch(addToLocal); dispatch(addToLocal);
}}> }}>
Coller depuis le presse papier Paste from clipboard
</Button> </Button>
<ScrollView> <ScrollView>
<ClipList type={'local'} clips={clips} /> <ClipList type={'local'} clips={clips} />

View File

@ -21,7 +21,7 @@ export default function ClipViewRemote() {
async function getClips(dispatch) { async function getClips(dispatch) {
axios axios
.get( .get(
'http://notifysync.simailadjalim.fr/clipboard?token=' + 'https://notifysync.simailadjalim.fr/clipboard?token=' +
store.getState().user.token, store.getState().user.token,
) )
.then((response, status) => { .then((response, status) => {
@ -31,7 +31,6 @@ export default function ClipViewRemote() {
toast.show('fetched latest clips from remote'); toast.show('fetched latest clips from remote');
}) })
.catch(response => { .catch(response => {
toast.show(JSON.stringify(response));
toast.show('failed to fetch latest clips'); toast.show('failed to fetch latest clips');
}); });
} }

View File

@ -48,12 +48,12 @@ export default function NotifView() {
</View> </View>
{layout == 'compact' ? ( {layout == 'compact' ? (
<Tab.Navigator tabBarPosition="bottom"> <Tab.Navigator tabBarPosition="bottom">
<Tab.Screen name="Local" options={{title: 'local'}}>
{() => <NotifViewLocal />}
</Tab.Screen>
<Tab.Screen name="Remote" options={{title: 'distant'}}> <Tab.Screen name="Remote" options={{title: 'distant'}}>
{() => <NotifViewRemote />} {() => <NotifViewRemote />}
</Tab.Screen> </Tab.Screen>
<Tab.Screen name="Local" options={{title: 'local'}}>
{() => <NotifViewLocal />}
</Tab.Screen>
</Tab.Navigator> </Tab.Navigator>
) : ( ) : (
<ScrollView <ScrollView
@ -63,8 +63,8 @@ export default function NotifView() {
height: '100%', height: '100%',
padding: ps(30), padding: ps(30),
}}> }}>
<NotifViewLocal />
<NotifViewRemote /> <NotifViewRemote />
<NotifViewLocal />
</ScrollView> </ScrollView>
)} )}
</> </>

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import {ScrollView, View, Text, useWindowDimensions} from 'react-native'; import {View, Text, useWindowDimensions, Platform} from 'react-native';
import {Button} from 'react-native-paper'; import {Button} from 'react-native-paper';
import NotifList from './NotifList'; import NotifList from './NotifList';
import {useDispatch} from 'react-redux'; import {useDispatch} from 'react-redux';
@ -8,6 +8,7 @@ import {useToast} from 'react-native-toast-notifications';
import * as Clipboard from 'expo-clipboard'; import * as Clipboard from 'expo-clipboard';
import {ps} from '../../utils'; import {ps} from '../../utils';
import {store} from '../../redux/store'; import {store} from '../../redux/store';
import { ReactNavigationDracula } from '../../themes';
export default function NotifViewLocal({}) { export default function NotifViewLocal({}) {
const [notifs, setNotifs] = React.useState( const [notifs, setNotifs] = React.useState(
@ -43,6 +44,21 @@ export default function NotifViewLocal({}) {
}); });
} }
if (Platform.OS != "android"){
return (
<View
style={{
borderRadius: 12,
width: '100%',
height: '100%',
backgroundColor: ReactNavigationDracula.colors.card,
flex: 1,
margin: width > 600 ? ps(10) : 0,
}}/>
)
}
return ( return (
<View <View
style={{ style={{
@ -54,14 +70,13 @@ export default function NotifViewLocal({}) {
<Button <Button
mode="elevated" mode="elevated"
onPress={() => { onPress={() => {
console.log('TODO');
dispatch(addToLocal); dispatch(addToLocal);
}}> }}>
importer la derniere notification Import last notification
</Button> </Button>
<ScrollView> <View>
<NotifList type={'local'} notifs={notifs} /> <NotifList type={'local'} notifs={notifs} />
</ScrollView> </View>
</View> </View>
); );
} }

View File

@ -22,7 +22,7 @@ export default function NotifViewRemote() {
async function getNotif(dispatch) { async function getNotif(dispatch) {
axios axios
.get( .get(
'http://notifysync.simailadjalim.fr/notification?token=' + 'https://notifysync.simailadjalim.fr/notification?token=' +
store.getState().user.token, store.getState().user.token,
) )
.then((response, status) => { .then((response, status) => {
@ -32,7 +32,6 @@ export default function NotifViewRemote() {
toast.show('fetched latest notifications from remote'); toast.show('fetched latest notifications from remote');
}) })
.catch(response => { .catch(response => {
toast.show(JSON.stringify(response));
toast.show('failed to fetch latest notifications'); toast.show('failed to fetch latest notifications');
}); });
} }

View File

@ -39,7 +39,7 @@ export const localClipsSlice = createSlice({
localClipRemoveFromList: (state, action) => { localClipRemoveFromList: (state, action) => {
state.localClip = state.localClip.filter(e => e !== action.payload); state.localClip = state.localClip.filter(e => e !== action.payload);
}, },
localClipClear: (state, action) => { localClipClear: state => {
state.localClip = []; state.localClip = [];
}, },
}, },
@ -66,7 +66,7 @@ export const remoteClipsSlice = createSlice({
remoteClipRemoveFromList: (state, action) => { remoteClipRemoveFromList: (state, action) => {
state.remoteClip = state.remoteClip.filter(e => e !== action.payload); state.remoteClip = state.remoteClip.filter(e => e !== action.payload);
}, },
remoteClipClear: (state, action) => { remoteClipClear: state => {
state.remoteClip = []; state.remoteClip = [];
}, },
}, },
@ -87,7 +87,7 @@ export const localNotifsSlice = createSlice({
localNotifRemoveFromList: (state, action) => { localNotifRemoveFromList: (state, action) => {
state.localNotif = state.localNotif.filter(e => e !== action.payload); state.localNotif = state.localNotif.filter(e => e !== action.payload);
}, },
localNotifClear: (state, action) => { localNotifClear: state => {
state.localNotif = []; state.localNotif = [];
}, },
}, },
@ -108,7 +108,7 @@ export const remoteNotifsSlice = createSlice({
remoteNotifRemoveFromList: (state, action) => { remoteNotifRemoveFromList: (state, action) => {
state.remoteNotif = state.remoteNotif.filter(e => e !== action.payload); state.remoteNotif = state.remoteNotif.filter(e => e !== action.payload);
}, },
remoteNotifClear: (state, action) => { remoteNotifClear: state => {
state.remoteNotif = []; state.remoteNotif = [];
}, },
}, },