updated external links

This commit is contained in:
PhilReact 2024-10-31 20:21:29 +02:00
parent fd6411bb30
commit c0831df541
7 changed files with 26 additions and 22 deletions

BIN
electron/assets/splash2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

View File

@ -2,3 +2,8 @@ require('./rt/electron-rt');
//////////////////////////////
// User Defined Preload scripts below
console.log('User Preload!');
const { contextBridge, shell } = require('electron');
contextBridge.exposeInMainWorld('electronAPI', {
openExternal: (url) => shell.openExternal(url)
});

View File

@ -12,6 +12,7 @@ import electronServe from 'electron-serve';
import windowStateKeeper from 'electron-window-state';
import { join } from 'path';
// Define components for a watcher to detect when the webapp is changed so we can reload in Dev mode.
const reloadWatcher = {
debouncer: null,

View File

@ -6,7 +6,6 @@ import {
useRef,
useState,
} from "react";
import { Browser } from "@capacitor/browser";
import "./App.css";
import { useDropzone } from "react-dropzone";
import {
@ -1377,7 +1376,7 @@ function App() {
textDecoration: "underline",
}}
onClick={async () => {
await Browser.open({ url: "https://www.qort.trade" });
window.electronAPI.openExternal("https://www.qort.trade");
}}
>
Get QORT at qort.trade
@ -2287,7 +2286,7 @@ function App() {
<CustomButton onClick={async ()=> {
await saveFileToDiskFunc()
await showInfo({
message: `Your wallet file was saved to internal storage, in the document folder. Keep that file secure.`,
message: `Keep your wallet file secure.`,
})
}}>
Download wallet
@ -2392,7 +2391,7 @@ await showInfo({
await saveFileToDiskFunc();
returnToMain();
await showInfo({
message: `Your wallet file was saved to internal storage, in the document folder. Keep that file secure.`,
message: `Keep your wallet file secure.`,
})
}}
>

View File

@ -3,10 +3,10 @@ import { executeEvent } from '../../utils/events';
import { useSetRecoilState } from 'recoil';
import { navigationControllerAtom } from '../../atoms/global';
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
import { Browser } from '@capacitor/browser';
import { saveFile } from '../../qortalRequests/get';
import { mimeToExtensionMap } from '../../utils/memeTypes';
import { MyContext } from '../../App';
import FileSaver from 'file-saver';
@ -269,7 +269,7 @@ const UIQortalRequests = [
try {
const { filename, mimeType, blob } = data;
const { filename, mimeType, blob, fileHandleOptions } = data;
setInfoSnackCustom({
type: "info",
@ -280,7 +280,10 @@ const UIQortalRequests = [
setOpenSnackGlobal(true);
await saveFileInChunks(blob, filename)
FileSaver.saveAs(blob, filename)
setInfoSnackCustom({
type: "success",
message:

View File

@ -36,8 +36,7 @@ export const MessageDisplay = ({ htmlContent , isReply}) => {
const target = e.target.closest('a');
if (target) {
const href = target.getAttribute('href');
await Browser.open({ url: href });
window.electronAPI.openExternal(href);
} else {
console.error('No <a> tag found or href is null.');
}

View File

@ -4,6 +4,8 @@ import { crypto, walletVersion } from '../../constants/decryptWallet';
import { doInitWorkers, kdf } from '../../deps/kdf';
import PhraseWallet from './phrase-wallet';
import * as WORDLISTS from './wordlists';
import FileSaver from 'file-saver';
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
export function generateRandomSentence(template = 'adverb verb noun adjective noun adverb verb noun adjective noun adjective verbed adjective noun', maxWordLength = 0, capitalize = true) {
const partsOfSpeechMap = {
@ -83,17 +85,12 @@ export const createAccount = async()=> {
}
export const saveFileToDisk = async (data: any, qortAddress: string) => {
export const saveFileToDisk = async (data, qortAddress) => {
const dataString = JSON.stringify(data);
const blob = new Blob([dataString], { type: 'application/json' });
const fileName = "qortal_backup_" + qortAddress + ".json";
const dataString = JSON.stringify(data);
const fileName = `qortal_backup_${qortAddress}.json`;
// Write the file to the Filesystem
await Filesystem.writeFile({
path: fileName,
data: dataString,
directory: Directory.Documents, // Save in the Documents folder
encoding: Encoding.UTF8,
});
};
await FileSaver.saveAs(blob, fileName);
}