mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-10 00:01:35 +00:00
Add setup guide. Bundled dev main.js
This commit is contained in:
parent
ad971836dd
commit
b4fac4caaf
45
.github/workflows/android-build.yml
vendored
45
.github/workflows/android-build.yml
vendored
@ -7,13 +7,14 @@ on:
|
||||
pull_request:
|
||||
branches: [ "main" , "android-webview-app-ts"]
|
||||
paths: [ "mobile", "frontend" ]
|
||||
|
||||
|
||||
jobs:
|
||||
build-android:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Checkout'
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: 'Download main.js Artifact'
|
||||
uses: dawidd6/action-download-artifact@v2
|
||||
with:
|
||||
@ -21,14 +22,46 @@ jobs:
|
||||
workflow_conclusion: success
|
||||
name: main-js
|
||||
path: mobile/html/Web.bundle/js/
|
||||
- name: 'Install npm dependencies'
|
||||
|
||||
- name: 'Install npm Dependencies'
|
||||
run: |
|
||||
cd mobile
|
||||
npm install
|
||||
|
||||
- name: 'Build Android Release'
|
||||
run: |
|
||||
cd android && ./gradlew assembleRelease
|
||||
- name: 'Upload .apk Artifact'
|
||||
cd mobile/android
|
||||
./gradlew assembleRelease
|
||||
|
||||
- name: 'Get Commit Hash'
|
||||
id: commit
|
||||
uses: pr-mpt/actions-commit-hash@v1
|
||||
|
||||
- name: 'Upload APK Artifact'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: app-release.apk
|
||||
path: android/app/build/outputs/apk/release/
|
||||
name: robosats-${{ steps.commit.outputs.short }}.zip
|
||||
path: mobile/android/app/build/outputs/apk/release/
|
||||
|
||||
- name: 'Create Pre-release'
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: android-${{ steps.commit.outputs.short }}
|
||||
release_name: robosats-alpha-${{ steps.commit.outputs.short }}
|
||||
body_path: CHANGELOG.md
|
||||
draft: false
|
||||
prerelease: true
|
||||
|
||||
- name: 'Upload Pre-release APK Asset'
|
||||
id: upload-release-asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./mobile/android/app/build/outputs/apk/release/app-release.apk
|
||||
asset_name: robosats-${{ steps.commit.outputs.short }}.apk
|
||||
asset_content_type: application/apk
|
4
CHANGELOG.md
Normal file
4
CHANGELOG.md
Normal file
@ -0,0 +1,4 @@
|
||||
# Android Pre-release
|
||||
To be prepared for Android releases.
|
||||
|
||||
App should not be used as of now. It uses the clearnet unsafe tor2web bridge.
|
3
mobile/.gitignore
vendored
3
mobile/.gitignore
vendored
@ -61,3 +61,6 @@ buck-out/
|
||||
# Ruby / CocoaPods
|
||||
/ios/Pods/
|
||||
/vendor/bundle/
|
||||
|
||||
# frontend js
|
||||
/html/Web.bundle/js*
|
||||
|
@ -22,16 +22,23 @@ import {SafeAreaView, Text, Platform} from 'react-native';
|
||||
const App = () => {
|
||||
// Webview with local html/js in a single location for andrid/iOS
|
||||
// https://yelotofu.com/react-native-load-local-static-site-inside-webview-2b93eb1c4225
|
||||
const htmlPath = (Platform.OS === 'android' ? 'file:///android_asset/' : '') + 'Web.bundle/index.html?';
|
||||
const htmlPath = (Platform.OS === 'android' ? 'file:///android_asset/' : '') + 'Web.bundle/index.html';
|
||||
|
||||
const uri = 'https://robosats.onion.moe'
|
||||
const onion = 'http://robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion'
|
||||
|
||||
const runFirst = `
|
||||
// document.body.style.backgroundColor = 'red';
|
||||
// const currentLocation = window.location;
|
||||
// setTimeout(function() { window.alert(currentLocation) }, 000);
|
||||
// true; // note: this is required, or you'll sometimes get silent failures
|
||||
`;
|
||||
|
||||
return (
|
||||
<SafeAreaView style={{ flex: 1 }}>
|
||||
<WebView
|
||||
source={{
|
||||
uri: uri,
|
||||
//baseUrl: uri,
|
||||
}}
|
||||
source={{ uri: uri }}
|
||||
// source={{ baseUrl: 'file:///android_asset/Web.bundle/' }}
|
||||
javaScriptEnabled={true}
|
||||
domStorageEnabled={true}
|
||||
sharedCookiesEnabled={true}
|
||||
@ -47,6 +54,7 @@ const App = () => {
|
||||
allowsBackForwardNavigationGestures={false}
|
||||
mediaPlaybackRequiresUserAction={false}
|
||||
allowsLinkPreview={false}
|
||||
injectedJavaScript={runFirst}
|
||||
renderLoading={() => <Text>Loading RoboSats</Text>}
|
||||
onError={(syntheticEvent) => <Text>{syntheticEvent}</Text>}
|
||||
/>
|
||||
|
File diff suppressed because one or more lines are too long
48
mobile/setup.md
Normal file
48
mobile/setup.md
Normal file
@ -0,0 +1,48 @@
|
||||
Tested on Ubuntu 20.04
|
||||
|
||||
# Install JDK
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt install default-jdk
|
||||
java -version
|
||||
```
|
||||
# Install Android Studio
|
||||
```
|
||||
sudo add-apt-repository ppa:maarten-fonville/android-studio
|
||||
sudo apt update
|
||||
sudo apt install android-studio
|
||||
```
|
||||
# Install watchman
|
||||
```
|
||||
wget https://github.com/facebook/watchman/releases/download/v2022.06.20.00/watchman-v2022.06.20.00-linux.zip
|
||||
unzip watchman-v2022.06.20.00-linux.zip
|
||||
cd watchman-v2022.06.20.00-linux
|
||||
sudo mkdir -p /usr/local/{bin,lib} /usr/local/var/run/watchman
|
||||
sudo cp bin/* /usr/local/bin
|
||||
sudo cp lib/* /usr/local/lib
|
||||
sudo chmod 755 /usr/local/bin/watchman
|
||||
sudo chmod 2777 /usr/local/var/run/watchman
|
||||
```
|
||||
# (If in VMware linux environment)
|
||||
```
|
||||
sudo apt install -y open-vm-tools-desktop
|
||||
sudo apt install -y qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
|
||||
sudo usermod -aG kvm $(whoami)
|
||||
reboot
|
||||
```
|
||||
# Create Emulator (or connect Android phone and install adb)
|
||||
Use the GUI of Android studio to create a new virtual devide. As of 23/06/2022 we are using a Pixel 5 as template and System image R API level 30 Android 11.0
|
||||
|
||||
If using a phone, start the USB debugging mode.
|
||||
|
||||
Go to /robosats/mobile/android/local.properties and add `sdk.dir = /home/USERNAME/Android/Sdk` (create the file local.properties if it does not exist)
|
||||
|
||||
# Launch app builder and
|
||||
Point a terminal to /robosats/mobile/
|
||||
```
|
||||
npm start
|
||||
```
|
||||
on another temrinal also in /robosats/mobile/
|
||||
```
|
||||
npx react-native run-android
|
||||
```
|
Loading…
Reference in New Issue
Block a user