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

Commit

Permalink
Merge branch 'release/v444'
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Healy committed Apr 19, 2019
2 parents 5a9a4b3 + 8428b3e commit afb2947
Show file tree
Hide file tree
Showing 12 changed files with 119 additions and 53 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## [v444](https://github.com/uport-project/uport-mobile/tree/v444) (2019-04-19)
[Full Changelog](https://github.com/uport-project/uport-mobile/compare/v443...v444)

**Merged pull requests:**

- Handle milliseconds in expiry [\#126](https://github.com/uport-project/uport-mobile/pull/126) ([jasonhealy](https://github.com/jasonhealy))
- Handle exeptions in sagas [\#125](https://github.com/uport-project/uport-mobile/pull/125) ([simonas-notcat](https://github.com/simonas-notcat))

## [v443](https://github.com/uport-project/uport-mobile/tree/v443) (2019-04-18)
[Full Changelog](https://github.com/uport-project/uport-mobile/compare/v442...v443)

Expand Down
4 changes: 2 additions & 2 deletions android/version.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#This is a generated file so things tend to get overwritten.
#Use `gradlew bumpVersion` to increment the version by 1
#or `gradlew bumpVersion -P_BUILD_NUMBER=<your specific version>` to set it manually
#Thu Apr 18 17:32:13 IST 2019
BUILD_NUMBER=443
#Fri Apr 19 15:41:17 IST 2019
BUILD_NUMBER=444
4 changes: 2 additions & 2 deletions ios/uPortMobile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2341,7 +2341,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
COPY_HEADERS_RUN_UNIFDEF = NO;
CURRENT_PROJECT_VERSION = 443;
CURRENT_PROJECT_VERSION = 444;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = 82SAVLYZ3K;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -2410,7 +2410,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
COPY_HEADERS_RUN_UNIFDEF = NO;
CURRENT_PROJECT_VERSION = 443;
CURRENT_PROJECT_VERSION = 444;
DEVELOPMENT_TEAM = 82SAVLYZ3K;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
Expand Down
2 changes: 1 addition & 1 deletion ios/uPortMobile/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>443</string>
<string>444</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/uPortMobileTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>443</string>
<string>444</string>
</dict>
</plist>
13 changes: 4 additions & 9 deletions lib/components/Notifications/Types/AttestationNotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import { Text } from 'react-native'
import Notification from '../partials/Notification'
import Avatar from 'uPortMobile/lib/components/shared/Avatar'
import { textStyles, colors } from 'uPortMobile/lib/styles/globalStyles'
import dateChecker from 'uPortMobile/lib/utilities/dateChecker'

const AttestationNotification = (props) => {
const AttestationNotification = props => {
const handleAuthorize = () => {
props.authorize(props.activity)
}
Expand All @@ -48,14 +49,8 @@ const AttestationNotification = (props) => {
noButtons={false}
>
<Avatar source={issuer} size={72} borderWidth={4} borderColor={colors.white} />
<Text style={[textStyles.h2, {margin: 10}]}>
{claimType}
</Text>
{ exp
? <Text style={[textStyles.p, {margin: 10}]}>
Expires: {new Date(exp).toLocaleDateString()}
</Text>
: null }
<Text style={[textStyles.h2, { margin: 10 }]}>{claimType}</Text>
{exp ? <Text style={[textStyles.p, { margin: 10 }]}>Expires: {dateChecker(exp)}</Text> : null}
</Notification>
)
}
Expand Down
9 changes: 4 additions & 5 deletions lib/components/Verifications/ExpirationItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
// Frameworks
import React from 'react'
import { Text, View, StyleSheet } from 'react-native'
import moment from 'moment'
import dateChecker from 'uPortMobile/lib/utilities/dateChecker'

// Styles
import { colors, fontLight } from 'uPortMobile/lib/styles/globalStyles'
Expand All @@ -34,12 +34,11 @@ const styles = StyleSheet.create({
})
// Helpers
const ExpirationItem = props => {
// let expirationDate = props.d && props.d >= JWT_MS_CUTOFF ? moment.unix(props.d) : moment.unix(props.d * 1000)
let formattedDate = moment.unix(props.d).format('MMM Do YYYY')
const formattedDate = dateChecker(props.d)
return (
<View>
{props.d ? (
<Text style={styles.expirationDate}>Exp: {props.testing ? props.d : formattedDate}</Text>
{!!props.d ? (
<Text style={styles.expirationDate}>Exp: {formattedDate}</Text>
) : (
<Text style={styles.expirationDate}>Exp: No Expiration</Text>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import ExpirationItem from '../ExpirationItem'
import renderer from 'react-test-renderer'

describe('ExpirationItem', () => {
it('renders ExpirationItem', () => {
const date = 'Thu Mar 06 2014 19:00:00 GMT-0500 (CST)'
const tree = renderer.create(
<ExpirationItem
d={date}
testing
/>
).toJSON()
it('renders ExpirationItem in seconds', () => {
const date = 1583020800
const tree = renderer.create(<ExpirationItem d={date} />).toJSON()
expect(tree).toMatchSnapshot()
})
it('renders ExpirationItem in milliseconds', () => {
const date = 1583020800000
const tree = renderer.create(<ExpirationItem d={date} />).toJSON()
expect(tree).toMatchSnapshot()
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ExpirationItem renders ExpirationItem in milliseconds 1`] = `
<View>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
style={
Object {
"color": "rgba(74,74,74,1)",
"fontFamily": undefined,
"fontSize": 12,
"lineHeight": 16,
}
}
>
Exp:
Mar 1st 2020
</Text>
</View>
`;

exports[`ExpirationItem renders ExpirationItem in seconds 1`] = `
<View>
<Text
accessible={true}
allowFontScaling={true}
ellipsizeMode="tail"
style={
Object {
"color": "rgba(74,74,74,1)",
"fontFamily": undefined,
"fontSize": 12,
"lineHeight": 16,
}
}
>
Exp:
Mar 1st 2020
</Text>
</View>
`;
6 changes: 2 additions & 4 deletions lib/components/shared/NestedInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import S from 'string'
import Icon from 'react-native-vector-icons/Ionicons'
import moment from 'moment'
import { colors } from 'uPortMobile/lib/styles/globalStyles'
import dateChecker from 'uPortMobile/lib/utilities/dateChecker'

const maxStringLength = 50

Expand Down Expand Up @@ -216,10 +217,7 @@ export class NestedInfo extends Component {

{verification && verification.exp && (
<View>
<Section
data={{ expiry: moment.unix(verification.exp).format('MMM Do YYYY') }}
navigator={this.props.navigator}
/>
<Section data={{ expiry: dateChecker(verification.exp) }} navigator={this.props.navigator} />
</View>
)}
</ScrollView>
Expand Down
53 changes: 32 additions & 21 deletions lib/sagas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
// You should have received a copy of the GNU General Public License
// along with uPort Mobile App. If not, see <http://www.gnu.org/licenses/>.
//
import { all } from 'redux-saga/effects'
import { all, put } from 'redux-saga/effects'
import { saveError } from '../actions/processStatusActions'
import startupSaga from './startupSaga'
import handleRequestSaga from './requests'
import identitySaga from './identitySaga'
Expand All @@ -36,24 +37,34 @@ import migrationsSaga from './migrationsSaga'
import debugSaga from './debugSaga'

export default function* rootSaga() {
yield all([
featureFlagsSaga(),
metricsSaga(),
startupSaga(),
stateSaver(),
identitySaga(),
networkState(),
handleRequestSaga(),
personaSaga(),
unnuSaga(),
blockchainSaga(),
notificationRegistrationSaga(),
recoverySaga(),
encryptionSaga(),
pututuSaga(),
keychainSaga(),
hubSaga(),
// migrationsSaga(),
debugSaga(),
])
try {
yield all([
featureFlagsSaga(),
metricsSaga(),
startupSaga(),
stateSaver(),
identitySaga(),
networkState(),
handleRequestSaga(),
personaSaga(),
unnuSaga(),
blockchainSaga(),
notificationRegistrationSaga(),
recoverySaga(),
encryptionSaga(),
pututuSaga(),
keychainSaga(),
hubSaga(),
// migrationsSaga(),
debugSaga(),
])
} catch(e) {
console.log('ERROR IN SAGAS', e)
let stack = ''
if (e.stack) {
stack = '\n' + e.stack.split('\n')[1]
}
yield put(saveError(e.name, e.message + stack))
}
}

12 changes: 12 additions & 0 deletions lib/utilities/dateChecker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import moment from 'moment'
/**
* Formats a timestamp into a readable date format regardless of seconds or milliseconds
*
*/
const dateChecker = (date: number) => {
const isMilliSeconds = date && date >= 1000000000000
const formattedDate = isMilliSeconds ? moment(date).format('MMM Do YYYY') : moment.unix(date).format('MMM Do YYYY')
return formattedDate
}

export default dateChecker

0 comments on commit afb2947

Please sign in to comment.