Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/upgrading-to-AFJ…
Browse files Browse the repository at this point in the history
…-040
  • Loading branch information
TimoGlastra committed Mar 17, 2023
2 parents c8eb7b7 + 881f5b9 commit a2cd211
Show file tree
Hide file tree
Showing 42 changed files with 3,540 additions and 3,097 deletions.
24 changes: 6 additions & 18 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,25 @@
# based on https://github.com/hyperledger/aries-framework-javascript-ext/blob/main/.github/actions/setup-node/action.yml
name: Setup NodeJS
description: Setup NodeJS with caching
author: 'timo@animo.id'
author: "timo@animo.id"

inputs:
node-version:
description: Node version to use
required: false
default: '16.15.0'
default: "16.15.0"

runs:
using: composite
steps:
- name: Get yarn cache directory path
id: yarn-cache-dir-path
shell: bash
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Setup node v${{ inputs.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
registry-url: 'https://registry.npmjs.org/'
registry-url: "https://registry.npmjs.org/"
cache: "yarn"

- name: Node Version
shell: bash
run: |
node -v && yarn -v
node -v && yarn -v
10 changes: 5 additions & 5 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Configure ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
ruby-version: 2.7

- name: Cache pod dependencies
id: pod-cache
Expand Down Expand Up @@ -106,9 +106,9 @@ jobs:
- name: Setup JDK
uses: actions/setup-java@v2
with:
distribution: 'zulu'
distribution: "zulu"
java-version: 11
cache: 'gradle'
cache: "gradle"

- name: Setup Android SDK
working-directory: ./app/android
Expand All @@ -122,13 +122,13 @@ jobs:
unzip -d $ANDROID_HOME/cmdline-tools commandlinetools-linux.zip
mv $ANDROID_HOME/cmdline-tools/cmdline-tools $ANDROID_HOME/cmdline-tools/latest
find $ANDROID_HOME -name sdkmanager
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin
echo y | sdkmanager "platforms;android-${{ matrix.compile-sdk }}" >/dev/null
echo y | sdkmanager "platform-tools" >/dev/null
echo y | sdkmanager "build-tools;${{ matrix.build-tools }}" >/dev/null
find $ANDROID_HOME -type f -executable -print
chmod +x ./gradlew
set +o pipefail
yes | sdkmanager --licenses
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
name: Code Quality

env:
cacheId: "6" # increment to expire the cache

on:
pull_request:
branches: [main]
Expand All @@ -21,7 +18,8 @@ jobs:
uses: ./.github/actions/setup-node

- name: Install dependencies
run: yarn install --immutable
run: |
yarn install --immutable
- name: Check style
run: |
Expand All @@ -41,7 +39,8 @@ jobs:
uses: ./.github/actions/setup-node

- name: Install dependencies
run: yarn install --immutable
run: |
yarn install --immutable
- name: Automated testing
run: |
Expand Down
18 changes: 10 additions & 8 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

<!-- Please keep this sorted alphabetically by github -->

| Name | Github | LFID |
| -------------- | ----------- | ---- |
| Akiff Manji | amanji | |
| Clécio Varjão | cvarjao | |
| James Ebert | JamesKEbert | |
| Jean-Christophe Drouin | jcdrouin21 | |
| Jason C. Leach | jleach | |
| Ryan Koch | ryankoch13 | |
| Name | Github | LFID |
| ---------------------- | ------------ | ---- |
| Akiff Manji | amanji | |
| Clécio Varjão | cvarjao | |
| James Ebert | JamesKEbert | |
| Jean-Christophe Drouin | jcdrouin21 | |
| Jason C. Leach | jleach | |
| Wade King | wadeking98 | |
| Ryan Koch | ryankoch13 | |
| Bryce McMath | bryce-mcmath | |

## Emeritus Maintainers

Expand Down
108 changes: 96 additions & 12 deletions core/App/components/listItems/NotificationListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useNavigation } from '@react-navigation/core'
import { StackNavigationProp } from '@react-navigation/stack'
import React, { useState, useEffect } from 'react'
import { useTranslation } from 'react-i18next'
import { StyleSheet, View, Text, TouchableOpacity } from 'react-native'
import { StyleSheet, View, ViewStyle, Text, TextStyle, TouchableOpacity } from 'react-native'
import Icon from 'react-native-vector-icons/MaterialIcons'

import { useConfiguration } from '../../contexts/configuration'
Expand All @@ -18,6 +18,7 @@ import { HomeStackParams, Screens, Stacks } from '../../types/navigators'
import { parsedSchema } from '../../utils/helpers'
import { testIdWithKey } from '../../utils/testable'
import Button, { ButtonType } from '../buttons/Button'
import { InfoBoxType } from '../misc/InfoBox'

const iconSize = 30

Expand All @@ -34,11 +35,19 @@ interface NotificationListItemProps {
}

type DisplayDetails = {
type: InfoBoxType
body: string | undefined
title: string | undefined
buttonTitle: string | undefined
}

type StyleConfig = {
containerStyle: ViewStyle
textStyle: TextStyle
iconColor: string
iconName: string
}

const NotificationListItem: React.FC<NotificationListItemProps> = ({ notificationType, notification }) => {
const navigation = useNavigation<StackNavigationProp<HomeStackParams>>()
const { customNotification } = useConfiguration()
Expand All @@ -47,14 +56,25 @@ const NotificationListItem: React.FC<NotificationListItemProps> = ({ notificatio
const { ColorPallet, TextTheme } = useTheme()
const { agent } = useAgent()
const [details, setDetails] = useState<DisplayDetails>({
type: InfoBoxType.Info,
title: undefined,
body: undefined,
buttonTitle: undefined,
})
const styles = StyleSheet.create({
container: {
const [styleConfig, setStyleConfig] = useState<StyleConfig>({
containerStyle: {
backgroundColor: ColorPallet.notification.info,
borderColor: ColorPallet.notification.infoBorder,
},
textStyle: {
color: ColorPallet.notification.infoText,
},
iconColor: ColorPallet.notification.infoIcon,
iconName: 'info',
})

const styles = StyleSheet.create({
container: {
borderRadius: 5,
borderWidth: 1,
padding: 10,
Expand All @@ -76,14 +96,12 @@ const NotificationListItem: React.FC<NotificationListItemProps> = ({ notificatio
flexGrow: 1,
fontWeight: 'bold',
alignSelf: 'center',
color: ColorPallet.notification.infoText,
},
bodyText: {
...TextTheme.normal,
flexShrink: 1,
marginVertical: 15,
paddingBottom: 10,
color: ColorPallet.notification.infoText,
},
icon: {
marginRight: 10,
Expand All @@ -103,6 +121,7 @@ const NotificationListItem: React.FC<NotificationListItemProps> = ({ notificatio
switch (notificationType) {
case NotificationType.CredentialOffer:
resolve({
type: InfoBoxType.Info,
title: t('CredentialOffer.NewCredentialOffer'),
body: `${name + (version ? ` v${version}` : '')}`,
buttonTitle: undefined,
Expand All @@ -113,26 +132,34 @@ const NotificationListItem: React.FC<NotificationListItemProps> = ({ notificatio
agent?.proofs.findRequestMessage(proofId).then((message) => {
if (message instanceof V1RequestPresentationMessage && message.indyProofRequest) {
resolve({
type: InfoBoxType.Info,
title: t('ProofRequest.NewProofRequest'),
body: message.indyProofRequest.name,
buttonTitle: undefined,
})
} else {
//TODO:(jl) Should we have a default message or stick with an empty string?
resolve({ title: t('ProofRequest.NewProofRequest'), body: '', buttonTitle: undefined })
resolve({
type: InfoBoxType.Info,
title: t('ProofRequest.NewProofRequest'),
body: '',
buttonTitle: undefined,
})
}
})
break
}
case NotificationType.Revocation:
resolve({
type: InfoBoxType.Error,
title: t('CredentialDetails.NewRevoked'),
body: `${name + (version ? ` v${version}` : '')}`,
buttonTitle: undefined,
})
break
case NotificationType.Custom:
resolve({
type: InfoBoxType.Info,
title: t(customNotification.title as any),
body: t(customNotification.description as any),
buttonTitle: t(customNotification.buttonTitle as any),
Expand Down Expand Up @@ -219,13 +246,70 @@ const NotificationListItem: React.FC<NotificationListItemProps> = ({ notificatio
})
}, [notificationType])

useEffect(() => {
switch (details.type) {
case InfoBoxType.Success:
setStyleConfig({
containerStyle: {
backgroundColor: ColorPallet.notification.success,
borderColor: ColorPallet.notification.successBorder,
},
textStyle: {
color: ColorPallet.notification.successText,
},
iconColor: ColorPallet.notification.successIcon,
iconName: 'check-circle',
})
break
case InfoBoxType.Warn:
setStyleConfig({
containerStyle: {
backgroundColor: ColorPallet.notification.warn,
borderColor: ColorPallet.notification.warnBorder,
},
textStyle: {
color: ColorPallet.notification.warnText,
},
iconColor: ColorPallet.notification.warnIcon,
iconName: 'warning',
})
break
case InfoBoxType.Error:
setStyleConfig({
containerStyle: {
backgroundColor: ColorPallet.notification.error,
borderColor: ColorPallet.notification.errorBorder,
},
textStyle: {
color: ColorPallet.notification.errorText,
},
iconColor: ColorPallet.notification.errorIcon,
iconName: 'error',
})
break
case InfoBoxType.Info:
default:
setStyleConfig({
containerStyle: {
backgroundColor: ColorPallet.notification.info,
borderColor: ColorPallet.notification.infoBorder,
},
textStyle: {
color: ColorPallet.notification.infoText,
},
iconColor: ColorPallet.notification.infoIcon,
iconName: 'info',
})
}
}, [details])

return (
<View style={styles.container} testID={testIdWithKey('NotificationListItem')}>
<View style={[styles.container, styleConfig.containerStyle]} testID={testIdWithKey('NotificationListItem')}>
<View style={styles.headerContainer}>
<View style={[styles.icon]}>
<Icon name={'info'} size={iconSize} color={ColorPallet.notification.infoIcon} />
<View style={styles.icon}>
<Icon name={styleConfig.iconName} size={iconSize} color={styleConfig.iconColor} />
</View>
<Text style={styles.headerText} testID={testIdWithKey('HeaderText')}>
<Text style={[styles.headerText, styleConfig.textStyle]} testID={testIdWithKey('HeaderText')}>
{details.title}
</Text>
{[NotificationType.Custom, NotificationType.ProofRequest, NotificationType.CredentialOffer].includes(
Expand All @@ -237,13 +321,13 @@ const NotificationListItem: React.FC<NotificationListItemProps> = ({ notificatio
testID={testIdWithKey(`Close${notificationType}`)}
onPress={onClose}
>
<Icon name={'close'} size={iconSize} color={ColorPallet.notification.infoIcon} />
<Icon name={'close'} size={iconSize} color={styleConfig.iconColor} />
</TouchableOpacity>
</View>
)}
</View>
<View style={styles.bodyContainer}>
<Text style={styles.bodyText} testID={testIdWithKey('BodyText')}>
<Text style={[styles.bodyText, styleConfig.textStyle]} testID={testIdWithKey('BodyText')}>
{details.body}
</Text>
<Button
Expand Down
1 change: 1 addition & 0 deletions core/App/components/misc/ConnectionAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const ConnectionAlert: React.FC<ConnectionAlertProps> = ({ connectionID }) => {
},
notifyTextContainer: {
borderLeftColor: ColorPallet.brand.highlight,
backgroundColor: ColorPallet.brand.secondaryBackground,
borderLeftWidth: 10,
flex: 1,
paddingLeft: 10,
Expand Down
Loading

0 comments on commit a2cd211

Please sign in to comment.