add isAndroid flag

This commit is contained in:
Tom (plebeius.eth)
2024-10-13 17:51:54 +02:00
parent c80fc5a284
commit f8c92b3e61
8 changed files with 34 additions and 2 deletions
+1
View File
@@ -10,6 +10,7 @@ android {
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle" apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies { dependencies {
implementation project(':capacitor-app') implementation project(':capacitor-app')
implementation project(':capacitor-device')
} }
@@ -2,5 +2,10 @@
"appId": "plebchan.android", "appId": "plebchan.android",
"appName": "plebchan", "appName": "plebchan",
"webDir": "build", "webDir": "build",
"bundledWebRuntime": false "bundledWebRuntime": false,
"plugins": {
"Device": {
"lazyLoad": true
}
}
} }
@@ -2,5 +2,9 @@
{ {
"pkg": "@capacitor/app", "pkg": "@capacitor/app",
"classpath": "com.capacitorjs.plugins.app.AppPlugin" "classpath": "com.capacitorjs.plugins.app.AppPlugin"
},
{
"pkg": "@capacitor/device",
"classpath": "com.capacitorjs.plugins.device.DevicePlugin"
} }
] ]
+3
View File
@@ -4,3 +4,6 @@ project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/
include ':capacitor-app' include ':capacitor-app'
project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android') project(':capacitor-app').projectDir = new File('../node_modules/@capacitor/app/android')
include ':capacitor-device'
project(':capacitor-device').projectDir = new File('../node_modules/@capacitor/device/android')
+6 -1
View File
@@ -4,7 +4,12 @@ const config: CapacitorConfig = {
appId: 'plebchan.android', appId: 'plebchan.android',
appName: 'plebchan', appName: 'plebchan',
webDir: 'build', webDir: 'build',
bundledWebRuntime: false bundledWebRuntime: false,
plugins: {
Device: {
lazyLoad: true,
},
},
}; };
export default config; export default config;
+1
View File
@@ -7,6 +7,7 @@
"private": true, "private": true,
"dependencies": { "dependencies": {
"@capacitor/app": "1.1.1", "@capacitor/app": "1.1.1",
"@capacitor/device": "^6.0.1",
"@floating-ui/react": "0.26.1", "@floating-ui/react": "0.26.1",
"@plebbit/plebbit-react-hooks": "https://github.com/plebbit/plebbit-react-hooks.git#a80ef4b155abf119e66c019576cbc1b338390e00", "@plebbit/plebbit-react-hooks": "https://github.com/plebbit/plebbit-react-hooks.git#a80ef4b155abf119e66c019576cbc1b338390e00",
"@testing-library/jest-dom": "5.14.1", "@testing-library/jest-dom": "5.14.1",
+8
View File
@@ -0,0 +1,8 @@
import { Capacitor } from '@capacitor/core';
import { Device } from '@capacitor/device';
export const isAndroid = Capacitor.getPlatform() === 'android';
export async function getDeviceInfo() {
return await Device.getInfo();
}
+5
View File
@@ -1239,6 +1239,11 @@
dependencies: dependencies:
tslib "^2.1.0" tslib "^2.1.0"
"@capacitor/device@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/@capacitor/device/-/device-6.0.1.tgz#bb5cb2b9e9c37142b71d51e4c6eed84625ce821e"
integrity sha512-Tlz67DAO5GKb5YAfupXiENZxDww6mHnG9iKI+8D5SVF82VLpEv5r9qwKtiounuQB2y2HWiHV8tlOk7DqnLVUqQ==
"@chainsafe/as-chacha20poly1305@^0.1.0": "@chainsafe/as-chacha20poly1305@^0.1.0":
version "0.1.0" version "0.1.0"
resolved "https://registry.yarnpkg.com/@chainsafe/as-chacha20poly1305/-/as-chacha20poly1305-0.1.0.tgz#7da6f8796f9b42dac6e830a086d964f1f9189e09" resolved "https://registry.yarnpkg.com/@chainsafe/as-chacha20poly1305/-/as-chacha20poly1305-0.1.0.tgz#7da6f8796f9b42dac6e830a086d964f1f9189e09"