Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/island-is/island.is into tw…
Browse files Browse the repository at this point in the history
…eaks_15.10_random
  • Loading branch information
albina committed Oct 15, 2024
2 parents f1e388e + c21a58f commit 1a076f7
Show file tree
Hide file tree
Showing 57 changed files with 796 additions and 246 deletions.
2 changes: 2 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Empty config file so defaults will be respected instead of users' own global config
# (prevent directory traversal)
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ import {
import { DocumentsScope } from '@island.is/auth/scopes'
import { DocumentClient } from '@island.is/clients/documents'
import { AuditService } from '@island.is/nest/audit'
import { Controller, Header, Param, Post, Res, UseGuards } from '@nestjs/common'
import {
Controller,
Header,
Param,
Post,
Res,
UseGuards,
Query,
} from '@nestjs/common'
import { ApiOkResponse, ApiTags } from '@nestjs/swagger'
import { Response } from 'express'

Expand All @@ -32,6 +40,7 @@ export class DocumentController {
@Param('pdfId') pdfId: string,
@CurrentUser() user: User,
@Res() res: Response,
@Query('action') action: string,
) {
const rawDocumentDTO = await this.documentClient.customersDocument({
kennitala: user.nationalId,
Expand All @@ -54,7 +63,9 @@ export class DocumentController {
res.header('Content-length', buffer.length.toString())
res.header(
'Content-Disposition',
`inline; filename=${rawDocumentDTO.fileName}.pdf`,
`${action === 'download' ? 'attachment' : 'inline'}; filename=${
rawDocumentDTO.fileName
}.pdf`,
)
res.header('Pragma: no-cache')
res.header('Cache-Control: no-cache')
Expand Down
6 changes: 6 additions & 0 deletions apps/native/app/src/hooks/use-locale.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { usePreferencesStore } from '../stores/preferences-store'

export const useLocale = () => {
const locale = usePreferencesStore(({ locale }) => locale)
return locale === 'is-IS' ? 'is' : 'en'
}
7 changes: 5 additions & 2 deletions apps/native/app/src/messages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export const en: TranslatedMessages = {
'home.onboardingModule.card2':
'The app’s purpose is to provide faster access to your documents, applications, and other dealings with governmental institutions.',
'home.onboardingModule.card3':
'If you have comments or suggestions about something that is missing or that could be improved, feel free to contact us via email at',
'If you have comments or suggestions about something that is missing or that could be improved, feel free to contact us via email at [email protected]',
'home.onboardingModule.card4':
'We encourage our users to read Digital Iceland’s privacy policy on',
'home.vehicleModule.summary':
Expand Down Expand Up @@ -594,6 +594,9 @@ export const en: TranslatedMessages = {
'You are opening Island.is in a browser. Do you want to create a passkey to sign in automatically with the app?',
'passkeys.headingSubtitle':
'Do you want to create a passkey to sign in automatically with the app?',
'passkeys.settings':
'In settings it is always possible to delete or add a passkey',
'passkeys.furtherInformation': 'More about passkeys',
'passkeys.createButton': 'Create a passkey',
'passkeys.skipButton': 'Skip',
'passkeys.errorRegistering': 'Error',
Expand All @@ -619,7 +622,7 @@ export const en: TranslatedMessages = {
'health.overview.insuredFrom': 'Insured from',
'health.overview.status': 'Status',
'health.overview.notInsured': 'You do not have health insurance',
'health.overview.payments': 'Payments',
'health.overview.coPayments': 'Co-payment',
'health.overview.maxMonthlyPayment': 'Max monthly payment',
'health.overview.paymentLimit': 'Payment Limit',
'health.overview.paymentCredit': 'Credit',
Expand Down
7 changes: 5 additions & 2 deletions apps/native/app/src/messages/is.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export const is = {
'home.onboardingModule.card2':
'Markmiðið með appinu er að þú hafir í hendi þér það sem þú þarfnast hverju sinni í samskiptum við hið opinbera.',
'home.onboardingModule.card3':
'Hafir þú athugasemdir eða ábendingar um eitthvað sem vantar eða sem má betur fara viljum við gjarnan fá frá þér línu á',
'Hafir þú athugasemdir eða ábendingar um eitthvað sem vantar eða sem má betur fara viljum við gjarnan fá frá þér línu á [email protected]',
'home.onboardingModule.card4':
'Notendum er bent á að kynna sér stefnu Stafræns Íslands um meðferð persónuupplýsinga á',
'home.vehicleModule.summary':
Expand Down Expand Up @@ -594,6 +594,9 @@ export const is = {
'Þú ert að fara að opna Ísland.is í vafra. Viltu búa til aðgangslykil til að skrá þig inn sjálfkrafa með appinu?',
'passkeys.headingSubtitle':
'Viltu búa til aðgangslykil til að skrá þig inn sjálfkrafa með appinu?',
'passkeys.settings':
'Undir stillingum er alltaf hægt að eyða eða búa til aðgangslykil',
'passkeys.furtherInformation': 'Nánar um aðgangslykla',
'passkeys.createButton': 'Búa til aðgangslykil',
'passkeys.skipButton': 'Sleppa',
'passkeys.errorRegistering': 'Villa',
Expand All @@ -619,7 +622,7 @@ export const is = {
'health.overview.insuredFrom': 'Sjúkratrygging frá',
'health.overview.status': 'Staða',
'health.overview.notInsured': 'Þú ert ekki með sjúkratryggingu',
'health.overview.payments': 'Greiðslur',
'health.overview.coPayments': 'Greiðsluþáttaka',
'health.overview.maxMonthlyPayment': 'Hámarksgreiðslan þín á mánuði',
'health.overview.paymentLimit': 'Greiðslumark',
'health.overview.paymentCredit': 'Inneign',
Expand Down
6 changes: 4 additions & 2 deletions apps/native/app/src/screens/air-discount/air-discount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Typography,
} from '@ui'
import React from 'react'
import { SafeAreaView, ScrollView, View } from 'react-native'
import { Image, SafeAreaView, ScrollView, View } from 'react-native'
import { NavigationFunctionComponent } from 'react-native-navigation'
import { FormattedMessage, useIntl } from 'react-intl'
import styled, { useTheme } from 'styled-components/native'
Expand All @@ -22,6 +22,7 @@ import { AirDiscountCard } from '@ui/lib/card/air-discount-card'
import { Bullet } from '@ui/lib/bullet/bullet'
import { useConnectivityIndicator } from '../../hooks/use-connectivity-indicator'
import { AirfaresUsageTable } from './airfares-usage-table'
import externalLinkIcon from '../../assets/icons/external-link.png'

const BulletList = styled.View`
margin-vertical: 12px;
Expand Down Expand Up @@ -152,7 +153,8 @@ export const AirDiscountScreen: NavigationFunctionComponent = ({
<FormattedMessage
id="airDiscount.tosLinkText"
defaultMessage="Notendaskilmálar"
/>
/>{' '}
<Image source={externalLinkIcon} />
</LinkText>
</Link>
</TOSLink>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
} from '../../graphql/types/schema'
import { createNavigationOptionHooks } from '../../hooks/create-navigation-option-hooks'
import { useConnectivityIndicator } from '../../hooks/use-connectivity-indicator'
import { useLocale } from '../../hooks/use-locale'
import { ApplicationsList } from './components/applications-list'
import { usePreferencesStore } from '../../stores/preferences-store'

const { useNavigationOptions, getNavigationOptions } =
createNavigationOptionHooks(
Expand All @@ -33,7 +33,6 @@ export const ApplicationsCompletedScreen: NavigationFunctionComponent = ({
}) => {
useNavigationOptions(componentId)
const [refetching, setRefetching] = useState(false)
const { locale } = usePreferencesStore()

const applicationsRes = useListApplicationsQuery({
variables: {
Expand All @@ -44,7 +43,7 @@ export const ApplicationsCompletedScreen: NavigationFunctionComponent = ({
ApplicationResponseDtoStatusEnum.Approved,
],
},
locale: locale === 'is-IS' ? 'is' : 'en',
locale: useLocale(),
},
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
} from '../../graphql/types/schema'
import { createNavigationOptionHooks } from '../../hooks/create-navigation-option-hooks'
import { useConnectivityIndicator } from '../../hooks/use-connectivity-indicator'
import { useLocale } from '../../hooks/use-locale'
import { ApplicationsList } from './components/applications-list'
import { usePreferencesStore } from '../../stores/preferences-store'

const { useNavigationOptions, getNavigationOptions } =
createNavigationOptionHooks(
Expand All @@ -33,14 +33,13 @@ export const ApplicationsInProgressScreen: NavigationFunctionComponent = ({
}) => {
useNavigationOptions(componentId)
const [refetching, setRefetching] = useState(false)
const { locale } = usePreferencesStore()

const applicationsRes = useListApplicationsQuery({
variables: {
input: {
status: [ApplicationResponseDtoStatusEnum.Inprogress],
},
locale: locale === 'is-IS' ? 'is' : 'en',
locale: useLocale(),
},
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
} from '../../graphql/types/schema'
import { createNavigationOptionHooks } from '../../hooks/create-navigation-option-hooks'
import { useConnectivityIndicator } from '../../hooks/use-connectivity-indicator'
import { useLocale } from '../../hooks/use-locale'
import { ApplicationsList } from './components/applications-list'
import { usePreferencesStore } from '../../stores/preferences-store'

const { useNavigationOptions, getNavigationOptions } =
createNavigationOptionHooks(
Expand All @@ -33,14 +33,13 @@ export const ApplicationsIncompleteScreen: NavigationFunctionComponent = ({
}) => {
useNavigationOptions(componentId)
const [refetching, setRefetching] = useState(false)
const { locale } = usePreferencesStore()

const applicationsRes = useListApplicationsQuery({
variables: {
input: {
status: [ApplicationResponseDtoStatusEnum.Draft],
},
locale: locale === 'is-IS' ? 'is' : 'en',
locale: useLocale(),
},
})

Expand Down
7 changes: 2 additions & 5 deletions apps/native/app/src/screens/applications/applications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import {
} from '../../graphql/types/schema'
import { createNavigationOptionHooks } from '../../hooks/create-navigation-option-hooks'
import { useConnectivityIndicator } from '../../hooks/use-connectivity-indicator'
import { useLocale } from '../../hooks/use-locale'
import { testIDs } from '../../utils/test-ids'
import { isIos } from '../../utils/devices'
import { ApplicationsPreview } from './components/applications-preview'
import { BottomTabsIndicator } from '../../components/bottom-tabs-indicator/bottom-tabs-indicator'
import { usePreferencesStore } from '../../stores/preferences-store'

const { useNavigationOptions, getNavigationOptions } =
createNavigationOptionHooks(
Expand Down Expand Up @@ -102,12 +102,9 @@ export const ApplicationsScreen: NavigationFunctionComponent = ({
const theme = useTheme()
const [refetching, setRefetching] = useState(false)
const [hiddenContent, setHiddenContent] = useState(isIos)
const { locale } = usePreferencesStore()

const queryLocale = locale === 'is-IS' ? 'is' : 'en'

const applicationsRes = useListApplicationsQuery({
variables: { locale: queryLocale },
variables: { locale: useLocale() },
})

const applications = useMemo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ import {
} from '../../graphql/types/schema'
import { createNavigationOptionHooks } from '../../hooks/create-navigation-option-hooks'
import { useConnectivityIndicator } from '../../hooks/use-connectivity-indicator'
import { useLocale } from '../../hooks/use-locale'
import { toggleAction } from '../../lib/post-mail-action'
import { authStore } from '../../stores/auth-store'
import { useOrganizationsStore } from '../../stores/organizations-store'
import { usePreferencesStore } from '../../stores/preferences-store'
import { ButtonRegistry } from '../../utils/component-registry'
import { getButtonsForActions } from './utils/get-buttons-for-actions'
import { useBrowser } from '../../lib/use-browser'
Expand Down Expand Up @@ -230,7 +230,6 @@ export const DocumentDetailScreen: NavigationFunctionComponent<{
const client = useApolloClient()
const intl = useIntl()
const htmlStyles = useHtmlStyles()
const { locale } = usePreferencesStore()
const { openBrowser } = useBrowser()
const { getOrganizationLogoUrl } = useOrganizationsStore()
const [accessToken, setAccessToken] = useState<string>()
Expand Down Expand Up @@ -293,7 +292,7 @@ export const DocumentDetailScreen: NavigationFunctionComponent<{
// If the document is urgent we need to check if the user needs to confirm reception of it before fetching the document data
includeDocument: shouldIncludeDocument,
},
locale: locale === 'is-IS' ? 'is' : 'en',
locale: useLocale(),
},
fetchPolicy: 'no-cache',
onCompleted: async (data) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/native/app/src/screens/health/health-overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export const HealthOverviewScreen: NavigationFunctionComponent = ({
)}
<HeadingSection
title={intl.formatMessage({
id: 'health.overview.payments',
id: 'health.overview.coPayments',
})}
onPress={() =>
openBrowser(
Expand Down
1 change: 0 additions & 1 deletion apps/native/app/src/screens/home/inbox-module.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ const InboxModule = React.memo(({ data, loading, error }: InboxModuleProps) => {
publicationDate={item.publicationDate}
id={`${item.id}-${index}`}
unread={!item.opened}
bookmarked={item.bookmarked}
senderName={item.sender.name}
icon={
item.sender.name && getOrganizationLogoUrl(item.sender.name, 75)
Expand Down
1 change: 0 additions & 1 deletion apps/native/app/src/screens/home/onboarding-module.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export const OnboardingModule = React.memo(() => {
dark: '#150920',
light: theme.color.purple100,
}}
link={{ url: 'mailto:[email protected]', title: '[email protected]' }}
/>
<WelcomeCard
key="card-4"
Expand Down
1 change: 0 additions & 1 deletion apps/native/app/src/screens/inbox/inbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ const PressableListItem = React.memo(
publicationDate={item.publicationDate}
id={item.id}
unread={!item.opened}
bookmarked={item.bookmarked}
senderName={item.sender.name}
icon={item.sender.name && getOrganizationLogoUrl(item.sender.name, 75)}
isUrgent={item.isUrgent}
Expand Down
Loading

0 comments on commit 1a076f7

Please sign in to comment.