Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/many-pumpkins-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@cypherock/cysync-core-constants': patch
'@cypherock/cysync-core': patch
---

ui for firmware release notes added
10 changes: 9 additions & 1 deletion packages/cysync-core-constants/src/i18n/lang/ar-AE.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"showQRCode": "إظهار رمز الاستجابة السريعة",
"editAccount": "تحرير الحساب",
"submit": "إرسال",
"showMore": "عرض المزيد"
"showMore": "عرض المزيد",
"downloadUpdate": "Download Update"
},
"tooltips": {
"downloadCsv": "تصدير كملف CSV"
Expand Down Expand Up @@ -561,6 +562,10 @@
"message": "تحديث البرامج الثابتة للإصدار ${version} متاح",
"button": "تنزيل"
},
"firmwareUpdateBar": {
"message": "Device firmware update version ${version} available",
"button": "Update firmware"
},
"betaNotificationBar": {
"message": "CySync v2.0.0 متوفر الآن!",
"button": "اعرف المزيد"
Expand Down Expand Up @@ -1320,6 +1325,9 @@
"releaseNote": {
"title": "ملاحظات الإصدار"
},
"firmwareNote": {
"title": "X1 Vault firmware version ${version} update"
},
"auth": {
"title": "اتبع التعليمات على X1 Vault",
"email2fa": {
Expand Down
10 changes: 9 additions & 1 deletion packages/cysync-core-constants/src/i18n/lang/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"showQRCode": "QR-Code anzeigen",
"editAccount": "Konto bearbeiten",
"submit": "Absenden",
"showMore": "Mehr anzeigen"
"showMore": "Mehr anzeigen",
"downloadUpdate": "Download Update"
},
"tooltips": {
"downloadCsv": "Als CSV exportieren"
Expand Down Expand Up @@ -563,6 +564,10 @@
"message": "Firmware-Aktualisierung Version ${version} verfügbar",
"button": "Herunterladen"
},
"firmwareUpdateBar": {
"message": "Device firmware update version ${version} available",
"button": "Update firmware"
},
"betaNotificationBar": {
"message": "CySync v2.0.0 ist verfügbar!",
"button": "Erfahren Sie mehr"
Expand Down Expand Up @@ -1325,6 +1330,9 @@
"releaseNote": {
"title": "Versionshinweise"
},
"firmwareNote": {
"title": "X1 Vault firmware version ${version} update"
},
"auth": {
"title": "Folgen Sie den Anweisungen auf dem X1 Vault",
"email2fa": {
Expand Down
10 changes: 9 additions & 1 deletion packages/cysync-core-constants/src/i18n/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"showQRCode": "Show QR Code",
"editAccount": "Edit Account",
"submit": "Submit",
"showMore": "Show more"
"showMore": "Show more",
"downloadUpdate": "Download Update"
},
"tooltips": {
"downloadCsv": "Export as CSV"
Expand Down Expand Up @@ -563,6 +564,10 @@
"message": "Firmware update version ${version} available",
"button": "Download"
},
"firmwareUpdateBar": {
"message": "Device firmware update version ${version} available",
"button": "Update firmware"
},
"betaNotificationBar": {
"message": "CySync v2.0.0 is available!",
"button": "Learn More"
Expand Down Expand Up @@ -1325,6 +1330,9 @@
"releaseNote": {
"title": "Release Notes"
},
"firmwareNote": {
"title": "X1 Vault firmware version ${version} update"
},
"auth": {
"title": "Follow instructions on the X1 Vault",
"email2fa": {
Expand Down
10 changes: 9 additions & 1 deletion packages/cysync-core-constants/src/i18n/lang/id-ID.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"showQRCode": "Tampilkan Kode QR",
"editAccount": "Sunting Akun",
"submit": "Kirim",
"showMore": "Tampilkan lebih banyak"
"showMore": "Tampilkan lebih banyak",
"downloadUpdate": "Download Update"
},
"tooltips": {
"downloadCsv": "Ekspor sebagai CSV"
Expand Down Expand Up @@ -563,6 +564,10 @@
"message": "Pembaruan Firmware Version ${version} tersedia",
"button": "Unduh"
},
"firmwareUpdateBar": {
"message": "Device firmware update version ${version} available",
"button": "Update firmware"
},
"betaNotificationBar": {
"message": "CySync v2.0.0 sudah tersedia!",
"button": "Pelajari Lebih Lanjut"
Expand Down Expand Up @@ -1325,6 +1330,9 @@
"releaseNote": {
"title": "Catatan Rilis"
},
"firmwareNote": {
"title": "X1 Vault firmware version ${version} update"
},
"auth": {
"title": "Ikuti instruksi pada X1 Vault",
"email2fa": {
Expand Down
10 changes: 9 additions & 1 deletion packages/cysync-core-constants/src/i18n/lang/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"showQRCode": "显示二维码",
"editAccount": "编辑账户",
"submit": "提交",
"showMore": "显示更多"
"showMore": "显示更多",
"downloadUpdate": "Download Update"
},
"tooltips": {
"downloadCsv": "导出为CSV"
Expand Down Expand Up @@ -561,6 +562,10 @@
"message": "固件更新 version ${version} 可用",
"button": "下载"
},
"firmwareUpdateBar": {
"message": "Device firmware update version ${version} available",
"button": "Update firmware"
},
"betaNotificationBar": {
"message": "CySync v2.0.0 可用!",
"button": "了解更多"
Expand Down Expand Up @@ -1300,6 +1305,9 @@
"releaseNote": {
"title": "发布说明"
},
"firmwareNote": {
"title": "X1 Vault firmware version ${version} update"
},
"auth": {
"title": "按照X1 Vault上的说明操作",
"email2fa": {
Expand Down
8 changes: 8 additions & 0 deletions packages/cysync-core-constants/src/i18n/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface LanguageStrings {
onboarding: LangOnboarding;
appUpdateBar: LangAppUpdateBar;
deviceUpdateBar: LangDeviceUpdateBar;
firmwareUpdateBar: LangFirmwareUpdateBar;
betaNotificationBar: LangBetaNotificationBar;
topbar: LangTopbar;
sidebar: LangSidebar;
Expand Down Expand Up @@ -75,6 +76,7 @@ interface LangButtons {
editAccount: string;
submit: string;
showMore: string;
downloadUpdate: string;
}

interface LangTooltips {
Expand Down Expand Up @@ -433,6 +435,11 @@ interface LangDeviceUpdateBar {
button: string;
}

interface LangFirmwareUpdateBar {
message: string;
button: string;
}

interface LangBetaNotificationBar {
message: string;
button: string;
Expand Down Expand Up @@ -640,6 +647,7 @@ interface LangDialogs {
close: { title: string };
reset: { confim: { title: string; subTitle: string } };
releaseNote: { title: string };
firmwareNote: { title: string };
auth: {
title: string;
email2fa: { title: string; emailInput: string };
Expand Down
3 changes: 3 additions & 0 deletions packages/cysync-core/src/actions/dialog/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export const openAuthenticateX1VaultDialog = () =>
export const openReleaseNotesDialog = () =>
openDialog({ name: 'releaseNotes', data: undefined });

export const openFirmwareReleaseNotesDialog = () =>
openDialog({ name: 'firmwareReleaseNotes', data: undefined });

export const openHistoryDialog = (props?: IHistoryDialogProps) =>
openDialog({ name: 'historyDialog', data: props });

Expand Down
18 changes: 18 additions & 0 deletions packages/cysync-core/src/bgTask/firmWareVersionSync/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React, { useEffect } from 'react';
import { useAppDispatch } from '~/store';
// import { openFirmwareReleaseNotesDialog } from '~/actions';
// import { keyValueStore } from '~/utils';
// import logger from '~/utils/logger';

export const VersionSyncTask: React.FC = () => {
const dispatch = useAppDispatch();

const checkVersion = async () => {
// need to add the logic to get and dispatch the latest firmware version
};
useEffect(() => {
checkVersion();
}, [dispatch]);

return null;
};
53 changes: 53 additions & 0 deletions packages/cysync-core/src/components/DeviceFirmwareUpdateBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import {
LangDisplay,
UpdateBar,
Container,
FirmwareIcon,
} from '@cypherock/cysync-ui';
import React, { FC } from 'react';
import { useTheme } from 'styled-components';

import { openFirmwareReleaseNotesDialog } from '~/actions';

import {
selectLanguage,
useAppDispatch,
useAppSelector,
useLatestDeviceVersion,
} from '..';

export const DeviceFirmwareUpdateBar: FC = () => {
const theme = useTheme();
const lang = useAppSelector(selectLanguage);
const dispatch = useAppDispatch();
const { version } = useLatestDeviceVersion();

if (!version) {
return null;
}

return (
<Container px={2} pt={2} pb={1} $bgColor="contentGradient" width="full">
<UpdateBar
icon={
<FirmwareIcon
width={21}
height={18}
fill={theme?.palette.text.heading}
stroke={theme?.palette.text.heading}
/>
}
onButtonClick={() => {
dispatch(openFirmwareReleaseNotesDialog());
}}
text={
<LangDisplay
text={lang.strings.firmwareUpdateBar.message}
variables={{ version: version ?? 'N/A' }}
/>
}
buttonText={lang.strings.firmwareUpdateBar.button}
/>
</Container>
);
};
1 change: 0 additions & 1 deletion packages/cysync-core/src/components/DeviceUpdateBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
} from '@cypherock/cysync-ui';
import React, { FC } from 'react';
import { useTheme } from 'styled-components';

import { openDeviceUpdateDialog } from '~/actions';

import {
Expand Down
1 change: 1 addition & 0 deletions packages/cysync-core/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export * from './Topbar';
export * from './CoinIcon';
export * from './AppUpdateBar';
export * from './DeviceUpdateBar';
export * from './DeviceFirmwareUpdateBar';
export * from './LoaderDialog';
export * from './CloseConfirmationDialog';
export * from './AppUpdateFailedFallback';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React, {
Context,
FC,
ReactNode,
createContext,
useContext,
useMemo,
} from 'react';

import { closeDialog, useAppDispatch } from '~/store';

export interface FirmwareReleaseNotesDialogContextInterface {
onClose: () => void;
}

export const FirmwareReleaseNotesDialogContext: Context<FirmwareReleaseNotesDialogContextInterface> =
createContext<FirmwareReleaseNotesDialogContextInterface>(
{} as FirmwareReleaseNotesDialogContextInterface,
);

export interface FirmwareReleaseNotesDialogProviderProps {
children: ReactNode;
}

export const FirmwareReleaseNotesDialogProvider: FC<
FirmwareReleaseNotesDialogProviderProps
> = ({ children }) => {
const dispatch = useAppDispatch();

const onClose = () => {
dispatch(closeDialog('firmwareReleaseNotes'));
};

const ctx = useMemo(
() => ({
onClose,
}),
[onClose],
);

return (
<FirmwareReleaseNotesDialogContext.Provider value={ctx}>
{children}
</FirmwareReleaseNotesDialogContext.Provider>
);
};

export function useFirmwareReleaseNotesDialog(): FirmwareReleaseNotesDialogContextInterface {
return useContext(FirmwareReleaseNotesDialogContext);
}
Loading