Skip to content

Commit

Permalink
Merge branch 'main' into feat/update-license-service
Browse files Browse the repository at this point in the history
  • Loading branch information
thorkellmani authored Jul 11, 2024
2 parents f17cf23 + c7dc145 commit 881b09e
Show file tree
Hide file tree
Showing 15 changed files with 284 additions and 229 deletions.
44 changes: 0 additions & 44 deletions .github/workflows/datadog-analysis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ jobs:
echo "SHA='$SHA', retrived from action environment"
fi
echo "Using SHA='$SHA' as docker tag sha"
export DOCKER_TAG=${DOCKER_BRANCH_TAG}_${SHA}_${GITHUB_RUN_NUMBER}
export DOCKER_TAG=${DOCKER_BRANCH_TAG}_${SHA:0:10}_${GITHUB_RUN_NUMBER}
echo "Docker tag will be ${DOCKER_TAG}"
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_OUTPUT
echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV
Expand Down
41 changes: 41 additions & 0 deletions apps/native/app/src/lib/show-picker.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { dynamicColor } from '@ui'
import { ActionSheetIOS } from 'react-native'
import DialogAndroid from 'react-native-dialogs'
import { uiStore } from '../stores/ui-store'
Expand Down Expand Up @@ -54,6 +55,21 @@ interface ShowPickerResponse {
selectedItem?: ShowPickerItem
}

const parseAndroidAction = (action: string) => {
switch (action) {
case 'actionPositive':
return 'positive'
case 'actionNegative':
return 'negative'
case 'actionNeutral':
return 'neutral'
case 'actionDismiss':
return 'dismiss'
default:
return 'select'
}
}

export function showPicker(
options: ShowPickerOptions,
): Promise<ShowPickerResponse> {
Expand Down Expand Up @@ -139,3 +155,28 @@ export function showPicker(
}
return Promise.resolve({ action: 'neutral' })
}

export function showAndroidPrompt(
title: string,
content?: string,
options?: DialogAndroid.OptionsPrompt,
): Promise<DialogAndroid.PromptResponse> {
const theme = uiStore.getState().theme!

return DialogAndroid.prompt(title, content, {
positiveColor: theme.color.blue400,
negativeColor: theme.color.red600,
widgetColor: theme.color.blue400,
contentColor: theme.shade.foreground,
backgroundColor: theme.shade.background,
neutralColor: theme.shade.foreground,
titleColor: theme.shade.foreground,
...options,
}).then(({ action, text, ...rest }: any) => {
return {
action: parseAndroidAction(action),
text,
...rest,
}
})
}
11 changes: 0 additions & 11 deletions apps/native/app/src/screens/applications/applications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ import {
useListSearchQuery,
} from '../../graphql/types/schema'
import { createNavigationOptionHooks } from '../../hooks/create-navigation-option-hooks'
import { useActiveTabItemPress } from '../../hooks/use-active-tab-item-press'
import { useConnectivityIndicator } from '../../hooks/use-connectivity-indicator'
import { useBrowser } from '../../lib/useBrowser'
import { getApplicationOverviewUrl } from '../../utils/applications-utils'
import { getRightButtons } from '../../utils/get-main-root'
import { testIDs } from '../../utils/test-ids'
import { ApplicationsModule } from '../home/applications-module'

Expand All @@ -42,7 +40,6 @@ const { useNavigationOptions, getNavigationOptions } =
searchBar: {
visible: false,
},
rightButtons: initialized ? getRightButtons({ theme } as any) : [],
},
bottomTab: {
iconColor: theme.color.blue400,
Expand Down Expand Up @@ -98,7 +95,6 @@ export const ApplicationsScreen: NavigationFunctionComponent = ({

useConnectivityIndicator({
componentId,
rightButtons: getRightButtons(),
refetching,
queryResult: [applicationsRes, res],
})
Expand Down Expand Up @@ -139,13 +135,6 @@ export const ApplicationsScreen: NavigationFunctionComponent = ({
[],
)

useActiveTabItemPress(3, () => {
flatListRef.current?.scrollToOffset({
offset: -150,
animated: true,
})
})

const keyExtractor = useCallback((item: ListItem) => item.id, [])

const onRefresh = useCallback(async () => {
Expand Down
6 changes: 4 additions & 2 deletions apps/native/app/src/screens/home/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ const { useNavigationOptions, getNavigationOptions } =
createNavigationOptionHooks(
(theme, intl, initialized) => ({
topBar: {
rightButtons: initialized ? getRightButtons({ theme } as any) : [],
rightButtons: initialized
? getRightButtons({ screen: 'Home', theme: theme as any })
: [],
},
bottomTab: {
...({
Expand Down Expand Up @@ -110,7 +112,7 @@ export const MainHomeScreen: NavigationFunctionComponent = ({

useConnectivityIndicator({
componentId,
rightButtons: getRightButtons(),
rightButtons: getRightButtons({ screen: 'Home' }),
queryResult: applicationsRes,
refetching,
})
Expand Down
3 changes: 0 additions & 3 deletions apps/native/app/src/screens/inbox/inbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import { toggleAction } from '../../lib/post-mail-action'
import { useOrganizationsStore } from '../../stores/organizations-store'
import { useUiStore } from '../../stores/ui-store'
import { ComponentRegistry } from '../../utils/component-registry'
import { getRightButtons } from '../../utils/get-main-root'
import { testIDs } from '../../utils/test-ids'

type ListItem =
Expand All @@ -61,7 +60,6 @@ const { useNavigationOptions, getNavigationOptions } =
title: {
text: intl.formatMessage({ id: 'inbox.screenTitle' }),
},
rightButtons: initialized ? getRightButtons({ theme } as any) : [],
},
bottomTab: {
iconColor: theme.color.blue400,
Expand Down Expand Up @@ -297,7 +295,6 @@ export const InboxScreen: NavigationFunctionComponent<{

useConnectivityIndicator({
componentId,
rightButtons: getRightButtons(),
queryResult: res,
refetching: res.refetching,
})
Expand Down
11 changes: 8 additions & 3 deletions apps/native/app/src/screens/more/more.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import { useConnectivityIndicator } from '../../hooks/use-connectivity-indicator
import { navigateTo } from '../../lib/deep-linking'
import { formatNationalId } from '../../lib/format-national-id'
import { useAuthStore } from '../../stores/auth-store'
import { getRightButtons } from '../../utils/get-main-root'
import { testIDs } from '../../utils/test-ids'
import { getRightButtons } from '../../utils/get-main-root'

const Row = styled.View`
margin-top: ${({ theme }) => theme.spacing[2]}px;
Expand All @@ -39,7 +39,9 @@ const { useNavigationOptions, getNavigationOptions } =
title: {
text: intl.formatMessage({ id: 'profile.screenTitle' }),
},
rightButtons: initialized ? getRightButtons({ theme } as any) : [],
rightButtons: initialized
? getRightButtons({ screen: 'More', theme: theme as any })
: [],
},
bottomTab: {
iconColor: theme.color.blue400,
Expand Down Expand Up @@ -77,7 +79,10 @@ export const MoreScreen: NavigationFunctionComponent = ({ componentId }) => {
const showAirDiscount = useFeatureFlag('isAirDiscountEnabled', false)

useNavigationOptions(componentId)
useConnectivityIndicator({ componentId, rightButtons: getRightButtons() })
useConnectivityIndicator({
componentId,
rightButtons: getRightButtons({ screen: 'More' }),
})

return (
<>
Expand Down
82 changes: 13 additions & 69 deletions apps/native/app/src/screens/settings/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ export const SettingsScreen: NavigationFunctionComponent = ({
locale,
setLocale,
hasAcceptedBiometrics,
appearanceMode,
setAppearanceMode,
useBiometrics,
setUseBiometrics,
appLockTimeout,
Expand Down Expand Up @@ -388,73 +386,7 @@ export const SettingsScreen: NavigationFunctionComponent = ({
}
/>
</TableViewGroup>
<TableViewGroup
header={intl.formatMessage({
id: 'settings.accessibilityLayout.groupTitle',
})}
>
<TableViewCell
title={intl.formatMessage({
id: 'settings.accessibilityLayout.sytemDarkMode',
})}
accessory={
<Switch
onValueChange={(value) => {
setAppearanceMode(value ? 'automatic' : 'light')
}}
value={appearanceMode === 'automatic'}
thumbColor={Platform.select({ android: theme.color.dark100 })}
trackColor={{
false: theme.color.dark200,
true: theme.color.blue400,
}}
/>
}
/>
<Pressable
onPress={() => {
clearTimeout(efficient.ts)
efficient.count = (efficient.count ?? 0) + 1
if (efficient.count === 11) {
setAppearanceMode('efficient')
}
efficient.ts = setTimeout(() => {
efficient.count = 0
}, 500)
}}
>
<TableViewCell
title={intl.formatMessage({
id: 'settings.accessibilityLayout.darkMode',
})}
accessory={
<Switch
onValueChange={(value) =>
setAppearanceMode(value ? 'dark' : 'light')
}
value={appearanceMode === 'dark'}
thumbColor={Platform.select({ android: theme.color.dark100 })}
trackColor={{
false: theme.color.dark200,
true: theme.color.blue400,
}}
/>
}
/>
</Pressable>
<PressableHighlight onPress={onLanguagePress}>
<TableViewCell
title={intl.formatMessage({
id: 'settings.accessibilityLayout.language',
})}
accessory={
<TableViewAccessory>
{locale === 'is-IS' ? 'Íslenska' : 'English'}
</TableViewAccessory>
}
/>
</PressableHighlight>
</TableViewGroup>

<TableViewGroup
header={intl.formatMessage({
id: 'settings.security.groupTitle',
Expand Down Expand Up @@ -661,6 +593,18 @@ export const SettingsScreen: NavigationFunctionComponent = ({
<TableViewGroup
header={intl.formatMessage({ id: 'settings.about.groupTitle' })}
>
<PressableHighlight onPress={onLanguagePress}>
<TableViewCell
title={intl.formatMessage({
id: 'settings.accessibilityLayout.language',
})}
accessory={
<TableViewAccessory>
{locale === 'is-IS' ? 'Íslenska' : 'English'}
</TableViewAccessory>
}
/>
</PressableHighlight>
<TableViewCell
title={intl.formatMessage({ id: 'settings.about.versionLabel' })}
subtitle={`${DeviceInfo.getVersion()} build ${DeviceInfo.getBuildNumber()}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function MileageCell({
backgroundColor: dynamicColor({
light: editable ? '#FFFCE0' : dynamicColor.theme.color.blueberry100,
dark: editable
? '#FFFCE0'
? dynamicColor.theme.shades.dark.shade400
: dynamicColor.theme.shades.dark.shade100,
}),
gap: 4,
Expand Down
Loading

0 comments on commit 881b09e

Please sign in to comment.