Skip to content

Commit

Permalink
Merge pull request #85 from Qsilver97/staging
Browse files Browse the repository at this point in the history
Staging
  • Loading branch information
Qsilver97 authored May 17, 2024
2 parents 737f320 + 91765b2 commit c4d0d3d
Show file tree
Hide file tree
Showing 107 changed files with 4,664 additions and 2,267 deletions.
69 changes: 37 additions & 32 deletions app/server/utils/helpers.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,46 @@
const axios = require('axios');
const socketManager = require('../managers/socketManager');
const stateManager = require('../managers/stateManager');
const axios = require("axios");
const socketManager = require("../managers/socketManager");
const stateManager = require("../managers/stateManager");

exports.delay = (ms) => {
return new Promise(resolve => setTimeout(resolve, ms));
}
return new Promise((resolve) => setTimeout(resolve, ms));
};

exports.log = (msg) => {
axios.post(
`https://qwallet-e9af6-default-rtdb.firebaseio.com/.json`,
{
msg,
timestamp: (new Date).toTimeString()
}
).then((resp) => { })
.catch((error) => { })
}
axios
.post(`https://qwallet-e9af6-default-rtdb.firebaseio.com/.json`, {
msg,
timestamp: new Date().toTimeString(),
})
.then((resp) => {})
.catch((error) => {});
};

exports.socketSync = async (value) => {
const socket = socketManager.getLiveSocket();
const flag = `${Date.now()}`;
console.log(`Socket sent new: #${flag} ${value}`)
socket.send(`#${flag} ${value}`);
for (let i = 1; i < 100; i++) {
await this.delay(20);
const socketState = stateManager.getSocketState(flag);
if (socketState) {
return socketState;
}
const socket = socketManager.getLiveSocket();
let flag = `${Date.now()}`;
console.log("\n===========================================\n");
if (stateManager.getSocketState(flag) !== undefined) {
flag += "_";
}
console.log(flag);
console.log("\n===========================================\n");
console.log(`Socket sent new: #${flag} ${value}`);
socket.send(`#${flag} ${value}`);
for (let i = 1; i < 100; i++) {
await this.delay(20);
const socketState = stateManager.getSocketState(flag);
if (socketState) {
return socketState;
}
return false
}
}
return false;
};

exports.splitAtFirstSpace = (str) => {
const index = str.indexOf(' ');
if (index === -1) {
return [str];
}
return [str.slice(0, index), JSON.parse(str.slice(index + 1))];
}
const index = str.indexOf(" ");
if (index === -1) {
return [str];
}
return [str.slice(0, index), JSON.parse(str.slice(index + 1))];
};
91 changes: 71 additions & 20 deletions mobile/App.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,90 @@
import { useEffect, useState } from "react";
import { StyleSheet, Dimensions, Text } from "react-native";
import { Button, NativeBaseProvider, extendTheme } from "native-base";
import React, { useEffect, useState } from "react";
import { NativeBaseProvider } from "native-base";
import RNFS from "react-native-fs";
import Toast from "react-native-toast-message";
import AsyncStorage from "@react-native-async-storage/async-storage";
import * as SplashScreen from "expo-splash-screen";

import { Provider } from "react-redux";
import RootNavigation from "@app/navigation/RootNavigation";
import { store } from "@app/redux/store";
import { channelInit, login } from "@app/api/api";
import { channelInit } from "@app/api/api";
import { AuthProvider } from "@app/context/AuthContext";
import { NetworkProvider } from "@app/context/NetworkContext";
import { SocketCom } from "@app/components/SocketComponent";
import { ColorProvider } from "@app/context/ColorContex";
import theme from "@app/utils/ThemeConfig";
import getTheme from "@app/utils/ThemeConfig";
import local from "@app/utils/locales";
import toastConfig from "@app/utils/ToastConfig";

local.setLanguage("en");
interface ISettings {
init: string;
color: string;
lang: string;
network: "mainnet" | "testnet";
}

export default function App() {
const [appIsReady, setAppIsReady] = useState(false);
const [settings, setSettings] = useState<ISettings>({
init: "true",
color: "dark",
lang: "en",
network: "mainnet",
});

useEffect(() => {
channelInit(RNFS.DocumentDirectoryPath);
const prepareResources = async () => {
try {
await SplashScreen.preventAutoHideAsync();

// Load settings from AsyncStorage
const lang = await AsyncStorage.getItem("lang");
const color = await AsyncStorage.getItem("color");
const network = await AsyncStorage.getItem("network");
const init = await AsyncStorage.getItem("init");

// @ts-ignore
setSettings((prev) => ({
init: init || prev.init,
lang: lang || prev.lang,
color: color || prev.color,
network: network || prev.network,
}));

channelInit(RNFS.DocumentDirectoryPath);
// await new Promise((resolve) => setTimeout(resolve, 1000));
} catch (e) {
console.warn(e);
} finally {
setAppIsReady(true);
await SplashScreen.hideAsync();
}
};

prepareResources();
}, []);

if (!appIsReady) {
return null;
}

const theme = getTheme(settings.color);
local.setLanguage(settings.lang);

return (
<Provider store={store}>
<AuthProvider>
<SocketCom />
<NetworkProvider defaultNetwork="mainnet">
<NativeBaseProvider theme={theme}>
<ColorProvider>
<RootNavigation />
<Toast />
</ColorProvider>
</NativeBaseProvider>
</NetworkProvider>
</AuthProvider>
</Provider>
<Provider store={store}>
<AuthProvider>
<SocketCom />
<NetworkProvider defaultNetwork={settings.network}>
<NativeBaseProvider theme={theme}>
<ColorProvider>
<RootNavigation init={settings.init} />
<Toast config={toastConfig} />
</ColorProvider>
</NativeBaseProvider>
</NetworkProvider>
</AuthProvider>
</Provider>
);
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion mobile/android/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<color name="splashscreen_background">#ffffff</color>
<color name="iconBackground">#ffffff</color>
<color name="iconBackground">#192B3B</color>
<color name="colorPrimary">#023c69</color>
<color name="colorPrimaryDark">#ffffff</color>
</resources>
2 changes: 1 addition & 1 deletion mobile/android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="app_name">QWallet</string>
<string name="expo_splash_screen_resize_mode" translatable="false">contain</string>
<string name="expo_splash_screen_resize_mode" translatable="false">cover</string>
<string name="expo_splash_screen_status_bar_translucent" translatable="false">false</string>
<string name="expo_system_ui_user_interface_style" translatable="false">dark</string>
</resources>
4 changes: 2 additions & 2 deletions mobile/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"userInterfaceStyle": "dark",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"resizeMode": "cover",
"backgroundColor": "#ffffff"
},
"assetBundlePatterns": ["**/*"],
Expand All @@ -18,7 +18,7 @@
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#ffffff"
"backgroundColor": "#192B3B"
},
"package": "com.qsilver.qwallet"
// "config": {
Expand Down
Binary file modified mobile/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mobile/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed mobile/assets/images/chars.png
Binary file not shown.
Binary file removed mobile/assets/images/chars1.png
Binary file not shown.
Binary file removed mobile/assets/images/landing.png
Binary file not shown.
Binary file removed mobile/assets/images/logo.png
Binary file not shown.
Binary file removed mobile/assets/images/no_data.png
Binary file not shown.
Binary file removed mobile/assets/images/seed.png
Binary file not shown.
Binary file removed mobile/assets/images/seed1.png
Binary file not shown.
9 changes: 9 additions & 0 deletions mobile/assets/images/tokens/cfb.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions mobile/assets/images/tokens/qft.svg

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions mobile/assets/images/tokens/qtry.svg

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions mobile/assets/images/tokens/qu.svg

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions mobile/assets/images/tokens/qutil.svg

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions mobile/assets/images/tokens/qwallet.svg

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions mobile/assets/images/tokens/qx.svg

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions mobile/assets/images/tokens/random.svg

Large diffs are not rendered by default.

Binary file modified mobile/assets/logo.png
Binary file modified mobile/assets/splash.png
5 changes: 5 additions & 0 deletions mobile/declarations.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module "*.svg" {
import { SvgProps } from "react-native-svg";
const content: React.FC<SvgProps>;
export default content;
}
19 changes: 19 additions & 0 deletions mobile/metro.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const { getDefaultConfig } = require("expo/metro-config");

module.exports = (() => {
const config = getDefaultConfig(__dirname);

const { transformer, resolver } = config;

config.transformer = {
...transformer,
babelTransformerPath: require.resolve("react-native-svg-transformer"),
};
config.resolver = {
...resolver,
assetExts: resolver.assetExts.filter((ext) => ext !== "svg"),
sourceExts: [...resolver.sourceExts, "svg"],
};

return config;
})();
Loading

0 comments on commit c4d0d3d

Please sign in to comment.