From 5de01e11cb028db0a81312c6974ac526eb16e254 Mon Sep 17 00:00:00 2001 From: Nilesh Bhingaradiya Date: Tue, 24 Aug 2021 11:19:21 +0530 Subject: [PATCH 1/4] #8 Clicking on an event notification confuses app, brings the app back to 'Add server' screen with Connection error --- App.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/App.js b/App.js index acffa18..956056c 100644 --- a/App.js +++ b/App.js @@ -103,9 +103,9 @@ const App: () => React$Node = () => { } const [id, accountRecord] = targetAccount; - const {address, login, password} = accountRecord; + const {address, login, password, port} = accountRecord; - checkServerCredentials('https://' + address, login, password).then(status => { + checkServerCredentials('https://' + address+ (port ? ':' + port : ''), login, password).then(status => { if (status !== false) { dispatch({ type: 'login', From 25244aeddc4f4d0371d7a715c5e0025d31846b1c Mon Sep 17 00:00:00 2001 From: nileshbhingaradiya Date: Wed, 25 Aug 2021 10:39:29 +0530 Subject: [PATCH 2/4] #8 change date and time format %m-%d-%y --- screens/EventScreen.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/screens/EventScreen.js b/screens/EventScreen.js index ee7aa28..cfc63af 100644 --- a/screens/EventScreen.js +++ b/screens/EventScreen.js @@ -2,6 +2,8 @@ import React, {useEffect, useState, useCallback, useContext, useRef} from 'react'; import {View, Text, FlatList, TouchableOpacity, SafeAreaView} from 'react-native'; import { createStackNavigator } from '@react-navigation/stack'; +import dayJs from 'dayjs'; + import {getEvents} from '../lib/api'; import {getAddressByCredentials} from '../lib/util'; @@ -42,7 +44,7 @@ function EventButton({id, title, published, updated, active, current}) { marginTop: 5, paddingLeft: 10, paddingRight: 10, paddingTop:15, paddingBottom:15}}> {title} - {updated ? Updated: {updated} : + {updated ? Updated: {dayJs(updated).format('M-D-YY h:m:s A')} : (published ? Published: {published} : null)} ); } @@ -51,16 +53,14 @@ function EventButton({id, title, published, updated, active, current}) { function EventList({navigation}) { const {state} = useContext(SessionContext); - const [lastUpdate, setLastUpdate] = useState(); const [eventList, setEventList] = useState([]); const [refreshing, setRefreshing] = useState(false); - const onRefresh = useCallback(() => { setRefreshing(true); getEvents(getAddressByCredentials(state.activeAccount)).then(([list, update]) => { setEventList(list); - setLastUpdate(update); + setLastUpdate(dayJs(update).format('M-D-YY h:m:s A')); setRefreshing(false); }); }, [state.activeAccount]); @@ -68,7 +68,7 @@ function EventList({navigation}) { useEffect(() => { onRefresh(); }, []); - +console.log('eventList===',eventList) return ( {lastUpdate && ( Last Update:{lastUpdate} From 8cd3c6b4d667e01dc17e5c35ea8bde3c0d231801 Mon Sep 17 00:00:00 2001 From: nileshbhingaradiya Date: Wed, 25 Aug 2021 10:40:50 +0530 Subject: [PATCH 3/4] #8 removed console --- screens/EventScreen.js | 1 - 1 file changed, 1 deletion(-) diff --git a/screens/EventScreen.js b/screens/EventScreen.js index cfc63af..865715e 100644 --- a/screens/EventScreen.js +++ b/screens/EventScreen.js @@ -68,7 +68,6 @@ function EventList({navigation}) { useEffect(() => { onRefresh(); }, []); -console.log('eventList===',eventList) return ( {lastUpdate && ( Last Update:{lastUpdate} From a96f9cd2bb9aa01b56c49b9220a6024a390653e7 Mon Sep 17 00:00:00 2001 From: nileshbhingaradiya Date: Wed, 25 Aug 2021 10:45:23 +0530 Subject: [PATCH 4/4] #8 used const variable for the date format --- screens/EventScreen.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/screens/EventScreen.js b/screens/EventScreen.js index 865715e..8171304 100644 --- a/screens/EventScreen.js +++ b/screens/EventScreen.js @@ -21,6 +21,8 @@ import ToggleNavigationButton from '../components/ToggleNavigationButton'; const Stack = createStackNavigator(); +const dateFormat = 'M-D-YY h:m:s A'; + function Player({uri}) { const [error, setError] = useState(false); const [stopped, setStopped] = useState(false); @@ -44,7 +46,7 @@ function EventButton({id, title, published, updated, active, current}) { marginTop: 5, paddingLeft: 10, paddingRight: 10, paddingTop:15, paddingBottom:15}}> {title} - {updated ? Updated: {dayJs(updated).format('M-D-YY h:m:s A')} : + {updated ? Updated: {dayJs(updated).format(dateFormat)} : (published ? Published: {published} : null)} ); } @@ -60,7 +62,7 @@ function EventList({navigation}) { setRefreshing(true); getEvents(getAddressByCredentials(state.activeAccount)).then(([list, update]) => { setEventList(list); - setLastUpdate(dayJs(update).format('M-D-YY h:m:s A')); + setLastUpdate(dayJs(update).format(dateFormat)); setRefreshing(false); }); }, [state.activeAccount]);