From a138662a3b31280e884ef3e250ee07dabc51dd9f Mon Sep 17 00:00:00 2001 From: AlixH Date: Wed, 8 Dec 2021 11:48:27 +0100 Subject: [PATCH 1/3] Fixed tenants logos --- src/provider/CentralServerProvider.tsx | 14 +++++--------- src/screens/auth/login/Login.tsx | 11 ++++++----- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/provider/CentralServerProvider.tsx b/src/provider/CentralServerProvider.tsx index ea84b3f69..b319fef3f 100644 --- a/src/provider/CentralServerProvider.tsx +++ b/src/provider/CentralServerProvider.tsx @@ -152,7 +152,7 @@ export default class CentralServerProvider { let tenantLogo = this.tenantLogosCache.get(tenant.subdomain); if (!tenantLogo) { // Call backend - const result = await this.axiosInstance.get(this.buildUtilRestEndpointUrl(ServerRoute.REST_TENANT_LOGO), { + const result = await this.axiosInstance.get(this.buildUtilRestEndpointUrl(ServerRoute.REST_TENANT_LOGO, null, tenant), { headers: this.buildHeaders(), responseType: 'arraybuffer', params: { @@ -1070,12 +1070,8 @@ export default class CentralServerProvider { return this.tenant?.endpoint + '/v1/api'; } - private buildUtilRestServerURL(): string { - return this.tenant?.endpoint + '/v1/util'; - } - - private buildCentralRestServerServiceUtilURL(tenant: TenantConnection): string { - return tenant?.endpoint + '/client/util'; + private buildUtilRestServerURL(tenant?: TenantConnection): string { + return (tenant?.endpoint ?? this.tenant?.endpoint) + '/v1/util'; } private buildCentralRestServerServiceSecuredURL(): string { @@ -1092,7 +1088,7 @@ export default class CentralServerProvider { return `${urlPrefix}/${resolvedUrlPattern}`; } - public buildUtilRestEndpointUrl(urlPatternAsString: ServerRoute, params: { [name: string]: string | number | null } = {}): string { - return this.buildRestEndpointUrl(urlPatternAsString, params, this.buildUtilRestServerURL()); + public buildUtilRestEndpointUrl(urlPatternAsString: ServerRoute, params: { [name: string]: string | number | null } = {}, tenant?: TenantConnection): string { + return this.buildRestEndpointUrl(urlPatternAsString, params, this.buildUtilRestServerURL(tenant)); } } diff --git a/src/screens/auth/login/Login.tsx b/src/screens/auth/login/Login.tsx index f528d5082..1cbd64316 100644 --- a/src/screens/auth/login/Login.tsx +++ b/src/screens/auth/login/Login.tsx @@ -172,6 +172,7 @@ export default class Login extends BaseScreen { this.tenants = await this.centralServerProvider.getTenants(); this.setState({ tenantSubDomain: null, + tenantLogo: null, tenantName: I18n.t('authentication.tenant'), email: null, password: null @@ -286,8 +287,8 @@ export default class Login extends BaseScreen { this.setState({ email: credentials.email, password: credentials.password, - tenantSubDomain: tenant.subdomain, - tenantName: tenant.name, + tenantSubDomain: tenant?.subdomain, + tenantName: tenant?.name, tenantLogo }); } else { @@ -295,8 +296,8 @@ export default class Login extends BaseScreen { this.setState({ email: null, password: null, - tenantSubDomain: tenant.subdomain, - tenantName: tenant.name, + tenantSubDomain: tenant?.subdomain, + tenantName: tenant?.name, tenantLogo }); } @@ -368,7 +369,7 @@ export default class Login extends BaseScreen {
{this.state.errorTenantSubDomain && From 66086c2bc414514409ec312a05f955ce1c70cccb Mon Sep 17 00:00:00 2001 From: AlixH Date: Wed, 8 Dec 2021 14:42:10 +0100 Subject: [PATCH 2/3] Minor fixes --- ios/Podfile.lock | 20 +++++----- .../site-area/SiteAreaComponent.tsx | 1 - src/screens/auth/eula/Eula.tsx | 8 +--- src/screens/base-screen/BaseScreen.tsx | 2 +- .../list/ChargingStations.tsx | 3 +- .../list/ChargingStationsStyles.tsx | 1 - src/screens/sidebar/SideBar.tsx | 7 ++-- src/screens/site-areas/SiteAreas.tsx | 6 ++- src/screens/site-areas/SiteAreasStyles.tsx | 3 ++ src/screens/sites/Sites.tsx | 13 +++++- src/screens/sites/SitesStyles.tsx | 5 ++- src/utils/Utils.tsx | 40 ++++--------------- 12 files changed, 47 insertions(+), 62 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index d5d32aaf0..8b3fd02b1 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -358,7 +358,7 @@ PODS: - React-jsinspector (0.64.2) - react-native-appearance (0.3.4): - React - - react-native-blob-util (0.13.17): + - react-native-blob-util (0.13.16): - React-Core - react-native-camera (3.44.3): - React-Core @@ -368,13 +368,13 @@ PODS: - React-Core - react-native-camera/RN (3.44.3): - React-Core - - react-native-google-maps (0.29.4): + - react-native-google-maps (0.29.3): - Google-Maps-iOS-Utils (= 2.1.0) - GoogleMaps (= 3.5.0) - React-Core - react-native-location (2.5.0): - React - - react-native-maps (0.29.4): + - react-native-maps (0.29.3): - React-Core - react-native-orientation-locker (1.3.1): - React-Core @@ -384,7 +384,7 @@ PODS: - React - react-native-splash-screen (3.2.0): - React - - react-native-webview (11.14.3): + - react-native-webview (11.14.2): - React-Core - React-perflogger (0.64.2) - React-RCTActionSheet (0.64.2): @@ -768,7 +768,7 @@ SPEC CHECKSUMS: DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de Fabric: ea977e3cd9c20425516d3dafd3bf8c941c51223f FBLazyVector: e686045572151edef46010a6f819ade377dfeb4b - FBReactNativeSpec: 6ad80628fb64b13af43b7a67ee3e2489cfd29615 + FBReactNativeSpec: 52a80ca1a343877d4c72738fffcf539ac4a64dec Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5 FirebaseAnalytics: 5dd088bd2e67bb9d13dbf792d1164ceaf3052193 FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd @@ -807,16 +807,16 @@ SPEC CHECKSUMS: React-jsiexecutor: 80c46bd381fd06e418e0d4f53672dc1d1945c4c3 React-jsinspector: cc614ec18a9ca96fd275100c16d74d62ee11f0ae react-native-appearance: 0f0e5fc2fcef70e03d48c8fe6b00b9158c2ba8aa - react-native-blob-util: d2919a2243cba497cd5713f72faeec283c69fde4 + react-native-blob-util: 6e75bea8ffce35c4009c0e519cd0a96432a93e2b react-native-camera: b8cc03e2feec0c04403d0998e37cf519d8fd4c6f - react-native-google-maps: 34517207071d54f3bc23c68752bbec0217bfc79e + react-native-google-maps: d6a30377b40a338bd09d6ad36ce48dc5d12b5792 react-native-location: 5a40ec1cc6abf2f6d94df979f98ec76c3a415681 - react-native-maps: a421fe6aeb74279597c4ea9598f25796108e2d89 + react-native-maps: 41d01d8e0afcebe32bec9eea3bd945adc1b18f7a react-native-orientation-locker: 998c0744e26624407dac068c04c605b4af7304a2 react-native-safe-area-context: 584dc04881deb49474363f3be89e4ca0e854c057 react-native-sensitive-info: 400c6e3d27945e15c8cddb5b4b92233c85ee06f8 react-native-splash-screen: 200d11d188e2e78cea3ad319964f6142b6384865 - react-native-webview: b83cf1aa6b4453fe53ffcc5896c36cdf37f0383f + react-native-webview: cc4ac8f021a832dce2979e1f48c5595341dd2fb5 React-perflogger: 25373e382fed75ce768a443822f07098a15ab737 React-RCTActionSheet: af7796ba49ffe4ca92e7277a5d992d37203f7da5 React-RCTAnimation: 6a2e76ab50c6f25b428d81b76a5a45351c4d77aa @@ -852,4 +852,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: b8dc8cd1a42309e725520e15610740f459384595 -COCOAPODS: 1.10.1 +COCOAPODS: 1.11.2 diff --git a/src/components/site-area/SiteAreaComponent.tsx b/src/components/site-area/SiteAreaComponent.tsx index f906086fa..48e063224 100644 --- a/src/components/site-area/SiteAreaComponent.tsx +++ b/src/components/site-area/SiteAreaComponent.tsx @@ -20,7 +20,6 @@ interface State {} export default class SiteAreaComponent extends React.Component { public state: State; public props: Props; - private counter = 0; // eslint-disable-next-line no-useless-constructor public constructor(props: Props) { diff --git a/src/screens/auth/eula/Eula.tsx b/src/screens/auth/eula/Eula.tsx index f32862dc6..9271db136 100644 --- a/src/screens/auth/eula/Eula.tsx +++ b/src/screens/auth/eula/Eula.tsx @@ -69,18 +69,12 @@ export default class Eula extends BaseScreen { { - this.props.navigation.navigate('Login'); - return true; - }} - leftActionIcon={'navigate-before'} - hideHomeAction /> {loading ? ( ) : ( - + )} diff --git a/src/screens/base-screen/BaseScreen.tsx b/src/screens/base-screen/BaseScreen.tsx index e077353ce..bff9298b4 100644 --- a/src/screens/base-screen/BaseScreen.tsx +++ b/src/screens/base-screen/BaseScreen.tsx @@ -6,7 +6,7 @@ import CentralServerProvider from '../../provider/CentralServerProvider'; import ProviderFactory from '../../provider/ProviderFactory'; import SecurityProvider from '../../provider/SecurityProvider'; import BaseProps from '../../types/BaseProps'; -import { AppStateStatus, BackHandler, NativeEventSubscription } from 'react-native'; +import { BackHandler, NativeEventSubscription } from 'react-native'; export interface Props extends BaseProps {} diff --git a/src/screens/charging-stations/list/ChargingStations.tsx b/src/screens/charging-stations/list/ChargingStations.tsx index ffdabbf66..52f82e3ad 100644 --- a/src/screens/charging-stations/list/ChargingStations.tsx +++ b/src/screens/charging-stations/list/ChargingStations.tsx @@ -87,7 +87,8 @@ export default class ChargingStations extends BaseAutoRefreshScreen { }, chargingStationMarker: { fontSize: '30@s', - backgroundColor: commonColor.listBg }, qrcodeButton: { backgroundColor: commonColor.primary, diff --git a/src/screens/sidebar/SideBar.tsx b/src/screens/sidebar/SideBar.tsx index 9071fa606..3bffb3203 100644 --- a/src/screens/sidebar/SideBar.tsx +++ b/src/screens/sidebar/SideBar.tsx @@ -39,8 +39,8 @@ export default class SideBar extends React.Component { public constructor(props: Props) { super(props); - this.componentFocusUnsubscribe = this.props.navigation?.addListener('focus', () => this.componentDidFocus()); - this.componentBlurUnsubscribe = this.props.navigation?.addListener('blur', () => this.componentDidFocus()); + // this.componentFocusUnsubscribe = this.props.navigation?.addListener('focus', () => this.componentDidFocus()); + // this.componentBlurUnsubscribe = this.props.navigation?.addListener('blur', () => this.componentDidFocus()); this.state = { userToken: null, tenantName: '', @@ -58,7 +58,7 @@ export default class SideBar extends React.Component { super.setState(state, callback); }; - public async componentDidFocus(): Promise { + public async componentDidMount() { this.centralServerProvider = await ProviderFactory.getProvider(); this.securityProvider = this.centralServerProvider?.getSecurityProvider(); await this.getUpdateDate(); @@ -85,7 +85,6 @@ export default class SideBar extends React.Component { public getUserInfo = async () => { // Logoff const userInfo = this.centralServerProvider.getUserInfo(); - // Add sites( this.setState({ userToken: this.centralServerProvider.getUserInfo(), isComponentOrganizationActive: this.securityProvider ? this.securityProvider.isComponentOrganizationActive() : false, diff --git a/src/screens/site-areas/SiteAreas.tsx b/src/screens/site-areas/SiteAreas.tsx index fcb997a32..a160eadcf 100644 --- a/src/screens/site-areas/SiteAreas.tsx +++ b/src/screens/site-areas/SiteAreas.tsx @@ -78,6 +78,7 @@ export default class SiteAreas extends BaseAutoRefreshScreen { public async componentDidMount(triggerRefresh: boolean = true): Promise { super.componentDidMount(triggerRefresh); + this.site = Utils.getParamFromNavigation(this.props.route, 'site', null) as unknown as Site; } public componentDidFocus() { @@ -332,12 +333,13 @@ export default class SiteAreas extends BaseAutoRefreshScreen { renderMarker={(siteArea, index) => ( this.showMapSiteAreaDetail(siteArea)} - /> + > + + )} initialRegion={this.currentRegion} onMapRegionChangeComplete={(region) => this.onMapRegionChangeComplete(region)} diff --git a/src/screens/site-areas/SiteAreasStyles.tsx b/src/screens/site-areas/SiteAreasStyles.tsx index 61dc67825..b30bebcda 100644 --- a/src/screens/site-areas/SiteAreasStyles.tsx +++ b/src/screens/site-areas/SiteAreasStyles.tsx @@ -49,6 +49,9 @@ export default function computeStyleSheet(): StyleSheet.NamedStyles { outlinedImage: { borderColor: commonColor.listItemBackground, borderWidth: 2 + }, + siteAreaMarker: { + fontSize: '40@s' } }); const portraitStyles = {}; diff --git a/src/screens/sites/Sites.tsx b/src/screens/sites/Sites.tsx index 527b09c7f..86a903f91 100644 --- a/src/screens/sites/Sites.tsx +++ b/src/screens/sites/Sites.tsx @@ -27,6 +27,12 @@ import standardLightLayout from '../../../assets/map/standard-light.png'; import satelliteLayout from '../../../assets/map/satellite.png'; import computeFabStyles from '../../components/fab/FabComponentStyles'; import ThemeManager from '../../custom-theme/ThemeManager'; +import ConnectorStats from '../../types/ConnectorStats'; +import statusMarkerAvailable from '../../../assets/icon/charging_station_available.png'; +import statusMarkerChargingOrOccupied from '../../../assets/icon/charging_station_charging.png'; +import statusMarkerUnavailable from '../../../assets/icon/charging_station_unavailable.png'; +import computeConnectorStatusStyles + from '../../components/connector-status/ConnectorStatusComponentStyles'; export interface Props extends BaseProps {} @@ -335,12 +341,13 @@ export default class Sites extends BaseAutoRefreshScreen { renderMarker={(site, index) => ( this.showMapSiteDetail(site)} - /> + > + + )} initialRegion={this.currentRegion} onMapRegionChangeComplete={(region) => this.onMapRegionChangeComplete(region)} @@ -348,4 +355,6 @@ export default class Sites extends BaseAutoRefreshScreen { ) } + + } diff --git a/src/screens/sites/SitesStyles.tsx b/src/screens/sites/SitesStyles.tsx index cf1620baa..3845b50bd 100644 --- a/src/screens/sites/SitesStyles.tsx +++ b/src/screens/sites/SitesStyles.tsx @@ -44,7 +44,10 @@ export default function computeStyleSheet(): StyleSheet.NamedStyles { outlinedImage: { borderColor: commonColor.listItemBackground, borderWidth: 2 - } + }, + siteMarker: { + fontSize: '40@s', + }, }); const portraitStyles = {}; const landscapeStyles = {}; diff --git a/src/utils/Utils.tsx b/src/utils/Utils.tsx index 33ebf2261..e940b3d01 100644 --- a/src/utils/Utils.tsx +++ b/src/utils/Utils.tsx @@ -32,6 +32,8 @@ import Constants from './Constants'; import Message from './Message'; import { Region } from 'react-native-maps'; import LocationManager from '../location/LocationManager'; +import computeConnectorStatusStyles + from '../components/connector-status/ConnectorStatusComponentStyles'; export default class Utils { public static getEndpointCloud(): EndpointCloud[] { @@ -947,42 +949,16 @@ export default class Utils { return `${Utils.formatTimer(hours)}:${Utils.formatTimer(minutes)}`; }; - public static buildChargingStationStatusMarker(connectors: Connector[], inactive: boolean): any { - if (inactive) { - //TODO handle reserved status when implemented - return statusMarkerUnavailable; - } else if (connectors.find((connector) => connector.status === ChargePointStatus.AVAILABLE)) { - return statusMarkerAvailable; - } else if ( - connectors.find((connector) => connector.status === ChargePointStatus.FINISHING) || - connectors.find((connector) => connector.status === ChargePointStatus.PREPARING) - ) { - return statusMarkerPreparingOrFinishing; - } else if ( - connectors.find((connector) => connector.status === ChargePointStatus.CHARGING) || - connectors.find((connector) => connector.status === ChargePointStatus.OCCUPIED) - ) { - return statusMarkerChargingOrOccupied; - } else if ( - connectors.find((connector) => connector.status === ChargePointStatus.SUSPENDED_EVSE) || - connectors.find((connector) => connector.status === ChargePointStatus.SUSPENDED_EV) - ) { - return statusMarkerSuspended; - } else if (connectors.find((connector) => connector.status === ChargePointStatus.FAULTED)) { - return statusMarkerFaulted; - } - return statusMarkerUnavailable; - } - - public static buildSiteStatusMarker(connectorStats: ConnectorStats): any { + public static computeSiteMarkerStyle(connectorStats: ConnectorStats) { + const connectorStatusStyles = computeConnectorStatusStyles(); if (connectorStats.availableConnectors > 0) { - return statusMarkerAvailable; + return connectorStatusStyles.availableConnectorDescription; } else if (connectorStats.chargingConnectors > 0) { - return statusMarkerChargingOrOccupied; + return connectorStatusStyles.chargingConnectorDescription; } else if (connectorStats.unavailableConnectors > 0) { - return statusMarkerUnavailable; + return connectorStatusStyles.unavailableConnectorDescription; } else { - return statusMarkerUnavailable; + return connectorStatusStyles.unavailableConnectorDescription; } } From 2319022ef828b7b504518e7ae36cebc74887137d Mon Sep 17 00:00:00 2001 From: LucasBrazi06 Date: Wed, 8 Dec 2021 19:05:18 +0100 Subject: [PATCH 3/3] Bumped version --- android/app/build.gradle | 4 ++-- ios/Podfile.lock | 2 +- ios/eMobility.xcodeproj/project.pbxproj | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 63d057344..8eccbb542 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -144,8 +144,8 @@ android { applicationId "com.emobility" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 195 - versionName "2.0.16" + versionCode 196 + versionName "2.0.17" missingDimensionStrategy 'react-native-camera', 'general' } splits { diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 8b3fd02b1..133c742a7 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -768,7 +768,7 @@ SPEC CHECKSUMS: DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de Fabric: ea977e3cd9c20425516d3dafd3bf8c941c51223f FBLazyVector: e686045572151edef46010a6f819ade377dfeb4b - FBReactNativeSpec: 52a80ca1a343877d4c72738fffcf539ac4a64dec + FBReactNativeSpec: e30d74099a6ef3e67364c1ecb8ab68197a5eb022 Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5 FirebaseAnalytics: 5dd088bd2e67bb9d13dbf792d1164ceaf3052193 FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd diff --git a/ios/eMobility.xcodeproj/project.pbxproj b/ios/eMobility.xcodeproj/project.pbxproj index cbde5e6ce..464add6e2 100644 --- a/ios/eMobility.xcodeproj/project.pbxproj +++ b/ios/eMobility.xcodeproj/project.pbxproj @@ -576,7 +576,7 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-eMobility-eMobilityTests/Pods-eMobility-eMobilityTests-frameworks.sh", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL/OpenSSL.framework/OpenSSL", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL-Universal/OpenSSL.framework/OpenSSL", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( @@ -594,7 +594,7 @@ ); inputPaths = ( "${PODS_ROOT}/Target Support Files/Pods-eMobility/Pods-eMobility-frameworks.sh", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL/OpenSSL.framework/OpenSSL", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL-Universal/OpenSSL.framework/OpenSSL", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( @@ -1027,7 +1027,7 @@ "\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-splash-screen\"", "\"${PODS_CONFIGURATION_BUILD_DIR}/yoga\"", ); - MARKETING_VERSION = 2.0.16; + MARKETING_VERSION = 2.0.17; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -1100,7 +1100,7 @@ "\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-splash-screen\"", "\"${PODS_CONFIGURATION_BUILD_DIR}/yoga\"", ); - MARKETING_VERSION = 2.0.16; + MARKETING_VERSION = 2.0.17; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC",