Skip to content

Commit

Permalink
merge main to test (#1397)
Browse files Browse the repository at this point in the history
Co-authored-by: patryk-sierzega <[email protected]>
Co-authored-by: Łukasz Kowalczyk <[email protected]>
Co-authored-by: Oskar Michalkiewicz <[email protected]>
Co-authored-by: Lukasz Jarkowski <[email protected]>
Co-authored-by: Oskar Michalkiewicz <[email protected]>
Co-authored-by: Łukasz Kowalczyk <[email protected]>
  • Loading branch information
7 people authored Sep 25, 2023
1 parent d6f780d commit fdea4fe
Show file tree
Hide file tree
Showing 366 changed files with 5,576 additions and 2,788 deletions.
11 changes: 7 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@ FEATURE_TOGGLE_ENVIRONMENT=
# [Optional] Defines the path to external variables file (used on CI)
STATIC_CONFIGURATION_FILE_PATH=

# [Optional] disable redux logger during development. Enabled by default, set "1" to disable
DISABLE_DEV_REDUX_LOGGER=
# [Optional] disable redux logger during development. Enabled by default, set "0" to disable
DEV_REDUX_LOGGER_ENABLED=

# [Optional] disable device logger during development. Enabled by default, set "1" to disable
DISABLE_DEV_DEVICE_LOGGER=
# [Optional] disable device logger during development. Enabled by default, set "0" to disable
DEV_DEVICE_LOGGER_ENABLED=

# [Optional] set desired latest release. Is based on enum OsEnvironment, so can be set to 'production', 'test-production' or 'daily'.

FEATURE_TOGGLE_RELEASE_ENVIRONMENT=

# [Optional] enable Mudita Center prerelease feature. Disabled by default, set "1" to enable
MUDITA_CENTER_PRERELEASE_ENABLED=
2 changes: 1 addition & 1 deletion .github/auto_assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ addAssignees: author

# A list of reviewers to be added to pull requests (GitHub user name)
reviewers:
- dkarski
- lkowalczyk87
- patryk-sierzega
- OskarMichalkiewicz
- dkarski

# A list of keywords to be skipped the process that add reviewers if pull requests include it
skipKeywords:
Expand Down
3 changes: 3 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ Jira: [CP-XXX]

**Description**

- [ ] getState function in async thunk actions is correctly typed
- [ ] redux selectors are used in components / prop drilling is reduce

<details>
<summary><b>Screenshots</b></summary>
// put images here
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,8 @@ packages/app/src/__deprecated__/renderer/fonts/main/**/*
# Fetched news
packages/app/src/news/default-news.json

# Fetched help items
packages/app/src/help/default-help.json

# Fetched appplication configuration
packages/app/src/settings/static/app-configuration.json
2 changes: 1 addition & 1 deletion packages/app/jest.coverage.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"branches": 67.71
}
}
}
}
11 changes: 10 additions & 1 deletion packages/app/package-lock.json

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

8 changes: 5 additions & 3 deletions packages/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mudita/mudita-center-app",
"version": "2.0.1",
"version": "2.2.0",
"description": "Mudita Center",
"main": "./dist/main.js",
"productName": "Mudita Center",
Expand Down Expand Up @@ -42,9 +42,10 @@
"translations:sync": "ts-node ./scripts/sync-translations.ts",
"fonts:download": "node ./scripts/downloadFonts.js",
"news:download": "ts-node ./scripts/downloadNews.ts",
"help:download": "ts-node ./scripts/downloadHelpItems.ts",
"app-configuration:download": "ts-node ./scripts/download-configuration.ts",
"UTILITY/AUTO COMMANDS": "=================================================",
"postinstall": "npm run fonts:download && npm run news:download && npm run app-configuration:download",
"postinstall": "npm run fonts:download && npm run news:download && npm run app-configuration:download && npm run help:download",
"prerelease": "npm run translations:overwrite && npm run build",
"prestart": "npm run build",
"predist:prod": "npm run translations:sync",
Expand All @@ -56,7 +57,7 @@
"build": {
"productName": "Mudita Center",
"appId": "com.mudita.center",
"copyright": "Copyright (c) 2017-2021, Mudita sp. z o.o. All rights reserved.",
"copyright": "Copyright (c) 2017-2023, Mudita sp. z o.o. All rights reserved.",
"mac": {
"category": "public.app-category.utilities",
"icon": "./icons/mac/icon.icns",
Expand Down Expand Up @@ -190,6 +191,7 @@
"@types/webpack-env": "^1.17.0",
"archiver": "^5.3.1",
"asar": "^3.2.0",
"async-mutex": "^0.4.0",
"awesome-typescript-loader": "^5.2.1",
"axios": "^0.27.2",
"axios-mock-adapter": "^1.21.2",
Expand Down
128 changes: 116 additions & 12 deletions packages/app/resources/license_en.txt

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions packages/app/scripts/downloadHelpItems.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Copyright (c) Mudita sp. z o.o. All rights reserved.
* For licensing, see https://github.com/mudita/mudita-center/blob/master/LICENSE.md
*/

const axios = require("axios")
const path = require("path")
const fs = require("fs-extra")
require("dotenv").config({
path: path.join(__dirname, "../../../.env"),
})
import { normalizeHelpData } from "../../app/src/__deprecated__/renderer/utils/contentful/normalize-help-data"
;(async () => {
try {
await fs.ensureDir(path.resolve(path.join("src", "main")))
const jsonPath = path.join("src", "help", "default-help.json")

const url = `${process.env.MUDITA_CENTER_SERVER_URL}/help`
const { data } = await axios.get(url)
const helpData = normalizeHelpData(data, "en-US")

await fs.writeJson(path.resolve(jsonPath), helpData)
console.log("Help downloading finished.")
} catch (error) {
console.log("Error while downloading Help.", error)
}
})()
26 changes: 26 additions & 0 deletions packages/app/src/__deprecated__/api/mudita-center-server/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ export interface getLatestProductionReleaseParams {
product: Product
version: "latest" | string
environment: OsEnvironment
deviceSerialNumber?: string
}

interface ExternalUsageDeviceQueryParams {
"serial-number": string
}

interface ExternalUsageDeviceResponse {
externalUsage: boolean
}

export class Client implements ClientInterface {
Expand Down Expand Up @@ -83,6 +92,23 @@ export class Client implements ClientInterface {
}
}

async getExternalUsageDevice(serialNumber: string): Promise<boolean> {
try {
const params: ExternalUsageDeviceQueryParams = {
"serial-number": serialNumber,
}

const response = await this.httpClient.get<
ExternalUsageDeviceQueryParams,
AxiosResponse<ExternalUsageDeviceResponse>
>(MuditaCenterServerRoutes.ExternalUsageDevice, { params })

return response.data.externalUsage
} catch (_) {
return false
}
}

async getLatestRelease(
params: getLatestProductionReleaseParams
): Promise<AxiosResponse<ReleaseManifest>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export enum MuditaCenterServerRoutes {
Help = "help",
GetReleaseV2 = "v2-get-release",
AppConfigurationV2 = "v2-app-configuration",
ExternalUsageDevice = "external-usage-device",
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export enum AboutActions {
LicenseOpenWindow = "license-open-window",
TermsOpenWindow = "terms-open-window",
PolicyOpenWindow = "policy-open-window",
PolicyOpenBrowser = "policy-open-browser",
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* 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 BrowserActions {
PolicyOpenBrowser = "policy-open-browser",
UpdateOpenBrowser = "update-open-browser",
}
26 changes: 24 additions & 2 deletions packages/app/src/__deprecated__/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import { Mode } from "App/__deprecated__/common/enums/mode.enum"
import { HelpActions } from "App/__deprecated__/common/enums/help-actions.enum"
import { AboutActions } from "App/__deprecated__/common/enums/about-actions.enum"
import { PureSystemActions } from "App/__deprecated__/common/enums/pure-system-actions.enum"
import { BrowserActions } from "App/__deprecated__/common/enums/browser-actions.enum"
import {
createMetadataStore,
MetadataStore,
Expand All @@ -80,6 +81,7 @@ import {
import { registerOsUpdateAlreadyDownloadedCheck } from "App/update/requests"
import { createSettingsService } from "App/settings/containers/settings.container"
import { ApplicationModule } from "App/core/application.module"
import registerExternalUsageDevice from "App/device/listeners/register-external-usage-device.listner"

// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
Expand Down Expand Up @@ -131,7 +133,6 @@ const commonWindowOptions: BrowserWindowConstructorOptions = {
webSecurity: false,
devTools: !productionEnvironment,
},
autoHideMenuBar: true,
}
const getWindowOptions = (
extendedWindowOptions?: BrowserWindowConstructorOptions
Expand Down Expand Up @@ -162,6 +163,13 @@ const createWindow = async () => {
title,
})
)
win.removeMenu()

win.webContents.on("before-input-event", (event, input) => {
if ((input.control || input.meta) && input.key.toLowerCase() === "r") {
event.preventDefault()
}
})

win.on("closed", () => {
win = null
Expand Down Expand Up @@ -195,6 +203,7 @@ const createWindow = async () => {
registerMetadataAllGetValueListener()
registerMetadataGetValueListener()
registerMetadataSetValueListener()
registerExternalUsageDevice()

if (productionEnvironment) {
win.setMenuBarVisibility(false)
Expand Down Expand Up @@ -268,6 +277,7 @@ ipcMain.answerRenderer(HelpActions.OpenWindow, () => {
title,
})
)
helpWindow.removeMenu()

helpWindow.on("closed", () => {
removeDownloadHelpHandler()
Expand Down Expand Up @@ -308,13 +318,14 @@ const createOpenWindowListener = (
if (newWindow === null) {
// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/await-thenable
newWindow = await new BrowserWindow(
newWindow = new BrowserWindow(
getWindowOptions({
width: DEFAULT_WINDOWS_SIZE.width,
height: DEFAULT_WINDOWS_SIZE.height,
title,
})
)
newWindow.removeMenu()

newWindow.on("closed", () => {
newWindow = null
Expand Down Expand Up @@ -343,6 +354,15 @@ const createOpenWindowListener = (
})
}

ipcMain.answerRenderer(BrowserActions.PolicyOpenBrowser, () =>
shell.openExternal(
`${process.env.MUDITA_CENTER_SERVER_URL ?? ""}/privacy-policy-url`
)
)
ipcMain.answerRenderer(BrowserActions.UpdateOpenBrowser, () =>
shell.openExternal("https://mudita.com")
)

createOpenWindowListener(
AboutActions.LicenseOpenWindow,
Mode.License,
Expand Down Expand Up @@ -412,6 +432,7 @@ ipcMain.answerRenderer(GoogleAuthActions.OpenWindow, async (scope: Scope) => {
title,
})
)
googleAuthWindow.removeMenu()

googleAuthWindow.on("close", () => {
void ipcMain.callRenderer(
Expand Down Expand Up @@ -474,6 +495,7 @@ ipcMain.answerRenderer(
title,
})
)
outlookAuthWindow.removeMenu()

// AUTO DISABLED - fix me if you like :)
// eslint-disable-next-line @typescript-eslint/no-floating-promises
Expand Down
Loading

0 comments on commit fdea4fe

Please sign in to comment.