mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-31 02:21:35 +00:00
Android style fixes (#286)
* Delete redundant loading div * Match SafeArea background color with system * Format and lint
This commit is contained in:
parent
7c52c90866
commit
a8c2af5824
@ -1,18 +1,24 @@
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import { WebView, WebViewMessageEvent } from 'react-native-webview';
|
||||
import { SafeAreaView, Text, Platform } from 'react-native';
|
||||
import { SafeAreaView, Text, Platform, Appearance } from 'react-native';
|
||||
import TorClient from './services/Tor';
|
||||
import Clipboard from '@react-native-clipboard/clipboard';
|
||||
import NetInfo from '@react-native-community/netinfo';
|
||||
import EncryptedStorage from 'react-native-encrypted-storage';
|
||||
|
||||
const backgroundColors = {
|
||||
light: 'white',
|
||||
dark: 'black',
|
||||
};
|
||||
|
||||
const App = () => {
|
||||
const colorScheme = Appearance.getColorScheme();
|
||||
const torClient = new TorClient();
|
||||
const webViewRef = useRef<WebView>();
|
||||
const uri = (Platform.OS === 'android' ? 'file:///android_asset/' : '') + 'Web.bundle/index.html';
|
||||
|
||||
const injectMessageResolve = (id: string, data?: object) => {
|
||||
const json = JSON.stringify(data || {});
|
||||
const json = JSON.stringify((data != null) || {});
|
||||
webViewRef.current?.injectJavaScript(
|
||||
`(function() {window.NativeRobosats.onMessageResolve(${id}, ${json});})();`,
|
||||
);
|
||||
@ -26,8 +32,8 @@ const App = () => {
|
||||
};
|
||||
|
||||
const init = (reponseId: string) => {
|
||||
const loadCookie = (key: string) => {
|
||||
return EncryptedStorage.getItem(key).then((value) => {
|
||||
const loadCookie = async (key: string) => {
|
||||
return await EncryptedStorage.getItem(key).then((value) => {
|
||||
if (value) {
|
||||
const json = JSON.stringify({ key, value });
|
||||
webViewRef.current?.injectJavaScript(
|
||||
@ -132,7 +138,7 @@ const App = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<SafeAreaView style={{ flex: 1 }}>
|
||||
<SafeAreaView style={{ flex: 1, backgroundColor: backgroundColors[colorScheme] }}>
|
||||
<WebView
|
||||
source={{
|
||||
uri,
|
||||
@ -154,10 +160,10 @@ const App = () => {
|
||||
setBuiltInZoomControls={false}
|
||||
allowingReadAccessToURL={uri}
|
||||
allowFileAccess={true}
|
||||
allowsBackForwardNavigationGestures={false}
|
||||
allowsBackForwardNavigationGestures={true}
|
||||
mediaPlaybackRequiresUserAction={false}
|
||||
allowsLinkPreview={false}
|
||||
renderLoading={() => <Text>Loading RoboSats</Text>}
|
||||
renderLoading={() => <Text></Text>}
|
||||
onError={(syntheticEvent) => <Text>{syntheticEvent.type}</Text>}
|
||||
/>
|
||||
</SafeAreaView>
|
||||
|
903
mobile/package-lock.json
generated
903
mobile/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -12,7 +12,7 @@ class TorClient {
|
||||
});
|
||||
}
|
||||
|
||||
private connectDaemon: () => void = async () => {
|
||||
private readonly connectDaemon: () => void = async () => {
|
||||
try {
|
||||
this.daemon.startIfNotStarted();
|
||||
} catch {
|
||||
|
Loading…
Reference in New Issue
Block a user