-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from Qsilver97/staging
Staging
- Loading branch information
Showing
107 changed files
with
4,664 additions
and
2,267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
Binary file modified
BIN
+10.7 KB
(130%)
mobile/android/app/src/main/res/drawable-hdpi/splashscreen_image.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
BIN
+10.7 KB
(130%)
mobile/android/app/src/main/res/drawable-mdpi/splashscreen_image.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
BIN
+10.7 KB
(130%)
mobile/android/app/src/main/res/drawable-xhdpi/splashscreen_image.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
BIN
+10.7 KB
(130%)
mobile/android/app/src/main/res/drawable-xxhdpi/splashscreen_image.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
BIN
+10.7 KB
(130%)
mobile/android/app/src/main/res/drawable-xxxhdpi/splashscreen_image.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
BIN
+2.62 KB
(140%)
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.
Binary file modified
BIN
+2.42 KB
(130%)
mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.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
BIN
+1.71 KB
(140%)
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.
Binary file modified
BIN
+1.55 KB
(130%)
mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.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
BIN
+3.41 KB
(140%)
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.
Binary file modified
BIN
+3.21 KB
(130%)
mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.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
BIN
+5.41 KB
(140%)
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.
Binary file modified
BIN
+4.95 KB
(130%)
mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.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
BIN
+7.23 KB
(140%)
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.
Binary file modified
BIN
+6.79 KB
(130%)
mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
})(); |
Oops, something went wrong.