From 5c2153f83b14d44e8f1b51b6a6ce1e079fa46c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Thu, 24 Apr 2025 11:12:55 +0200 Subject: [PATCH] Add Report a Problem functionality (#8605) * Add Report a Problem functionality * update cache pinned SHA version from 4.0.2 to 4.2.0 * Address feedback * Fix tests * Fix some issues and update kotlin coroutines version * Fix delete file for iOS * Bump 1 more version for coroutines * Use rxjava instead of kotlin coroutines to avoid security issue * Move path prefix to avoid test error * Address feedback * Address feedback * Address feedback * Use mailto on iOS * Fix tests related to button changes * Address feedback * Update icon and fix onboarding buttons * Fix test --------- Co-authored-by: Angelos Kyratzakos Co-authored-by: Mattermost Build --- app/actions/remote/entry/common.test.ts | 5 +- app/components/button/index.test.tsx | 85 ++++++ app/components/button/index.tsx | 58 ++-- .../__snapshots__/index.test.tsx.snap | 17 +- app/components/menu_divider/index.test.tsx | 52 ++++ app/components/menu_divider/index.tsx | 38 +++ .../__snapshots__/index.test.tsx.snap | 201 ++++++-------- .../section_notice/section_notice_button.tsx | 4 +- app/components/selected_users/index.tsx | 3 +- app/constants/screens.ts | 2 + app/queries/servers/system.test.ts | 76 +++++- app/queries/servers/system.ts | 23 ++ app/screens/channel_bookmark/index.tsx | 22 +- .../muted_banner.tsx | 30 +-- .../convert_gm_to_channel_form.tsx | 1 - .../footer/download_with_action/index.tsx | 3 +- app/screens/gallery/video_renderer/error.tsx | 3 - .../__snapshots__/index.test.tsx.snap | 34 +-- app/screens/index.test.tsx | 196 ++++++++++++++ app/screens/index.tsx | 23 +- app/screens/onboarding/footer_buttons.tsx | 6 +- .../report_a_problem/app_logs.test.tsx | 165 ++++++++++++ app/screens/report_a_problem/app_logs.tsx | 114 ++++++++ .../report_a_problem/copy_metadata.test.tsx | 110 ++++++++ .../report_a_problem/copy_metadata.tsx | 78 ++++++ app/screens/report_a_problem/index.test.tsx | 158 +++++++++++ app/screens/report_a_problem/index.ts | 25 ++ .../report_a_problem/log_file_item.test.tsx | 48 ++++ .../report_a_problem/log_file_item.tsx | 45 ++++ .../report_a_problem/report_problem.test.tsx | 237 +++++++++++++++++ .../report_a_problem/report_problem.tsx | 171 ++++++++++++ app/screens/report_a_problem/styles.tsx | 42 +++ app/screens/settings/about/about.tsx | 49 ++-- app/screens/settings/config.ts | 181 +++++++++---- ...end_test_notification_notice.test.tsx.snap | 103 +++----- .../settings/report_problem/index.test.tsx | 157 +++++++++++ app/screens/settings/report_problem/index.ts | 26 +- .../report_problem/report_problem.test.tsx | 123 +++++++++ .../report_problem/report_problem.tsx | 93 ++++--- app/screens/settings/settings.tsx | 2 +- .../terms_of_service/terms_of_service.tsx | 45 ++-- app/utils/buttonStyles.test.ts | 32 ++- app/utils/buttonStyles.ts | 96 +++---- app/utils/file/index.test.ts | 33 ++- app/utils/file/index.ts | 9 + app/utils/files.test.ts | 7 +- app/utils/files.tsx | 5 - app/utils/log.test.ts | 6 + app/utils/share_logs.test.ts | 250 ++++++++++++++++++ app/utils/share_logs.ts | 92 +++++++ assets/base/i18n/en.json | 16 ++ .../mattermost/rnutils/RNUtilsModuleImpl.kt | 69 ++++- .../rnutils/helpers/SaveDataTask.kt | 118 +++++---- .../android/src/newarch/RNUtilsModule.kt | 6 + .../android/src/oldarch/RNUtilsModule.kt | 7 + libraries/@mattermost/rnutils/ios/RNUtils.mm | 16 ++ .../rnutils/ios/RNUtilsWrapper.swift | 71 +++++ .../@mattermost/rnutils/src/NativeRNUtils.ts | 2 + patches/expo-file-system+18.0.6.patch | 16 ++ test/setup.ts | 18 ++ types/api/config.d.ts | 3 + types/screens/report_a_problem.ts | 10 + 62 files changed, 3139 insertions(+), 597 deletions(-) create mode 100644 app/components/button/index.test.tsx create mode 100644 app/components/menu_divider/index.test.tsx create mode 100644 app/components/menu_divider/index.tsx create mode 100644 app/screens/index.test.tsx create mode 100644 app/screens/report_a_problem/app_logs.test.tsx create mode 100644 app/screens/report_a_problem/app_logs.tsx create mode 100644 app/screens/report_a_problem/copy_metadata.test.tsx create mode 100644 app/screens/report_a_problem/copy_metadata.tsx create mode 100644 app/screens/report_a_problem/index.test.tsx create mode 100644 app/screens/report_a_problem/index.ts create mode 100644 app/screens/report_a_problem/log_file_item.test.tsx create mode 100644 app/screens/report_a_problem/log_file_item.tsx create mode 100644 app/screens/report_a_problem/report_problem.test.tsx create mode 100644 app/screens/report_a_problem/report_problem.tsx create mode 100644 app/screens/report_a_problem/styles.tsx create mode 100644 app/screens/settings/report_problem/index.test.tsx create mode 100644 app/screens/settings/report_problem/report_problem.test.tsx create mode 100644 app/utils/share_logs.test.ts create mode 100644 app/utils/share_logs.ts create mode 100644 patches/expo-file-system+18.0.6.patch create mode 100644 types/screens/report_a_problem.ts diff --git a/app/actions/remote/entry/common.test.ts b/app/actions/remote/entry/common.test.ts index 71b5128d1..1b71b8236 100644 --- a/app/actions/remote/entry/common.test.ts +++ b/app/actions/remote/entry/common.test.ts @@ -22,6 +22,7 @@ import NetworkManager from '@managers/network_manager'; import {getDeviceToken} from '@queries/app/global'; import {getCurrentChannelId, getCurrentTeamId, setCurrentTeamAndChannelId} from '@queries/servers/system'; import NavigationStore from '@store/navigation_store'; +import {logDebug} from '@utils/log'; import {entry, setExtraSessionProps, verifyPushProxy, entryInitialChannelId, restDeferredAppEntryActions, handleEntryAfterLoadNavigation, deferredAppEntryActions} from './common'; @@ -866,7 +867,6 @@ describe('actions/remote/entry/common', () => { }); it('should handle error gracefully', async () => { - const consoleDebugSpy = jest.spyOn(console, 'debug').mockImplementation(() => {}); (DatabaseManager.getServerDatabaseAndOperator as jest.Mock).mockImplementation(() => { throw new Error('Test error'); }); @@ -882,8 +882,7 @@ describe('actions/remote/entry/common', () => { false, ); - expect(consoleDebugSpy).toHaveBeenCalled(); - consoleDebugSpy.mockRestore(); + expect(logDebug).toHaveBeenCalled(); }); it('should handle tablet device scenario', async () => { diff --git a/app/components/button/index.test.tsx b/app/components/button/index.test.tsx new file mode 100644 index 000000000..42f7a3ec6 --- /dev/null +++ b/app/components/button/index.test.tsx @@ -0,0 +1,85 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +import {fireEvent, render, within} from '@testing-library/react-native'; +import React, {type ComponentProps} from 'react'; +import {View, Text} from 'react-native'; + +import {Preferences} from '@constants'; + +import Button from './index'; + +describe('components/button', () => { + const getBaseProps = (): ComponentProps => ({ + onPress: jest.fn(), + text: 'Test Button', + theme: Preferences.THEMES.denim, + testID: 'test-button', + }); + + it('should render button with text', () => { + const props = getBaseProps(); + const {getByText} = render(