Skip to content

Commit

Permalink
2513: Rename api-client to shared and open a new subfolder api (#2595)
Browse files Browse the repository at this point in the history
* 2513: Rename api-client to shared and create a subfolder api

* 2513: removed not related files

* 2513: removed not related files

* 2513: fix merge

* 2513: Fix merge

* 2513: Tidy up

* 2513: Exclude folders

---------

Co-authored-by: Steffen Kleinle <[email protected]>
  • Loading branch information
lunars97 and steffenkleinle authored Jan 25, 2024
1 parent da58dd1 commit 2350b8e
Show file tree
Hide file tree
Showing 389 changed files with 542 additions and 650 deletions.
4 changes: 2 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"jsxSingleQuote": true,
"endOfLine": "auto",
"importOrder": [
"^(?!(api-client|build-configs|translations|\\.)).*",
"^(api-client|build-configs|translations)",
"^(?!(shared|build-configs|translations|\\.)).*",
"^(shared|build-configs|translations)",
"^(\\.)+(\\/)+"
],
"importOrderSeparation": true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Both projects are whitelabelled with different [build configs](build-configs/REA
There are also separate sub-projects used by both projects:

- **[translations](translations/README.md)**: Translated texts and utilities to manage them
- **[api-client](api-client/README.md)**: Implementation of the endpoints (v3) of the integreat cms
- **[shared](shared/README.md)**: Contains common shared utilities, for example related to implementation of the endpoints (v3) of the integreat cms
- **[build-configs](build-configs/README.md)**: Configuration files to build different versions of the apps

## Getting Started
Expand Down
4 changes: 0 additions & 4 deletions api-client/.vscode/settings.json

This file was deleted.

2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Config } from '@jest/types'
const config: Partial<Config.GlobalConfig> = {
rootDir: '.',
verbose: true,
projects: ['web', 'native', 'api-client', 'translations'],
projects: ['web', 'native', 'shared', 'translations'],
reporters: [
['default', {}],
[
Expand Down
7 changes: 5 additions & 2 deletions native/.idea/integreat-app-native.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion native/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const transformNodeModules = [
'@react-navigation',
'react-navigation-header-buttons',
'react-native-blob-util',
'api-client',
'shared',
'translations',
'@sentry/react-native',
'build-configs',
Expand Down
2 changes: 1 addition & 1 deletion native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@sentry/react-native": "^5.9.1",
"@sentry/types": "^7.65.0",
"accordion-collapse-react-native": "^1.1.1",
"api-client": "0.0.1",
"shared": "0.0.1",
"build-configs": "0.0.1",
"htmlparser2": "^9.0.0",
"i18next": "^23.4.6",
Expand Down
3 changes: 2 additions & 1 deletion native/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { enableScreens } from 'react-native-screens'
import { HeaderButtonsProvider } from 'react-navigation-header-buttons'
import { ThemeProvider } from 'styled-components'

import { CLOSE_PAGE_SIGNAL_NAME, REDIRECT_ROUTE, setUserAgent } from 'api-client'
import { CLOSE_PAGE_SIGNAL_NAME, REDIRECT_ROUTE } from 'shared'
import { setUserAgent } from 'shared/api'
import { config } from 'translations'

import Navigator from './Navigator'
Expand Down
4 changes: 2 additions & 2 deletions native/src/Navigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import {
SEARCH_ROUTE,
SETTINGS_ROUTE,
SPRUNGBRETT_OFFER_ROUTE,
useLoadAsync,
} from 'api-client'
} from 'shared'
import { useLoadAsync } from 'shared/api'

import Header from './components/Header'
import RedirectContainer from './components/RedirectContainer'
Expand Down
6 changes: 3 additions & 3 deletions native/src/__tests__/Navigator.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NavigationContainer } from '@react-navigation/native'
import { mocked } from 'jest-mock'
import React from 'react'

import { CityModelBuilder, ReturnType, useLoadAsync } from 'api-client'
import { CityModelBuilder, ReturnType, useLoadAsync } from 'shared/api'

import Navigator from '../Navigator'
import { AppContext } from '../contexts/AppContextProvider'
Expand All @@ -17,8 +17,8 @@ jest.mock('styled-components')
jest.mock('../utils/DefaultDataContainer', () => ({ deleteCity: jest.fn(async () => undefined) }))
jest.mock('@react-native-community/netinfo')
jest.mock('../hooks/useLoadCities', () => jest.fn(() => ({ data: cities, error: null })))
jest.mock('api-client', () => ({
...jest.requireActual('api-client'),
jest.mock('shared/api', () => ({
...jest.requireActual('shared/api'),
useLoadAsync: jest.fn(() => ({ data: null, error: null })),
}))
jest.mock('../utils/sentry')
Expand Down
3 changes: 2 additions & 1 deletion native/src/components/AddressInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { useTranslation } from 'react-i18next'
import { Platform } from 'react-native'
import styled from 'styled-components/native'

import { getExternalMapsLink, LocationModel } from 'api-client'
import { getExternalMapsLink } from 'shared'
import { LocationModel } from 'shared/api'

import { ExternalLinkIcon } from '../assets'
import { contentDirection } from '../constants/contentDirection'
Expand Down
2 changes: 1 addition & 1 deletion native/src/components/AppStateListener.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ReactElement, useEffect } from 'react'
import { AppState } from 'react-native'

import { RESUME_SIGNAL_NAME, SUSPEND_SIGNAL_NAME } from 'api-client'
import { RESUME_SIGNAL_NAME, SUSPEND_SIGNAL_NAME } from 'shared'

import sendTrackingSignal from '../utils/sendTrackingSignal'

Expand Down
5 changes: 2 additions & 3 deletions native/src/components/Categories.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React, { ReactElement } from 'react'
import { View } from 'react-native'

import { CategoriesMapModel, CategoryModel, CityModel } from 'api-client'
import { CATEGORIES_ROUTE } from 'api-client/src/routes'
import { RouteInformationType } from 'api-client/src/routes/RouteInformationTypes'
import { CATEGORIES_ROUTE, RouteInformationType } from 'shared'
import { CategoriesMapModel, CategoryModel, CityModel } from 'shared/api'

import { URL_PREFIX } from '../constants/webview'
import TileModel from '../models/TileModel'
Expand Down
2 changes: 1 addition & 1 deletion native/src/components/CategoryListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { memo, ReactElement } from 'react'
import styled from 'styled-components/native'

import { CategoryModel } from 'api-client'
import { CategoryModel } from 'shared/api'

import { contentDirection, isContentDirectionReversalRequired } from '../constants/contentDirection'
import dimensions from '../constants/dimensions'
Expand Down
3 changes: 2 additions & 1 deletion native/src/components/CityEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { Text } from 'react-native'
import Highlighter from 'react-native-highlight-words'
import styled from 'styled-components/native'

import { CityModel, normalizeString } from 'api-client'
import { normalizeString } from 'shared'
import { CityModel } from 'shared/api'

import testID from '../testing/testID'
import Pressable from './base/Pressable'
Expand Down
3 changes: 2 additions & 1 deletion native/src/components/CitySelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { useTranslation } from 'react-i18next'
import { View } from 'react-native'
import styled from 'styled-components/native'

import { CityModel, filterSortCities } from 'api-client'
import { filterSortCities } from 'shared'
import { CityModel } from 'shared/api'

import buildConfig from '../constants/buildConfig'
import CityEntry from './CityEntry'
Expand Down
4 changes: 2 additions & 2 deletions native/src/components/DashboardNavigationTiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import { useTranslation } from 'react-i18next'
import styled from 'styled-components/native'

import {
CityModel,
EVENTS_ROUTE,
LOCAL_NEWS_TYPE,
NEWS_ROUTE,
OFFERS_ROUTE,
POIS_ROUTE,
RouteInformationType,
TU_NEWS_TYPE,
} from 'api-client'
} from 'shared'
import { CityModel } from 'shared/api'

import { CalendarIcon, NewsIcon, OffersIcon, POIsIcon } from '../assets'
import buildConfig from '../constants/buildConfig'
Expand Down
3 changes: 2 additions & 1 deletion native/src/components/DatesPageDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { useTranslation } from 'react-i18next'
import { View } from 'react-native'
import styled from 'styled-components'

import { DateModel, MAX_DATE_RECURRENCES, MAX_DATE_RECURRENCES_COLLAPSED } from 'api-client'
import { MAX_DATE_RECURRENCES, MAX_DATE_RECURRENCES_COLLAPSED } from 'shared'
import { DateModel } from 'shared/api'

import Collapsible from './Collapsible'
import PageDetail from './PageDetail'
Expand Down
3 changes: 2 additions & 1 deletion native/src/components/EmbeddedOffers.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { ReactElement } from 'react'

import { MALTE_HELP_FORM_OFFER_ROUTE, OfferModel, SPRUNGBRETT_OFFER_ALIAS } from 'api-client'
import { MALTE_HELP_FORM_OFFER_ROUTE, SPRUNGBRETT_OFFER_ALIAS } from 'shared'
import { OfferModel } from 'shared/api'

import MalteHelpFormOffer from './MalteHelpFormOffer'
import SprungbrettOffer from './SprungbrettOffer'
Expand Down
3 changes: 2 additions & 1 deletion native/src/components/EventListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { useTranslation } from 'react-i18next'
import { SvgProps } from 'react-native-svg'
import styled from 'styled-components/native'

import { DateModel, DateIcon, EventModel, parseHTML } from 'api-client'
import { parseHTML } from 'shared'
import { DateModel, DateIcon, EventModel } from 'shared/api'

import {
CalendarRecurringIcon,
Expand Down
2 changes: 1 addition & 1 deletion native/src/components/ExportEventButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { PERMISSIONS, requestMultiple } from 'react-native-permissions'
import { Frequency } from 'rrule'
import styled from 'styled-components/native'

import { EventModel } from 'api-client'
import { EventModel } from 'shared/api'

import useSnackbar from '../hooks/useSnackbar'
import { reportError } from '../utils/sentry'
Expand Down
2 changes: 1 addition & 1 deletion native/src/components/Failure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { ReactElement } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components/native'

import { ErrorCode } from 'api-client'
import { ErrorCode } from 'shared/api'

import { NoInternetIcon, SadSmileyIcon, WarningIcon } from '../assets'
import Icon from './base/Icon'
Expand Down
3 changes: 2 additions & 1 deletion native/src/components/FeedbackContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { ReactElement, useEffect, useState } from 'react'
import styled from 'styled-components/native'

import { createFeedbackEndpoint, FeedbackRouteType, SEND_FEEDBACK_SIGNAL_NAME } from 'api-client'
import { SEND_FEEDBACK_SIGNAL_NAME } from 'shared'
import { createFeedbackEndpoint, FeedbackRouteType } from 'shared/api'

import { determineApiUrl } from '../utils/helpers'
import sendTrackingSignal from '../utils/sendTrackingSignal'
Expand Down
5 changes: 2 additions & 3 deletions native/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
EventsRouteType,
getSlugFromPath,
LANDING_ROUTE,
LanguageModel,
NEWS_ROUTE,
POIS_ROUTE,
PoisRouteType,
Expand All @@ -20,8 +19,8 @@ import {
DISCLAIMER_ROUTE,
SEARCH_ROUTE,
SETTINGS_ROUTE,
FeedbackRouteType,
} from 'api-client'
} from 'shared'
import { LanguageModel, FeedbackRouteType } from 'shared/api'

import { NavigationProps, RouteProps, RoutesParamsType, RoutesType } from '../constants/NavigationTypes'
import buildConfig from '../constants/buildConfig'
Expand Down
2 changes: 1 addition & 1 deletion native/src/components/LanguageNotAvailablePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'
import { RefreshControl, Text } from 'react-native'
import styled from 'styled-components/native'

import { fromError, LanguageModel } from 'api-client'
import { fromError, LanguageModel } from 'shared/api'

import useCityAppContext from '../hooks/useCityAppContext'
import useLoadCities from '../hooks/useLoadCities'
Expand Down
4 changes: 2 additions & 2 deletions native/src/components/MalteHelpFormOffer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import {
ContactChannel,
ContactGender,
InvalidEmailError,
MALTE_HELP_FORM_MAX_COMMENT_LENGTH,
OfferModel,
submitMalteHelpForm,
} from 'api-client'
MALTE_HELP_FORM_MAX_COMMENT_LENGTH,
} from 'shared/api'

import { SecurityIcon, SupportIcon } from '../assets'
import useSnackbar from '../hooks/useSnackbar'
Expand Down
2 changes: 1 addition & 1 deletion native/src/components/MapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
clusterLayerId,
featureLayerId,
clusterClickZoomFactor,
} from 'api-client'
} from 'shared'

import { LocationFixedIcon, LocationNotFixedIcon, LocationOffIcon } from '../assets'
import { clusterCountLayer, clusterLayer, markerLayer } from '../constants/layers'
Expand Down
2 changes: 1 addition & 1 deletion native/src/components/MapsAttribution.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { ReactElement, useState } from 'react'
import styled from 'styled-components/native'

import { openStreeMapCopyright } from 'api-client'
import { openStreeMapCopyright } from 'shared'

import Link from './Link'
import Pressable from './base/Pressable'
Expand Down
3 changes: 2 additions & 1 deletion native/src/components/NearbyCities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import React, { ReactElement } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components/native'

import { CityModel, getNearbyCities } from 'api-client'
import { getNearbyCities } from 'shared'
import { CityModel } from 'shared/api'

import { RefreshIcon } from '../assets'
import useUserLocation from '../hooks/useUserLocation'
Expand Down
3 changes: 2 additions & 1 deletion native/src/components/News.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { useTranslation } from 'react-i18next'
import { ScrollView } from 'react-native'
import styled from 'styled-components/native'

import { ErrorCode, LocalNewsModel, NewsRouteType, NewsType, replaceLinks, TU_NEWS_TYPE, TunewsModel } from 'api-client'
import { NewsRouteType, NewsType, TU_NEWS_TYPE } from 'shared'
import { LocalNewsModel, TunewsModel, ErrorCode, replaceLinks } from 'shared/api'

import { NavigationProps } from '../constants/NavigationTypes'
import { contentAlignment } from '../constants/contentDirection'
Expand Down
3 changes: 2 additions & 1 deletion native/src/components/NewsHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import React, { memo, ReactElement } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components/native'

import { CityModel, LOCAL_NEWS_TYPE, NewsType, TU_NEWS_TYPE } from 'api-client'
import { LOCAL_NEWS_TYPE, NewsType, TU_NEWS_TYPE } from 'shared'
import { CityModel } from 'shared/api'

import { TuNewsActiveIcon, TuNewsInactiveIcon } from '../assets'
import Caption from './Caption'
Expand Down
2 changes: 1 addition & 1 deletion native/src/components/NewsListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { ReactElement } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components/native'

import { LocalNewsModel, TunewsModel } from 'api-client'
import { LocalNewsModel, TunewsModel } from 'shared/api'

import { ArrowBackIcon } from '../assets'
import { EXCERPT_MAX_LINES } from '../constants'
Expand Down
2 changes: 1 addition & 1 deletion native/src/components/OpeningEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { ReactElement } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components/native'

import { TimeSlot } from 'api-client/src/types'
import { TimeSlot } from 'shared/api/types'

import { contentDirection } from '../constants/contentDirection'

Expand Down
3 changes: 2 additions & 1 deletion native/src/components/OpeningHours.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { useTranslation } from 'react-i18next'
import { Text } from 'react-native'
import styled from 'styled-components/native'

import { OpeningHoursModel, weekdays } from 'api-client'
import { weekdays } from 'shared'
import { OpeningHoursModel } from 'shared/api'

import { contentDirection } from '../constants/contentDirection'
import Collapsible from './Collapsible'
Expand Down
2 changes: 1 addition & 1 deletion native/src/components/OrganizationContentInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Trans, useTranslation } from 'react-i18next'
import { View } from 'react-native'
import styled from 'styled-components/native'

import { OrganizationModel } from 'api-client'
import { OrganizationModel } from 'shared/api'

import HighlightBox from './HighlightBox'
import Link from './Link'
Expand Down
3 changes: 2 additions & 1 deletion native/src/components/PoiDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import React, { ReactElement } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components/native'

import { GeoJsonPoi, PoiModel } from 'api-client'
import { GeoJsonPoi } from 'shared'
import { PoiModel } from 'shared/api'

import { MailIcon, PhoneIcon, PoiThumbnailPlaceholderLarge, WebsiteIcon } from '../assets'
import AddressInfo from './AddressInfo'
Expand Down
2 changes: 1 addition & 1 deletion native/src/components/PoiFiltersModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next'
import { SvgUri } from 'react-native-svg'
import styled from 'styled-components/native'

import { PoiCategoryModel, PoiModel } from 'api-client'
import { PoiCategoryModel, PoiModel } from 'shared/api'

import { ClockIcon } from '../assets'
import Modal from './Modal'
Expand Down
Loading

0 comments on commit 2350b8e

Please sign in to comment.