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

🔄 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 9cb3a0bebe
8 changed files with 88 additions and 22 deletions

View File

@ -0,0 +1,53 @@
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
- run : apt install rsync
- name: Deploy with rsync
run: rsync -rav --delete dist/ www-data@simailadjalim.fr:/var/www/clipsync-webapp

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
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 NotifList from './NotifList';
import {useDispatch} from 'react-redux';
@ -8,6 +8,7 @@ import {useToast} from 'react-native-toast-notifications';
import * as Clipboard from 'expo-clipboard';
import {ps} from '../../utils';
import {store} from '../../redux/store';
import { ReactNavigationDracula } from '../../themes';
export default function NotifViewLocal({}) {
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 (
<View
style={{
@ -54,14 +70,13 @@ export default function NotifViewLocal({}) {
<Button
mode="elevated"
onPress={() => {
console.log('TODO');
dispatch(addToLocal);
}}>
importer la derniere notification
Import last notification
</Button>
<ScrollView>
<View>
<NotifList type={'local'} notifs={notifs} />
</ScrollView>
</View>
</View>
);
}

View File

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

View File

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