[CP-2608] Removal of Dead Code (#1799)

This commit is contained in:
Daniel Karski
2024-03-27 16:25:37 +01:00
committed by GitHub
parent d14a0cba10
commit c60cb608c6
201 changed files with 109 additions and 4470 deletions

View File

@@ -23,7 +23,7 @@
"storybook:build": "storybook build",
"DATA UPDATE/OVERWRITE COMMANDS": "=========================================",
"translations:sort": "ts-node ../../scripts/sort-translations.ts",
"translations:sync": "ts-node ../../scripts/sync-translations.ts",
"translations:sync": "ts-node ../../scripts/sync-translations/sync-translations.ts",
"fonts:download": "node ../../scripts/downloadFonts.js",
"copy-static-dependencies": "node ../../scripts/copy-static-sql-js-dependencies.js",
"news:download": "ts-node ../../scripts/downloadNews.ts",

View File

@@ -1,10 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
export enum DataLoading {
Loading,
Finished,
Error,
}

View File

@@ -1,9 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
export default interface DisconnectInfo {
// Is the phone currently disconnected?
readonly disconnected: boolean
}

View File

@@ -1,11 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
import { MenuItemConstructorOptions } from "electron"
export interface ContextMenuItem extends MenuItemConstructorOptions {
devModeOnly?: boolean
labelCreator?: () => string
}

View File

@@ -1,26 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
import { fireEvent } from "@testing-library/react"
import ContextMenu from "Core/__deprecated__/context-menu/context-menu"
const menuPopupMock = jest.fn()
const menuAppendMock = jest.fn()
jest.mock("@electron/remote", () => ({
Menu: () => ({
popup: menuPopupMock,
append: menuAppendMock,
}),
MenuItem: () => jest.fn(),
}))
test("contextmenu event listener is added on ContextMenu init", () => {
const menu = new ContextMenu()
menu.init()
fireEvent.contextMenu(window)
expect(menuAppendMock).toHaveBeenCalled()
expect(menuPopupMock).toHaveBeenCalled()
})

View File

@@ -1,206 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
import { getCurrentWindow, Menu, MenuItem } from "@electron/remote"
import { ContextMenuItem } from "Core/__deprecated__/context-menu/context-menu.interface"
import { AppHotkeys } from "Core/__deprecated__/hotkeys/hotkeys.types"
interface DevModeProps {
isEnabled?: () => boolean
toggler: () => void
}
/**
* Creates a new ContextMenu that allows to extend app's context menu
* @class
*
* It has two basic options always available:
* - Toggle developer mode (Command/Control + D)
* - Toggle Developer Tools
*
* It can be extended by custom menu items. Each main menu item has its own
* label with sub-items attached so the final structure will be as following:
* - Main menu 1
* - Sub-item 1
* - Sub-item 2
* - Main menu 2
* - Sub-item 1
* - Sub-item 2
* - Sub-item 3
*
* Main menu item is visible only if at least one sub-item is also visible.
*
* Each sub-item is visible only in developer mode by default, but it can be changed
* by adding an additional property when registering items for given main menu:
* contextMenu.registerItems("Main menu 1", [
* {
* label: Sub-item 1",
* click: () => {},
* devModeOnly: false,
* },
* ])
*
* This ensures that main menu items and their sub-menus will only be visible
* when needed.
*
* Sub-item's label is a static string by default but there's an additional prop
* that allows to pass a function that can create a dynamic label:
* contextMenu.registerItems("Main menu 2", [
* {
* labelCreator: () => isSomethingTrue() ? "Sub-item true" : "Sub-item false",
* click: () => {},
* },
* ])
*/
class ContextMenu {
private readonly isDevModeEnabled?: () => boolean
private readonly devModeToggler?: () => void
private contextMenu = new Menu()
private customMenu: Record<string, ContextMenuItem[]> = {}
constructor(devMode?: DevModeProps) {
this.isDevModeEnabled = devMode?.isEnabled
this.devModeToggler = devMode?.toggler
}
private addSeparator() {
this.contextMenu.append(new MenuItem({ type: "separator" }))
}
private mapCustomItems() {
const customMenuItems = Object.entries(this.customMenu)
let firstItemAdded = false
for (const [mainMenuLabel, menuItems] of customMenuItems) {
const visibleMenuItems = menuItems
.filter(({ visible }) => visible ?? true)
.filter(({ devModeOnly }) => {
if (this.isDevModeEnabled) {
return (devModeOnly && this.isDevModeEnabled()) || !devModeOnly
} else {
return true
}
})
if (visibleMenuItems.length > 0) {
if (!firstItemAdded) {
this.addSeparator()
firstItemAdded = true
}
this.contextMenu.append(
new MenuItem({
label: mainMenuLabel,
submenu: visibleMenuItems.map(
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/no-unused-vars
({ devModeOnly, labelCreator, ...options }) => ({
label: labelCreator ? labelCreator() : options.label,
...options,
})
),
})
)
}
}
}
private rebuildMenu({ clientX, clientY }: MouseEvent) {
this.contextMenu = new Menu()
if (this.isDevModeEnabled && this.devModeToggler) {
this.contextMenu.append(
new MenuItem({
label: `${
this.isDevModeEnabled() ? "Disable" : "Enable"
} developer mode`,
click: this.devModeToggler,
accelerator: AppHotkeys.DevMode,
})
)
}
this.mapCustomItems()
this.addSeparator()
this.contextMenu.append(
new MenuItem({
label: "Inspect element",
click: () =>
getCurrentWindow().webContents.inspectElement(clientX, clientY),
})
)
this.contextMenu.append(
new MenuItem({
label: "Toggle Developer Tools",
role: "toggleDevTools",
})
)
}
private showMenu(event: MouseEvent) {
this.rebuildMenu(event)
this.contextMenu.popup()
}
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
public init() {
window.addEventListener(
"contextmenu",
(event) => this.showMenu(event),
false
)
}
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/ban-types
public registerItem(mainLabel: string, menuItem: ContextMenuItem): Function {
const newItem: ContextMenuItem = {
devModeOnly: true,
...menuItem,
}
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line no-prototype-builtins
if (this.customMenu.hasOwnProperty(mainLabel)) {
const menuItems = this.customMenu[mainLabel]
const label =
newItem.label || (newItem.labelCreator && newItem.labelCreator())
if (!menuItems.some((item) => item.label === label)) {
menuItems.push(newItem)
}
} else {
this.customMenu[mainLabel] = [newItem]
}
return () => {
const menu = this.customMenu[mainLabel]
delete menu[menu.indexOf(newItem)]
}
}
public registerItems(
mainLabel: string,
menuItems: ContextMenuItem[]
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/ban-types
): Function {
const unregisterItemsFunctions = menuItems.map((item) =>
this.registerItem(mainLabel, item)
)
return () => {
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
unregisterItemsFunctions.forEach((unregister) => unregister())
}
}
}
export default ContextMenu

View File

@@ -1,44 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
import store from "Core/__deprecated__/renderer/store"
import { isDevModeEnabled, toggleDevMode } from "./dev-mode.helpers"
const mockHistory = {
push: jest.fn(),
replace: jest.fn(),
go: jest.fn(),
block: jest.fn(),
listen: jest.fn(),
location: { pathname: "", search: "", hash: "", state: null },
};
jest.mock("history", () => ({
createHashHistory: jest.fn(() => mockHistory),
}));
describe("Function: isDevModeEnabled", () => {
test("returns current devMode state", () => {
expect(isDevModeEnabled()).toBeFalsy()
store.dispatch.devMode.enableDevMode()
expect(isDevModeEnabled()).toBeTruthy()
})
})
describe("Function: toggleDevMode", () => {
test("changing devMode state to `true` if it's disabled", () => {
store.dispatch.devMode.disableDevMode()
expect(store.getState().devMode.enabled).toBeFalsy()
toggleDevMode()
expect(store.getState().devMode.enabled).toBeTruthy()
})
test("changing devMode state to `false` if it's enabled and", () => {
store.dispatch.devMode.enableDevMode()
expect(store.getState().devMode.enabled).toBeTruthy()
toggleDevMode()
expect(store.getState().devMode.enabled).toBeFalsy()
})
})

View File

@@ -1,20 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
import store from "Core/__deprecated__/renderer/store"
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const isDevModeEnabled = () => {
return Boolean(store.getState().devMode.enabled)
}
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const toggleDevMode = () => {
store.getState().devMode.enabled
? store.dispatch.devMode.disableDevMode()
: store.dispatch.devMode.enableDevMode()
}

View File

@@ -1,12 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
export interface DevMode {
enabled?: boolean
pureSimulation?: boolean
harmonySimulation?: boolean
}
export type DevModePayload = boolean

View File

@@ -1,65 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
import { init } from "@rematch/core"
import devMode from "Core/__deprecated__/dev-mode/store/dev-mode"
let store = init({
models: { devMode },
})
// Cleans store after each test
beforeEach(() => {
store = init({
models: { devMode },
})
})
test("have default state properly defined", () => {
expect(store.getState().devMode).toMatchObject({
enabled: false,
pureSimulation: false,
harmonySimulation: false,
})
})
test("properly enables dev mode", () => {
expect(store.getState().devMode).toMatchObject({ enabled: false })
store.dispatch.devMode.enableDevMode()
expect(store.getState().devMode).toMatchObject({ enabled: true })
})
test("properly disables dev mode", () => {
store.dispatch.devMode.enableDevMode()
expect(store.getState().devMode).toMatchObject({ enabled: true })
store.dispatch.devMode.disableDevMode()
expect(store.getState().devMode).toMatchObject({ enabled: false })
})
test("properly enables phone simulation mode", () => {
expect(store.getState().devMode).toMatchObject({ pureSimulation: false })
store.dispatch.devMode.enablePureSimulation()
expect(store.getState().devMode).toMatchObject({ pureSimulation: true })
})
test("properly disables phone simulation mode", () => {
store.dispatch.devMode.enablePureSimulation()
expect(store.getState().devMode).toMatchObject({ pureSimulation: true })
store.dispatch.devMode.disablePureSimulation()
expect(store.getState().devMode).toMatchObject({ pureSimulation: false })
})
test("properly enables harmony simulation mode", () => {
expect(store.getState().devMode).toMatchObject({ harmonySimulation: false })
store.dispatch.devMode.enableHarmonySimulation()
expect(store.getState().devMode).toMatchObject({ harmonySimulation: true })
})
test("properly disables harmony simulation mode", () => {
store.dispatch.devMode.enableHarmonySimulation()
expect(store.getState().devMode).toMatchObject({ harmonySimulation: true })
store.dispatch.devMode.disableHarmonySimulation()
expect(store.getState().devMode).toMatchObject({ harmonySimulation: false })
})

View File

@@ -1,48 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
import { DevMode } from "Core/__deprecated__/dev-mode/store/dev-mode.interface"
const initialStateValue: DevMode = {
enabled: false,
pureSimulation: false,
harmonySimulation: false,
}
export default {
state: initialStateValue,
reducers: {
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
enableDevMode(state: DevMode) {
return { ...state, enabled: true }
},
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
disableDevMode(state: DevMode) {
return { ...state, enabled: false }
},
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
enablePureSimulation(state: DevMode) {
return { ...state, pureSimulation: true }
},
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
disablePureSimulation(state: DevMode) {
return { ...state, pureSimulation: false }
},
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
enableHarmonySimulation(state: DevMode) {
return { ...state, harmonySimulation: true }
},
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
disableHarmonySimulation(state: DevMode) {
return { ...state, harmonySimulation: false }
},
},
}

View File

@@ -1,33 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
import { BrowserWindow } from "electron"
import { getCurrentWindow } from "@electron/remote"
import localShortcut from "electron-localshortcut"
import { AppHotkeys } from "Core/__deprecated__/hotkeys/hotkeys.types"
/**
* Creates a wrapper for "electron-localShortcut" to make registering hotkeys easier
* @class
*/
class Hotkeys {
private readonly window: BrowserWindow
constructor() {
this.window = getCurrentWindow()
}
public register(hotkey: AppHotkeys, callback: () => void) {
localShortcut.register(this.window, hotkey, callback)
}
public unregister(hotkey: AppHotkeys) {
localShortcut.unregister(this.window, hotkey)
}
}
const hotkeys = new Hotkeys()
export default hotkeys

View File

@@ -1,10 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
export enum AppHotkeys {
DevMode = "CommandOrControl+D",
pureSimulation = "CommandOrControl+P",
HarmonySimulation = "CommandOrControl+B",
}

View File

@@ -300,6 +300,33 @@ exports[`Device: Mudita harmony matches snapshot 1`] = `
/>
</span>
</div>
<div
class="c4"
>
<a
class="c5"
displaystyle="7"
href="#/onboarding"
size="1"
>
<span
class="c6 c7"
data-testid="icon-Send"
height="3.2"
width="3.2"
>
<test-file-stub
image="test-file-stub"
/>
</span>
<p
class="c8 c9"
color="primary"
>
[value] module.onboarding
</p>
</a>
</div>
<div
class="c4"
>
@@ -697,6 +724,33 @@ exports[`Device: Mudita pure matches snapshot 1`] = `
/>
</span>
</div>
<div
class="c4"
>
<a
class="c5"
displaystyle="7"
href="#/onboarding"
size="1"
>
<span
class="c6 c7"
data-testid="icon-Send"
height="3.2"
width="3.2"
>
<test-file-stub
image="test-file-stub"
/>
</span>
<p
class="c8 c9"
color="primary"
>
[value] module.onboarding
</p>
</a>
</div>
<div
class="c4"
>

View File

@@ -7,7 +7,6 @@ import React from "react"
import styled from "styled-components"
import { FunctionComponent } from "Core/core/types/function-component.interface"
import { IconType } from "Core/__deprecated__/renderer/components/core/icon/icon-type"
import { intl } from "Core/__deprecated__/renderer/utils/intl"
import {
baseMenuElements,
centerMenuElements,
@@ -15,13 +14,9 @@ import {
MenuElement,
} from "Core/__deprecated__/renderer/constants/menu-elements"
import MenuGroup from "Core/__deprecated__/renderer/components/rest/menu/menu-group.component"
import {
backgroundColor,
textColor,
} from "Core/core/styles/theming/theme-getters"
import { backgroundColor } from "Core/core/styles/theming/theme-getters"
import Icon from "Core/__deprecated__/renderer/components/core/icon/icon.component"
import { DeviceType } from "Core/device"
import { DevMode } from "Core/__deprecated__/dev-mode/store/dev-mode.interface"
import { View } from "Core/__deprecated__/renderer/constants/views"
const LogoWrapper = styled.div`
@@ -37,21 +32,12 @@ const SvgMuditaLogo = styled(Icon)`
margin: 2rem 0 2.4rem;
`
const DevSign = styled.span`
position: absolute;
right: 0;
top: 2rem;
line-height: 2rem;
color: ${textColor("secondary")};
`
const simulatePhoneConnectionEnabled = process.env.simulatePhoneConnection
interface Props {
deviceType: DeviceType | null
deviceFeaturesVisible?: boolean
openHelpWindow?: () => void
devModeEnabled?: DevMode["enabled"]
notifications: {
[View.Messages]: boolean
}
@@ -61,7 +47,6 @@ interface Props {
const MenuTop: FunctionComponent<Props> = ({
deviceType,
deviceFeaturesVisible,
devModeEnabled,
notifications,
genericMenuElements,
}) => {
@@ -74,7 +59,6 @@ const MenuTop: FunctionComponent<Props> = ({
.filter(({ connectedPhoneOnly }) =>
deviceFeaturesVisible ? true : !connectedPhoneOnly
)
.filter(({ devModeOnly }) => (devModeEnabled ? true : !devModeOnly))
.filter(({ simulatePhoneConnection }) =>
simulatePhoneConnectionEnabled ? true : !simulatePhoneConnection
)
@@ -98,11 +82,6 @@ const MenuTop: FunctionComponent<Props> = ({
<div>
<LogoWrapper>
<SvgMuditaLogo type={IconType.MuditaLogoWithText} />
{devModeEnabled && (
<DevSign>
{intl.formatMessage({ id: "component.devModeHeader" })}
</DevSign>
)}
</LogoWrapper>
{links}
</div>

View File

@@ -9,7 +9,6 @@ import { connect } from "react-redux"
import { createSelector } from "@reduxjs/toolkit"
import { DeviceType } from "Core/device/constants"
import { ReduxRootState } from "Core/__deprecated__/renderer/store"
import { DevMode } from "Core/__deprecated__/dev-mode/store/dev-mode.interface"
import { FunctionComponent } from "Core/core/types/function-component.interface"
import { View } from "Core/__deprecated__/renderer/constants/views"
import { getUnreadThreads } from "Core/messages/selectors"
@@ -34,7 +33,6 @@ export interface MenuProps {
deviceType: DeviceType | null
deviceFeaturesVisible?: boolean
openHelpWindow?: () => void
devModeEnabled?: DevMode["enabled"]
notifications: {
[View.Messages]: boolean
}

View File

@@ -14,7 +14,6 @@ const mapStateToProps = (state: RootState & ReduxRootState) => {
deviceFeaturesVisible:
state.deviceInitialization.deviceInitializationStatus ===
DeviceInitializationStatus.Initialized,
devModeEnabled: state.devMode.enabled,
dataSyncInProgress: isDataSyncInProgressSelector(state),
}
}

View File

@@ -12,7 +12,6 @@ import Menu, {
MenuProps,
} from "Core/__deprecated__/renderer/components/rest/menu/menu.component"
import { renderWithThemeAndIntl } from "Core/__deprecated__/renderer/utils/render-with-theme-and-intl"
import { flags } from "Core/feature-flags"
import { MenuGroupTestIds } from "Core/__deprecated__/renderer/components/rest/menu/menu-group-test-ids.enum"
import { ReduxRootState } from "Core/__deprecated__/renderer/store"
import { DeviceState } from "Core/device"
@@ -95,7 +94,6 @@ const render = (
}
describe("Device: Mudita pure", () => {
jest.spyOn(flags, "get").mockReturnValue(true)
test("matches snapshot", () => {
const { container } = render(defaultState)
@@ -153,7 +151,6 @@ describe("Device: Mudita pure", () => {
})
describe("Device: Mudita harmony", () => {
jest.spyOn(flags, "get").mockReturnValue(true)
test("matches snapshot", () => {
const { container } = render({
@@ -167,7 +164,6 @@ describe("Device: Mudita harmony", () => {
})
test("Menu should have overview item", () => {
jest.spyOn(flags, "get").mockReturnValue(true)
const { queryByTestId } = render({
...defaultState,

View File

@@ -7,7 +7,6 @@ import { defineMessages } from "react-intl"
import { DeviceType } from "Core/device/constants"
import { View, views } from "Core/__deprecated__/renderer/constants/views"
import { MenuGroupTestIds } from "Core/__deprecated__/renderer/components/rest/menu/menu-group-test-ids.enum"
import { Feature, flags } from "Core/feature-flags"
import { IconType } from "Core/__deprecated__/renderer/components/core/icon/icon-type"
const messages = defineMessages({
@@ -87,7 +86,6 @@ export interface MenuElement {
| string
icons?: IconType[]
connectedPhoneOnly?: boolean
devModeOnly?: boolean
simulatePhoneConnection?: boolean
openHelpWindow?: () => void
visibleOn?: DeviceType[]
@@ -104,7 +102,6 @@ export const baseMenuElements: MenuElement[] = [
},
],
viewKey: View.Onboarding,
devModeOnly: true,
},
{
items: [
@@ -126,14 +123,7 @@ export const deviceMenuElements: MenuElement[] = [
{
label: messages.yourPure,
items: YOUR_PURE_BUTTONS,
icons: flags.get(Feature.YourPureIconsEnabled)
? [
IconType.MenuRange,
IconType.MenuBattery,
IconType.Sim,
IconType.TetheringStatus,
]
: [],
icons: [],
connectedPhoneOnly: true,
visibleOn: [DeviceType.MuditaPure],
},

View File

@@ -5,8 +5,6 @@
import { defineMessages } from "react-intl"
import { URL_MAIN, URL_TABS } from "Core/__deprecated__/renderer/constants/urls"
import { flags } from "Core/feature-flags/helpers/feature-flag.helpers"
import { Feature } from "Core/feature-flags/constants/feature.enum"
import { IconType } from "Core/__deprecated__/renderer/components/core/icon/icon-type"
const messages = defineMessages({
@@ -14,8 +12,6 @@ const messages = defineMessages({
templates: { id: "module.templates" },
contacts: { id: "module.contacts" },
connection: { id: "module.settings.connection" },
notifications: { id: "module.settings.notifications" },
audioConversion: { id: "module.settings.audioConversion" },
backup: { id: "module.settings.backup" },
about: { id: "module.settings.about" },
})
@@ -53,18 +49,6 @@ export const tabElements: TabElement[] = [
{
parentUrl: URL_MAIN.settings,
tabs: [
{
label: messages.notifications,
url: `${URL_MAIN.settings}${URL_TABS.notifications}`,
icon: IconType.Notifications,
hidden: !flags.get(Feature.SettingsNotificationTabEnabled),
},
{
label: messages.audioConversion,
url: `${URL_MAIN.settings}${URL_TABS.audioConversion}`,
icon: IconType.MenuMusic,
hidden: !flags.get(Feature.SettingsAudioConversionTabEnabled),
},
{
label: messages.backup,
url: URL_MAIN.settings,

View File

@@ -22,8 +22,6 @@ export const URL_MAIN = {
export const URL_TABS = {
templates: "/templates",
connection: "/connection",
notifications: "/notifications",
audioConversion: "/audio-conversion",
about: "/about",
} as const

View File

@@ -1,6 +1,4 @@
{
"component.alphaWarning": "This is not an official Mudita Center version. You use the application at your own risk. Your data may be corrupted and updating your device can upload an unstable OS. Please download ",
"component.alphaWarningLink": "the last stable Mudita Center.",
"component.buttonMonthly": "Monthly",
"component.cancelButton": "Cancel",
"component.collectingDataModalAgree": "Agree",
@@ -70,11 +68,6 @@
"component.dataModalErrorDescription": "The contact you are trying to edit does not exist.",
"component.dataModalErrorWithRetryButton": "Try again",
"component.dataModalLoadingTitle": "Loading",
"component.devModeDisableAction": "Turn it off!",
"component.devModeEnabled": "Dev Mode is ready!",
"component.devModeHeader": "DEV",
"component.devModeToggle": "Toggle dev window",
"component.devModeWrapperName": "Developer Options",
"component.deviceSelection.selectDevice": "Show connected devices",
"component.deviceSelection.changeDevice": "Show connected devices",
"component.dialog.title": "Browse Files",
@@ -286,12 +279,6 @@
"module.contacts.attachment.notes": "NOTES:",
"module.contacts.authorizationFailedButton": "Retry",
"module.contacts.authorizationFailedTitle": "Authorization failed",
"module.contacts.block": "Block",
"module.contacts.blockButton": "Block",
"module.contacts.blockCancelButton": "Cancel",
"module.contacts.blockText": "Do you really want to block\n<b>the {name} contact?</b>",
"module.contacts.blockTitle": "Block contact",
"module.contacts.blockTooltipDescription": "Block contact",
"module.contacts.cancelEdit": "Cancel",
"module.contacts.contactDetails": "Contact details",
"module.contacts.delete": "Delete",
@@ -335,8 +322,6 @@
"module.contacts.favourites": "Favorites",
"module.contacts.firstAddressLine": "Address line 1",
"module.contacts.firstName": "First name",
"module.contacts.forwardNamecard": "Forward namecard",
"module.contacts.forwardTooltipDescription": "Forward namecard",
"module.contacts.googleButtonText": "Log in to Google",
"module.contacts.ice": "ICE",
"module.contacts.iceContact": "ICE contact",
@@ -400,8 +385,6 @@
"module.contacts.syncModalHelpText": "For Apple Devices, you'll need to <link>create a vCard (VCF file)</link>, then import it.",
"module.contacts.syncModalText": "To start importing contacts from your Google or Outlook accounts, simply log in to your account.",
"module.contacts.syncModalTitle": "Import contacts",
"module.contacts.unblock": "Unblock",
"module.contacts.unblockTooltipDescription": "Unblock contact",
"module.error": "Error",
"module.errorBody": "We're sorry, authentication cannot be performed at this time.",
"module.eula.actionButton": "Change device",
@@ -431,14 +414,7 @@
"module.filesManager.invalidFiledModalTitle": "Upload files",
"module.filesManager.invalidFiledModalUploadInfo": "To avoid problems we only uploaded the files that will work.",
"module.filesManager.panelSearchPlaceholder": "Search music files",
"module.filesManager.pendingUploadModalAbortButtonText": "Abort",
"module.filesManager.pendingUploadModalActionButton": "Ok",
"module.filesManager.pendingUploadModalHeader": "Files uploading",
"module.filesManager.pendingUploadModalTextDetailsInfo": "The first {count, plural, one {file} other {# files}} will be uploaded to the device.",
"module.filesManager.pendingUploadModalTextInfo": "Mudita Center cannot load all files.\nThe number of selected files exceeds the limit.",
"module.filesManager.pendingUploadModalTitle": "Upload files",
"module.filesManager.selectionNumber": "{num, plural, =-1 {All Files} one {# File} other {# Files}} selected",
"module.filesManager.tooManyFilesTooltipDescription": "The maximum number of files has been reached ({filesSlotsHarmonyMaxLimit} files)",
"module.filesManager.unsupportedFileFormatUploadModalActionButton": "OK",
"module.filesManager.unsupportedFileFormatUploadModalHeader": "Unsupported file format",
"module.filesManager.unsupportedFileFormatUploadModalTextInfo": "This file format is not supported. Please select a different file and try again.",
@@ -471,7 +447,6 @@
"module.messages.attachTemplateTooltipDescription": "Attach Template",
"module.messages.browseContactsButton": "Browse Contacts",
"module.messages.browseContactsModalTitle": "Browse Contacts",
"module.messages.callsTooltipDescription": "Call contact",
"module.messages.contactTooltipDescription": "Contact details",
"module.messages.conversationDelete": "1 conversation was deleted.",
"module.messages.conversationGroup": "Conversations",
@@ -518,7 +493,6 @@
"module.messages.marksAsReadTooltipDescription": "Mark as read",
"module.messages.marksAsUnreadTooltipDescription": "Mark as unread",
"module.messages.messageDropdownDelete": "Delete message",
"module.messages.messageDropdownForward": "Forward message",
"module.messages.messageDropdownResend": "Resend message",
"module.messages.newContactTooltipDescription": "Create new contact",
"module.messages.newMessage": "New message",
@@ -776,16 +750,6 @@
"module.settings.aboutLicense": "License",
"module.settings.aboutPrivacyPolicy": "Privacy Policy",
"module.settings.aboutTermsOfService": "Terms of service",
"module.settings.audioConversion": "Audio Conversion",
"module.settings.audioConversionAlwaysAskLabel": "Always ask",
"module.settings.audioConversionConversionFormat": "Conversion format:",
"module.settings.audioConversionConversionFormatFlacSubLabel": "High quality, large size files",
"module.settings.audioConversionConversionFormatMp3SubLabel": "Low quality, small size files",
"module.settings.audioConversionConversionFormatWavLabel": "Recommended",
"module.settings.audioConversionConversionFormatWavSubLabel": "Medium quality, normal size files",
"module.settings.audioConversionConvertAutomatically": "Convert automatically",
"module.settings.audioConversionConvertNonStandardFilesLabel": "Convert non-standard audio files",
"module.settings.audioConversionDescription": "Select what happens when uploading new music files:",
"module.settings.autostartLabel": "Autostart Mudita Center",
"module.settings.backup": "Backup",
"module.settings.backupButtonLabel": "Change location",
@@ -801,12 +765,6 @@
"module.settings.description": " ",
"module.settings.loadingSubtitle": "Checking for update",
"module.settings.loadingTitle": "Mudita Center",
"module.settings.notifications": "Notifications",
"module.settings.notificationsDescription": "Select which notifications you want to receive while using Mudita Center:",
"module.settings.notificationsIncomingCallsNotificationsLabel": "Incoming calls notifications",
"module.settings.notificationsIncomingMessagesNotifications": "Incoming messages notifications",
"module.settings.notificationsLowBatteryNotifications": "Low battery level notifications",
"module.settings.notificationsPureOsUpdatesNotifications": "PureOS updates notifications",
"module.settings.offLabel": "Off",
"module.settings.onLabel": "On",
"module.settings.privacyPolicyModalButton": "Agree",

View File

@@ -72,7 +72,6 @@ export const mapContact = (contact: GoogleContactResourceItem): Contact => {
email,
ice: false,
favourite: false,
blocked: false,
note,
}
}

View File

@@ -132,7 +132,6 @@ test("contacts are received properly", async () => {
expect(await store.dispatch.google.getContacts()).toMatchInlineSnapshot(`
Array [
Object {
"blocked": false,
"email": "example@mudita.com",
"favourite": false,
"firstAddressLine": "bomboladzka 1",
@@ -146,7 +145,6 @@ test("contacts are received properly", async () => {
"secondaryPhoneNumber": "",
},
Object {
"blocked": false,
"email": "example@mudita.com",
"favourite": false,
"firstAddressLine": "lolo 123",

View File

@@ -31,7 +31,6 @@ export class ContactBuilder implements ContactBuilderInterface {
secondAddressLine: "",
ice: false,
favourite: false,
blocked: false,
}
build(): Contact {
return { ...this.contact }

View File

@@ -4,17 +4,14 @@
*/
import auth from "Core/__deprecated__/renderer/models/auth/auth"
import devMode from "Core/__deprecated__/dev-mode/store/dev-mode"
import networkStatus from "Core/__deprecated__/renderer/models/network-status/network-status"
export interface RootModel {
auth: typeof auth
devMode: typeof devMode
networkStatus: typeof networkStatus
}
export const models: RootModel = {
auth,
devMode,
networkStatus,
}

View File

@@ -1,50 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
import { init } from "@rematch/core"
import devMode from "Core/__deprecated__/dev-mode/store/dev-mode"
import appContextMenu from "Core/__deprecated__/renderer/wrappers/app-context-menu"
import registerAppContextMenu from "./register-app-context-menu"
import ContextMenu from "Core/__deprecated__/context-menu/context-menu"
const storeMock = init({
models: {
devMode,
},
})
jest.mock("@electron/remote", () => ({
app: {
getPath: () => "/mocked/path",
},
}))
jest.mock(
"Core/__deprecated__/renderer/store",
jest.fn().mockReturnValueOnce({
getState: () => storeMock.getState(),
})
)
jest.mock("Core/__deprecated__/context-menu/context-menu")
test("calls ContextMenu registerItems method with proper attributes", () => {
registerAppContextMenu(appContextMenu)
expect(
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
(ContextMenu as jest.Mock).mock.instances[0].registerItems.mock.calls[0][0]
).toEqual("Device")
expect(
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
(ContextMenu as jest.Mock).mock.instances[0].registerItems.mock.calls[1][0]
).toEqual("Messages")
expect(
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
(ContextMenu as jest.Mock).mock.instances[0].registerItems.mock.calls[2][0]
).toEqual("Contacts")
})

View File

@@ -1,40 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
import store from "Core/__deprecated__/renderer/store"
import ContextMenu from "Core/__deprecated__/context-menu/context-menu"
import contactsContextMenu from "Core/contacts/helpers/context-menu/context-menu"
import importDeviceLogFiles from "Core/__deprecated__/renderer/requests/import-device-log-files.request"
import importDeviceCrashDumpFiles from "Core/__deprecated__/renderer/requests/import-device-crash-dumps-files.request"
import { clearAllThreads } from "Core/messages/actions/base.action"
import getAppPath from "Core/__deprecated__/main/utils/get-app-path"
const cwd = getAppPath("pure-logs")
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
const registerAppContextMenu = (menu: ContextMenu) => {
menu.registerItems("Device", [
{
label: "Download logs file",
click: () => importDeviceLogFiles(cwd),
},
{
label: "Download crash dumps file",
click: () => importDeviceCrashDumpFiles(cwd),
},
])
menu.registerItems("Messages", [
{
label: "Clear all threads",
click: () => store.dispatch(clearAllThreads()),
},
])
menu.registerItems("Contacts", contactsContextMenu)
}
export default registerAppContextMenu

View File

@@ -10,20 +10,12 @@ import {
testQuestion,
testSeedCollectionIds,
} from "Core/__deprecated__/seeds/help"
import { ConversionFormat, Convert } from "Core/settings/constants"
import { Settings } from "Core/settings/dto"
export const fakeAppSettings: Settings = {
applicationId: "app-Nr8uiSV7KmWxX3WOFqZPF7uB",
autostart: false,
tethering: false,
incomingCalls: false,
incomingMessages: false,
lowBattery: false,
osUpdates: false,
nonStandardAudioFilesConversion: false,
convert: Convert.ConvertAutomatically,
conversionFormat: ConversionFormat.WAV,
tray: true,
osBackupLocation: `fake/path/pure/phone/backups/`,
osDownloadLocation: `fake/path/pure/os/downloads/`,

View File

@@ -1,17 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
import ContextMenu from "Core/__deprecated__/context-menu/context-menu"
import {
isDevModeEnabled,
toggleDevMode,
} from "Core/__deprecated__/dev-mode/store/dev-mode.helpers"
const appContextMenu = new ContextMenu({
isEnabled: isDevModeEnabled,
toggler: toggleDevMode,
})
export default appContextMenu

View File

@@ -1,81 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
import * as React from "react"
import {
backgroundColor,
textColor,
} from "Core/core/styles/theming/theme-getters"
import { FunctionComponent } from "Core/core/types/function-component.interface"
import { intl } from "Core/__deprecated__/renderer/utils/intl"
import styled from "styled-components"
import Text, {
TextDisplayStyle,
} from "Core/__deprecated__/renderer/components/core/text/text.component"
import { defineMessages } from "react-intl"
import { IconType } from "Core/__deprecated__/renderer/components/core/icon/icon-type"
import Icon from "Core/__deprecated__/renderer/components/core/icon/icon.component"
import { Close } from "Core/__deprecated__/renderer/components/core/modal/modal.styled.elements"
import { DisplayStyle } from "Core/__deprecated__/renderer/components/core/button/button.config"
const messages = defineMessages({
warning: {
id: "component.alphaWarning",
},
button: { id: "component.alphaWarningLink" },
})
const Warning = styled.div`
background-color: ${backgroundColor("modal")};
padding: 2.4rem;
box-shadow: 0 0.2rem 3rem rgba(0, 0, 0, 0.0793816);
border-radius: 0.4rem;
z-index: 1;
margin: 2.4rem 3.2rem 0;
display: flex;
justify-content: flex-start;
align-items: center;
`
const WarningIconWrapper = styled.div`
margin-right: 2.4rem;
`
const ReleaseLink = styled.a`
font-weight: bold;
text-decoration: underline;
color: ${textColor("warning")};
padding: 0.1rem 0.3rem;
&:hover {
background-color: ${backgroundColor("minor")};
}
`
interface Props {
onClose: () => void
}
const AlphaReleaseWarning: FunctionComponent<Props> = ({ onClose }) => {
const url = "https://mudita.com/products/software-apps/mudita-center/"
return (
<Warning>
<WarningIconWrapper>
<Icon type={IconType.Warning} width={2.4} />
</WarningIconWrapper>
<Text displayStyle={TextDisplayStyle.Paragraph1} color="warning">
{intl.formatMessage(messages.warning)}
<ReleaseLink target="_blank" href={url}>
{intl.formatMessage(messages.button)}
</ReleaseLink>
</Text>
<Close
displayStyle={DisplayStyle.IconOnly}
onClick={onClose}
Icon={IconType.Close}
/>
</Warning>
)
}
export default AlphaReleaseWarning

View File

@@ -18,8 +18,6 @@ import { FunctionComponent } from "Core/core/types/function-component.interface"
import { intl } from "Core/__deprecated__/renderer/utils/intl"
import styled from "styled-components"
import { IconSize } from "Core/__deprecated__/renderer/components/core/icon/icon.component"
import { Feature, flags } from "Core/feature-flags"
import AlphaReleaseWarning from "Core/__deprecated__/renderer/wrappers/components/alpha-release-warning.component"
import DeviceSelectDrawer from "Core/device-select/components/device-select-drawer.component"
const Layout = styled.div`
@@ -62,8 +60,6 @@ const ViewWrapper = styled.div`
`
const LayoutDesktopWrapper: FunctionComponent = ({ children }) => {
const [warningOpen, setWarningOpen] = React.useState<boolean>(true)
const handleCloseWarning = () => setWarningOpen(false)
return (
<Layout>
<MenuWrapper>
@@ -85,9 +81,6 @@ const LayoutDesktopWrapper: FunctionComponent = ({ children }) => {
/>
</HeaderWrapper>
<ViewWrapper>
{flags.get(Feature.AlphaRelaseWarning) && warningOpen && (
<AlphaReleaseWarning onClose={handleCloseWarning} />
)}
{children}
<DeviceSelectDrawer />
</ViewWrapper>

View File

@@ -20,7 +20,6 @@ export const contactsSeedInput: Contact[] = [
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
},
@@ -34,7 +33,6 @@ export const contactsSeedInput: Contact[] = [
note: "sapiente rem dignissimos sunt",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "3284 Klocko Plains",
secondAddressLine: "",
},
@@ -48,7 +46,6 @@ export const contactsSeedInput: Contact[] = [
note: "voluptatem expedita vel",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "55727 Kelly Expressway",
secondAddressLine: "",
},
@@ -62,7 +59,6 @@ export const contactsSeedInput: Contact[] = [
note: "ipsum numquam fugiat",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "Estevanburgh",
},
@@ -76,7 +72,6 @@ export const contactsSeedInput: Contact[] = [
note: "dolorem",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "Lake Lonie",
},
@@ -90,7 +85,6 @@ export const contactsSeedInput: Contact[] = [
note: "sequi recusandae eveniet",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "36324 Norval Flat",
secondAddressLine: "",
},
@@ -104,7 +98,6 @@ export const contactsSeedInput: Contact[] = [
note: "quibusdam autem neque consequatur",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "",
secondAddressLine: "Effertzchester",
},
@@ -118,7 +111,6 @@ export const contactsSeedInput: Contact[] = [
note: "distinctio itaque",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "05994 Romaguera Bypass",
secondAddressLine: "",
},
@@ -132,7 +124,6 @@ export const contactsSeedInput: Contact[] = [
note: "culpa deserunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "80462 Bednar Courts",
secondAddressLine: "",
},
@@ -146,7 +137,6 @@ export const contactsSeedInput: Contact[] = [
note: "et corrupti fugit perspiciatis",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "6209 Ruth Ports",
secondAddressLine: "",
},
@@ -160,7 +150,6 @@ export const contactsSeedInput: Contact[] = [
note: "sint quasi quis saepe",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "West Gaetano",
},
@@ -174,7 +163,6 @@ export const contactsSeedInput: Contact[] = [
note: "ducimus provident",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "New Coty",
},
@@ -188,7 +176,6 @@ export const contactsSeedInput: Contact[] = [
note: "molestias et dolorum",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "Saulland",
},
@@ -202,7 +189,6 @@ export const contactsSeedInput: Contact[] = [
note: "minima dolorem vero eveniet",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "973 Mraz Knoll",
secondAddressLine: "",
},
@@ -216,7 +202,6 @@ export const contactsSeedInput: Contact[] = [
note: "sed",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "Hardytown",
},
@@ -230,7 +215,6 @@ export const contactsSeedInput: Contact[] = [
note: "saepe laboriosam",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "77170 MacGyver Pine",
secondAddressLine: "Uptontown",
},
@@ -244,7 +228,6 @@ export const contactsSeedInput: Contact[] = [
note: "aut rerum",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "980 Feeney Bypass",
secondAddressLine: "",
},
@@ -258,7 +241,6 @@ export const contactsSeedInput: Contact[] = [
note: "harum aut quia",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "9885 Lavinia Village",
secondAddressLine: "",
},
@@ -272,7 +254,6 @@ export const contactsSeedInput: Contact[] = [
note: "voluptate quis est et",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "1301 Gaylord Divide",
secondAddressLine: "",
},
@@ -286,7 +267,6 @@ export const contactsSeedInput: Contact[] = [
note: "eum",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -300,7 +280,6 @@ export const contactsSeedInput: Contact[] = [
note: "et sunt omnis",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "478 Reilly Meadow",
secondAddressLine: "East Belle",
},
@@ -314,7 +293,6 @@ export const contactsSeedInput: Contact[] = [
note: "tempore non",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -328,7 +306,6 @@ export const contactsSeedInput: Contact[] = [
note: "at consectetur ducimus",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -342,7 +319,6 @@ export const contactsSeedInput: Contact[] = [
note: "consequuntur sapiente aspernatur",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -356,7 +332,6 @@ export const contactsSeedInput: Contact[] = [
note: "fugiat qui",
ice: true,
favourite: true,
blocked: false,
speedDial: 3,
firstAddressLine: "",
secondAddressLine: "",
@@ -371,7 +346,6 @@ export const contactsSeedInput: Contact[] = [
note: "provident quos nulla ipsum",
ice: false,
favourite: false,
blocked: false,
speedDial: 2,
firstAddressLine: "",
secondAddressLine: "",
@@ -386,7 +360,6 @@ export const contactsSeedInput: Contact[] = [
note: "qui possimus",
ice: false,
favourite: false,
blocked: false,
speedDial: 7,
firstAddressLine: "6618 Veum Turnpike",
secondAddressLine: "",
@@ -401,7 +374,6 @@ export const contactsSeedInput: Contact[] = [
note: "nihil",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "45453 Clarabelle Alley",
secondAddressLine: "",
},
@@ -415,7 +387,6 @@ export const contactsSeedInput: Contact[] = [
note: "autem mollitia doloremque",
ice: false,
favourite: true,
blocked: false,
speedDial: 8,
firstAddressLine: "935 Gwen Park",
secondAddressLine: "",
@@ -430,7 +401,6 @@ export const contactsSeedInput: Contact[] = [
note: "quasi suscipit sit",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "",
secondAddressLine: "Rennerfurt",
},
@@ -444,7 +414,6 @@ export const contactsSeedInput: Contact[] = [
note: "rerum consequatur qui quia",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "5630 Yundt Motorway",
secondAddressLine: "Legroshaven",
},
@@ -458,7 +427,6 @@ export const contactsSeedInput: Contact[] = [
note: "quia cum",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -472,7 +440,6 @@ export const contactsSeedInput: Contact[] = [
note: "aut voluptate nisi sit",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -486,7 +453,6 @@ export const contactsSeedInput: Contact[] = [
note: "possimus",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -500,7 +466,6 @@ export const contactsSeedInput: Contact[] = [
note: "temporibus molestiae",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "016 McClure Curve",
secondAddressLine: "",
},
@@ -514,7 +479,6 @@ export const contactsSeedInput: Contact[] = [
note: "explicabo aspernatur impedit velit",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "08979 Kathleen Garden",
secondAddressLine: "West Everettefurt",
},
@@ -528,7 +492,6 @@ export const contactsSeedInput: Contact[] = [
note: "voluptates et dolorem ad",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "8035 Rempel Crescent",
secondAddressLine: "Streichborough",
},
@@ -542,7 +505,6 @@ export const contactsSeedInput: Contact[] = [
note: "accusantium quod",
ice: false,
favourite: false,
blocked: false,
speedDial: 9,
firstAddressLine: "",
secondAddressLine: "",
@@ -557,7 +519,6 @@ export const contactsSeedInput: Contact[] = [
note: "ut ut magni",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -571,7 +532,6 @@ export const contactsSeedInput: Contact[] = [
note: "accusantium quos velit quo",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "63863 Fausto Points",
secondAddressLine: "Trentonfort",
},
@@ -585,7 +545,6 @@ export const contactsSeedInput: Contact[] = [
note: "labore aut qui eum",
ice: true,
favourite: true,
blocked: false,
firstAddressLine: "0728 Kassulke Land",
secondAddressLine: "",
},
@@ -599,7 +558,6 @@ export const contactsSeedInput: Contact[] = [
note: "voluptatem quo et totam",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -613,7 +571,6 @@ export const contactsSeedInput: Contact[] = [
note: "aut",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "742 Nicolas Center",
secondAddressLine: "",
},
@@ -627,7 +584,6 @@ export const contactsSeedInput: Contact[] = [
note: "et",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "1480 Upton Flat",
secondAddressLine: "East Kearaville",
},
@@ -641,7 +597,6 @@ export const contactsSeedInput: Contact[] = [
note: "possimus quasi optio rerum",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "2101 Daniel Tunnel",
secondAddressLine: "Medhurstfort",
},
@@ -655,7 +610,6 @@ export const contactsSeedInput: Contact[] = [
note: "distinctio",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "1820 Ziemann Via",
secondAddressLine: "O'Connellburgh",
},
@@ -669,7 +623,6 @@ export const contactsSeedInput: Contact[] = [
note: "dignissimos aperiam",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -683,7 +636,6 @@ export const contactsSeedInput: Contact[] = [
note: "ratione rerum aut dolores",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "01684 Otilia Flat",
secondAddressLine: "South Ardella",
},
@@ -697,7 +649,6 @@ export const contactsSeedInput: Contact[] = [
note: "dolore voluptate porro",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -711,7 +662,6 @@ export const contactsSeedInput: Contact[] = [
note: "qui quibusdam",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -725,7 +675,6 @@ export const contactsSeedInput: Contact[] = [
note: "id rerum et magnam",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -739,7 +688,6 @@ export const contactsSeedInput: Contact[] = [
note: "impedit ut cupiditate",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -753,7 +701,6 @@ export const contactsSeedInput: Contact[] = [
note: "repellat occaecati",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -767,7 +714,6 @@ export const contactsSeedInput: Contact[] = [
note: "minima consequatur hic",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "7301 Beer Haven",
secondAddressLine: "",
},
@@ -781,7 +727,6 @@ export const contactsSeedInput: Contact[] = [
note: "ut aliquid ex",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -795,7 +740,6 @@ export const contactsSeedInput: Contact[] = [
note: "fugiat culpa",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -809,7 +753,6 @@ export const contactsSeedInput: Contact[] = [
note: "quia aliquid non non",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "491 Kertzmann Locks",
secondAddressLine: "North Horacio",
},
@@ -823,7 +766,6 @@ export const contactsSeedInput: Contact[] = [
note: "adipisci voluptas",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "3297 Garrison Brooks",
secondAddressLine: "",
},
@@ -837,7 +779,6 @@ export const contactsSeedInput: Contact[] = [
note: "nam quia rerum",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "",
secondAddressLine: "New Guyberg",
},
@@ -851,7 +792,6 @@ export const contactsSeedInput: Contact[] = [
note: "consequatur",
ice: true,
favourite: true,
blocked: false,
firstAddressLine: "043 Braulio Cape",
secondAddressLine: "Lake Georgette",
},
@@ -865,7 +805,6 @@ export const contactsSeedInput: Contact[] = [
note: "et",
ice: false,
favourite: false,
blocked: false,
speedDial: 5,
firstAddressLine: "0692 Ara Rapids",
secondAddressLine: "",
@@ -880,7 +819,6 @@ export const contactsSeedInput: Contact[] = [
note: "nostrum dicta totam",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -894,7 +832,6 @@ export const contactsSeedInput: Contact[] = [
note: "possimus et doloremque ex",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "19856 Keegan Spurs",
secondAddressLine: "New Eileen",
},
@@ -908,7 +845,6 @@ export const contactsSeedInput: Contact[] = [
note: "eius id",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -922,7 +858,6 @@ export const contactsSeedInput: Contact[] = [
note: "repudiandae sint nihil perspiciatis",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -936,7 +871,6 @@ export const contactsSeedInput: Contact[] = [
note: "eligendi",
ice: false,
favourite: true,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -950,7 +884,6 @@ export const contactsSeedInput: Contact[] = [
note: "atque aut exercitationem quia",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "2669 Kihn Alley",
secondAddressLine: "West Gerda",
},
@@ -964,7 +897,6 @@ export const contactsSeedInput: Contact[] = [
note: "sunt praesentium",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "North Sylvan",
},
@@ -978,7 +910,6 @@ export const contactsSeedInput: Contact[] = [
note: "tenetur",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "New Maybelleview",
},
@@ -992,7 +923,6 @@ export const contactsSeedInput: Contact[] = [
note: "et",
ice: true,
favourite: true,
blocked: false,
firstAddressLine: "1891 Darrick Bypass",
secondAddressLine: "",
},
@@ -1006,7 +936,6 @@ export const contactsSeedInput: Contact[] = [
note: "tenetur voluptas",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -1020,7 +949,6 @@ export const contactsSeedInput: Contact[] = [
note: "atque",
ice: false,
favourite: true,
blocked: false,
firstAddressLine: "80283 Dashawn Mews",
secondAddressLine: "",
},
@@ -1034,7 +962,6 @@ export const contactsSeedInput: Contact[] = [
note: "placeat odit quidem dolorem",
ice: false,
favourite: false,
blocked: false,
speedDial: 6,
firstAddressLine: "",
secondAddressLine: "South Pamelahaven",
@@ -1049,7 +976,6 @@ export const contactsSeedInput: Contact[] = [
note: "molestiae dicta ut",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "66831 Darrin Shoal",
secondAddressLine: "Ellsworthshire",
},
@@ -1063,7 +989,6 @@ export const contactsSeedInput: Contact[] = [
note: "omnis quia ea",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "53692 Giovanni Loop",
secondAddressLine: "Port Chanelle",
},
@@ -1077,7 +1002,6 @@ export const contactsSeedInput: Contact[] = [
note: "nostrum",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "7133 Erdman Summit",
secondAddressLine: "",
},
@@ -1091,7 +1015,6 @@ export const contactsSeedInput: Contact[] = [
note: "similique dolorem enim",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "North Felixmouth",
},
@@ -1105,7 +1028,6 @@ export const contactsSeedInput: Contact[] = [
note: "debitis deserunt ea et",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "03941 Alphonso Orchard",
secondAddressLine: "Mullerfort",
},
@@ -1119,7 +1041,6 @@ export const contactsSeedInput: Contact[] = [
note: "autem cumque animi",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "56400 Jordan Oval",
secondAddressLine: "East Marjory",
},
@@ -1133,7 +1054,6 @@ export const contactsSeedInput: Contact[] = [
note: "minima",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -1147,7 +1067,6 @@ export const contactsSeedInput: Contact[] = [
note: "quasi molestiae velit",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "017 Bashirian Forges",
secondAddressLine: "Maryseport",
},
@@ -1161,7 +1080,6 @@ export const contactsSeedInput: Contact[] = [
note: "nisi est",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "Browntown",
},
@@ -1175,7 +1093,6 @@ export const contactsSeedInput: Contact[] = [
note: "quas",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -1189,7 +1106,6 @@ export const contactsSeedInput: Contact[] = [
note: "cum aut voluptatem sunt",
ice: false,
favourite: true,
blocked: false,
firstAddressLine: "30177 Altenwerth Trace",
secondAddressLine: "East Percivalberg",
},
@@ -1203,7 +1119,6 @@ export const contactsSeedInput: Contact[] = [
note: "beatae dolores voluptatibus numquam",
ice: false,
favourite: false,
blocked: false,
speedDial: 4,
firstAddressLine: "",
secondAddressLine: "",
@@ -1218,7 +1133,6 @@ export const contactsSeedInput: Contact[] = [
note: "cum voluptas",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "Feestview",
},
@@ -1232,7 +1146,6 @@ export const contactsSeedInput: Contact[] = [
note: "molestias in",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "Kiehntown",
},
@@ -1246,7 +1159,6 @@ export const contactsSeedInput: Contact[] = [
note: "sequi sunt nisi",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "09136 Linda Spring",
secondAddressLine: "",
},
@@ -1260,7 +1172,6 @@ export const contactsSeedInput: Contact[] = [
note: "quibusdam",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "81120 Alejandra Island",
secondAddressLine: "Konopelskiview",
},
@@ -1274,7 +1185,6 @@ export const contactsSeedInput: Contact[] = [
note: "voluptate repellendus tempora",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "Blancaburgh",
},
@@ -1288,7 +1198,6 @@ export const contactsSeedInput: Contact[] = [
note: "dolores deleniti sunt doloremque",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "062 Anastasia Points",
secondAddressLine: "South Raphael",
},
@@ -1302,7 +1211,6 @@ export const contactsSeedInput: Contact[] = [
note: "qui",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "461 O'Conner Trace",
secondAddressLine: "",
},
@@ -1316,7 +1224,6 @@ export const contactsSeedInput: Contact[] = [
note: "consequatur ea commodi fugit",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "",
secondAddressLine: "Toybury",
},
@@ -1330,7 +1237,6 @@ export const contactsSeedInput: Contact[] = [
note: "voluptas aliquid aut",
ice: false,
favourite: true,
blocked: false,
firstAddressLine: "43478 Kiley Spurs",
secondAddressLine: "",
},
@@ -1344,7 +1250,6 @@ export const contactsSeedInput: Contact[] = [
note: "nesciunt tenetur praesentium",
ice: true,
favourite: true,
blocked: false,
firstAddressLine: "",
secondAddressLine: "Kochmouth",
},
@@ -1358,7 +1263,6 @@ export const contactsSeedInput: Contact[] = [
note: "non minima sed voluptatibus",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "83085 Stamm Lock",
secondAddressLine: "North Merle",
},
@@ -1372,7 +1276,6 @@ export const contactsSeedInput: Contact[] = [
note: "qui nesciunt",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "83765 Rigoberto Mount",
secondAddressLine: "",
},
@@ -1386,7 +1289,6 @@ export const contactsSeedInput: Contact[] = [
note: "beatae",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -1400,7 +1302,6 @@ export const contactsSeedInput: Contact[] = [
note: "magni sit dicta",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "568 Rohan Brook",
secondAddressLine: "Carolynefort",
},
@@ -1414,7 +1315,6 @@ export const contactsSeedInput: Contact[] = [
note: "molestiae quod",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "19913 Nicholas Brook",
secondAddressLine: "",
},
@@ -1428,7 +1328,6 @@ export const contactsSeedInput: Contact[] = [
note: "fuga qui minus",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -1442,7 +1341,6 @@ export const contactsSeedInput: Contact[] = [
note: "consequatur",
ice: true,
favourite: true,
blocked: false,
firstAddressLine: "043 Braulio Cape",
secondAddressLine: "Lake Georgette",
},
@@ -1456,7 +1354,6 @@ export const contactsSeedInput: Contact[] = [
note: "",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -1470,7 +1367,6 @@ export const contactsSeedInput: Contact[] = [
note: "",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -1484,7 +1380,6 @@ export const contactsSeedInput: Contact[] = [
note: "",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -1498,7 +1393,6 @@ export const contactsSeedInput: Contact[] = [
note: "",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -1512,7 +1406,6 @@ export const contactsSeedInput: Contact[] = [
note: "",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},

View File

@@ -25,7 +25,6 @@ const contact: Contact = {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}

View File

@@ -28,7 +28,6 @@ const newContact: NewContact = {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}

View File

@@ -29,7 +29,6 @@ const contact: Contact = {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}
@@ -67,8 +66,8 @@ describe("async `deleteContacts` ", () => {
const mockStore = createMockStore([thunk])({
contacts: initialState,
deviceManager: {
activeDeviceId: ""
}
activeDeviceId: "",
},
})
const {
meta: { requestId },
@@ -101,8 +100,8 @@ describe("async `deleteContacts` ", () => {
const mockStore = createMockStore([thunk])({
contacts: initialState,
deviceManager: {
activeDeviceId: ""
}
activeDeviceId: "",
},
})
const {
meta: { requestId },
@@ -129,8 +128,8 @@ describe("async `deleteContacts` ", () => {
const mockStore = createMockStore([thunk])({
contacts: initialState,
deviceManager: {
activeDeviceId: ""
}
activeDeviceId: "",
},
})
const {
meta: { requestId },

View File

@@ -29,7 +29,6 @@ const contact: Contact = {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}
@@ -79,10 +78,7 @@ describe("async `editContact` ", () => {
describe("when `editContactRequest` request return error", () => {
test("fire async `editContact` returns `rejected` action", async () => {
;(editContactRequest as jest.Mock).mockReturnValue(errorDeviceResponse)
const errorMock = new AppError(
ContactsEvent.EditContact,
"Edit Contact request failed"
)
const errorMock = new AppError(ContactsEvent.EditContact, "Edit Contact request failed")
const mockStore = createMockStore([thunk])({
contacts: initialState,
})

View File

@@ -15,6 +15,9 @@ export const editContact = createAsyncThunk<Error | undefined, Contact>(
async (contact, { dispatch, rejectWithValue }) => {
const { data, error } = await editContactRequest(contact)
console.log("data: ", data)
console.log("error: ", error)
if (error || !data) {
return rejectWithValue(
new AppError(ContactsEvent.EditContact, "Edit Contact request failed")

View File

@@ -35,7 +35,6 @@ const newContact: NewContact = {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}

View File

@@ -1,86 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
import React from "react"
import { FunctionComponent } from "Core/core/types/function-component.interface"
import Modal from "Core/__deprecated__/renderer/components/core/modal/modal.component"
import { ModalSize } from "Core/__deprecated__/renderer/components/core/modal/modal.interface"
import { noop } from "Core/__deprecated__/renderer/utils/noop"
import styled from "styled-components"
import Text, {
TextDisplayStyle,
} from "Core/__deprecated__/renderer/components/core/text/text.component"
import { defineMessages } from "react-intl"
import { intl, textFormatters } from "Core/__deprecated__/renderer/utils/intl"
import Icon from "Core/__deprecated__/renderer/components/core/icon/icon.component"
import { LoaderType } from "Core/__deprecated__/renderer/components/core/loader/loader.interface"
import Loader from "Core/__deprecated__/renderer/components/core/loader/loader.component"
import { createFullName } from "Core/contacts/helpers/contacts.helpers"
import { Contact } from "Core/contacts/reducers/contacts.interface"
import { IconType } from "Core/__deprecated__/renderer/components/core/icon/icon-type"
const ModalContent = styled.div`
display: flex;
flex-direction: column;
align-items: center;
p {
white-space: pre-wrap;
text-align: center;
line-height: 2.2rem;
margin-top: 3.2rem;
}
`
const messages = defineMessages({
title: { id: "module.contacts.blockTitle" },
text: { id: "module.contacts.blockText" },
cancelButton: { id: "module.contacts.blockCancelButton" },
blockButton: { id: "module.contacts.blockButton" },
})
interface DeleteContactModalProps {
contact: Contact
onBlock?: () => void
onClose?: () => void
blocking?: boolean
}
const BlockContactModal: FunctionComponent<DeleteContactModalProps> = ({
onBlock = noop,
onClose = noop,
blocking,
contact,
}) => {
return (
<Modal
title={intl.formatMessage(messages.title)}
size={ModalSize.Small}
onActionButtonClick={onBlock}
actionButtonLabel={
blocking ? (
<Loader size={2} type={LoaderType.Spinner} />
) : (
intl.formatMessage(messages.blockButton)
)
}
onClose={onClose}
closeButtonLabel={intl.formatMessage(messages.cancelButton)}
>
<ModalContent>
<Icon type={IconType.DeleteBig} width={12} height={12} />
<Text
displayStyle={TextDisplayStyle.Paragraph3}
message={{
...messages.text,
values: { name: createFullName(contact), ...textFormatters },
}}
/>
</ModalContent>
</Modal>
)
}
export default BlockContactModal

View File

@@ -4,13 +4,11 @@
*/
import React from "react"
import { defineMessages } from "react-intl"
import { FunctionComponent } from "Core/core/types/function-component.interface"
import { SidebarHeaderButton } from "Core/__deprecated__/renderer/components/core/table/table.component"
import Icon from "Core/__deprecated__/renderer/components/core/icon/icon.component"
import ButtonComponent from "Core/__deprecated__/renderer/components/core/button/button.component"
import { DisplayStyle } from "Core/__deprecated__/renderer/components/core/button/button.config"
import { intl } from "Core/__deprecated__/renderer/utils/intl"
import { defineMessages } from "react-intl"
import { noop } from "Core/__deprecated__/renderer/utils/noop"
import {
AdditionalInfo,
@@ -24,7 +22,6 @@ import {
Name,
} from "Core/contacts/components/contact-details/contact-details.styled"
import { ContactDetailsTestIds } from "Core/contacts/components/contact-details/contact-details-test-ids.enum"
import { flags, Feature } from "Core/feature-flags"
import { Contact } from "Core/contacts/reducers/contacts.interface"
import Text, {
TextDisplayStyle,
@@ -34,7 +31,6 @@ import { IconType } from "Core/__deprecated__/renderer/components/core/icon/icon
const messages = defineMessages({
favourites: { id: "module.contacts.favourites" },
speedDial: { id: "module.contacts.speedDial" },
blocked: { id: "module.contacts.detailsBlocked" },
information: { id: "module.contacts.information" },
address: { id: "module.contacts.detailsAddress" },
notes: { id: "module.contacts.notes" },
@@ -48,76 +44,27 @@ const messages = defineMessages({
exportTooltipDescription: { id: "module.contacts.exportTooltipDescription" },
deleteTooltipDescription: { id: "module.contacts.deleteTooltipDescription" },
editTooltipDescription: { id: "module.contacts.editTooltipDescription" },
forwardTooltipDescription: {
id: "module.contacts.forwardTooltipDescription",
},
unblockTooltipDescription: {
id: "module.contacts.unblockTooltipDescription",
},
blockTooltipDescription: { id: "module.contacts.blockTooltipDescription" },
})
interface ContactDetailsProps {
contact?: Contact
onExport: (ids: string[]) => void
onForward: (contact: Contact) => void
onBlock: (contact: Contact) => void
onUnblock: (contact: Contact) => void
onDelete: (id: string) => void
onEdit: (contact: Contact) => void
onCall: (phoneNumber: string) => void
onMessage: (phoneNumber: string) => void
onClose: () => void
isThreadOpened: (phoneNumber: string) => boolean
}
export const phoneActions = (
phoneNumber: string,
messageDisabled: boolean,
onCall: (input: string) => void,
onMessage: (input: string) => void
): JSX.Element[] => {
const callHandler = () => onCall(phoneNumber)
const messageHandler = () => onMessage(phoneNumber)
return [
<ButtonComponent
displayStyle={DisplayStyle.InputIcon}
Icon={IconType.Calls}
key="Call"
onClick={callHandler}
/>,
<ButtonComponent
disabled={messageDisabled}
displayStyle={DisplayStyle.InputIcon}
Icon={IconType.Message}
key="Message"
onClick={messageHandler}
/>,
]
}
const ContactDetails: FunctionComponent<ContactDetailsProps> = ({
contact,
onEdit,
onExport,
onForward,
onUnblock,
onBlock,
onDelete,
onCall,
onMessage,
isThreadOpened,
onClose,
}) => {
if (contact) {
const handleEdit = () => onEdit(contact)
const handleExport = () => onExport([contact.id])
const handleForward = () => onForward(contact)
const handleBlock = () => onBlock(contact)
const handleUnblock = () => onUnblock(contact)
const handleDelete = () => onDelete(contact.id)
const handleMessage = (phoneNumber: string) => onMessage(phoneNumber)
const icons = (
<>
@@ -132,32 +79,11 @@ const ContactDetails: FunctionComponent<ContactDetailsProps> = ({
onClick={handleExport}
data-testid={ContactDetailsTestIds.ExportButton}
/>
{flags.get(Feature.ContactForwardEnabled) && (
<SidebarHeaderButton
description={messages.forwardTooltipDescription}
iconType={IconType.Forward}
onClick={handleForward}
/>
)}
<SidebarHeaderButton
description={messages.editTooltipDescription}
iconType={IconType.Edit}
onClick={handleEdit}
/>
{flags.get(Feature.ContactBlockingEnabled) &&
(contact.blocked ? (
<SidebarHeaderButton
description={messages.unblockTooltipDescription}
iconType={IconType.Blocked}
onClick={handleUnblock}
/>
) : (
<SidebarHeaderButton
description={messages.blockTooltipDescription}
iconType={IconType.Blocked}
onClick={handleBlock}
/>
))}
</>
)
@@ -212,38 +138,12 @@ const ContactDetails: FunctionComponent<ContactDetailsProps> = ({
data-testid={ContactDetailsTestIds.PrimaryPhoneInput}
value={contact.primaryPhoneNumber ?? ""}
label={intl.formatMessage(messages.noPrimaryNumber)}
// TODO: Implement additional toggles for this feature
trailingIcons={
contact.primaryPhoneNumber
? flags.get(Feature.ContactPhoneFieldIconsEnabled)
? phoneActions(
contact.primaryPhoneNumber,
!isThreadOpened(contact.primaryPhoneNumber),
onCall,
handleMessage
)
: undefined
: undefined
}
/>
<Input
type={"text"}
data-testid={ContactDetailsTestIds.SecondaryPhoneInput}
value={contact.secondaryPhoneNumber ?? ""}
label={intl.formatMessage(messages.noSecondNumber)}
// TODO: Implement additional toggles for this feature
trailingIcons={
contact.secondaryPhoneNumber
? flags.get(Feature.ContactPhoneFieldIconsEnabled)
? phoneActions(
contact.secondaryPhoneNumber,
!isThreadOpened(contact.secondaryPhoneNumber),
onCall,
handleMessage
)
: undefined
: undefined
}
/>
</div>
)}

View File

@@ -12,16 +12,10 @@ import { Contact } from "Core/contacts/reducers"
type Props = ComponentProps<typeof ContactDetails>
const defaultProps: Props = {
onUnblock: jest.fn(),
onBlock: jest.fn(),
onCall: jest.fn(),
onDelete: jest.fn(),
onEdit: jest.fn(),
onExport: jest.fn(),
onForward: jest.fn(),
onMessage: jest.fn(),
onClose: jest.fn(),
isThreadOpened: () => false,
}
const contactRich: Contact = {
@@ -34,7 +28,6 @@ const contactRich: Contact = {
note: "sapiente rem dignissimos sunt",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}
@@ -49,7 +42,6 @@ const contactBasic: Contact = {
note: "",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "",
secondAddressLine: "",
}

View File

@@ -77,7 +77,6 @@ export const defaultContact = {
firstAddressLine: "",
secondAddressLine: "",
favourite: false,
blocked: false,
speedDial: undefined,
ice: false,
} as NewContact

View File

@@ -20,7 +20,6 @@ const contactData: NewContact = {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Baker street 221, London",
secondAddressLine: "",
}

View File

@@ -25,7 +25,6 @@ const contacts = [
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Baker street 221, London",
secondAddressLine: "",
},
@@ -39,7 +38,6 @@ const contacts = [
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
},
@@ -53,7 +51,6 @@ const contacts = [
note: "sapiente rem dignissimos sunt",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "3284 Klocko Plains",
secondAddressLine: "",
},
@@ -67,7 +64,6 @@ const contacts = [
note: "voluptatem expedita vel",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "55727 Kelly Expressway",
secondAddressLine: "",
},
@@ -81,7 +77,6 @@ const contacts = [
note: "ipsum numquam fugiat",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "Estevanburgh",
},
@@ -95,7 +90,6 @@ const contacts = [
note: "dolorem",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "Lake Lonie",
},
@@ -109,7 +103,6 @@ const contacts = [
note: "sequi recusandae eveniet",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "36324 Norval Flat",
secondAddressLine: "",
},

View File

@@ -17,7 +17,6 @@ const contacts: Contact[] = [
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
},

View File

@@ -18,9 +18,6 @@ export interface ContactListProps {
toggleRow: (id: string) => void
selectedItems: string[]
onExport: (ids: string[]) => void
onForward: (contact: Contact) => void
onBlock: (contact: Contact) => void
onUnblock: (contact: Contact) => void
onDelete: (id: string) => void
onEdit: (contact: Contact) => void
contactList: ContactCategory[]

View File

@@ -25,12 +25,9 @@ const defaultProps: Props = {
contactList: [],
selectedItems: [],
onEdit: jest.fn(),
onBlock: jest.fn(),
onDelete: jest.fn(),
onExport: jest.fn(),
onForward: jest.fn(),
onSelect: jest.fn(),
onUnblock: jest.fn(),
toggleRow: jest.fn(),
selectedContact: null,
resultsState: ResultState.Empty,
@@ -101,7 +98,6 @@ const render = (extraProps?: Partial<Props>) => {
return {
...outcome,
rerender: (newExtraProps: Partial<Props>) => {
const newProps = {
...defaultProps,

View File

@@ -45,9 +45,6 @@ const ContactList: FunctionComponent<ContactListProps> = ({
onSelect,
onExport,
onEdit,
onForward,
onBlock,
onUnblock,
onDelete,
resultsState,
editMode,
@@ -102,9 +99,6 @@ const ContactList: FunctionComponent<ContactListProps> = ({
toggleRow={toggleRow}
onExport={onExport}
onEdit={onEdit}
onForward={onForward}
onBlock={onBlock}
onUnblock={onUnblock}
onDelete={onDelete}
onSelect={onSelect}
selectedItems={selectedItems}

View File

@@ -22,7 +22,6 @@ const contacts: Contact[] = [
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
},
@@ -36,7 +35,6 @@ const contacts: Contact[] = [
note: "temporibus molestiae",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "016 McClure Curve",
secondAddressLine: "",
},

View File

@@ -19,7 +19,6 @@ import Avatar, {
basicAvatarStyles,
} from "Core/__deprecated__/renderer/components/core/avatar/avatar.component"
import { backgroundColor } from "Core/core/styles/theming/theme-getters"
import Icon from "Core/__deprecated__/renderer/components/core/icon/icon.component"
import useTableScrolling from "Core/__deprecated__/renderer/utils/hooks/use-table-scrolling"
import { createFullName } from "Core/contacts/helpers/contacts.helpers"
import { intl } from "Core/__deprecated__/renderer/utils/intl"
@@ -27,9 +26,7 @@ import { DisplayStyle } from "Core/__deprecated__/renderer/components/core/butto
import ButtonComponent from "Core/__deprecated__/renderer/components/core/button/button.component"
import Dropdown from "Core/__deprecated__/renderer/components/core/dropdown/dropdown.component"
import { InView } from "react-intersection-observer"
import { HiddenButton } from "Core/contacts/components/contact-list/contact-list.styled"
import { ContactSearchResultsTestIdsEnum } from "Core/contacts/components/contact-search-results/contact-search-results-test-ids.enum"
import { flags, Feature } from "Core/feature-flags"
import { Contact, ResultState } from "Core/contacts/reducers/contacts.interface"
import { IconType } from "Core/__deprecated__/renderer/components/core/icon/icon-type"
@@ -64,12 +61,6 @@ const Actions = styled.div`
box-sizing: border-box;
`
const BlockedIcon = styled(Icon).attrs(() => ({
type: IconType.Blocked,
}))`
margin-left: 1.6rem;
`
const SelectableContacts = styled(Table)<{ mouseLock?: boolean }>`
min-width: 32rem;
flex: 1;
@@ -93,9 +84,6 @@ interface ContactSearchResultProps {
results: Contact[]
selectedItems: string[]
onExport: (ids: string[]) => void
onForward: (contact: Contact) => void
onBlock: (contact: Contact) => void
onUnblock: (contact: Contact) => void
onDelete: (id: string) => void
}
@@ -103,9 +91,6 @@ const ContactSearchResults: FunctionComponent<ContactSearchResultProps> = ({
results,
onSelect,
onExport,
onForward,
onBlock,
onUnblock,
onDelete,
resultsState,
selectedItems,
@@ -135,9 +120,6 @@ const ContactSearchResults: FunctionComponent<ContactSearchResultProps> = ({
? results.map((contact) => {
const selected = selectedItems.includes(contact.id)
const handleExport = () => onExport([contact.id])
const handleForward = () => onForward(contact)
const handleBlock = () => onBlock(contact)
const handleUnblock = () => onUnblock(contact)
const handleDelete = () => onDelete(contact.id)
const handleSelect = () => onSelect(contact)
@@ -175,9 +157,6 @@ const ContactSearchResults: FunctionComponent<ContactSearchResultProps> = ({
intl.formatMessage({
id: "module.contacts.listUnnamedContact",
})}
{contact.blocked && (
<BlockedIcon width={1.4} height={1.4} />
)}
</ClickableCol>
<Col>{phoneNumber}</Col>
<Col>
@@ -188,45 +167,14 @@ const ContactSearchResults: FunctionComponent<ContactSearchResultProps> = ({
<Col>
<Actions>
<Dropdown onOpen={disableScroll} onClose={enableScroll}>
<HiddenButton
<ButtonComponent
labelMessage={{
id: "module.contacts.exportAsVcard",
}}
Icon={IconType.Upload}
onClick={handleExport}
displayStyle={DisplayStyle.Dropdown}
hide={!flags.get(Feature.ContactExportEnabled)}
/>
<HiddenButton
labelMessage={{
id: "module.contacts.forwardNamecard",
}}
Icon={IconType.Forward}
onClick={handleForward}
displayStyle={DisplayStyle.Dropdown}
hide={!flags.get(Feature.ContactForwardEnabled)}
/>
{contact.blocked ? (
<HiddenButton
labelMessage={{
id: "module.contacts.unblock",
}}
Icon={IconType.Blocked}
onClick={handleUnblock}
displayStyle={DisplayStyle.Dropdown}
hide={!flags.get(Feature.ContactBlockingEnabled)}
/>
) : (
<HiddenButton
labelMessage={{
id: "module.contacts.block",
}}
Icon={IconType.Blocked}
onClick={handleBlock}
displayStyle={DisplayStyle.Dropdown}
hide={!flags.get(Feature.ContactBlockingEnabled)}
/>
)}
<ButtonComponent
labelMessage={{
id: "module.contacts.delete",

View File

@@ -23,12 +23,9 @@ type Props = ComponentProps<typeof ContactSearchResults>
const defaultProps: Props = {
results: [],
selectedItems: [],
onBlock: jest.fn(),
onDelete: jest.fn(),
onExport: jest.fn(),
onForward: jest.fn(),
onSelect: jest.fn(),
onUnblock: jest.fn(),
selectedContact: null,
resultsState: ResultState.Empty,
}
@@ -43,7 +40,6 @@ const contact: Contact = {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}

View File

@@ -1,8 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
export enum ContactSimpleListItemAvatarTestIds {
Blocked = "contact-simple-list-item-avatar-blocked",
}

View File

@@ -3,19 +3,17 @@
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
import React from "react"
import { defineMessages } from "react-intl"
import { ContactSimpleListItemAvatarProps } from "Core/contacts/components/contact-simple-list-item-avatar/contact-simple-list-item-avatar.interface"
import {
BlockedIcon,
InitialsAvatar,
NameSpan,
} from "Core/contacts/components/contact-simple-list-item-avatar/contact-simple-list-item-avatar.styled"
import { ContactSimpleListItemAvatarTestIds } from "Core/contacts/components/contact-simple-list-item-avatar/contact-simple-list-item-avatar-test-ids.enum"
import { createFullName } from "Core/contacts/helpers/contacts.helpers"
import { AvatarSize } from "Core/__deprecated__/renderer/components/core/avatar/avatar.component"
import { FunctionComponent } from "Core/core/types/function-component.interface"
import { intl } from "Core/__deprecated__/renderer/utils/intl"
import React from "react"
import { defineMessages } from "react-intl"
const messages = defineMessages({
unnamedContact: { id: "module.contacts.listUnnamedContact" },
@@ -32,13 +30,6 @@ export const ContactSimpleListItemAvatar: FunctionComponent<
<NameSpan>
{fullName || intl.formatMessage(messages.unnamedContact)}
</NameSpan>
{contact.blocked && (
<BlockedIcon
width={2}
height={2}
data-testid={ContactSimpleListItemAvatarTestIds.Blocked}
/>
)}
</>
)
}

View File

@@ -4,8 +4,6 @@
*/
import Avatar from "Core/__deprecated__/renderer/components/core/avatar/avatar.component"
import { IconType } from "Core/__deprecated__/renderer/components/core/icon/icon-type"
import Icon from "Core/__deprecated__/renderer/components/core/icon/icon.component"
import styled from "styled-components"
import Text from "Core/__deprecated__/renderer/components/core/text/text.component"
@@ -16,12 +14,6 @@ export const InitialsAvatar = styled(Avatar)`
flex-shrink: 0;
`
export const BlockedIcon = styled(Icon).attrs(() => ({
type: IconType.Blocked,
}))`
margin-left: 1.6rem;
`
/* stylelint-disable property-no-vendor-prefix */
/* stylelint-disable value-no-vendor-prefix */
export const NameSpan = styled(Text)`

View File

@@ -3,13 +3,12 @@
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
import React from "react"
import { ContactSimpleListItemAvatar } from "Core/contacts/components/contact-simple-list-item-avatar/contact-simple-list-item-avatar.component"
import { ContactSimpleListItemAvatarProps } from "Core/contacts/components/contact-simple-list-item-avatar/contact-simple-list-item-avatar.interface"
import { ContactSimpleListItemAvatarTestIds } from "Core/contacts/components/contact-simple-list-item-avatar/contact-simple-list-item-avatar-test-ids.enum"
import { Contact } from "Core/contacts/dto"
import { AvatarTestIds } from "Core/__deprecated__/renderer/components/core/avatar/avatar-test-ids.enum"
import { renderWithThemeAndIntl } from "Core/__deprecated__/renderer/utils/render-with-theme-and-intl"
import React from "react"
const render = (props: ContactSimpleListItemAvatarProps) =>
renderWithThemeAndIntl(<ContactSimpleListItemAvatar {...props} />)
@@ -24,38 +23,10 @@ const contact: Contact = {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}
describe("Contact with complete data", () => {
test("Renders contact information with blocked icon if `blocked` field is equal to `true`", () => {
const { getByTestId, getByText } = render({
contact,
})
expect(getByTestId(AvatarTestIds.AvatarText)).toHaveTextContent("SB")
expect(
getByTestId(ContactSimpleListItemAvatarTestIds.Blocked)
).toBeInTheDocument()
expect(getByText("Sławomir Borewicz")).toBeInTheDocument()
})
test("Renders contact information without blocked icon if `blocked` field is equal to `false`", () => {
const { queryByTestId } = render({
contact: {
...contact,
blocked: false,
},
})
expect(
queryByTestId(ContactSimpleListItemAvatarTestIds.Blocked)
).not.toBeInTheDocument()
})
})
describe("Contact with incomplete name", () => {
test("Renders contact with `firstName` only if `lastName` haven't provided", () => {
const { getByTestId, getByText } = render({

View File

@@ -25,7 +25,6 @@ const contact: Contact = {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}

View File

@@ -30,7 +30,6 @@ const contactWithBothPhoneNumbers: Contact = {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: true,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}

View File

@@ -23,7 +23,6 @@ const contact: Contact = {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}

View File

@@ -42,7 +42,6 @@ const contacts: Contact[] = [
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
},
@@ -56,7 +55,6 @@ const contacts: Contact[] = [
note: "temporibus molestiae",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "016 McClure Curve",
secondAddressLine: "",
},
@@ -70,7 +68,6 @@ const contacts: Contact[] = [
note: "",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -86,7 +83,6 @@ const favouritesContacts: Contact = {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: true,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}

View File

@@ -46,7 +46,6 @@ const contacts: Record<string, Contact> = {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
},
@@ -60,7 +59,6 @@ const contacts: Record<string, Contact> = {
note: "temporibus molestiae",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "016 McClure Curve",
secondAddressLine: "",
},
@@ -74,7 +72,6 @@ const contacts: Record<string, Contact> = {
note: "",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -88,7 +85,6 @@ const contacts: Record<string, Contact> = {
note: "",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -283,7 +279,6 @@ describe("Functionality: contacts list", () => {
expect(contactListProps.contacts.flat()).toMatchInlineSnapshot(`
Array [
Object {
"blocked": false,
"email": "",
"favourite": false,
"firstAddressLine": "016 McClure Curve",
@@ -297,7 +292,6 @@ describe("Functionality: contacts list", () => {
"secondaryPhoneNumber": "",
},
Object {
"blocked": false,
"email": "",
"favourite": false,
"firstAddressLine": "",
@@ -311,7 +305,6 @@ describe("Functionality: contacts list", () => {
"secondaryPhoneNumber": "",
},
Object {
"blocked": false,
"email": "example@mudita.com",
"favourite": false,
"firstAddressLine": "Malczewskiego 3, Warszawa",
@@ -336,7 +329,6 @@ describe("Functionality: contacts list", () => {
"secondaryPhoneNumber": "32 123 44 55",
},
Object {
"blocked": false,
"email": "",
"favourite": false,
"firstAddressLine": "",
@@ -375,7 +367,6 @@ describe("Functionality: contacts list", () => {
expect(contactListProps.contacts.flat()).toMatchInlineSnapshot(`
Array [
Object {
"blocked": false,
"email": "",
"favourite": false,
"firstAddressLine": "016 McClure Curve",
@@ -389,7 +380,6 @@ describe("Functionality: contacts list", () => {
"secondaryPhoneNumber": "",
},
Object {
"blocked": false,
"email": "",
"favourite": false,
"firstAddressLine": "",
@@ -403,7 +393,6 @@ describe("Functionality: contacts list", () => {
"secondaryPhoneNumber": "",
},
Object {
"blocked": false,
"email": "example@mudita.com",
"favourite": false,
"firstAddressLine": "Malczewskiego 3, Warszawa",

View File

@@ -80,7 +80,6 @@ const contactOne: Contact = {
note: "sapiente rem dignissimos sunt",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}
@@ -95,7 +94,6 @@ const contactTwo: Contact = {
note: "sapiente rem dignissimos sunt",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "Jasna 3, Coruscant",
secondAddressLine: "",
}
@@ -111,7 +109,6 @@ const contactsData: Contact[] = [
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
},
@@ -159,16 +156,10 @@ const defaultProps: Props = {
editContact: jest.fn(),
loadContacts: jest.fn(),
addNewContactsToState: jest.fn(),
isThreadOpened: jest.fn(),
onCall: jest.fn(),
onManageButtonClick: jest.fn(),
onMessage: jest.fn(),
onSpeedDialSettingsSave: jest.fn(),
setProviderData: jest.fn(),
onEdit: jest.fn(),
onForward: jest.fn(),
onBlock: jest.fn(),
onUnblock: jest.fn(),
onDelete: jest.fn(),
resultState: ResultState.Loaded,
speedDialChosenList: [],

View File

@@ -14,16 +14,13 @@ import useTableSidebar from "Core/__deprecated__/renderer/utils/hooks/use-table-
import ContactEdit, {
defaultContact,
} from "Core/contacts/components/contact-edit/contact-edit.component"
import { noop } from "Core/__deprecated__/renderer/utils/noop"
import modalService from "Core/__deprecated__/renderer/components/core/modal/modal.service"
import SpeedDialModal from "Core/contacts/components/speed-dial-modal/speed-dial-modal.container"
import BlockContactModal from "Core/contacts/components/block-contact-modal/block-contact-modal.component"
import { createFullName } from "Core/contacts/helpers/contacts.helpers"
import { intl, textFormatters } from "Core/__deprecated__/renderer/utils/intl"
import DeleteModal from "Core/__deprecated__/renderer/components/core/modal/delete-modal.component"
import { ContactSection } from "Core/contacts/components/contacts/contacts.styled"
import { defineMessages } from "react-intl"
import { useHistory } from "react-router-dom"
import useURLSearchParams from "Core/__deprecated__/renderer/utils/hooks/use-url-search-params"
import findContactByPhoneNumber from "Core/contacts/helpers/find-contact-by-phone-number/find-contact-by-phone-number"
import {
@@ -45,7 +42,6 @@ import {
FileService,
NewContactResponse,
} from "Core/contacts/components/contacts/contacts.interface"
import appContextMenu from "Core/__deprecated__/renderer/wrappers/app-context-menu"
import ContactSearchResults from "Core/contacts/components/contact-search-results/contact-search-results.component"
import ImportContactsFlow, {
ImportContactsFlowState,
@@ -97,16 +93,13 @@ const Contacts: FunctionComponent<ContactsProps> = ({
contactList = [],
contacts,
speedDialChosenList,
isThreadOpened,
loadContacts,
addNewContact,
importContact,
editContact,
deleteContacts,
authorize,
onCall,
getPaths,
onMessage,
exportContacts,
addNewContactsToState,
resetAllItems,
@@ -116,7 +109,6 @@ const Contacts: FunctionComponent<ContactsProps> = ({
allItemsSelected,
closeImportWindow,
}) => {
const history = useHistory()
const searchParams = useURLSearchParams()
const activeDeviceId = useSelector(activeDeviceIdSelector)
const phoneNumber = searchParams.get("phoneNumber") || ""
@@ -312,8 +304,6 @@ const Contacts: FunctionComponent<ContactsProps> = ({
}
}
const handleMessage = (phoneNumber: string) => onMessage(history, phoneNumber)
const openDeleteModal = (id: string) => {
const contact = contacts.find((contact) => contact.id === id)
const handleDelete = async () => {
@@ -349,89 +339,10 @@ const Contacts: FunctionComponent<ContactsProps> = ({
)
}
const handleUnblock = async (contact: Contact) => {
const unblockedContact: Contact = {
...contact,
blocked: false,
}
try {
await editContactWithRetry(unblockedContact)
} catch (error) {
logger.error(
`Contacts: editing (unblock) process throw error. Data: ${JSON.stringify(
error
)}`
)
}
if (detailsEnabled) {
openSidebar(unblockedContact)
}
}
const openBlockModal = (contact: Contact) => {
const handleBlock = async () => {
modalService.rerenderModal(
<BlockContactModal contact={contact} blocking />
)
const blockedContact: Contact = {
...contact,
blocked: true,
favourite: false,
}
try {
await editContactWithRetry(blockedContact)
} catch (error) {
logger.error(
`Contacts: editing process (block) throw error. Data: ${JSON.stringify(
error
)}`
)
}
if (detailsEnabled) {
openSidebar(blockedContact)
}
}
void modalService.openModal(
<BlockContactModal contact={contact} onBlock={handleBlock} />
)
}
const openSpeedDialModal = () => {
void modalService.openModal(<SpeedDialModal onSave={closeModal} />)
}
// Synchronization, dev mode: toggle contacts saving failure
const [syncShouldFail, setSyncFailure] = useState(false)
useEffect(() => {
const unregisterItem = appContextMenu.registerItem("Contacts", {
labelCreator: () =>
`${syncShouldFail ? "Disable" : "Enable"} saving failure`,
click: () => setSyncFailure((prevState) => !prevState),
})
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return () => unregisterItem()
}, [syncShouldFail])
// Synchronization, dev mode: toggle contacts importing failure
const [parseShouldFail, setParseFailure] = useState(false)
useEffect(() => {
const unregisterItem = appContextMenu.registerItem("Contacts", {
labelCreator: () =>
`${parseShouldFail ? "Disable" : "Enable"} parsing failure`,
click: () => setParseFailure((prevState) => !prevState),
})
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return () => unregisterItem()
}, [parseShouldFail])
const [importContactsFlowState, setImportContactsFlowState] =
useState<ImportContactsFlowState>()
const [importedContacts, setImportedContacts] = useState<NewContact[]>([])
@@ -543,10 +454,6 @@ const Contacts: FunctionComponent<ContactsProps> = ({
// eslint-disable-next-line @typescript-eslint/await-thenable
await showDownloadingLoader()
if (parseShouldFail) {
handleError()
return
}
const importedContacts =
service.type === "files"
? await mapVCFsToContacts(service.data)
@@ -719,9 +626,6 @@ const Contacts: FunctionComponent<ContactsProps> = ({
results={results}
onSelect={handleContactSelect}
onExport={handleExport}
onForward={noop}
onUnblock={handleUnblock}
onBlock={openBlockModal}
onDelete={openDeleteModal}
resultsState={resultState}
selectedContact={selectedContact}
@@ -734,9 +638,6 @@ const Contacts: FunctionComponent<ContactsProps> = ({
contactList={contactList}
onSelect={openSidebar}
onExport={handleExport}
onForward={noop}
onUnblock={handleUnblock}
onBlock={openBlockModal}
onDelete={openDeleteModal}
onEdit={handleEditingContact}
editMode={Boolean(editedContact || newContact)}
@@ -770,14 +671,8 @@ const Contacts: FunctionComponent<ContactsProps> = ({
contact={contactFreshData(activeRow)}
onClose={closeSidebar}
onExport={handleExport}
onForward={noop}
onUnblock={handleUnblock}
onBlock={openBlockModal}
onDelete={openDeleteModal}
onEdit={handleEditingContact}
onCall={onCall}
onMessage={handleMessage}
isThreadOpened={isThreadOpened}
/>
)}
</TableWithSidebarWrapper>

View File

@@ -5,7 +5,6 @@
import { OpenDialogOptions } from "electron"
import { PayloadAction } from "@reduxjs/toolkit"
import { History, LocationState } from "history"
import { AuthProviders } from "Core/__deprecated__/renderer/models/auth/auth.typings"
import {
ExternalProvider,
@@ -49,8 +48,6 @@ export interface ContactsProps {
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
onManageButtonClick: (cb?: any) => Promise<void>
isThreadOpened: (phoneNumber: string) => boolean
onMessage: (history: History<LocationState>, phoneNumber: string) => void
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
authorize: (provider: ExternalProvider) => Promise<PayloadAction<Error | any>>
@@ -60,23 +57,23 @@ export interface ContactsProps {
importContact: (
arg: ImportContactArg
) => Promise<PayloadAction<Error | Contact>>
editContact: (contact: Contact) => Promise<PayloadAction<Error | undefined>>
editContact: (
contact: Contact
) => Promise<PayloadAction<ContactErrorResponse | undefined>>
deleteContacts: (
ids: ContactID[]
) => Promise<PayloadAction<Error | undefined>>
loadContacts: (provider: Provider) => Promise<Contact[]>
addNewContactsToState: (contacts: Contact[]) => Promise<void>
exportContacts: (contacts: Contact[]) => Promise<ExportContactsResult>
onCall: (phoneNumber: string) => void
onEdit: (contacts: Contact) => void
onForward: (contact: Contact) => void
onBlock: (contact: Contact) => void
onUnblock: (contact: Contact) => void
onDelete: (id: string) => void
resultState: ResultState
contactList: ContactCategory[]
closeImportWindow: (provider: ExternalProvider) => Promise<void>
getPaths: (options: OpenDialogOptions) => Promise<PayloadAction<ResultObject<string[] | undefined>>>
getPaths: (
options: OpenDialogOptions
) => Promise<PayloadAction<ResultObject<string[] | undefined>>>
}
export interface NewContactResponse extends NewContact {

View File

@@ -47,7 +47,6 @@ const labeledContactList: any = getSortedContactList(contactsSeed)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const contacts: any = getContacts(contactsSeed)
const speedDialChosenList: number[] = getSpeedDialChosenList(contactsSeed)
const isThreadOpened = () => true
const ContactsWrapper = styled.div`
max-width: 97.5rem;
@@ -73,16 +72,10 @@ const ContactsComponent = ({
speedDialChosenList={speedDialChosenList}
onManageButtonClick={dummyPromise(action("Manage contact"))}
onEdit={action("Edit contact")}
onForward={action("Forward contact")}
onUnblock={action("Unblock contact")}
onBlock={action("Block contact")}
onDelete={action("Delete contact")}
onMessage={action("Send message")}
onCall={action("Call")}
onSpeedDialSettingsSave={action("Save speed dial settings")}
resultState={resultState}
setProviderData={noop}
isThreadOpened={isThreadOpened}
addNewContactsToState={asyncNoop}
addNewContact={asyncNoop}
importContact={asyncNoop}
@@ -125,7 +118,6 @@ storiesOf("Views|Phone", module)
const singleContact = ({
favourite = false,
blocked = false,
speedDial,
}: Partial<Contact> = {}) => ({
...defaultContact,
@@ -139,7 +131,6 @@ const singleContact = ({
firstAddressLine: "50856 Mabelle Motorway",
secondAddressLine: "USA",
favourite,
blocked,
speedDial,
ice: true,
})
@@ -150,14 +141,8 @@ storiesOf("Views|Phone/Contact details/Existing", module)
contact={singleContact()}
onEdit={action("Edit contact")}
onExport={action("Export contact")}
onForward={action("Forward contact")}
onUnblock={action("Unblock contact")}
onBlock={action("Block contact")}
onDelete={action("Delete contact")}
onMessage={action("Send message")}
onCall={action("Call")}
onClose={action("Close sidebar")}
isThreadOpened={isThreadOpened}
/>
))
.add("Favourite, speed dial", () => (
@@ -165,14 +150,8 @@ storiesOf("Views|Phone/Contact details/Existing", module)
contact={singleContact({ favourite: true, speedDial: 3 })}
onEdit={action("Edit contact")}
onExport={action("Export contact")}
onForward={action("Forward contact")}
onUnblock={action("Unblock contact")}
onBlock={action("Block contact")}
onDelete={action("Delete contact")}
onMessage={action("Send message")}
onCall={action("Call")}
onClose={action("Close sidebar")}
isThreadOpened={isThreadOpened}
/>
))
.add("Favourite only", () => (
@@ -180,14 +159,8 @@ storiesOf("Views|Phone/Contact details/Existing", module)
contact={singleContact({ favourite: true })}
onEdit={action("Edit contact")}
onExport={action("Export contact")}
onForward={action("Forward contact")}
onUnblock={action("Unblock contact")}
onBlock={action("Block contact")}
onDelete={action("Delete contact")}
onMessage={action("Send message")}
onCall={action("Call")}
onClose={action("Close sidebar")}
isThreadOpened={isThreadOpened}
/>
))
.add("Speed dial only", () => (
@@ -195,29 +168,8 @@ storiesOf("Views|Phone/Contact details/Existing", module)
contact={singleContact({ speedDial: 3 })}
onEdit={action("Edit contact")}
onExport={action("Export contact")}
onForward={action("Forward contact")}
onUnblock={action("Unblock contact")}
onBlock={action("Block contact")}
onDelete={action("Delete contact")}
onMessage={action("Send message")}
onCall={action("Call")}
onClose={action("Close sidebar")}
isThreadOpened={isThreadOpened}
/>
))
.add("Blocked", () => (
<ContactDetails
contact={singleContact({ blocked: true })}
onEdit={action("Edit contact")}
onExport={action("Export contact")}
onForward={action("Forward contact")}
onUnblock={action("Unblock contact")}
onBlock={action("Block contact")}
onDelete={action("Delete contact")}
onMessage={action("Send message")}
onCall={action("Call")}
onClose={action("Close sidebar")}
isThreadOpened={isThreadOpened}
/>
))

View File

@@ -24,7 +24,6 @@ const contacts: NewContact[] = [
firstAddressLine: "6 Czeczota St.",
secondAddressLine: "02600 Warsaw",
favourite: true,
blocked: false,
ice: false,
},
]

View File

@@ -7,11 +7,7 @@ export enum VirtualizedContactListItemTestIds {
ContactRow = "virtualized-contact-list-item-contact-row",
PhoneNumber = "virtualized-contact-phone-number",
ContactExportButton = "virtualized-contact-list-item-contact-export-button",
BlockedIcon = "virtualized-contact-list-item-blocked-icon",
ContactRowDropdownToggler = "virtualized-contact-dropdown-toggler",
ContactBlockButton = "virtualized-contact-list-item-contact-block-button",
ContactUnblockButton = "virtualized-contact-list-item-contact-unblock-button",
ContactEditButton = "virtualized-contact-list-item-contact-edit-button",
ContactDeleteButton = "virtualized-contact-list-item-contact-delete-button",
ContactForwardButton = "virtualized-contact-list-item-contact-forward-button",
}

View File

@@ -3,17 +3,16 @@
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
import React from "react"
import { defineMessages } from "react-intl"
import {
Actions,
BlockedIcon,
Checkbox,
ClickableCol,
ContactListRow,
InitialsAvatar,
NameSpan,
} from "Core/contacts/components/virtualized-contact-list-item/virtualized-contact-list-item.styled"
import { HiddenButton } from "Core/contacts/components/contact-list/contact-list.styled"
import { Feature, flags } from "Core/feature-flags"
import { AvatarSize } from "Core/__deprecated__/renderer/components/core/avatar/avatar.component"
import ButtonComponent from "Core/__deprecated__/renderer/components/core/button/button.component"
import { DisplayStyle } from "Core/__deprecated__/renderer/components/core/button/button.config"
@@ -26,23 +25,11 @@ import Text, {
TextDisplayStyle,
} from "Core/__deprecated__/renderer/components/core/text/text.component"
import { FunctionComponent } from "Core/core/types/function-component.interface"
import React from "react"
import { defineMessages } from "react-intl"
import { VirtualizedContactListItemProps } from "Core/contacts/components/virtualized-contact-list-item/virtualized-contact-list-item.interface"
import { intl } from "Core/__deprecated__/renderer/utils/intl"
import { VirtualizedContactListItemTestIds } from "Core/contacts/components/virtualized-contact-list-item/virtualized-contact-list-item-test-ids"
const messages = defineMessages({
forwardNamecard: {
id: "module.contacts.forwardNamecard",
},
unblock: {
id: "module.contacts.unblock",
},
block: {
id: "module.contacts.block",
},
exportAsVcard: {
id: "module.contacts.exportAsVcard",
},
@@ -65,9 +52,6 @@ export const VirtualizedContactListItem: FunctionComponent<
toggleRow,
onExport,
onEdit,
onForward,
onBlock,
onUnblock,
onDelete,
onSelect,
contact,
@@ -81,9 +65,6 @@ export const VirtualizedContactListItem: FunctionComponent<
const onChange = () => toggleRow(contact.id)
const handleExport = () => onExport([contact.id])
const handleEdit = () => onEdit(contact)
const handleForward = () => onForward(contact)
const handleBlock = () => onBlock(contact)
const handleUnblock = () => onUnblock(contact)
const handleDelete = () => onDelete(contact.id)
const handleSelect = () => onSelect(contact)
@@ -137,13 +118,6 @@ export const VirtualizedContactListItem: FunctionComponent<
>
{createStyledFullName() ||
intl.formatMessage(messages.listUnnamedContact)}
{contact.blocked && (
<BlockedIcon
data-testid={VirtualizedContactListItemTestIds.BlockedIcon}
width={1.4}
height={1.4}
/>
)}
</ClickableCol>
<Col>
<Text
@@ -164,42 +138,6 @@ export const VirtualizedContactListItem: FunctionComponent<
VirtualizedContactListItemTestIds.ContactRowDropdownToggler
}
>
<HiddenButton
labelMessage={messages.forwardNamecard}
Icon={IconType.Forward}
onClick={handleForward}
displayStyle={DisplayStyle.Dropdown}
hide={!flags.get(Feature.ContactForwardEnabled)}
iconSize={IconSize.Medium}
data-testid={
VirtualizedContactListItemTestIds.ContactForwardButton
}
/>
{contact.blocked ? (
<HiddenButton
labelMessage={messages.unblock}
Icon={IconType.Blocked}
onClick={handleUnblock}
displayStyle={DisplayStyle.Dropdown}
hide={!flags.get(Feature.ContactBlockingEnabled)}
iconSize={IconSize.Medium}
data-testid={
VirtualizedContactListItemTestIds.ContactUnblockButton
}
/>
) : (
<HiddenButton
labelMessage={messages.block}
Icon={IconType.Blocked}
onClick={handleBlock}
displayStyle={DisplayStyle.Dropdown}
hide={!flags.get(Feature.ContactBlockingEnabled)}
iconSize={IconSize.Medium}
data-testid={
VirtualizedContactListItemTestIds.ContactBlockButton
}
/>
)}
<ButtonComponent
labelMessage={messages.editBulkAction}
iconSize={IconSize.Medium}

View File

@@ -12,9 +12,6 @@ export interface VirtualizedContactListItemProps {
toggleRow: (id: string) => void
onExport: (ids: string[]) => void
onEdit: (contact: Contact) => void
onForward: (contact: Contact) => void
onBlock: (contact: Contact) => void
onUnblock: (contact: Contact) => void
onDelete: (id: string) => void
onSelect: (contact: Contact) => void
contact: Contact

View File

@@ -21,7 +21,6 @@ const contact: Contact = {
note: "sapiente rem dignissimos sunt",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}
@@ -31,9 +30,6 @@ const renderer = (extraProps?: Partial<VirtualizedContactListItemProps>) => {
toggleRow: jest.fn(),
onExport: jest.fn(),
onEdit: jest.fn(),
onForward: jest.fn(),
onBlock: jest.fn(),
onUnblock: jest.fn(),
onDelete: jest.fn(),
onSelect: jest.fn(),
disableScroll: jest.fn(),
@@ -67,30 +63,6 @@ test("renders unnamed contact label if contact has not defined name", () => {
).toBeInTheDocument()
})
test("renders blocked icon if contact is blocked", () => {
const { queryByTestId } = renderer({
contact: {
...contact,
blocked: true,
},
})
expect(
queryByTestId(VirtualizedContactListItemTestIds.BlockedIcon)
).toBeInTheDocument()
})
test("does not render blocked icon if contact is not blocked", () => {
const { queryByTestId } = renderer({
contact: {
...contact,
blocked: false,
},
})
expect(
queryByTestId(VirtualizedContactListItemTestIds.BlockedIcon)
).not.toBeInTheDocument()
})
test("renders primary and secondary phone number if defined", () => {
const { queryByText } = renderer({
contact: {
@@ -128,37 +100,5 @@ describe("dropdown", () => {
expect(
queryByTestId(VirtualizedContactListItemTestIds.ContactExportButton)
).toBeInTheDocument()
expect(
queryByTestId(VirtualizedContactListItemTestIds.ContactForwardButton)
).toBeInTheDocument()
})
test("renders unblock button in dropdown if contact is blocked", () => {
const { queryByTestId } = renderer({
contact: {
...contact,
blocked: true,
},
})
expect(
queryByTestId(VirtualizedContactListItemTestIds.ContactUnblockButton)
).toBeInTheDocument()
expect(
queryByTestId(VirtualizedContactListItemTestIds.ContactBlockButton)
).not.toBeInTheDocument()
})
test("renders block button in dropdown if contact is not blocked", () => {
const { queryByTestId } = renderer({
contact: {
...contact,
blocked: false,
},
})
expect(
queryByTestId(VirtualizedContactListItemTestIds.ContactUnblockButton)
).not.toBeInTheDocument()
expect(
queryByTestId(VirtualizedContactListItemTestIds.ContactBlockButton)
).toBeInTheDocument()
})
})

View File

@@ -20,9 +20,6 @@ export const VirtualizedContactList: FunctionComponent<
toggleRow,
onExport,
onEdit,
onForward,
onBlock,
onUnblock,
onDelete,
onSelect,
selectedContact,
@@ -71,9 +68,6 @@ export const VirtualizedContactList: FunctionComponent<
toggleRow={toggleRow}
onExport={onExport}
onEdit={onEdit}
onForward={onForward}
onBlock={onBlock}
onUnblock={onUnblock}
onDelete={onDelete}
onSelect={onSelect}
disableScroll={disableScroll}

View File

@@ -13,9 +13,6 @@ export interface VirtualizedContactListProps {
toggleRow: (id: string) => void
onExport: (ids: string[]) => void
onEdit: (contact: Contact) => void
onForward: (contact: Contact) => void
onBlock: (contact: Contact) => void
onUnblock: (contact: Contact) => void
onDelete: (id: string) => void
onSelect: (contact: Contact) => void
componentContactList: ContactCategory[]

View File

@@ -36,7 +36,6 @@ const contact: Contact = {
note: "sapiente rem dignissimos sunt",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}
@@ -51,7 +50,6 @@ const contact2: Contact = {
note: "abc",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "Nowacka 3, Warszawa",
secondAddressLine: "",
}
@@ -61,9 +59,6 @@ const renderer = (extraProps?: Partial<VirtualizedContactListProps>) => {
toggleRow: jest.fn(),
onExport: jest.fn(),
onEdit: jest.fn(),
onForward: jest.fn(),
onBlock: jest.fn(),
onUnblock: jest.fn(),
onDelete: jest.fn(),
onSelect: jest.fn(),
disableScroll: jest.fn(),

View File

@@ -20,7 +20,6 @@ const contact: Contact = {
note: "sapiente rem dignissimos sunt",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}
@@ -30,9 +29,6 @@ const renderer = (extraProps?: Partial<VirtualizedContactListProps>) => {
toggleRow: jest.fn(),
onExport: jest.fn(),
onEdit: jest.fn(),
onForward: jest.fn(),
onBlock: jest.fn(),
onUnblock: jest.fn(),
onDelete: jest.fn(),
onSelect: jest.fn(),
disableScroll: jest.fn(),

View File

@@ -5,7 +5,6 @@
import { connect } from "react-redux"
import { History, LocationState } from "history"
import { PayloadAction } from "@reduxjs/toolkit"
import { OpenDialogOptions } from "electron"
import Contacts from "Core/contacts/components/contacts/contacts.component"
import { noop } from "Core/__deprecated__/renderer/utils/noop"
@@ -30,7 +29,6 @@ import {
} from "Core/contacts/helpers/contacts.helpers"
import { exportContacts } from "Core/contacts/helpers/export-contacts/export-contacts"
import { ContactErrorResponse } from "Core/contacts/components/contacts/contacts.interface"
import { isThreadOpenedSelector } from "Core/messages/selectors"
import { createNewContact } from "Core/contacts/actions/create-new-contacts.action"
import { deleteContacts } from "Core/contacts/actions/delete-contacts.action"
import {
@@ -65,8 +63,6 @@ const mapStateToProps = (state: RootModel & ReduxRootState) => {
contacts: contactsSelector(state),
speedDialChosenList: speedDialChosenListSelector(state),
getContact: (id: string) => getContactSelector(id)(state),
isThreadOpened: (phoneNumber: string) =>
isThreadOpenedSelector(phoneNumber)(state),
}
}
@@ -119,7 +115,7 @@ const mapDispatchToProps = (dispatch: TmpDispatch) => {
contact: Contact
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/require-await
): Promise<PayloadAction<ContactErrorResponse | undefined>> =>
): Promise<ContactErrorResponse | void> =>
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
dispatch(editContact(contact)),
@@ -150,7 +146,6 @@ const mapDispatchToProps = (dispatch: TmpDispatch) => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
toggleItem: (id: string) => dispatch(toggleItem(id)),
// TODO: Add proper actions
onForward: noop,
onBlock: noop,
onSelect: noop,
onCall: noop,

View File

@@ -30,7 +30,6 @@ const contacts: Contact[] = [
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
},
@@ -44,7 +43,6 @@ const contacts: Contact[] = [
note: "temporibus molestiae",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "016 McClure Curve",
secondAddressLine: "",
},
@@ -58,7 +56,6 @@ const contacts: Contact[] = [
note: "",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "016 McClure Curve",
secondAddressLine: "",
},

View File

@@ -30,7 +30,6 @@ const contacts: Contact[] = [
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
},
@@ -44,7 +43,6 @@ const contacts: Contact[] = [
note: "temporibus molestiae",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "016 McClure Curve",
secondAddressLine: "",
},

View File

@@ -16,7 +16,6 @@ const contacts: NewContact[] = [
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
},
@@ -29,7 +28,6 @@ const contacts: NewContact[] = [
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
},
@@ -42,7 +40,6 @@ const contacts: NewContact[] = [
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
},
@@ -53,7 +50,6 @@ test("contacts are mapped according to validation rules", () => {
.toMatchInlineSnapshot(`
Array [
Object {
"blocked": false,
"email": "example@mudita.com",
"favourite": false,
"firstAddressLine": "Malczewskiego 3, Warszawa",
@@ -66,7 +62,6 @@ test("contacts are mapped according to validation rules", () => {
"secondaryPhoneNumber": "",
},
Object {
"blocked": false,
"email": "example@mudita.com",
"favourite": false,
"firstAddressLine": "Malczewskiego 3, Warszawa",
@@ -79,7 +74,6 @@ test("contacts are mapped according to validation rules", () => {
"secondaryPhoneNumber": "",
},
Object {
"blocked": false,
"email": "example@mudita.com",
"favourite": false,
"firstAddressLine": "Malczewskiego 3, Warszawa",

View File

@@ -1,19 +0,0 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/
import store from "Core/__deprecated__/renderer/store"
import { ContextMenuItem } from "Core/__deprecated__/context-menu/context-menu.interface"
import { devClearAllContacts } from "Core/contacts/actions/base.action"
const contactsContextMenu: ContextMenuItem[] = [
{
label: "Clear all contacts",
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
click: () => store.dispatch(devClearAllContacts()),
},
]
export default contactsContextMenu

View File

@@ -17,7 +17,6 @@ const contacts: Contact[] = [
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
},
@@ -31,7 +30,6 @@ const contacts: Contact[] = [
note: "sapiente rem dignissimos sunt",
ice: true,
favourite: false,
blocked: true,
firstAddressLine: "3284 Klocko Plains",
secondAddressLine: "",
},

View File

@@ -16,7 +16,6 @@ const contact: Contact = {
note: "sapiente rem dignissimos sunt",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "00-000 Somewhere",
}

View File

@@ -11,7 +11,7 @@ const pureContact: PureContact = {
id: 19,
address: "6 Czeczota St.\n02600 Warsaw",
altName: "Boligłowa",
blocked: false,
favourite: true,
numbers: ["500400300"],
priName: "Alek",
@@ -19,7 +19,6 @@ const pureContact: PureContact = {
}
const contact: Contact = {
blocked: false,
email: "",
favourite: true,
firstAddressLine: "6 Czeczota St.",

View File

@@ -10,7 +10,6 @@ export class ContactPresenter {
static mapToContact(pureContact: PureContact): Contact {
const {
id,
blocked,
favourite,
address = "",
altName,
@@ -22,7 +21,6 @@ export class ContactPresenter {
const secondAddressLine = address.substr(address.indexOf("\n") + 1)
return {
blocked,
favourite,
primaryPhoneNumber,
secondaryPhoneNumber,
@@ -41,7 +39,6 @@ export class ContactPresenter {
static mapToPureContact(contact: Contact): PureContact {
const {
blocked = false,
favourite = false,
firstName = "",
lastName = "",
@@ -62,7 +59,6 @@ export class ContactPresenter {
return {
id: Number(id),
blocked,
favourite,
email: email || "",
numbers: numbers,

View File

@@ -15,7 +15,6 @@ export interface Contact {
primaryPhoneNumber?: string
secondaryPhoneNumber?: string
favourite?: boolean
blocked?: boolean
ice?: boolean
speedDial?: number
note?: string

View File

@@ -86,7 +86,6 @@ describe("Set Contacts data functionality", () => {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}
@@ -126,7 +125,6 @@ describe("AddNewContactToState data functionality", () => {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}
@@ -166,7 +164,6 @@ describe("EditContactInState data functionality", () => {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}
@@ -197,7 +194,6 @@ describe("EditContactInState data functionality", () => {
collection: ["0"],
db: {
"0": {
blocked: false,
email: "example@mudita.com",
favourite: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
@@ -226,7 +222,6 @@ describe("DeleteContactsInState data functionality", () => {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}

View File

@@ -8,7 +8,6 @@ import { ContactModel } from "Core/contacts/models"
import { Contact } from "Core/contacts/reducers"
const contact: Contact = {
blocked: false,
email: "",
favourite: true,
firstAddressLine: "6 Czeczota St.",

View File

@@ -33,7 +33,6 @@ const contacts: Record<string, Contact> = {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
},
@@ -47,7 +46,6 @@ const contacts: Record<string, Contact> = {
note: "temporibus molestiae",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "016 McClure Curve",
secondAddressLine: "",
},
@@ -61,7 +59,6 @@ const contacts: Record<string, Contact> = {
note: "",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -75,7 +72,6 @@ const contacts: Record<string, Contact> = {
note: "",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
@@ -111,7 +107,6 @@ describe("When contacts state have records", () => {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
},
@@ -140,7 +135,6 @@ describe("When contacts state have records", () => {
note: "temporibus molestiae",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "016 McClure Curve",
secondAddressLine: "",
},
@@ -156,14 +150,12 @@ describe("When contacts state have records", () => {
note: "",
ice: true,
favourite: false,
blocked: false,
firstAddressLine: "",
secondAddressLine: "",
},
],
n: [
{
blocked: false,
email: "",
favourite: false,
firstAddressLine: "",
@@ -193,7 +185,6 @@ describe("selector can filter contact by existence of primary or secondary phone
Object {
"": Array [
Object {
"blocked": false,
"email": "",
"favourite": false,
"firstAddressLine": "",
@@ -209,7 +200,6 @@ describe("selector can filter contact by existence of primary or secondary phone
],
"n": Array [
Object {
"blocked": false,
"email": "",
"favourite": false,
"firstAddressLine": "",
@@ -230,7 +220,6 @@ describe("selector can filter contact by existence of primary or secondary phone
Object {
"": Array [
Object {
"blocked": false,
"email": "",
"favourite": false,
"firstAddressLine": "",

View File

@@ -30,7 +30,6 @@ describe("`getContactByPhoneNumberSelector` selector", () => {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}

View File

@@ -28,7 +28,6 @@ describe("`getContactSelector` selector", () => {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}

View File

@@ -30,7 +30,6 @@ describe("`isContactCreatedByPhoneNumberSelector` selector", () => {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}

View File

@@ -28,7 +28,6 @@ describe("`isContactCreatedSelector` selector", () => {
note: "sapiente rem dignissimos sunt",
ice: false,
favourite: false,
blocked: false,
firstAddressLine: "Malczewskiego 3, Warszawa",
secondAddressLine: "",
}

View File

@@ -31,7 +31,6 @@ const pureContact: PureContact = {
id: 19,
address: "6 Czeczota St.\n02600 Warsaw",
altName: "Boligłowa",
blocked: false,
favourite: true,
numbers: ["500400300"],
priName: "Alek",
@@ -39,7 +38,6 @@ const pureContact: PureContact = {
}
const contact: Contact = {
blocked: false,
email: "",
favourite: true,
firstAddressLine: "6 Czeczota St.",

View File

@@ -22,12 +22,7 @@ import Onboarding from "Core/onboarding/components/onboarding/onboarding.compone
import OnboardingTroubleshooting from "Core/onboarding/components/onboarding-troubleshooting/onboarding-troubleshooting.component"
import LayoutDesktopWrapper from "Core/__deprecated__/renderer/wrappers/layout-desktop-wrapper"
import LayoutBlankWrapper from "Core/__deprecated__/renderer/wrappers/layout-blank-wrapper"
import {
AboutContainer,
NotificationsContainer,
BackupContainer,
AudioConversionContainer,
} from "Core/settings/components"
import { AboutContainer, BackupContainer } from "Core/settings/components"
import PureSystem from "Core/overview/components/pure-system/pure-system.container"
import LayoutDesktopWrapperWithoutHeader from "Core/__deprecated__/renderer/wrappers/layout-desktop-wrapper-without-header"
import TemplatesContainer from "Core/templates/template.container"
@@ -113,14 +108,6 @@ export default () => (
<Route path={URL_OVERVIEW.root} component={Overview} exact />
<Route path={URL_MAIN.contacts} component={Contacts} exact />
<Route path={URL_MAIN.settings} component={BackupContainer} exact />
<Route
path={`${URL_MAIN.settings}${URL_TABS.notifications}`}
component={NotificationsContainer}
/>
<Route
path={`${URL_MAIN.settings}${URL_TABS.audioConversion}`}
component={AudioConversionContainer}
/>
<Route
path={`${URL_MAIN.settings}${URL_TABS.about}`}
component={AboutContainer}

View File

@@ -13,19 +13,14 @@ import { QuestionAndAnswer } from "Core/help/components/help.component"
import Help from "Core/help/help.container"
import { renderAnswer } from "Core/help/helpers/render-answer"
import { useHelpSearch } from "Core/__deprecated__/renderer/utils/hooks/use-help-search/use-help-search"
import ContextMenu from "Core/__deprecated__/context-menu/context-menu"
import { Feature, flags } from "Core/feature-flags"
import { HelpActions } from "Core/__deprecated__/common/enums/help-actions.enum"
const devModeEnabled = flags.get(Feature.DeveloperModeEnabled)
const saveToStore = async (normalizeData: QuestionAndAnswer) =>
await ipcRenderer.callMain(HelpActions.SetStoreValue, normalizeData)
const getStoreData = async (key?: string) =>
await ipcRenderer.callMain(HelpActions.GetStore, key)
const HelpApp: FunctionComponent = () => {
const { data, searchQuestion } = useHelpSearch(saveToStore, getStoreData)
const [searchInputValue, setSearchInputValue] = useState("")
useEffect(() => {
@@ -34,13 +29,6 @@ const HelpApp: FunctionComponent = () => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [searchInputValue])
useEffect(() => {
if (devModeEnabled) {
const helpContextMenu = new ContextMenu()
helpContextMenu.init()
}
}, [])
return (
<Router history={history}>
<Switch>

View File

@@ -61,7 +61,6 @@ export interface GetBackupDeviceStatusResponseBody {
export interface Contact {
address: string
altName: string
blocked: boolean
favourite: boolean
id: number
numbers: string[]

View File

@@ -26,7 +26,6 @@ const render = (extraProps?: Partial<AgreementModalProps>) => {
return {
...outcome,
rerender: (newExtraProps: Partial<AgreementModalProps>) => {
const newProps = {
...defaultProps,

View File

@@ -6,18 +6,5 @@
export enum Feature {
LoggerEnabled = "logger-enabled",
LogsScrubbingEnabled = "logs-scrubbing-enabled",
DeveloperModeEnabled = "developer-mode-enabled",
MessagesForwardEnabled = "messages-forward-enabled",
MessagesThreadCallsEnabled = "messages-thread-calls-enabled",
MessagesCallFromThreadEnabled = "messages-call-from-thread-enabled",
ContactForwardEnabled = "contact-forward-enabled",
ContactBlockingEnabled = "contact-blocking-enabled",
ContactPhoneFieldIconsEnabled = "contact-phone-field-icons-enabled",
ContactExportEnabled = "contact-export-enabled",
SettingsNotificationTabEnabled = "settings-notification-tab-enabled",
SettingsAudioConversionTabEnabled = "settings-audio-conversion-tab-enabled",
CalendarTabEnabled = "calendar-tab-enabled",
YourPureIconsEnabled = "your-pure-icons-enabled",
AlphaRelaseWarning = "alpha-release-warning",
ForceUpdate = "force-update",
}

View File

@@ -9,11 +9,6 @@ import { Environment, Feature } from "Core/feature-flags/constants"
const loggerEnabled = process.env.DEV_DEVICE_LOGGER_ENABLED !== "0"
export const features: EnvironmentConfig = {
[Feature.MessagesForwardEnabled]: {
[Environment.Development]: true,
[Environment.Production]: false,
[Environment.AlphaProduction]: false,
},
[Feature.LoggerEnabled]: {
[Environment.Development]: loggerEnabled,
[Environment.Production]: loggerEnabled,
@@ -24,66 +19,6 @@ export const features: EnvironmentConfig = {
[Environment.Production]: true,
[Environment.AlphaProduction]: true,
},
[Feature.DeveloperModeEnabled]: {
[Environment.Development]: true,
[Environment.Production]: false,
[Environment.AlphaProduction]: true,
},
[Feature.MessagesThreadCallsEnabled]: {
[Environment.Development]: true,
[Environment.Production]: false,
[Environment.AlphaProduction]: false,
},
[Feature.MessagesCallFromThreadEnabled]: {
[Environment.Development]: true,
[Environment.Production]: false,
[Environment.AlphaProduction]: false,
},
[Feature.ContactForwardEnabled]: {
[Environment.Development]: true,
[Environment.Production]: false,
[Environment.AlphaProduction]: false,
},
[Feature.ContactBlockingEnabled]: {
[Environment.Development]: true,
[Environment.Production]: false,
[Environment.AlphaProduction]: false,
},
[Feature.ContactPhoneFieldIconsEnabled]: {
[Environment.Development]: true,
[Environment.Production]: false,
[Environment.AlphaProduction]: false,
},
[Feature.ContactExportEnabled]: {
[Environment.Development]: true,
[Environment.Production]: false,
[Environment.AlphaProduction]: false,
},
[Feature.SettingsNotificationTabEnabled]: {
[Environment.Development]: true,
[Environment.Production]: false,
[Environment.AlphaProduction]: false,
},
[Feature.SettingsAudioConversionTabEnabled]: {
[Environment.Development]: true,
[Environment.Production]: false,
[Environment.AlphaProduction]: false,
},
[Feature.CalendarTabEnabled]: {
[Environment.Development]: true,
[Environment.Production]: false,
[Environment.AlphaProduction]: false,
},
[Feature.YourPureIconsEnabled]: {
[Environment.Development]: true,
[Environment.Production]: false,
[Environment.AlphaProduction]: false,
},
[Feature.AlphaRelaseWarning]: {
[Environment.Development]: false,
[Environment.Production]: false,
[Environment.AlphaProduction]: true,
},
[Feature.ForceUpdate]: {
[Environment.Development]: false,
[Environment.Production]: true,

View File

@@ -9,7 +9,6 @@ export enum MessageBubbleTestIds {
Dropdown = "message-bubble-dropdown",
DropdownActionButton = "message-bubble-dropdown-action-button",
ResendMessageButton = "message-bubble-resend-message-button",
ForwardMessageButton = "message-bubble-forward-message-button",
DeleteMessageButton = "message-bubble-delete-message-button",
NotSendIcon = "message-bubble-not-send-icon",
Loader = "message-bubble-loader",

View File

@@ -31,7 +31,6 @@ import { DisplayStyle } from "Core/__deprecated__/renderer/components/core/butto
import { MessageBubbleTestIds } from "Core/messages/components/message-bubble/message-bubble-test-ids.enum"
import { IconType } from "Core/__deprecated__/renderer/components/core/icon/icon-type"
import { MessageType } from "Core/messages/constants"
import { flags, Feature } from "Core/feature-flags"
import { SearchResultAccent } from "Core/search/components"
import Loader from "Core/__deprecated__/renderer/components/core/loader/loader.component"
import { LoaderType } from "Core/__deprecated__/renderer/components/core/loader/loader.interface"
@@ -44,7 +43,6 @@ const MessageBubble: FunctionComponent<MessageBubbleProps> = ({
date,
interlocutor = false,
displayAvatar = false,
forwardMessage = noop,
removeMessage = noop,
resendMessage = noop,
messageType,
@@ -59,9 +57,6 @@ const MessageBubble: FunctionComponent<MessageBubbleProps> = ({
const close = () => setClicked("")
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
const forward = () => forwardMessage(id)
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
const remove = () => removeMessage(id)
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
@@ -117,17 +112,6 @@ const MessageBubble: FunctionComponent<MessageBubbleProps> = ({
data-testid={MessageBubbleTestIds.ResendMessageButton}
/>
)}
{flags.get(Feature.MessagesForwardEnabled) && (
<ButtonComponent
labelMessage={{
id: "module.messages.messageDropdownForward",
}}
Icon={IconType.Forward}
onClick={forward}
displayStyle={DisplayStyle.Dropdown}
data-testid={MessageBubbleTestIds.ForwardMessageButton}
/>
)}
<ButtonComponent
labelMessage={{
id: "module.messages.messageDropdownDelete",

Some files were not shown because too many files have changed in this diff Show More