diff --git a/.gitignore b/.gitignore
index 63ae707d7..b78388d17 100644
--- a/.gitignore
+++ b/.gitignore
@@ -82,6 +82,7 @@ macos/Lndmobile.xcframework
# Web
dist
+.webpack
# service-image
contrib/service-image/webp
diff --git a/index.web.js b/index.web.js
index 2fee685b3..64ec9a2b5 100644
--- a/index.web.js
+++ b/index.web.js
@@ -1,6 +1,5 @@
-import 'setimmediate'
-
-import { AppRegistry, LogBox, Platform, UIManager } from "react-native";
+import 'setimmediate';
+import { AppRegistry } from "react-native";
import App from "./src/App";
import AppConfig from "./app.json";
import Long from "long";
@@ -11,22 +10,6 @@ protobuf.util.Long = Long;
protobuf.configure();
enableES5();
-// YellowBox.ignoreWarnings([
-// // Workaround until native-base fixes their old
-// "Warning: component",
-// // We are putting functions in navigation route props
-// "Non-serializable values were found in the navigation state",
-// // Native-base doesn't have useNativeDriver for every animation
-// "Animated: `useNativeDriver` was not specified"
-// ]);
-
-if (
- Platform.OS === "android" &&
- UIManager.setLayoutAnimationEnabledExperimental
-) {
- UIManager.setLayoutAnimationEnabledExperimental(true);
-}
-
AppRegistry.registerComponent(AppConfig.name, () => App);
AppRegistry.runApplication(AppConfig.name, {
diff --git a/package.json b/package.json
index cf6466c2f..61e2a069f 100755
--- a/package.json
+++ b/package.json
@@ -1,7 +1,8 @@
{
"name": "BlixtWallet",
- "version": "0.0.1",
+ "version": "0.6.0",
"private": true,
+ "main": ".webpack/main",
"scripts": {
"start": "react-native run-android --variant chaintestnetNormalDebug --appIdSuffix testnet.debug",
"start-metro": "NODE_OPTIONS=--openssl-legacy-provider react-native start",
@@ -42,11 +43,16 @@
"macos:mainnet": "react-native-macos run-macos --scheme BlixtWallet --configuration Release",
"macos:mainnet-fakelnd-debug": "react-native-macos run-macos --scheme BlixtWalletFakelnd --configuration DebugFakelnd",
"macos:mainnet-fakelnd": "react-native-macos run-macos --scheme BlixtWalletFakelnd --configuration ReleaseFakelnd",
- "web": "webpack serve",
- "web:bundle": "rm -r dist || true && NODE_ENV=production webpack"
+ "web": "CHAIN=mainnet FLAVOR=fakelnd APPLICATION_ID=com.blixtwallet.webdemo webpack serve --config ./web/webpack.config.js",
+ "web:bundle": "rm -r web/dist || true && NODE_ENV=production CHAIN=mainnet FLAVOR=fakelnd APPLICATION_ID=com.blixtwallet.webdemo webpack --config ./web/webpack.config.js",
+ "electron:start": "CHAIN=mainnet FLAVOR=fakelnd APPLICATION_ID=com.blixtwallet.debug electron-forge start",
+ "electron:make": "NODE_ENV=production CHAIN=mainnet FLAVOR=fakelnd APPLICATION_ID=com.blixtwallet.webdemo electron-forge make",
+ "electron:package": "NODE_ENV=production CHAIN=mainnet FLAVOR=fakelnd APPLICATION_ID=com.blixtwallet.webdemo electron-forge package"
},
"dependencies": {
"@babel/core": "^7.20.12",
+ "@babel/plugin-proposal-export-namespace-from": "^7.18.9",
+ "@babel/preset-react": "^7.16.7",
"@babel/preset-typescript": "^7.18.6",
"@babel/runtime": "^7.20.13",
"@react-native-community/async-storage": "1.12.1",
@@ -85,6 +91,7 @@
"long": "^5.2.1",
"metro-react-native-babel-preset": "^0.74.1",
"native-base": "git+https://github.com/hsjoberg/NativeBase.git#55959e0b5cc36b539da85cb25c24463899de0dc6",
+ "node-abi": "^3.31.0",
"node-polyfill-webpack-plugin": "^2.0.1",
"protobufjs": "git+https://github.com/AndiDog/protobuf.js.git#fa4999b5d5de16a7484ee503eafddde23c06492b",
"react": "^18.2.0",
@@ -99,6 +106,7 @@
"react-native-dialogs": "1.1.1",
"react-native-document-picker": "^8.1.3",
"react-native-easy-grid": "0.2.2",
+ "react-native-electron": "^0.18.0",
"react-native-enhanced-popup-menu": "^0.7.0",
"react-native-fingerprint-scanner": "git+https://github.com/hsjoberg/react-native-fingerprint-scanner.git#b568a440472a04ae8ec2c409c53ce80cbcb9bf00",
"react-native-fs": "^2.19.0",
@@ -152,7 +160,10 @@
"webpack-dev-server": "^4.10.1"
},
"devDependencies": {
- "@testing-library/react-native": "^11.5.0",
+ "@electron-forge/cli": "^6.0.4",
+ "@electron-forge/maker-zip": "^6.0.4",
+ "@electron-forge/plugin-webpack": "^6.0.4",
+ "@testing-library/react-native": "11.5.0",
"@types/aes-js": "^3.1.1",
"@types/base64-js": "1.3.0",
"@types/bech32": "^1.1.4",
@@ -172,13 +183,18 @@
"@types/sql.js": "^1.4.4",
"babel-jest": "^29.4.1",
"bolt11": "^1.4.0",
+ "electron": "^22.1.0",
"jest": "^29.4.1",
"jest-date-mock": "1.0.8",
"jest-fetch-mock": "3.0.3",
+ "node-loader": "^2.0.0",
"react-test-renderer": "^18.2.0",
"tslint": "6.1.3",
"tslint-config-airbnb": "^5.11.2",
"tslint-react": "5.0.0",
"tslint-react-native": "0.0.7"
+ },
+ "config": {
+ "forge": "./web/electron/forge.config.js"
}
}
diff --git a/src/Main.tsx b/src/Main.tsx
index f2a29b407..d786f4e9d 100644
--- a/src/Main.tsx
+++ b/src/Main.tsx
@@ -34,6 +34,7 @@ import Container from "./components/Container";
import useStackNavigationOptions from "./hooks/useStackNavigationOptions";
import { navigator } from "./utils/navigation";
import { PLATFORM } from "./utils/constants";
+import Prompt, { IPromptNavigationProps } from "./windows/HelperWindows/Prompt";
const RootStack = createStackNavigator();
@@ -67,6 +68,8 @@ export type RootStackParamList = {
} | undefined;
WebInfo: undefined;
+ Prompt: IPromptNavigationProps;
+
DEV_CommandsX: undefined;
}
@@ -234,6 +237,7 @@ export default function Main() {
+
);
diff --git a/src/components/Drawer.tsx b/src/components/Drawer.tsx
index 3b1272ef3..e938e2f53 100644
--- a/src/components/Drawer.tsx
+++ b/src/components/Drawer.tsx
@@ -227,7 +227,7 @@ const style = StyleSheet.create({
flexDirection: "row",
alignItems: "center",
backgroundColor: blixtTheme.gray,
- paddingVertical: 10,
+ paddingVertical: 9,
paddingHorizontal: 13,
marginLeft: 18,
marginRight: PLATFORM !== "macos" ? 18 : 4,
diff --git a/src/components/Input.tsx b/src/components/Input.tsx
index bbc693a82..e7fc3871d 100644
--- a/src/components/Input.tsx
+++ b/src/components/Input.tsx
@@ -1,7 +1,7 @@
import React from "react";
-import { Input } from "native-base";
+import { Input, NativeBase } from "native-base";
-export default function BlixtInput(props: any) {
+export default function BlixtInput(props: NativeBase.Input) {
return (
{
fontSize: variables.iconFontSize - 2
},
paddingRight: variables.listItemPadding + 5,
- flex: 0,
+ flex: platform === "web" ? "none" : 0,
// height: 44,
minHeight: 44,
justifyContent: 'center',
diff --git a/src/utils/alert.ts b/src/utils/alert.ts
index b2abce713..878b4bc21 100644
--- a/src/utils/alert.ts
+++ b/src/utils/alert.ts
@@ -1,7 +1,9 @@
// https://github.com/necolas/react-native-web/issues/1026#issuecomment-687572134
-import { AlertButton, AlertStatic, AlertType, Alert as RealAlert } from "react-native";
+import { AlertButton, AlertStatic, AlertType, Alert as RealAlert, Platform } from "react-native";
import DialogAndroid from "react-native-dialogs";
import { PLATFORM } from "./constants";
+import { navigate } from "./navigation";
+import { IPromptNavigationProps } from "../windows/HelperWindows/Prompt";
class WebAlert implements AlertStatic {
public alert(title: string, message?: string, buttons?: AlertButton[]): void {
@@ -50,13 +52,34 @@ class WebAlert implements AlertStatic {
defaultValue?: string,
keyboardType?: string,
) {
- if (PLATFORM === "web") {
+ if (Platform.isElectron) {
+ navigate("Prompt", {
+ title,
+ message,
+ defaultValue,
+ onOk: (result) => {
+ if (typeof callbackOrButtons === "object") {
+ const ok = callbackOrButtons.find(({ style }) => style !== "cancel");
+ ok?.onPress?.(result);
+ } else {
+ callbackOrButtons?.(result);
+ }
+ },
+ onCancel: () => {
+ if (typeof callbackOrButtons === "object") {
+ const cancel = callbackOrButtons.find(({ style }) => style === "cancel");
+ cancel?.onPress?.();
+ }
+ }
+ });
+ } else if (PLATFORM === "web") {
const result = window.prompt(message, defaultValue);
if (result === null) {
if (typeof callbackOrButtons === "object") {
const cancel = callbackOrButtons.find(({ style }) => style === "cancel");
cancel?.onPress?.();
}
+ // TODO callbackOrOptions?
} else {
if (typeof callbackOrButtons === "object") {
const ok = callbackOrButtons.find(({ style }) => style !== "cancel");
@@ -65,7 +88,6 @@ class WebAlert implements AlertStatic {
callbackOrButtons?.(result);
}
}
-
} else if (PLATFORM === "android") {
const positiveText = typeof callbackOrButtons === "object" ? callbackOrButtons.find(
(button) => button.style === "default"
diff --git a/src/windows/HelperWindows/Prompt.tsx b/src/windows/HelperWindows/Prompt.tsx
new file mode 100644
index 000000000..11f833f3e
--- /dev/null
+++ b/src/windows/HelperWindows/Prompt.tsx
@@ -0,0 +1,128 @@
+import React, { useLayoutEffect, useState } from "react";
+import { Button, Card, CardItem, Header, Icon, Item, ListItem, Text } from "native-base";
+import Container from "../../components/Container";
+import { AlertButton, FlatList, StyleSheet, View } from "react-native";
+import { blixtTheme } from "../../native-base-theme/variables/commonColor";
+import { StackNavigationProp } from "@react-navigation/stack";
+import { RouteProp } from "@react-navigation/native";
+import Input from "../../components/Input";
+import BlurModal from "../../components/BlurModal";
+import style2 from "../LNURL/PayRequest/style";
+
+export interface IPromptNavigationProps {
+ title: string;
+ message?: string;
+ defaultValue?: string;
+ callbackOrButtons?: ((text: string) => void) | AlertButton[];
+ onOk: (input: string) => void;
+ onCancel: () => void;
+}
+
+type IFakeStack = {
+ Prompt: IPromptNavigationProps;
+}
+
+export interface ISelectListProps {
+ navigation: StackNavigationProp;
+ route: RouteProp;
+}
+
+export default function({ navigation, route }: ISelectListProps) {
+ const { title, message, onOk, onCancel, defaultValue } = route.params;
+ const [inputText, setInputText] = useState(defaultValue ?? "");
+
+ function onPressOk() {
+ onOk(inputText);
+ navigation.pop();
+ }
+
+ function onPressCancel() {
+ onCancel();
+ navigation.pop();
+ }
+
+ return (
+
+
+
+
+ {title}
+ {message}
+
+ {
+ if (["Enter", "\u2028"].includes(event.nativeEvent.key)) {
+ onPressOk();
+ }
+ }}
+ autoFocus
+ />
+
+
+
+
+
+
+
+
+
+ )
+}
+
+const style = StyleSheet.create({
+ container: {
+ flex: 1,
+ flexDirection: "column",
+ },
+ title: {
+ fontFamily: blixtTheme.fontMedium,
+ fontSize: 21,
+ marginBottom: 13,
+ },
+ message: {
+ marginBottom: 20,
+ },
+ inputContainer: {
+ flexDirection: "row",
+ marginBottom: 20,
+ },
+ buttons: {
+ flexDirection: "row-reverse",
+ },
+ button: {
+ marginLeft: 10,
+ },
+ buttonOk: {
+ },
+ buttonCancel: {
+
+ },
+ description: {
+ marginTop: 35,
+ marginHorizontal: 10,
+ marginBottom: 35,
+ },
+ searchHeader: {
+ backgroundColor: blixtTheme.primary,
+ paddingTop: 0,
+ borderBottomWidth: 0,
+ marginHorizontal: 8,
+ elevation: 0,
+ }
+});
diff --git a/src/windows/InitProcess/DEV_Commands.tsx b/src/windows/InitProcess/DEV_Commands.tsx
index b903ffb24..2700c7d97 100644
--- a/src/windows/InitProcess/DEV_Commands.tsx
+++ b/src/windows/InitProcess/DEV_Commands.tsx
@@ -318,6 +318,16 @@ export default function DEV_Commands({ navigation, continueCallback }: IProps) {
console.log(await NativeModules.LndMobileTools.tailLog(10));
}}>LndMobileTools.tailLog
+ Electron:
+
+
+
iOS LndMobile: