mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-14 03:16:24 +00:00
Merge pull request #631 from RoboSats/android-webview-audio
* Bump all the things Seems to work :) * Remove v8 * Bump Android SDK to 33 * Update setup.md ; delete deprecated maven repos * Enable ProGuard and add rules * Remove v8 * Fix android sound notifications * Sync package-lock --------- Co-authored-by: +shyfire131 <shyfire131@shyfire131.net>
This commit is contained in:
commit
230123c079
4
.gitignore
vendored
4
.gitignore
vendored
@ -649,5 +649,7 @@ docs/.jekyll-cache*
|
|||||||
docs/_site*
|
docs/_site*
|
||||||
node
|
node
|
||||||
|
|
||||||
# mobile frontend js
|
# mobile frontend statics
|
||||||
mobile/html/Web.bundle/js*
|
mobile/html/Web.bundle/js*
|
||||||
|
mobile/html/Web.bundle/css*
|
||||||
|
mobile/html/Web.bundle/assets*
|
||||||
|
@ -31,11 +31,15 @@ interface NotificationMessage {
|
|||||||
pageTitle: string;
|
pageTitle: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const path =
|
||||||
|
window.NativeRobosats === undefined
|
||||||
|
? '/static/assets/sounds'
|
||||||
|
: 'file:///android_asset/Web.bundle/assets/sounds';
|
||||||
const audio = {
|
const audio = {
|
||||||
chat: new Audio(`/static/assets/sounds/chat-open.mp3`),
|
chat: new Audio(`${path}/chat-open.mp3`),
|
||||||
takerFound: new Audio(`/static/assets/sounds/taker-found.mp3`),
|
takerFound: new Audio(`${path}/taker-found.mp3`),
|
||||||
ding: new Audio(`/static/assets/sounds/locked-invoice.mp3`),
|
ding: new Audio(`${path}/locked-invoice.mp3`),
|
||||||
successful: new Audio(`/static/assets/sounds/successful.mp3`),
|
successful: new Audio(`${path}/successful.mp3`),
|
||||||
};
|
};
|
||||||
|
|
||||||
const emptyNotificationMessage: NotificationMessage = {
|
const emptyNotificationMessage: NotificationMessage = {
|
||||||
|
@ -154,6 +154,10 @@ const configMobile: Configuration = {
|
|||||||
from: path.resolve(__dirname, 'static/css'),
|
from: path.resolve(__dirname, 'static/css'),
|
||||||
to: path.resolve(__dirname, '../mobile/html/Web.bundle/css'),
|
to: path.resolve(__dirname, '../mobile/html/Web.bundle/css'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
from: path.resolve(__dirname, 'static/assets/sounds'),
|
||||||
|
to: path.resolve(__dirname, '../mobile/html/Web.bundle/assets/sounds'),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
@ -176,7 +176,7 @@ const App = () => {
|
|||||||
allowingReadAccessToURL={uri}
|
allowingReadAccessToURL={uri}
|
||||||
allowFileAccess={true}
|
allowFileAccess={true}
|
||||||
allowsBackForwardNavigationGestures={true}
|
allowsBackForwardNavigationGestures={true}
|
||||||
mediaPlaybackRequiresUserAction={false}
|
mediaPlaybackRequiresUserAction={false} // Allow autoplay
|
||||||
allowsLinkPreview={false}
|
allowsLinkPreview={false}
|
||||||
renderLoading={() => <Text></Text>}
|
renderLoading={() => <Text></Text>}
|
||||||
onError={(syntheticEvent) => <Text>{syntheticEvent.type}</Text>}
|
onError={(syntheticEvent) => <Text>{syntheticEvent.type}</Text>}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
apply plugin: "com.android.application"
|
apply plugin: "com.android.application"
|
||||||
|
apply plugin: "com.facebook.react"
|
||||||
|
|
||||||
import com.android.build.OutputFile
|
import com.android.build.OutputFile
|
||||||
|
|
||||||
@ -81,8 +82,6 @@ project.ext.react = [
|
|||||||
enableHermes: false, // clean and rebuild if changing
|
enableHermes: false, // clean and rebuild if changing
|
||||||
]
|
]
|
||||||
|
|
||||||
apply from: "../../node_modules/react-native/react.gradle"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set this to true to create two separate APKs instead of one:
|
* Set this to true to create two separate APKs instead of one:
|
||||||
* - An APK that only works on ARM devices
|
* - An APK that only works on ARM devices
|
||||||
@ -96,7 +95,7 @@ def enableSeparateBuildPerCPUArchitecture = true
|
|||||||
/**
|
/**
|
||||||
* Run Proguard to shrink the Java bytecode in release builds.
|
* Run Proguard to shrink the Java bytecode in release builds.
|
||||||
*/
|
*/
|
||||||
def enableProguardInReleaseBuilds = false
|
def enableProguardInReleaseBuilds = true
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The preferred build flavor of JavaScriptCore.
|
* The preferred build flavor of JavaScriptCore.
|
||||||
@ -129,6 +128,10 @@ def reactNativeArchitectures() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
configurations {
|
||||||
|
all*.exclude group: 'com.facebook.fbjni', module: 'fbjni-java-only'
|
||||||
|
}
|
||||||
|
|
||||||
ndkVersion rootProject.ext.ndkVersion
|
ndkVersion rootProject.ext.ndkVersion
|
||||||
|
|
||||||
compileSdkVersion rootProject.ext.compileSdkVersion
|
compileSdkVersion rootProject.ext.compileSdkVersion
|
||||||
|
5
mobile/android/app/proguard-rules.pro
vendored
5
mobile/android/app/proguard-rules.pro
vendored
@ -8,3 +8,8 @@
|
|||||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
# Add any project specific keep options here:
|
# Add any project specific keep options here:
|
||||||
|
|
||||||
|
# Keep some of the react-native-tor classes
|
||||||
|
-keep class com.sifir.tor.TorServiceParam { *; }
|
||||||
|
-keep class com.sifir.tor.TcpSocksStream { *; }
|
||||||
|
-keep class com.sifir.tor.OwnedTorService { *; }
|
@ -9,13 +9,10 @@ import com.facebook.react.ReactNativeHost;
|
|||||||
import com.facebook.react.ReactPackage;
|
import com.facebook.react.ReactPackage;
|
||||||
import com.facebook.react.config.ReactFeatureFlags;
|
import com.facebook.react.config.ReactFeatureFlags;
|
||||||
import com.facebook.soloader.SoLoader;
|
import com.facebook.soloader.SoLoader;
|
||||||
import com.facebook.react.bridge.JavaScriptExecutorFactory;
|
|
||||||
import com.facebook.react.modules.systeminfo.AndroidInfoHelpers;
|
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import com.robosats.newarchitecture.MainApplicationReactNativeHost;
|
import com.robosats.newarchitecture.MainApplicationReactNativeHost;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import io.csie.kudo.reactnative.v8.executor.V8ExecutorFactory;
|
|
||||||
|
|
||||||
public class MainApplication extends Application implements ReactApplication {
|
public class MainApplication extends Application implements ReactApplication {
|
||||||
|
|
||||||
@ -39,15 +36,6 @@ public class MainApplication extends Application implements ReactApplication {
|
|||||||
protected String getJSMainModuleName() {
|
protected String getJSMainModuleName() {
|
||||||
return "index";
|
return "index";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected JavaScriptExecutorFactory getJavaScriptExecutorFactory() {
|
|
||||||
return new V8ExecutorFactory(
|
|
||||||
getApplicationContext(),
|
|
||||||
getPackageName(),
|
|
||||||
AndroidInfoHelpers.getFriendlyDeviceName(),
|
|
||||||
getUseDeveloperSupport());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private final ReactNativeHost mNewArchitectureNativeHost =
|
private final ReactNativeHost mNewArchitectureNativeHost =
|
||||||
|
@ -4,11 +4,12 @@ import org.apache.tools.ant.taskdefs.condition.Os
|
|||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext {
|
ext {
|
||||||
buildToolsVersion = "31.0.0"
|
buildToolsVersion = "33.0.0"
|
||||||
minSdkVersion = 26
|
minSdkVersion = 26
|
||||||
compileSdkVersion = 31
|
compileSdkVersion = 33
|
||||||
targetSdkVersion = 31
|
targetSdkVersion = 33
|
||||||
kotlin_version = "1.7.10"
|
kotlin_version = "1.8.21"
|
||||||
|
kotlinVersion = "1.8.21" //for react-native-tor
|
||||||
|
|
||||||
if (System.properties['os.arch'] == "aarch64") {
|
if (System.properties['os.arch'] == "aarch64") {
|
||||||
// For M1 Users we need to use the NDK 24 which added support for aarch64
|
// For M1 Users we need to use the NDK 24 which added support for aarch64
|
||||||
@ -19,12 +20,20 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
|
maven {
|
||||||
|
// Replace AAR from original RN with AAR from react-native-v8
|
||||||
|
url("$rootDir/../node_modules/react-native-v8/dist")
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
// prebuilt libv8android.so
|
||||||
|
url("$rootDir/../node_modules/v8-android/dist")
|
||||||
|
}
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
classpath("com.android.tools.build:gradle:7.1.1")
|
classpath('com.android.tools.build:gradle:7.3.1')
|
||||||
classpath("com.facebook.react:react-native-gradle-plugin")
|
classpath("com.facebook.react:react-native-gradle-plugin")
|
||||||
classpath("de.undercouch:gradle-download-task:5.0.1")
|
classpath("de.undercouch:gradle-download-task:5.0.1")
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
@ -34,22 +43,21 @@ buildscript {
|
|||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
|
||||||
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
|
|
||||||
url("$rootDir/../node_modules/react-native/android")
|
|
||||||
}
|
|
||||||
maven {
|
maven {
|
||||||
// Android JSC is installed from npm
|
// Android JSC is installed from npm
|
||||||
url("$rootDir/../node_modules/jsc-android/dist")
|
url("$rootDir/../node_modules/jsc-android/dist")
|
||||||
}
|
}
|
||||||
mavenCentral {
|
mavenCentral()
|
||||||
// We don't want to fetch react-native from Maven Central as there are
|
|
||||||
// older versions over there.
|
|
||||||
content {
|
|
||||||
excludeGroup "com.facebook.react"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
google()
|
google()
|
||||||
maven { url 'https://www.jitpack.io' }
|
maven { url 'https://www.jitpack.io' }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configurations.all {
|
||||||
|
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
|
||||||
|
if (details.requested.group == 'org.jetbrains.kotlin' &&
|
||||||
|
details.requested.name.startsWith("kotlin-stdlib")) {
|
||||||
|
details.useVersion "1.8.21"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,3 +35,4 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
|
|||||||
# to write custom TurboModules/Fabric components OR use libraries that
|
# to write custom TurboModules/Fabric components OR use libraries that
|
||||||
# are providing them.
|
# are providing them.
|
||||||
newArchEnabled=false
|
newArchEnabled=false
|
||||||
|
hermesEnabled=false
|
BIN
mobile/android/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
mobile/android/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
6
mobile/android/gradlew
vendored
6
mobile/android/gradlew
vendored
@ -205,6 +205,12 @@ set -- \
|
|||||||
org.gradle.wrapper.GradleWrapperMain \
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
# Use "xargs" to parse quoted args.
|
||||||
#
|
#
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
10
mobile/android/gradlew.bat
vendored
10
mobile/android/gradlew.bat
vendored
@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
|||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
|||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
24868
mobile/package-lock.json
generated
24868
mobile/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -13,21 +13,19 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-native-clipboard/clipboard": "^1.11.2",
|
"@react-native-clipboard/clipboard": "^1.11.2",
|
||||||
"@react-native-community/netinfo": "^9.3.9",
|
"@react-native-community/netinfo": "^9.3.10",
|
||||||
"react": "^18.0.0",
|
"react": "18.2.0",
|
||||||
"react-native": "^0.69.6",
|
"react-native": "^0.71.8",
|
||||||
"react-native-encrypted-storage": "^4.0.3",
|
"react-native-encrypted-storage": "^4.0.3",
|
||||||
"react-native-tor": "^0.1.8",
|
"react-native-tor": "^0.1.8",
|
||||||
"react-native-v8": "^1.5.0",
|
"react-native-webview": "^12.1.0"
|
||||||
"react-native-webview": "^12.1.0",
|
|
||||||
"v8-android-nointl": "^10.100.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.21.4",
|
"@babel/core": "^7.21.4",
|
||||||
"@babel/runtime": "^7.12.5",
|
"@babel/runtime": "^7.12.5",
|
||||||
"@react-native-community/eslint-config": "^3.2.0",
|
"@react-native-community/eslint-config": "^3.2.0",
|
||||||
"@types/jest": "^29.5.1",
|
"@types/jest": "^29.5.1",
|
||||||
"@types/react-native": "^0.69.0",
|
"@types/react-native": "^0.71.3",
|
||||||
"@types/react-test-renderer": "^18.0.0",
|
"@types/react-test-renderer": "^18.0.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.59.2",
|
"@typescript-eslint/eslint-plugin": "^5.59.2",
|
||||||
"@typescript-eslint/parser": "^5.59.6",
|
"@typescript-eslint/parser": "^5.59.6",
|
||||||
@ -45,7 +43,7 @@
|
|||||||
"jest": "^29.5.0",
|
"jest": "^29.5.0",
|
||||||
"metro-react-native-babel-preset": "^0.75.1",
|
"metro-react-native-babel-preset": "^0.75.1",
|
||||||
"prettier": "^2.8.8",
|
"prettier": "^2.8.8",
|
||||||
"react-test-renderer": "18.0.0",
|
"react-test-renderer": "18.2.0",
|
||||||
"typescript": "^5.0.4"
|
"typescript": "^5.0.4"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
|
@ -44,7 +44,7 @@ reboot
|
|||||||
|
|
||||||
## Create Emulator (or connect Android phone and install adb)
|
## 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
|
Use the GUI of Android studio to create a new virtual device. As of 26/03/2023 we are using a Pixel 5 as template and System image Tiramisu API level 33
|
||||||
|
|
||||||
If using a phone, start the USB debugging mode.
|
If using a phone, start the USB debugging mode.
|
||||||
|
|
||||||
@ -63,18 +63,26 @@ Make sure you have the `main.js` file created on `robosats/mobile/html/Web.bundl
|
|||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
Point a terminal to `/robosats/mobile/`
|
Launch your emulator if you are using one:
|
||||||
|
|
||||||
|
```
|
||||||
|
cd ~/Android/Sdk/tools && ./emulator -avd <DEVICE_NAME>
|
||||||
|
```
|
||||||
|
|
||||||
|
Point a terminal to `/robosats/mobile/` to start metro
|
||||||
|
|
||||||
```
|
```
|
||||||
npm start
|
npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
on another temrinal also in `/robosats/mobile/`
|
And on another terminal, also in `/robosats/mobile/`, build and install the debug app
|
||||||
|
|
||||||
```
|
```
|
||||||
npx react-native run-android
|
npx react-native run-android
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can also use `react-native run-android --mode=release` to fully test the release builds of the app.
|
||||||
|
|
||||||
# OSX
|
# OSX
|
||||||
|
|
||||||
## Install JDK
|
## Install JDK
|
||||||
|
Loading…
Reference in New Issue
Block a user