chiark / gitweb /
Start of moving to expo.
authorMarnanel Thurman <marnanel@thurman.org.uk>
Fri, 10 Dec 2021 23:58:57 +0000 (23:58 +0000)
committerMarnanel Thurman <marnanel@thurman.org.uk>
Sat, 11 Dec 2021 00:01:18 +0000 (00:01 +0000)
grok.js still doesn't work because it relies on the cordova advanced-http library.

Moved images to the new correct folder.

25 files changed:
.babelrc [deleted file]
App.js [new file with mode: 0644]
app.json [new file with mode: 0644]
assets/images/adaptive-icon.png
assets/images/favicon.png
assets/images/hdpi.png
assets/images/icon.png
assets/images/ldpi.png
assets/images/logo.png [moved from assets/images/pxxxhdpi.png with 100% similarity]
assets/images/mdpi.png
assets/images/padaptive-icon.png [deleted file]
assets/images/pfavicon.png [deleted file]
assets/images/phdpi.png [deleted file]
assets/images/picon.png [deleted file]
assets/images/pldpi.png [deleted file]
assets/images/pmdpi.png [deleted file]
assets/images/psplash.png [deleted file]
assets/images/pxhdpi.png [deleted file]
assets/images/pxxhdpi.png [deleted file]
assets/images/splash.png
assets/images/xhdpi.png
assets/images/xxhdpi.png
assets/images/xxxhdpi.png
grok.js [moved from src/grok.js with 95% similarity]
www/lavender-dream-by-huhu.jpg [deleted file]

diff --git a/.babelrc b/.babelrc
deleted file mode 100644 (file)
index f9e1d60..0000000
--- a/.babelrc
+++ /dev/null
@@ -1 +0,0 @@
-{ "presets": ["@babel/preset-env", "@babel/preset-react"] }
diff --git a/App.js b/App.js
new file mode 100644 (file)
index 0000000..48af548
--- /dev/null
+++ b/App.js
@@ -0,0 +1,130 @@
+import React from 'react';
+import {
+        StyleSheet, Text, View, TextInput,
+        Image,
+        Button,
+} from 'react-native';
+import {
+        grok_set_url,
+        grok_login1,
+        grok_login2,
+} from './grok.js';
+import logo from './assets/images/logo.png';
+
+export default class App extends React.Component {
+   
+    state = {
+            username: '',
+            password: '',
+            message: '...',
+    };
+
+    constructor(props) {
+            super(props);
+    };
+
+    handle_login1(login1) {
+        ui_login_show_message("Logging in...");
+        grok_login2(
+                this.handle_login2,
+                login1['auth'],
+                this.state.username,
+                this.state.password,
+        )
+    }
+
+    start_login() {
+            console.log('Start login!');
+            console.log(this.state);
+            this.setState({
+                    message: 'Connecting...',
+            });
+            grok_login1(this.handle_login1);
+    };
+
+    ui_login_show_message(message) {
+        $("#login-message").show().text(message);
+        console.log(message);
+    };
+
+    render() {
+            return (
+      <View style={styles.container}>
+
+                    <View style={styles.innerBox}>
+        <Image source={logo} style={styles.logo} />
+
+        <Text>Welcome to dwim!</Text>
+
+                    <Text>Username:</Text>
+            <TextInput type="text" name="username"
+                    onChangeText={(text) => { this.state.username = text} }
+                    style={styles.input}
+                    />
+
+                    <Text>Password:</Text>
+            <TextInput type="password" name="password"
+                    onChangeText={(text) => { this.state.password = text} }
+                    secureTextEntry={true}
+                    style={styles.input}
+                     />
+
+                    <Button
+                    onPress={() => this.start_login()}
+                    style={styles.button}
+                    title="Log in"
+                    />
+
+        <Text
+                    name="login_message"
+                    style={styles.login_message}> {this.state.message} </Text>
+      </View>
+      </View>
+    );
+  }
+}
+
+const styles = StyleSheet.create({
+        container: {
+                flex: 1,
+                backgroundColor: '#8a0000',
+                alignItems: 'center',
+                justifyContent: 'center',
+        },
+        innerBox: {
+                flex: 1,
+                backgroundColor: '#fffdd0',
+                alignItems: 'center',
+                justifyContent: 'center',
+                borderRadius: 10,
+                width: '70%',
+                height: '50%',
+        },
+        logo: {
+                marginBottom: 10,
+        },
+        input: {
+                height: 40,
+                margin: 12,
+                borderWidth: 1,
+                padding: 10,
+                width: '80%',
+        },
+        button: {
+                height: 40,
+                width: "50%",
+                margin: 12,
+                borderWidth: 1,
+                borderRadius: 5,
+                padding: 20,
+                backgroundColor: "#8a0000",
+                fontSize: 20,
+                color: '#fff',
+        }, 
+        login_message: {
+                fontWeight: "bold",
+                fontSize: 14,
+                marginTop: 20,
+                color: '#000',
+        }, 
+});
diff --git a/app.json b/app.json
new file mode 100644 (file)
index 0000000..2252d45
--- /dev/null
+++ b/app.json
@@ -0,0 +1,35 @@
+{
+  "expo": {
+    "name": "dwim",
+    "description": "Dreamwidth client",
+    "slug": "dwim",
+    "version": "0.1.5",
+    "orientation": "portrait",
+    "icon": "./assets/images/icon.png",
+    "scheme": "myapp",
+    "userInterfaceStyle": "automatic",
+    "splash": {
+      "image": "./assets/images/splash.png",
+      "resizeMode": "contain",
+      "backgroundColor": "#ffffff"
+    },
+    "updates": {
+      "fallbackToCacheTimeout": 0
+    },
+    "assetBundlePatterns": [
+      "**/*"
+    ],
+    "ios": {
+      "supportsTablet": true
+    },
+    "android": {
+      "adaptiveIcon": {
+        "foregroundImage": "./assets/images/adaptive-icon.png",
+        "backgroundColor": "#ffffff"
+      }
+    },
+    "web": {
+      "favicon": "./assets/images/favicon.png"
+    }
+  }
+}
index 1bda276fe113965e19e475f2fb9495ce3e2fb260..a3309a7bbbd91e70329d0fe32d4b9816f850e681 100644 (file)
Binary files a/assets/images/adaptive-icon.png and b/assets/images/adaptive-icon.png differ
index 92f6c1ddae042ce93022cefe8e8d97e7775f89d3..1d63d9ce2e7586b52277e493a7fc6609fca0e73a 100644 (file)
Binary files a/assets/images/favicon.png and b/assets/images/favicon.png differ
index e01821aa8f2103414063e5e786fd203e29eabcf3..f0c8c9c58b0ab7314fbab4ccde70bf502fe705fc 100644 (file)
Binary files a/assets/images/hdpi.png and b/assets/images/hdpi.png differ
index 92f6c1ddae042ce93022cefe8e8d97e7775f89d3..1d63d9ce2e7586b52277e493a7fc6609fca0e73a 100644 (file)
Binary files a/assets/images/icon.png and b/assets/images/icon.png differ
index 5abd56713e751e1741934d7c2deab76bb087f610..16c8819b15d6f7e38ab138c794ef01a3c96befd6 100644 (file)
Binary files a/assets/images/ldpi.png and b/assets/images/ldpi.png differ
index 92f6c1ddae042ce93022cefe8e8d97e7775f89d3..1d63d9ce2e7586b52277e493a7fc6609fca0e73a 100644 (file)
Binary files a/assets/images/mdpi.png and b/assets/images/mdpi.png differ
diff --git a/assets/images/padaptive-icon.png b/assets/images/padaptive-icon.png
deleted file mode 100644 (file)
index a3309a7..0000000
Binary files a/assets/images/padaptive-icon.png and /dev/null differ
diff --git a/assets/images/pfavicon.png b/assets/images/pfavicon.png
deleted file mode 100644 (file)
index 1d63d9c..0000000
Binary files a/assets/images/pfavicon.png and /dev/null differ
diff --git a/assets/images/phdpi.png b/assets/images/phdpi.png
deleted file mode 100644 (file)
index f0c8c9c..0000000
Binary files a/assets/images/phdpi.png and /dev/null differ
diff --git a/assets/images/picon.png b/assets/images/picon.png
deleted file mode 100644 (file)
index 1d63d9c..0000000
Binary files a/assets/images/picon.png and /dev/null differ
diff --git a/assets/images/pldpi.png b/assets/images/pldpi.png
deleted file mode 100644 (file)
index 16c8819..0000000
Binary files a/assets/images/pldpi.png and /dev/null differ
diff --git a/assets/images/pmdpi.png b/assets/images/pmdpi.png
deleted file mode 100644 (file)
index 1d63d9c..0000000
Binary files a/assets/images/pmdpi.png and /dev/null differ
diff --git a/assets/images/psplash.png b/assets/images/psplash.png
deleted file mode 100644 (file)
index 1960c0a..0000000
Binary files a/assets/images/psplash.png and /dev/null differ
diff --git a/assets/images/pxhdpi.png b/assets/images/pxhdpi.png
deleted file mode 100644 (file)
index 3ee9378..0000000
Binary files a/assets/images/pxhdpi.png and /dev/null differ
diff --git a/assets/images/pxxhdpi.png b/assets/images/pxxhdpi.png
deleted file mode 100644 (file)
index aeaa2a9..0000000
Binary files a/assets/images/pxxhdpi.png and /dev/null differ
index 4de84634955cc9943950c98f73848f23eab318ca..1960c0a1c11852bbc34de016cf592e6612bf66e1 100644 (file)
Binary files a/assets/images/splash.png and b/assets/images/splash.png differ
index bfbdfc68bfe8fd86a4ce5b9d7aaf2d5bd7e55edd..3ee93789c682f8aa4933f62b979ef31f53f74b81 100644 (file)
Binary files a/assets/images/xhdpi.png and b/assets/images/xhdpi.png differ
index 591c464cd22ba930e85ba7802482a314f6c91d90..aeaa2a910cdb1a3b59640b62d724c6fca010cb7d 100644 (file)
Binary files a/assets/images/xxhdpi.png and b/assets/images/xxhdpi.png differ
index 8b5ca005313d615fb93e29092ea13961174111ec..944f3940851bce32e4f1c6e5288b69e6fa3d0b1c 100644 (file)
Binary files a/assets/images/xxxhdpi.png and b/assets/images/xxxhdpi.png differ
similarity index 95%
rename from src/grok.js
rename to grok.js
index c2c04c75f3cd3056c04baf90ac7f35554476f07f..f77255108ae28b8712b6d2eecbf56411aa9c51fb 100644 (file)
+++ b/grok.js
@@ -1,4 +1,12 @@
-var tough = require('tough-cookie');
+import React from 'react';
+
+import {
+          SafeAreaView,
+          StyleSheet,
+          View,
+          TouchableOpacity,
+          Text,
+} from 'react-native';
 
 var DREAMWIDTH_URL = 'https://dreamwidth.org';
 export var grok_url = DREAMWIDTH_URL;
diff --git a/www/lavender-dream-by-huhu.jpg b/www/lavender-dream-by-huhu.jpg
deleted file mode 100644 (file)
index 20cfda9..0000000
Binary files a/www/lavender-dream-by-huhu.jpg and /dev/null differ