diff options
-rw-r--r-- | app/components/wallpaper/bg.png | bin | 56176 -> 11602 bytes | |||
-rw-r--r-- | app/components/wallpaper/[email protected] | bin | 203224 -> 35635 bytes | |||
-rw-r--r-- | app/screens/graph/graph-screen.tsx | 45 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | screenshot.png | bin | 94764 -> 54546 bytes | |||
-rw-r--r-- | yarn.lock | 21 |
6 files changed, 39 insertions, 29 deletions
diff --git a/app/components/wallpaper/bg.png b/app/components/wallpaper/bg.png Binary files differindex 641838e..45b63f3 100644 --- a/app/components/wallpaper/bg.png +++ b/app/components/wallpaper/bg.png diff --git a/app/components/wallpaper/[email protected] b/app/components/wallpaper/[email protected] Binary files differindex 3ae8396..828e94f 100644 --- a/app/components/wallpaper/[email protected] +++ b/app/components/wallpaper/[email protected] diff --git a/app/screens/graph/graph-screen.tsx b/app/screens/graph/graph-screen.tsx index da3734a..2ae956c 100644 --- a/app/screens/graph/graph-screen.tsx +++ b/app/screens/graph/graph-screen.tsx @@ -13,6 +13,8 @@ import genRandomTree from "../../data/randomdata" import AsyncStorage from "@react-native-async-storage/async-storage" +import axios from "axios"; + const ROOT: ViewStyle = { backgroundColor: color.palette.black, flex: 1, @@ -24,10 +26,6 @@ export const GraphScreen = observer(function GraphScreen() { // Pull in navigation via hook // const navigation = useNavigation() - const [charge, setCharge] = useState(-30) - const [collision, setCollision] = useState(false) - const [linkStrength, setLinkStrength] = useState(1) - const [linkIts, setLinkIts] = useState(1) const [physics, setPhysics] = useState({}) const physicsInit = { @@ -43,13 +41,16 @@ export const GraphScreen = observer(function GraphScreen() { particleWidth: 1, nodeRel: 1, } + const getData = async () => { try { - const value = await AsyncStorage.getItem("@physics") - if (value !== null || keys(value) === keys(physicsInit)) { - return JSON.parse(value) + const value: string = await AsyncStorage.getItem("@physics"); + if (value !== null ) { + const valueJson = JSON.parse(value); + if ( Object.keys(valueJson).length === Object.keys(physicsInit).length) { + return valueJson; + } else { return physicsInit }; } else { - console.log(physicsInit) return physicsInit } } catch (e) { @@ -57,36 +58,36 @@ export const GraphScreen = observer(function GraphScreen() { } } + //"ComponentOnMount" + // Get previous settings and the data from the org-roam-server useEffect(() => { - getData().then((data) => setPhysics(data)) + getData().then((data) => setPhysics(data)); + // axios.get('/roamData') + // .then(()=>console.log("Whoo got data")) + //.catch((e)=>{ + // console.log(e); + // console.log("Couldn't get data."); + //}); }, []) const storeData = async (value) => { try { const jsonValue = JSON.stringify(value) - await AsyncStorage.setItem("@physics", jsonValue) + await AsyncStorage.mergeItem("@physics", jsonValue) console.log("Writing " + jsonValue) } catch (e) { console.log(e) } } - /* const [physics, setPhysics] = useState( - * { - * charge: -30, - * collision: false, - * linkStrength: 1, - * linkIts: 1, - * collapse: false, - * threedim: false, - * particles: 2, - * }); */ + + // hook to save the current configuration of the physics tweaks + // after it is updated useEffect(() => { if (timer) { clearTimeout(timer) - console.log("clear timer") } + // set timer so the thing doesn't run every single slider tick const timer = setTimeout(() => { - console.log("Physics changed") storeData(physics) const test = getData() console.log(test) diff --git a/package.json b/package.json index 7b09eda..aba9265 100644 --- a/package.json +++ b/package.json @@ -35,9 +35,11 @@ "@react-native-community/slider": "^3.0.3", "@react-navigation/native": "5.9.3", "@react-navigation/stack": "5.12.8", + "@types/axios": "^0.14.0", "@types/react-native-collapsible": "^0.11.0", "@unimodules/core": "6.0.0", "apisauce": "2.0.0", + "axios": "^0.21.1", "d3-force": "^3.0.0", "expo": "40.0.1", "expo-localization": "9.1.0", diff --git a/screenshot.png b/screenshot.png Binary files differindex 5d4be97..b5373fd 100644 --- a/screenshot.png +++ b/screenshot.png @@ -3272,6 +3272,13 @@ resolved "https://registry.yarnpkg.com/@tweenjs/tween.js/-/tween.js-18.6.4.tgz#40a3d0a93647124872dec8e0fd1bd5926695b6ca" integrity sha512-lB9lMjuqjtuJrx7/kOkqQBtllspPIN+96OvTCeJ2j5FEzinoAXTdAMFnDAQT1KVPRlnYfBrqxtqP66vDM40xxQ== +"@types/axios@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@types/axios/-/axios-0.14.0.tgz#ec2300fbe7d7dddd7eb9d3abf87999964cafce46" + integrity sha1-7CMA++fX3d1+udOr+HmZlkyvzkY= + dependencies: + axios "*" + "@types/babel__core@^7.0.0", "@types/babel__core@^7.1.7": version "7.1.15" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.15.tgz#2ccfb1ad55a02c83f8e0ad327cbc332f55eb1024" @@ -4791,6 +4798,13 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59" integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA== +axios@*, axios@^0.21.0, axios@^0.21.1: + version "0.21.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8" + integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== + dependencies: + follow-redirects "^1.10.0" + axios@^0.16.2: version "0.16.2" resolved "https://registry.yarnpkg.com/axios/-/axios-0.16.2.tgz#ba4f92f17167dfbab40983785454b9ac149c3c6d" @@ -4799,13 +4813,6 @@ axios@^0.16.2: follow-redirects "^1.2.3" is-buffer "^1.1.5" -axios@^0.21.0: - version "0.21.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8" - integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== - dependencies: - follow-redirects "^1.10.0" - version "0.19.0-beta.1" resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.0-beta.1.tgz#3d6a9ee75885d1fd39e108df9a4fb2e48e1af1e8" |