Skip to content

Commit

Permalink
Merge branch 'master' into delivery-price-error
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-LHOSTE authored Dec 4, 2024
2 parents 42a1a6a + dbdba23 commit 295069b
Show file tree
Hide file tree
Showing 29 changed files with 1,424 additions and 1,274 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/fastlane_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,5 @@ jobs:
- name: Upload IPA artifact
uses: actions/upload-artifact@v4
with:
name: example-iOS.ipa
name: ${{ inputs.app_name }}_release_iOS.ipa
path: ios/example-iOS.ipa
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ android {
multiDexEnabled true
// No need to increment the versionCode, it will be automatically incremented by the fastlane
versionCode 218
versionName "2.27.2"
versionName "2.28.0"

manifestPlaceholders = [
tipsiStripeRedirectScheme: "coopcycle",
Expand Down
2 changes: 1 addition & 1 deletion ios/CoopCycle/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.27.1</string>
<string>2.28.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand Down
37 changes: 19 additions & 18 deletions jestSetup.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
/* global jest */

import NavigationHolder from './src/NavigationHolder'
import NavigationHolder from './src/NavigationHolder';

jest.mock('react-native/Libraries/AppState/AppState', () => ({
currentState: 'active',
}));

jest.mock('react-native-localize', () => ({
findBestLanguageTag: () => ({ languageTag: 'en' }),
}));

jest.mock('react-native-blob-util', () => ({
fetch: () => {},
wrap: () => {}
wrap: () => {},
}));

jest.mock('expo-file-system', () => ({
createUploadTask: jest.fn(),
FileSystemUploadType: {
MULTIPART: 1
MULTIPART: 1,
},
FileSystemSessionType: {
BACKGROUND: 0
}
BACKGROUND: 0,
},
}));

jest.mock('@react-native-firebase/analytics', () => ({
logEvent: jest.fn(),
setUserProperty: jest.fn(),
}))
}));

jest.mock('@react-native-firebase/messaging', () => ({
}))
jest.mock('@react-native-firebase/messaging', () => ({}));

jest.mock('countly-sdk-react-native-bridge', () => ({
enableParameterTamperingProtection: () => {},
Expand All @@ -46,22 +49,20 @@ jest.mock('react-native-background-geolocation', () => ({
stop: jest.fn(),
removeListeners: jest.fn(),
changePace: jest.fn(),
}))
}));

jest.mock('@stripe/stripe-react-native', () => ({
}))
jest.mock('@stripe/stripe-react-native', () => ({}));

jest.mock('react-native-share', () => ({
}))
jest.mock('react-native-share', () => ({}));

jest.mock('uuid', () => ({
v4: jest.fn(),
}))
}));

const fakeNavigator = {
current: {
dispatch: (action) => {}
}
}
dispatch: action => {},
},
};

NavigationHolder.setNavigationRef(fakeNavigator)
NavigationHolder.setNavigationRef(fakeNavigator);
6 changes: 4 additions & 2 deletions src/Datadog.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ const datadogConfig = new DatadogProviderConfiguration(
applicationId,
true, // track User interactions (e.g.: Tap on buttons. You can use 'accessibilityLabel' element property to give tap action the name, otherwise element type will be reported)
true, // track XHR Resources
true, // track Errors
//FIXME: re-enable after migrating to react-native 0.76: https://github.com/facebook/hermes/issues/1496
false, // track Errors
);
// Optional: Select your Datadog website (one of "US1", "EU1", "US3", "US5", "AP1" or "GOV")
datadogConfig.site = 'US1';
// Optional: Enable JavaScript long task collection
datadogConfig.longTaskThresholdMs = 100;
// Optional: enable or disable native crash reports
datadogConfig.nativeCrashReportEnabled = true;
//FIXME: re-enable after migrating to react-native 0.76: https://github.com/facebook/hermes/issues/1496
datadogConfig.nativeCrashReportEnabled = false;
// Optional: Sample RUM sessions (% of session are sent to Datadog. Default is 100%).
datadogConfig.sessionSamplingRate = __DEV__ ? 100 : 20;
// Optional: Sample tracing integrations for network calls between your app and your backend (% of calls to your instrumented backend are linked from the RUM view to the APM view. Default is 20%)
Expand Down
29 changes: 18 additions & 11 deletions src/components/NotificationHandler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect } from 'react';
import React, { useEffect, useMemo } from 'react';
import { useDispatch, useSelector } from 'react-redux';

import {
Expand Down Expand Up @@ -26,32 +26,39 @@ export default function NotificationHandler() {
const notificationsToDisplay = useSelector(selectNotificationsToDisplay);
const notificationsWithSound = useSelector(selectNotificationsWithSound);

const hasNotifications = useMemo(
() =>
notificationsToDisplay.length > 0 || notificationsWithSound.length > 0,
[notificationsToDisplay, notificationsWithSound],
);

const hasNotificationsWithSound = useMemo(
() => notificationsWithSound.length > 0,
[notificationsWithSound],
);

const dispatch = useDispatch();

useEffect(() => {
if (
notificationsToDisplay.length > 0 ||
notificationsWithSound.length > 0
) {
// use memoized value to avoid re-setting timeout when more notifications arrive
if (hasNotifications) {
setTimeout(() => {
dispatch(clearNotifications());
}, NOTIFICATION_DURATION_MS);
}
}, [notificationsToDisplay, notificationsWithSound, dispatch]);
}, [hasNotifications, dispatch]);

useEffect(() => {
// on Android, when notification is received, OS let us execute some code
// but it's very limited, e.g. handlers set via setTimeout are not executed
// so we do not play sound in that case, because we will not be able to stop it
if (
notificationsWithSound.length > 0 &&
AppState.currentState === 'active'
) {
// use memoized value to avoid re-starting the sound when more notifications arrive
if (hasNotificationsWithSound && AppState.currentState === 'active') {
dispatch(startSound());
} else {
dispatch(stopSound());
}
}, [notificationsWithSound, dispatch]);
}, [hasNotificationsWithSound, dispatch]);

return (
<NotificationModal
Expand Down
4 changes: 2 additions & 2 deletions src/components/RestaurantCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Text } from 'native-base';
import { Image, StyleSheet, View } from 'react-native';
import { TimingBadge } from '../navigation/checkout/components/RestaurantBadges';
import { useBackgroundContainerColor } from '../styles/theme';
import { isRestaurantAvailable } from '../utils/checkout';
import { isRestaurantOrderingAvailable } from '../utils/checkout';
import { RestaurantBadge } from './RestaurantBadge';
import { RestaurantTag } from './RestaurantTag';
import { RestaurantBanner } from './RestaurantBanner';
Expand Down Expand Up @@ -92,7 +92,7 @@ const styles = StyleSheet.create({

export const RestaurantCard = ({ restaurant }) => {
const backgroundColor = useBackgroundContainerColor();
const isAvailable = isRestaurantAvailable(restaurant);
const isAvailable = isRestaurantOrderingAvailable(restaurant);

return (
<View style={[styles.item, { backgroundColor }]}>
Expand Down
Loading

0 comments on commit 295069b

Please sign in to comment.