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

Commit

Permalink
Merge pull request #14 from nileshbhingaradiya/bug/connectio_error#8
Browse files Browse the repository at this point in the history
  • Loading branch information
curtishall authored Aug 25, 2021
2 parents 0b086e9 + a96f9cd commit f9e7e53
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
11 changes: 6 additions & 5 deletions screens/EventScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -19,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);
Expand All @@ -42,7 +46,7 @@ function EventButton({id, title, published, updated, active, current}) {
marginTop: 5, paddingLeft: 10, paddingRight: 10, paddingTop:15,
paddingBottom:15}}>
<View><Text style={{color: active ? 'white' : '#777777'}}>{title}</Text></View>
{updated ? <View><Text style={{color: active ? 'white' : '#777777'}}>Updated: {updated}</Text></View> :
{updated ? <View><Text style={{color: active ? 'white' : '#777777'}}>Updated: {dayJs(updated).format(dateFormat)}</Text></View> :
(published ? <View><Text style={{color: active ? 'white' : '#777777'}}>Published: {published}</Text></View> : null)}
</View>);
}
Expand All @@ -51,24 +55,21 @@ 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(dateFormat));
setRefreshing(false);
});
}, [state.activeAccount]);

useEffect(() => {
onRefresh();
}, []);

return (<SafeAreaView style={{flex: 1}}>
{lastUpdate && (<View style={{flexDirection: 'row', padding: 10, backgroundColor: '#333333'}}>
<Text style={{color: 'white'}}>Last Update:</Text><Text style={{color: 'white', marginLeft: 10}}>{lastUpdate}</Text>
Expand Down

0 comments on commit f9e7e53

Please sign in to comment.