Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions ios/LiveActivity/GpsTripAttributes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import ActivityKit

struct GpsTripAttributes: ActivityAttributes {
var deepLink: String
var buttonText: String
var subtitle: String


public struct ContentState: Codable, Hashable {
var distance: Double
var distanceUnit: String
var distanceUnitLong: String
var buttonText: String
var subtitle: String
}
}
6 changes: 3 additions & 3 deletions ios/LiveActivity/GpsTripLiveActivity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct GpsTripLiveActivity: Widget {
.resizable()
.scaledToFit()
.frame(maxWidth: 64)
Text(context.attributes.subtitle)
Text(context.state.subtitle)
.font(.custom("ExpensifyNeue-Regular", size: 15))
.foregroundColor(.white)
}
Expand Down Expand Up @@ -61,7 +61,7 @@ struct GpsTripLiveActivity: Widget {
.resizable()
.scaledToFit()
.frame(maxWidth: 64)
Text(context.attributes.subtitle)
Text(context.state.subtitle)
.font(.custom("ExpensifyNeue-Regular", size: 15))
.foregroundColor(.white)
.lineLimit(1)
Expand All @@ -83,7 +83,7 @@ struct GpsTripLiveActivity: Widget {
.frame(minHeight: 70, maxHeight: .infinity, alignment: .bottom)
}
DynamicIslandExpandedRegion(.bottom) {
Text(context.attributes.buttonText)
Text(context.state.buttonText)
.font(.custom("ExpensifyNeue-Bold", size: 15))
.foregroundColor(.expensifyGreen)
.frame(maxWidth: .infinity)
Expand Down
4 changes: 2 additions & 2 deletions src/components/GPSTripStateChecker/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import {useSplashScreenState} from '@src/SplashScreenStateContext';
import useUpdateGpsNotificationOnUnitChange from './useUpdateGpsNotificationOnUnitChange';
import useUpdateGpsNotification from './useUpdateGpsNotification';
import useUpdateGpsTripOnReconnect from './useUpdateGpsTripOnReconnect';

function GPSTripStateChecker() {
Expand All @@ -28,7 +28,7 @@ function GPSTripStateChecker() {
const reportID = gpsDraftDetails?.reportID ?? generateReportID();

useUpdateGpsTripOnReconnect();
useUpdateGpsNotificationOnUnitChange();
useUpdateGpsNotification();

useEffect(() => {
async function handleGpsTripInProgressOnAppRestart() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
import {useEffect} from 'react';
import {useEffect, useRef} from 'react';
import useDefaultExpensePolicy from '@hooks/useDefaultExpensePolicy';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import DistanceRequestUtils from '@libs/DistanceRequestUtils';
import shouldUseDefaultExpensePolicyUtil from '@libs/shouldUseDefaultExpensePolicy';
import {shouldUpdateGpsNotificationUnit, updateGpsTripNotificationUnit} from '@pages/iou/request/step/IOURequestStepDistanceGPS/GPSNotifications';
import {shouldUpdateGpsNotificationUnit, updateGpsTripNotificationLanguage, updateGpsTripNotificationUnit} from '@pages/iou/request/step/IOURequestStepDistanceGPS/GPSNotifications';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';

function useUpdateGpsNotification() {
useUpdateGpsNotificationOnLanguageChange();
useUpdateGpsNotificationOnUnitChange();
}

function useUpdateGpsNotificationOnLanguageChange() {
const {translate, preferredLocale} = useLocalize();
const currentPreferredLocale = useRef(preferredLocale);

useEffect(() => {
if (currentPreferredLocale.current === preferredLocale) {
return;
}

currentPreferredLocale.current = preferredLocale;

if (!shouldUpdateGpsNotificationUnit()) {
return;
}

updateGpsTripNotificationLanguage(translate);
}, [preferredLocale, translate]);
}

function useUpdateGpsNotificationOnUnitChange() {
const {translate} = useLocalize();

Expand All @@ -28,4 +52,4 @@ function useUpdateGpsNotificationOnUnitChange() {
}, [unit, translate]);
}

export default useUpdateGpsNotificationOnUnitChange;
export default useUpdateGpsNotification;
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// GPS notifications updates are iOS only
function useUpdateGpsNotification() {}

export default useUpdateGpsNotification;

This file was deleted.

2 changes: 2 additions & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ const translations: TranslationDeepObject<typeof en> = {
per: 'pro',
mi: 'Meile',
km: 'Kilometer',
milesAbbreviated: 'mi',
kilometersAbbreviated: 'km',
copied: 'Kopiert!',
someone: 'Jemand',
total: 'Gesamt',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ const translations = {
// @context Unit label for “mile.” Should be treated as a measurement unit and may require capitalization depending on locale conventions.
mi: 'mile',
km: 'kilometer',
milesAbbreviated: 'mi',
kilometersAbbreviated: 'km',
copied: 'Copied!',
someone: 'Someone',
total: 'Total',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ const translations: TranslationDeepObject<typeof en> = {
per: 'por',
mi: 'milla',
km: 'kilómetro',
milesAbbreviated: 'mi',
kilometersAbbreviated: 'km',
copied: '¡Copiado!',
someone: 'Alguien',
total: 'Total',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ const translations: TranslationDeepObject<typeof en> = {
per: 'par',
mi: 'mile',
km: 'kilomètre',
milesAbbreviated: 'mi',
kilometersAbbreviated: 'km',
copied: 'Copié !',
someone: 'Quelqu’un',
total: 'Total',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ const translations: TranslationDeepObject<typeof en> = {
per: 'for',
mi: 'miglio',
km: 'chilometro',
milesAbbreviated: 'mi',
kilometersAbbreviated: 'km',
copied: 'Copiato!',
someone: 'Qualcuno',
total: 'Totale',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ const translations: TranslationDeepObject<typeof en> = {
per: 'あたり',
mi: 'マイル',
km: 'キロメートル',
milesAbbreviated: 'マイル',
kilometersAbbreviated: 'キロ',
copied: 'コピーしました!',
someone: '誰か',
total: '合計',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ const translations: TranslationDeepObject<typeof en> = {
per: 'per',
mi: 'mijl',
km: 'kilometer',
milesAbbreviated: 'mi',
kilometersAbbreviated: 'km',
copied: 'Gekopieerd!',
someone: 'Iemand',
total: 'Totaal',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ const translations: TranslationDeepObject<typeof en> = {
per: 'na',
mi: 'mila',
km: 'kilometr',
milesAbbreviated: 'mi',
kilometersAbbreviated: 'km',
copied: 'Skopiowano!',
someone: 'Ktoś',
total: 'Suma',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ const translations: TranslationDeepObject<typeof en> = {
per: 'por',
mi: 'milha',
km: 'quilômetro',
milesAbbreviated: 'mi',
kilometersAbbreviated: 'km',
copied: 'Copiado!',
someone: 'Alguém',
total: 'Total',
Expand Down
2 changes: 2 additions & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,8 @@ const translations: TranslationDeepObject<typeof en> = {
per: '每',
mi: '英里',
km: '千米',
milesAbbreviated: '英里',
kilometersAbbreviated: '千米',
copied: '已复制!',
someone: '某人',
total: '总计',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,15 @@ function updateGpsTripNotificationDistance(_distanceInMeters: number) {}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function updateGpsTripNotificationUnit(_translate: LocalizedTranslate, _unit: Unit) {}

export {startGpsTripNotification, stopGpsTripNotification, updateGpsTripNotificationDistance, updateGpsTripNotificationUnit, checkAndCleanGpsNotification, shouldUpdateGpsNotificationUnit};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function updateGpsTripNotificationLanguage(_translate: LocalizedTranslate) {}

export {
startGpsTripNotification,
stopGpsTripNotification,
updateGpsTripNotificationDistance,
updateGpsTripNotificationUnit,
updateGpsTripNotificationLanguage,
checkAndCleanGpsNotification,
shouldUpdateGpsNotificationUnit,
};
Loading
Loading