Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IOCOM-905, IOCOM-906] New DS on Message Router #5755

Merged
merged 21 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ca20a78
New DS on Message Router
Vangaorth May 9, 2024
eae5f04
Forced header to be always shown until the old DS is removed
Vangaorth May 9, 2024
f74cbc2
Merge branch 'master' into IOCOM-905-router
Vangaorth May 13, 2024
dadce7d
Merge branch 'master' into IOCOM-905-router
Vangaorth May 14, 2024
2a5950e
Merge branch 'master' into IOCOM-905-router
Vangaorth May 14, 2024
73c63bd
Merge branch 'master' into IOCOM-905-router
Vangaorth May 14, 2024
4d7491c
Merge branch 'master' into IOCOM-905-router
Vangaorth May 14, 2024
c04fc34
Merge branch 'master' into IOCOM-905-router
Vangaorth May 14, 2024
cedcdad
Merge branch 'master' into IOCOM-905-router
Vangaorth May 15, 2024
502048d
Merge branch 'master' into IOCOM-905-router
Vangaorth May 15, 2024
5003c50
Merge branch 'master' into IOCOM-905-router
Vangaorth May 15, 2024
6bdd379
Merge branch 'master' into IOCOM-905-router
Vangaorth May 15, 2024
4e7e7d3
Merge branch 'master' into IOCOM-905-router
Vangaorth May 16, 2024
ea318b7
Merge branch 'master' into IOCOM-905-router
Vangaorth May 16, 2024
73df05d
Merge branch 'master' into IOCOM-905-router
Vangaorth May 17, 2024
51e18c2
Merge branch 'master' into IOCOM-905-router
Vangaorth May 17, 2024
c711a7b
Merge branch 'master' into IOCOM-905-router
Vangaorth May 17, 2024
e08bdba
Suggested changes
Vangaorth May 17, 2024
52902b8
Fixed bad action sequence on test
Vangaorth May 17, 2024
8fdb4ab
Merge branch 'master' into IOCOM-905-router
Vangaorth May 17, 2024
4958076
Merge branch 'master' into IOCOM-905-router
Vangaorth May 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion locales/en/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1921,7 +1921,8 @@ messageDetails:
contextualHelpContent: !include messages/message_detail.md
headerTitle: Message
emptyMessage: No content
loadingText: Loading message details in progress...
loadingText: Loading message details
pleaseWait: Wait a few moments
errorText: We were unable to load the details of your message
retryText: It's probably a temporary error... please try again!
submitBugText: If the problem is not resolved, report it with the '?' icon at the top right, thank you!
Expand Down
3 changes: 2 additions & 1 deletion locales/it/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1921,7 +1921,8 @@ messageDetails:
contextualHelpContent: !include messages/message_detail.md
headerTitle: Messaggio
emptyMessage: Nessun contenuto
loadingText: Caricamento dei dettagli del messaggio in corso...
loadingText: Stiamo caricando il messaggio
pleaseWait: Attendi qualche secondo
errorText: Non siamo riusciti a caricare i dettagli del tuo messaggio
retryText: Probabilmente è un errore temporaneo... riprova per piacere!
submitBugText: Se il problema non si risolve segnalacelo con l'icona '?' in alto a destra, grazie!
Expand Down
14 changes: 10 additions & 4 deletions ts/components/screens/LoadingScreenContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
import { SafeAreaView } from "react-native-safe-area-context";
import { LoadingIndicator } from "../../components/ui/LoadingIndicator";
import { useOnFirstRender } from "../../utils/hooks/useOnFirstRender";
import { WithTestID } from "../../types/WithTestID";

const styles = StyleSheet.create({
container: {
Expand All @@ -29,13 +30,14 @@ const styles = StyleSheet.create({

const SPACE_BETWEEN_SPINNER_AND_TEXT = 24;

type LoadingScreenContentProps = {
type LoadingScreenContentProps = WithTestID<{
contentTitle: string;
children?: React.ReactNode;
};
headerVisible?: boolean;
}>;

export const LoadingScreenContent = (props: LoadingScreenContentProps) => {
const { contentTitle, children } = props;
const { contentTitle, children, headerVisible, testID } = props;

useOnFirstRender(() => {
// Since the screen is shown for a very short time,
Expand All @@ -50,7 +52,11 @@ export const LoadingScreenContent = (props: LoadingScreenContentProps) => {
});

return (
<SafeAreaView style={styles.container}>
<SafeAreaView
style={styles.container}
edges={headerVisible ? ["bottom"] : undefined}
testID={testID}
>
shadowsheep1 marked this conversation as resolved.
Show resolved Hide resolved
<ContentWrapper>
<View style={styles.content}>
<View
Expand Down
56 changes: 56 additions & 0 deletions ts/components/screens/__tests__/LoadingScreenContent.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import React from "react";
import { Text } from "react-native";
import { createStore } from "redux";
import LoadingScreenContent from "../LoadingScreenContent";
import { appReducer } from "../../../store/reducers";
import { applicationChangeState } from "../../../store/actions/application";
import { renderScreenWithNavigationStoreContext } from "../../../utils/testWrapper";
import { GlobalState } from "../../../store/reducers/types";
import { preferencesDesignSystemSetEnabled } from "../../../store/actions/persistedPreferences";

describe("LoadingScreenContent", () => {
it("should match the snapshot with title, no children, header hidden", () => {
const defaultProps = {
contentTitle: "Test Content Title"
} as React.ComponentProps<typeof LoadingScreenContent>;
expect(renderComponent(defaultProps)).toMatchSnapshot();
});
it("should match the snapshot with title, no children, header shown", () => {
const defaultProps = {
contentTitle: "Test Content Title",
headerVisible: true
} as React.ComponentProps<typeof LoadingScreenContent>;
expect(renderComponent(defaultProps)).toMatchSnapshot();
});
it("should match the snapshot with title, a child, header hidden", () => {
const defaultProps = {
contentTitle: "Test Content Title",
children: <Text>{"My test child"}</Text>
} as React.ComponentProps<typeof LoadingScreenContent>;
expect(renderComponent(defaultProps)).toMatchSnapshot();
});
it("should match the snapshot with title, a child, header shown", () => {
const defaultProps = {
contentTitle: "Test Content Title",
children: <Text>{"My test child"}</Text>,
headerVisible: true
} as React.ComponentProps<typeof LoadingScreenContent>;
expect(renderComponent(defaultProps)).toMatchSnapshot();
});
});

function renderComponent(
props: React.ComponentProps<typeof LoadingScreenContent>
) {
const globalState = appReducer(undefined, applicationChangeState("active"));
const designSystemEnabledState = appReducer(
globalState,
preferencesDesignSystemSetEnabled({ isDesignSystemEnabled: true })
);
return renderScreenWithNavigationStoreContext<GlobalState>(
() => <LoadingScreenContent {...props} />,
"DUMMY ROUTE",
{},
createStore(appReducer, designSystemEnabledState as any)
);
}