Skip to content

Commit

Permalink
v2.3.0-rc.4 (#1865)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkarski committed May 14, 2024
1 parent 32096e4 commit 20591e1
Show file tree
Hide file tree
Showing 43 changed files with 121 additions and 610 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Software License Agreement

Mudita Center – https://github.com/mudita/mudita-center
Copyright (c) 2017-2021, Mudita Sp. z o.o. All rights reserved.
Copyright (c) 2017-2024, Mudita Sp. z o.o. All rights reserved.

## Sources of Intellectual Property Included in Mudita Center

Expand Down
4 changes: 2 additions & 2 deletions apps/mudita-center/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions apps/mudita-center/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mudita-center",
"version": "2.3.0-rc.3",
"version": "2.3.0-rc.4",
"description": "Mudita Center",
"main": "./dist/main.js",
"productName": "Mudita Center",
Expand Down Expand Up @@ -39,7 +39,7 @@
"build": {
"productName": "Mudita Center",
"appId": "com.mudita.center",
"copyright": "Copyright (c) 2017-2023, Mudita sp. z o.o. All rights reserved.",
"copyright": "Copyright (c) 2017-2024, Mudita sp. z o.o. All rights reserved.",
"mac": {
"category": "public.app-category.utilities",
"icon": "./icons/mac/icon.icns",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ const InputSearchComponent: FunctionComponent<InputSearchProps> = ({
useEffect(() => {
if (listRef.current) {
listRef.current.children[activeItemIndex]?.scrollIntoView({
behavior: "smooth",
behavior: "auto",
block: "nearest",
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ export const ModalSubTitle = styled(Text)`
`

export const Close = styled(Button)`
margin-top: -0.6rem;
margin-right: -0.8rem;
grid-area: Close;
justify-self: end;
width: 2.8rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,9 @@ import { Settings } from "Core/settings/dto"

export const fakeAppSettings: Settings = {
applicationId: "app-Nr8uiSV7KmWxX3WOFqZPF7uB",
autostart: false,
tethering: false,
tray: true,
osBackupLocation: `fake/path/pure/phone/backups/`,
osDownloadLocation: `fake/path/pure/os/downloads/`,
language: "en-US",
neverConnected: true,
collectingData: undefined,
privacyPolicyAccepted: false,
diagnosticSentTimestamp: 0,
ignoredCrashDumps: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ export class AnalyticDataTrackerService implements AnalyticDataTrackerClass {
this.visitorMetadata = visitorMetadata
}

private trackRequest(event: TrackEvent): Promise<AxiosResponse | undefined> {
private async trackRequest(
event: TrackEvent
): Promise<AxiosResponse | undefined> {
const params: AxiosRequestConfig["params"] = {
rec: 1,
apiv: 1,
Expand All @@ -101,10 +103,12 @@ export class AnalyticDataTrackerService implements AnalyticDataTrackerClass {
...event,
}

return this.httpClient.post(this.apiUrl, undefined, {
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
params,
})
try {
return await this.httpClient.post(this.apiUrl, undefined, {
params,
})
} catch {
return undefined
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@
import { createSelector } from "@reduxjs/toolkit"
import { isAppUpdateProcessPassed } from "Core/app-initialization/selectors/is-app-update-process-passed.selector"
import { isUsbAccessGrantedSelector } from "Core/settings/selectors/is-usb-access-granted.selector"
import { settingsStateSelector } from "Core/settings/selectors"

export const isAppInitializationFinishedSelector = createSelector(
isAppUpdateProcessPassed,
isUsbAccessGrantedSelector,
(appUpdateProcessPassed, usbAccessGranted): boolean => {
return appUpdateProcessPassed && usbAccessGranted
settingsStateSelector,
(
appUpdateProcessPassed,
usbAccessGranted,
{ privacyPolicyAccepted }
): boolean => {
return appUpdateProcessPassed && usbAccessGranted && Boolean(privacyPolicyAccepted)
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,27 @@

import { createSelector } from "@reduxjs/toolkit"
import { settingsStateSelector } from "Core/settings/selectors"
import { shouldAppUpdateFlowVisible } from "Core/app-initialization/selectors/should-app-update-flow-visible.selector"

export const isAppUpdateProcessPassed = createSelector(
const selectNoDataAboutUpdateAvaible = createSelector(
settingsStateSelector,
({
updateAvailable,
updateAvailableSkipped,
checkingForUpdateFailed,
updateRequired,
}): boolean => {
return (
!updateRequired &&
(checkingForUpdateFailed ||
updateAvailableSkipped ||
updateAvailable === false)
updateAvailableSkipped === undefined &&
updateAvailable === undefined &&
checkingForUpdateFailed
)
}
)

export const isAppUpdateProcessPassed = createSelector(
selectNoDataAboutUpdateAvaible,
shouldAppUpdateFlowVisible,
(noDataAboutUpdateAvaible, appUpdateFlowVisible): boolean => {
return !appUpdateFlowVisible || noDataAboutUpdateAvaible
}
)
12 changes: 0 additions & 12 deletions libs/core/connecting/requests/register-first-phone-connection.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,9 @@ export const initializeMuditaPure = createAsyncThunk<
return DeviceInitializationStatus.Aborted
}
const unlockStatus = await dispatch(getUnlockStatus())
if (!unlockStatus.payload) {
if (unlockStatus.payload === "LOCKED") {
return DeviceInitializationStatus.Initializing
}

if (!isActiveDeviceAttachedSelector(getState())) {
} else if (unlockStatus.payload === "ABORTED") {
dispatch(
setDeviceInitializationStatus(DeviceInitializationStatus.Aborted)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const PasscodeInputs: FunctionComponent<Props> = ({
const onKeyDownHandler =
(number: number) =>
(e: { key: string; code: string; preventDefault: () => void }) => {
if (/[0-9]/.test(e.key)) {
if (/^[0-9]$/.test(e.key)) {
const backspaceEdgeCase = activeInput === 0 && e.key === ""
if (
activeInput !== undefined &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ const letterKeyEvent = {
charCode: 0,
} as KeyboardEvent

const F1KeyEvent = {
key: "F1",
code: "F1",
keyCode: 112,
charCode: 0,
} as KeyboardEvent

const backspaceKeyEvent = {
key: "Backspace",
code: "Backspace",
Expand Down Expand Up @@ -88,7 +95,7 @@ test("Passcode inputs are disabled when filled", () => {
expect(inputsList()[0]).toHaveStyleRule("background-color", "#f4f5f6")
})

test("Show typing error message", async () => {
test("Show typing error message when a latter is typed", async () => {
const { inputsList, errorMessage } = renderer()
fireEvent.keyDown(inputsList()[0] as Element, letterKeyEvent)
await waitFor(() =>
Expand All @@ -98,6 +105,16 @@ test("Show typing error message", async () => {
)
})

test("Show typing error message when F1 is typed", async () => {
const { inputsList, errorMessage } = renderer()
fireEvent.keyDown(inputsList()[0] as Element, F1KeyEvent)
await waitFor(() =>
expect(errorMessage()).toHaveTextContent(
"[value] component.passcodeModalErrorTyping"
)
)
})

test("Message is displayed properly when request about phone lock return internal server error", async () => {
const { inputsList, errorMessage } = renderer({
unlockDevice: jest.fn().mockReturnValue({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,24 @@ const DrawerWrapper = styled("div")`
.EZDrawer .EZDrawer__checkbox:checked ~ .EZDrawer__container {
transition: transform 500ms;
}
* {
box-sizing: border-box;
}
`

const DrawerChildrenContainer = styled("div")`
padding: 1.3rem 1.8rem 1.3rem 1.8rem;
padding: 1.8rem;
overflow: hidden;
display: flex;
flex-direction: column;
gap: 3.2rem;
gap: 3.4rem;
height: 100%;
`

const Header = styled("div")`
display: flex;
justify-content: space-between;
padding-right: 1.8rem;
padding-right: 0.7rem;
`

const DevicesContainer = styled("div")`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ import { intl } from "Core/__deprecated__/renderer/utils/intl"
import { getSerialNumberValue } from "Core/utils/get-serial-number-value"

const Device = styled("div")<{ active: boolean }>`
padding: 1.8rem 2.4rem 1.8rem 1rem;
padding: 1.8rem 2.1rem;
display: flex;
min-width: 27.2rem;
max-width: 27.2rem;
width: 100%;
&:hover {
background: ${backgroundColor("main")};
Expand All @@ -55,7 +54,7 @@ const DeviceImageContainer = styled("div")`
justify-content: center;
min-height: 9.6rem;
min-width: 9.1rem;
padding: 0 2.4rem 0 0rem;
padding: 0 2.8rem 0 0;
`

export const DeviceImageStyled = styled(DeviceImage)`
Expand Down Expand Up @@ -101,7 +100,7 @@ const ActiveDot = styled("span")`
background-color: ${textColor("primary")};
border-radius: 50%;
display: inline-block;
margin: 0rem 0.5rem 0.8rem 0.5rem;
margin: 0 0.5rem 0.8rem 0.5rem;
`

const DeviceName = styled(Text)`
Expand Down
23 changes: 18 additions & 5 deletions libs/core/device/actions/get-unlock-status.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@
*/

import { createAsyncThunk } from "@reduxjs/toolkit"
import { DeviceEvent } from "Core/device/constants"
import { DeviceCommunicationError, DeviceEvent } from "Core/device/constants"
import { unlockDeviceStatusRequest } from "Core/device/requests"
import { ReduxRootState } from "Core/__deprecated__/renderer/store"
import { setLockTime } from "Core/device/actions/base.action"
import { setLockTime, setUnlockedStatus } from "Core/device/actions/base.action"
import { getLeftTimeSelector } from "Core/device/selectors"
import { handleCommunicationError } from "Core/device/actions/handle-communication-error.action"

export type UnlockStatus = "UNLOCKED" | "LOCKED" | "ABORTED"

export const getUnlockStatus = createAsyncThunk<
boolean,
UnlockStatus,
void,
{ state: ReduxRootState }
>(DeviceEvent.GetUnlockedStatus, async (_, { dispatch, getState }) => {
const { ok, error } = await unlockDeviceStatusRequest()
const result = await unlockDeviceStatusRequest()
const { ok, error } = result
const leftTime = getLeftTimeSelector(getState())

if (ok && leftTime !== undefined) {
Expand All @@ -27,5 +30,15 @@ export const getUnlockStatus = createAsyncThunk<
await dispatch(handleCommunicationError(error))
}

return ok
if (error?.type === DeviceCommunicationError.DeviceLocked) {
dispatch(setUnlockedStatus(false))
return "LOCKED"
}

if (ok) {
dispatch(setUnlockedStatus(true))
return "UNLOCKED"
} else {
return "ABORTED"
}
})
10 changes: 0 additions & 10 deletions libs/core/device/reducers/device.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import { createReducer } from "@reduxjs/toolkit"
import {
getUnlockStatus,
loadDeviceData,
loadStorageInfoAction,
setCriticalBatteryLevelStatus,
Expand Down Expand Up @@ -110,15 +109,6 @@ export const deviceReducer = createReducer<DeviceState>(
error: action.payload as AppError,
}
})
.addCase(getUnlockStatus.fulfilled, (state, action) => {
return {
...state,
status: {
...state.status,
unlocked: action.payload,
},
}
})
.addCase(setLockTime, (state, action) => {
return {
...state,
Expand Down
7 changes: 0 additions & 7 deletions libs/core/modals-manager/constants/event.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@
*/

export enum ModalsManagerEvent {
CheckAppForcedUpdateFlowToShow = "CHECK_APP_FORCED_UPDATE_FLOW_TO_SHOW",
CheckAppUpdateFlowToShow = "CHECK_APP_UPDATE_FLOW_TO_SHOW",
CheckCollectingDataModalToShow = "CHECK_COLLECTING_DATA_MODAL_TO_SHOW",
HideModals = "HIDE_MODALS",
HideCollectingDataModal = "HIDE_COLLECTING_DATA_MODAL",
ShowModal = "SHOW_MODAL",
ShowCollectingDataModal = "SHOW_COLLECTING_DATA_MODAL",
ShowAppForcedUpdateFlow = "SHOW_APP_FORCED_UPDATE_FLOW",
ShowAppRequiresSerialPortGroup = "SHOW_APP_REQUIRES_SERIAL_PORT_GROUP",
AddUSBAccess = "ADD_USB_ACCESS",
}
5 changes: 0 additions & 5 deletions libs/core/overview/components/backup/backup.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,9 @@ const lastBackupDate = new Date("2020-01-15T07:35:01.562Z")
type Props = ComponentProps<typeof Backup>

const defaultProps: Props = {
autostart: false,
collectingData: undefined,
tethering: false,
tray: false,
diagnosticSentTimestamp: 0,
language: "en-US",
onBackupCreate: noop,
neverConnected: false,
osBackupLocation: "",
osDownloadLocation: "",
backupActionDisabled: false,
Expand Down
Loading

0 comments on commit 20591e1

Please sign in to comment.