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

Commit

Permalink
Merge pull request #47 from mslipenchuk267/staging
Browse files Browse the repository at this point in the history
UX Enhancements
  • Loading branch information
mslipenchuk267 authored Nov 27, 2020
2 parents 0aa71e8 + 2bb4200 commit 1df3405
Show file tree
Hide file tree
Showing 18 changed files with 305 additions and 274 deletions.
3 changes: 2 additions & 1 deletion App.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { composeWithDevTools } from 'redux-devtools-extension';
import userReducer from './store/reducers/user';
import AppNavigator from './navigation/AppNavigator';
import PushNotificationManager from './components/PushNotificationManager';

import Toast from 'react-native-toast-message';
LogBox.ignoreLogs([
'Require cycle:', // issued by the fetch() function -> doesn't affect anything
'VirtualizedLists should never be nested' // issued by the scanned device flat list in lcdview on homescreen
Expand Down Expand Up @@ -46,6 +46,7 @@ const App = () => {
<Provider store={store}>
<PushNotificationManager>
<AppNavigator />
<Toast ref={(ref) => Toast.setRef(ref)} />
</PushNotificationManager>
</Provider>
);
Expand Down
2 changes: 1 addition & 1 deletion __tests__/StateSelectorScreen.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { fireEvent, render } from '@testing-library/react-native'

import StateSelectorScreen from '../screens/diagnosis/StateSelectorScreen';
import StateSelectorScreen from '../screens/news/StateSelectorScreen';

describe('StateSelectorScreen', () => {
it('should display filtered states', () => {
Expand Down
8 changes: 5 additions & 3 deletions components/PushNotificationManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { handleNotification } from '../helpers/notificationHelper';
const PushNotificationManager = (props) => {
const dispatch = useDispatch();
const contactedIDs = useSelector(state => state.user.contactedIDs);
const didTryAutoLogin = useSelector(state => state.user.didTryAutoLogin);

useEffect(() => {
registerDevice = () => {
Expand Down Expand Up @@ -52,9 +53,10 @@ const PushNotificationManager = (props) => {
})
.catch(err => console.error('getInitialNotification() failed', err))
}

registerDevice()
registerNotificationEvents()
if (!didTryAutoLogin) {
registerDevice();
}
registerNotificationEvents();
}, [dispatch, contactedIDs])

return (
Expand Down
13 changes: 13 additions & 0 deletions components/ScannedDevice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import { View, Text } from 'react-native';

const ScannedDevice = (props) => {
return (
<View style={{ flexDirection: 'row', justifyContent: 'space-between', paddingTop: 3 }} onStartShouldSetResponder={() => true} >
<Text>{props.tempID}</Text>
<Text>{props.averageRssi}</Text>
</View>
)
}

export default ScannedDevice;
11 changes: 5 additions & 6 deletions helpers/authHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
* // refresh token
* }
*/
export const isRefreshNeeded = (accessTokenExpiration) => {
if (new Date() >= new Date(accessTokenExpiration)) {
export const isRefreshNeeded = (tokenExpiration) => {
if (new Date() >= new Date(tokenExpiration)) {
console.log("authHelper.js/isRefreshNeeded() - User requires a refresh")
return true;
} else {
console.log("authHelper.js/isRefreshNeeded() - User requires a refresh")
return false;
}
}
Expand All @@ -25,8 +27,6 @@ export const isRefreshNeeded = (accessTokenExpiration) => {
* }
*/
export const uploadDeviceToken = async (deviceToken, accessToken) => {
console.log("authHelper.js/uploadDeviceToken() - Inside the function")

if (deviceToken && accessToken) {
// Assemble Request
var myHeaders = new Headers();
Expand All @@ -39,10 +39,9 @@ export const uploadDeviceToken = async (deviceToken, accessToken) => {
body: raw,
redirect: 'follow'
};
//
// Send Request
const result = await fetch("http://a87713a1fd4b64cd4b788e8a1592de07-1206905140.us-west-2.elb.amazonaws.com/device_key", requestOptions)
const resData = await result.json()

// Error Check
if (resData.error) {
// alert user to error
Expand Down
12 changes: 6 additions & 6 deletions helpers/scanHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ export const handleDevice = async (error, device, dispatch, bleManager) => {
} catch {
console.log("Could not get Discover services on:", device.name)
}
try {
await bleManager.cancelDeviceConnection(device.id)
console.log("Disconnected from device: ", device.name)
} catch {
console.log("Could not disconnect from device: ", device.name)
}
// try {
// await bleManager.cancelDeviceConnection(device.id)
// console.log("Disconnected from device: ", device.name)
// } catch {
// console.log("Could not disconnect from device: ", device.name)
// }

}
}
152 changes: 80 additions & 72 deletions ios/parliament/Info.plist
Original file line number Diff line number Diff line change
@@ -1,72 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Parliament-TU</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Our application will do bluetooth contact tracing in foreground and background if you accept.</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>We use bluetooth for contact tracing at your request.</string>
<key>NSCameraUsageDescription</key>
<string>We only use your camera to let you scan QR codes.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UIAppFonts</key>
<array>
<string>Entypo.ttf</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>bluetooth-central</string>
<string>bluetooth-peripheral</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>BleInTheBackground</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Parliament-TU</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Our application will do bluetooth contact tracing in foreground and background if you accept.</string>
<key>NSBluetoothPeripheralUsageDescription</key>
<string>We use bluetooth for contact tracing at your request.</string>
<key>NSCameraUsageDescription</key>
<string>We only use your camera to let you scan QR codes.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UIAppFonts</key>
<array>
<string>Entypo.ttf</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>bluetooth-central</string>
<string>bluetooth-peripheral</string>
<string>external-accessory</string>
<string>fetch</string>
<string>processing</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
Loading

0 comments on commit 1df3405

Please sign in to comment.