added screen orientation qr

This commit is contained in:
2025-06-22 08:50:29 +03:00
parent 9113267dc2
commit d2fc982852
9 changed files with 67 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ dependencies {
implementation project(':capacitor-filesystem')
implementation project(':capacitor-local-notifications')
implementation project(':capacitor-preferences')
implementation project(':capacitor-screen-orientation')
implementation project(':capacitor-splash-screen')
implementation project(':capawesome-capacitor-file-picker')
implementation project(':evva-capacitor-secure-storage-plugin')

View File

@@ -13,6 +13,7 @@
android:usesCleartextTraffic="true">
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
android:screenOrientation="unspecified"
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBarLaunch"

View File

@@ -17,6 +17,9 @@ project(':capacitor-local-notifications').projectDir = new File('../node_modules
include ':capacitor-preferences'
project(':capacitor-preferences').projectDir = new File('../node_modules/@capacitor/preferences/android')
include ':capacitor-screen-orientation'
project(':capacitor-screen-orientation').projectDir = new File('../node_modules/@capacitor/screen-orientation/android')
include ':capacitor-splash-screen'
project(':capacitor-splash-screen').projectDir = new File('../node_modules/@capacitor/splash-screen/android')

14
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "qortal-go",
"version": "0.5.2",
"version": "0.5.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "qortal-go",
"version": "0.5.2",
"version": "0.5.3",
"dependencies": {
"@capacitor/android": "^6.1.2",
"@capacitor/app": "^6.0.1",
@@ -16,6 +16,7 @@
"@capacitor/filesystem": "^6.0.1",
"@capacitor/local-notifications": "^6.1.0",
"@capacitor/preferences": "^6.0.3",
"@capacitor/screen-orientation": "^6.0.3",
"@capacitor/splash-screen": "^6.0.2",
"@capawesome/capacitor-file-picker": "^6.1.0",
"@chatscope/chat-ui-kit-react": "^2.0.3",
@@ -1700,6 +1701,15 @@
"@capacitor/core": "^6.0.0"
}
},
"node_modules/@capacitor/screen-orientation": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/@capacitor/screen-orientation/-/screen-orientation-6.0.3.tgz",
"integrity": "sha512-5R+tf+twRNnkZFGSWsQkEBz1MFyP1kzZDyqOA9rtXJlTQYNcFJWouSXEuNa+Ba6i6nEi4X83BuXVzEFJ7zDrgQ==",
"license": "MIT",
"peerDependencies": {
"@capacitor/core": "^6.0.0"
}
},
"node_modules/@capacitor/splash-screen": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/@capacitor/splash-screen/-/splash-screen-6.0.2.tgz",

View File

@@ -20,6 +20,7 @@
"@capacitor/filesystem": "^6.0.1",
"@capacitor/local-notifications": "^6.1.0",
"@capacitor/preferences": "^6.0.3",
"@capacitor/screen-orientation": "^6.0.3",
"@capacitor/splash-screen": "^6.0.2",
"@capawesome/capacitor-file-picker": "^6.1.0",
"@chatscope/chat-ui-kit-react": "^2.0.3",

View File

@@ -28,6 +28,8 @@ import {
Tooltip,
Typography,
} from "@mui/material";
import { ScreenOrientation } from '@capacitor/screen-orientation';
import { decryptStoredWallet } from "./utils/decryptWallet";
import AccountBalanceWalletIcon from '@mui/icons-material/AccountBalanceWallet';
import PriorityHighIcon from '@mui/icons-material/PriorityHigh';
@@ -518,6 +520,15 @@ function App() {
}
}
useEffect(() => {
try {
ScreenOrientation.lock({ orientation: 'portrait' });
} catch (error) {
console.error(error)
}
}, []);
useEffect(()=> {
if(!shownTutorialsInitiated) return
if(extState === 'not-authenticated'){

View File

@@ -245,7 +245,7 @@ export const AppViewer = React.forwardRef(({ app , hide, isDevMode, skipAuth}, i
height: !isMobile ? '100vh' : `calc(${rootHeight} - 60px - 45px )`,
border: 'none',
width: '100%'
}} id="browser-iframe" src={defaultUrl} sandbox="allow-scripts allow-same-origin allow-forms allow-downloads allow-modals"
}} id="browser-iframe" src={defaultUrl} sandbox="allow-scripts allow-same-origin allow-forms allow-downloads allow-modals allow-orientation-lock"
allow="fullscreen; clipboard-read; clipboard-write">
</iframe>

View File

@@ -353,6 +353,7 @@ export function openIndexedDB() {
'TRANSFER_ASSET',
'SIGN_FOREIGN_FEES',
'GET_PRIMARY_NAME',
'SCREEN-ORIENTATION'
]
@@ -372,6 +373,7 @@ const UIQortalRequests = [
'TRANSFER_ASSET',
'SIGN_FOREIGN_FEES',
'GET_PRIMARY_NAME',
'SCREEN_ORIENTATION'
];

View File

@@ -4,6 +4,7 @@ import { addForeignServer, addGroupAdminRequest, addListItems, adminAction, banF
import { getData, storeData } from "./utils/chromeStorage";
import { executeEvent } from "./utils/events";
import { ScreenOrientation } from '@capacitor/screen-orientation';
function getLocalStorage(key) {
@@ -1398,6 +1399,40 @@ export const isRunningGateway = async ()=> {
}
break;
}
case 'SCREEN_ORIENTATION': {
try {
const mode = request.payload?.mode
if(mode === 'unlock'){
await ScreenOrientation.unlock();
} else {
await ScreenOrientation.lock({ orientation: mode });
}
event.source.postMessage(
{
requestId: request.requestId,
action: request.action,
payload: true,
type: 'backgroundMessageResponse',
},
event.origin
);
} catch (error) {
event.source.postMessage(
{
requestId: request.requestId,
action: request.action,
error: error.message,
type: 'backgroundMessageResponse',
},
event.origin
);
}
break;
}
default:
break;
}