mirror of
https://github.com/amnezia-vpn/amnezia-client.git
synced 2026-06-23 02:00:20 +07:00
remove dead code
This commit is contained in:
@@ -16,31 +16,24 @@ import "../Components"
|
||||
PageType {
|
||||
id: root
|
||||
|
||||
/** Loud dim colors when true (red/blue/cyan/orange regions). Sync with PageStart.pairingQrChromeDebug. */
|
||||
property bool pairingQrChromeDebug: false
|
||||
|
||||
/** iOS (and any non-Android mobile): native QRCodeReader; Qt may not always report os === "ios". */
|
||||
readonly property bool useIosStyleNativeQrReader: GC.isMobile() && Qt.platform.os !== "android"
|
||||
|
||||
/** iOS-only: full-screen UIKit UIWindow scanner (PairingUiController.iosNativePairingQrOverlayBuild — not Qt.platform.os). */
|
||||
readonly property bool useIosNativePairingQrOverlay: PairingUiController.iosNativePairingQrOverlayBuild
|
||||
|
||||
/** Android: full-screen CameraActivity — Qt cannot reliably composite CameraX under QML on some OEMs (e.g. Samsung). */
|
||||
readonly property bool useAndroidNativePairingQrScanner: GC.isMobile() && Qt.platform.os === "android"
|
||||
/** Android: iOS-like flow — titles and camera preview only in CameraActivity; QML hides duplicate scan chrome. */
|
||||
readonly property bool useAndroidNativePairingQrOverlay: PairingUiController.androidNativePairingQrOverlayBuild
|
||||
&& GC.isMobile()
|
||||
&& Qt.platform.os === "android"
|
||||
|
||||
/** Let dimming draw into window chrome (status bar + tab bar) when camera underlay is active. */
|
||||
readonly property bool extendScanDimToScreenEdges: GC.isMobile() && pairingWizardStep === 0
|
||||
&& PairingUiController.embeddedPairingQrCameraActive
|
||||
&& !root.useAndroidNativePairingQrOverlay
|
||||
clip: !extendScanDimToScreenEdges
|
||||
|
||||
/** QQuickWindow (not Item); do not type as Item — breaks binding on Qt 6. */
|
||||
/** QQuickWindow as var — typing as Item breaks bindings on Qt 6. */
|
||||
readonly property var appWindow: Window.window
|
||||
/** Pixels of window above this page (status bar / safe area gap). */
|
||||
readonly property real scanDimBleedTop: {
|
||||
if (!extendScanDimToScreenEdges || !appWindow || !appWindow.contentItem)
|
||||
return 0
|
||||
@@ -49,7 +42,6 @@ PageType {
|
||||
bleed = Math.max(bleed, PageController.safeAreaTopMargin)
|
||||
return bleed
|
||||
}
|
||||
/** Pixels of window below this page (tab bar + home indicator). */
|
||||
readonly property real scanDimBleedBottom: {
|
||||
if (!extendScanDimToScreenEdges || !appWindow || !appWindow.contentItem)
|
||||
return 0
|
||||
@@ -63,15 +55,9 @@ PageType {
|
||||
return bleed
|
||||
}
|
||||
|
||||
/**
|
||||
* Bottom bleed for dimLayer only. On iOS embedded native QR, keep dim inside the page — semi-opaque dim
|
||||
* extended into the tab stack seam composites badly with opaque tab chrome (persistent hairline).
|
||||
* Native bottom mask still uses scanDimBleedBottom via pushIosNativeBottomBleedSync().
|
||||
*/
|
||||
readonly property real scanDimBleedBottomForDimLayer: (root.useIosStyleNativeQrReader
|
||||
&& PairingUiController.embeddedPairingQrCameraActive) ? 0 : scanDimBleedBottom
|
||||
|
||||
/** iOS: extend UIKit bottom dim under QML tab bar (see iosPairingCameraAccess + PairingUiController). */
|
||||
function pushIosNativeBottomBleedSync() {
|
||||
if (!root.useIosStyleNativeQrReader || !PairingUiController.embeddedPairingQrCameraActive) {
|
||||
return
|
||||
@@ -85,61 +71,16 @@ PageType {
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: pairingScanLayoutLogTimer
|
||||
interval: 50
|
||||
repeat: false
|
||||
onTriggered: root.logPairingScanLayout("timer")
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: PairingUiController
|
||||
|
||||
function onEmbeddedPairingQrCameraActiveChanged() {
|
||||
if (PairingUiController.embeddedPairingQrCameraActive) {
|
||||
pairingScanLayoutLogTimer.restart()
|
||||
Qt.callLater(root.pushIosNativeBottomBleedSync)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function logPairingScanLayout(tag) {
|
||||
const w = Window.window
|
||||
const ci = w && w.contentItem ? w.contentItem : null
|
||||
let m00 = null
|
||||
let m0h = null
|
||||
let scanBot = null
|
||||
let dimTL = null
|
||||
let dimBR = null
|
||||
let dimHoleB = null
|
||||
if (ci) {
|
||||
m00 = root.mapToItem(ci, 0, 0)
|
||||
m0h = root.mapToItem(ci, 0, root.height)
|
||||
scanBot = scanStep.mapToItem(ci, 0, scanStep.height)
|
||||
dimTL = dimLayer.mapToItem(ci, 0, 0)
|
||||
dimBR = dimLayer.mapToItem(ci, dimLayer.width, dimLayer.height)
|
||||
dimHoleB = dimLayer.holeBottom
|
||||
}
|
||||
console.warn("[PairingQrLayout]", tag,
|
||||
"extend=", extendScanDimToScreenEdges,
|
||||
"clip=", clip,
|
||||
"root=", root.width, "x", root.height,
|
||||
"win=", w ? w.width : -1, "x", w ? w.height : -1,
|
||||
"contentItem=", ci ? ci.width : -1, "x", ci ? ci.height : -1,
|
||||
"bleedT/B=", scanDimBleedTop, scanDimBleedBottom,
|
||||
"dimLayerBleedB=", root.scanDimBleedBottomForDimLayer,
|
||||
"safeT/B=", PageController.safeAreaTopMargin, PageController.safeAreaBottomMargin,
|
||||
"map00=", m00 ? m00.x + "," + m00.y : "n/a",
|
||||
"map0h=", m0h ? m0h.x + "," + m0h.y : "n/a",
|
||||
"ci.scanStepBot=", scanBot ? scanBot.x.toFixed(1) + "," + scanBot.y.toFixed(1) : "n/a",
|
||||
"ci.dimTL/BR=", dimTL ? dimTL.x.toFixed(1) + "," + dimTL.y.toFixed(1) : "n/a",
|
||||
dimBR ? dimBR.x.toFixed(1) + "," + dimBR.y.toFixed(1) : "n/a",
|
||||
"dimHoleB=", dimHoleB !== null ? dimHoleB.toFixed(1) : "n/a",
|
||||
"win.screen=", w && w.screen ? w.screen.width + "x" + w.screen.height : "n/a",
|
||||
"dimLayer wh=", dimLayer.width, "x", dimLayer.height)
|
||||
}
|
||||
|
||||
/** 0 = scan QR, 1 = confirm before sending subscription */
|
||||
property int pairingWizardStep: 0
|
||||
property bool keepPhonePairingInBackgroundOnClose: false
|
||||
|
||||
@@ -188,11 +129,6 @@ PageType {
|
||||
if (addDeviceConfirmNavigationScheduled) {
|
||||
return
|
||||
}
|
||||
console.warn("[PairingQrSend] startMobileScanner Qt.platform.os=", Qt.platform.os,
|
||||
"iosNativePairingQrOverlayBuild=", PairingUiController.iosNativePairingQrOverlayBuild,
|
||||
"useIosNativePairingQrOverlay=", root.useIosNativePairingQrOverlay,
|
||||
"androidNativePairingQrOverlayBuild=", PairingUiController.androidNativePairingQrOverlayBuild,
|
||||
"useAndroidNativePairingQrOverlay=", root.useAndroidNativePairingQrOverlay)
|
||||
if (!PairingUiController.isPairingCameraAccessGranted()) {
|
||||
awaitingCameraPermissionForScan = true
|
||||
PairingUiController.requestPairingCameraAccess()
|
||||
@@ -208,14 +144,10 @@ PageType {
|
||||
if (root.useAndroidNativePairingQrScanner) {
|
||||
const coolUntil = PairingUiController.androidPairingReaderCooldownUntilEpochMs
|
||||
if (Date.now() < coolUntil) {
|
||||
console.warn("[PairingQrSend] startMobileScanner: skip (native camera cooldown), ms left=",
|
||||
(coolUntil - Date.now()))
|
||||
return
|
||||
}
|
||||
const now = Date.now()
|
||||
if (now - _androidPairingReaderLastStartMs < 700) {
|
||||
console.warn("[PairingQrSend] startMobileScanner: skip duplicate Android CameraActivity within",
|
||||
(now - _androidPairingReaderLastStartMs), "ms")
|
||||
return
|
||||
}
|
||||
_androidPairingReaderLastStartMs = now
|
||||
@@ -314,14 +246,8 @@ PageType {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* StackView often instantiates the page already visible — onVisibleChanged(true) may never run, so
|
||||
* startMobileScanner (and native overlay present) would be skipped; only stop/dismiss runs. Same pattern as
|
||||
* PageSetupWizardApiQrPairingReceive (Component.onCompleted + visible).
|
||||
*/
|
||||
Component.onCompleted: {
|
||||
if (GC.isMobile() && root.visible && pairingWizardStep === 0) {
|
||||
console.warn("[PairingQrSend] Component.onCompleted: schedule startMobileScanner (page created visible)")
|
||||
Qt.callLater(startMobileScanner)
|
||||
}
|
||||
}
|
||||
@@ -347,29 +273,21 @@ PageType {
|
||||
})
|
||||
return
|
||||
}
|
||||
/**
|
||||
* No fixed ms delay: f1 reapply UIView transparency; f2 restart AVCapture; f3 refresh again —
|
||||
* after restartPairingIosCamera, QUIMetalView / render thread often rebuilds opaque layers (same bug
|
||||
* as status-bar-only camera) until underlay is reapplied once more.
|
||||
*/
|
||||
Qt.callLater(function () {
|
||||
if (!root.visible || root.pairingWizardStep !== 0 || !GC.isMobile()) {
|
||||
return
|
||||
}
|
||||
console.warn("[PairingQrResume] ApplicationActive f1 underlay")
|
||||
PairingUiController.embeddedPairingQrCameraActive = true
|
||||
PairingUiController.refreshIosEmbeddedPairingQrChrome()
|
||||
Qt.callLater(function () {
|
||||
if (!root.visible || root.pairingWizardStep !== 0) {
|
||||
return
|
||||
}
|
||||
console.warn("[PairingQrResume] ApplicationActive f2 restart camera")
|
||||
root.restartPairingIosCamera()
|
||||
Qt.callLater(function () {
|
||||
if (!root.visible || root.pairingWizardStep !== 0) {
|
||||
return
|
||||
}
|
||||
console.warn("[PairingQrResume] ApplicationActive f3 underlay post-camera")
|
||||
PairingUiController.refreshIosEmbeddedPairingQrChrome()
|
||||
})
|
||||
})
|
||||
|
||||
@@ -19,87 +19,15 @@ PageType {
|
||||
property bool isControlsDisabled: false
|
||||
property bool isTabBarDisabled: false
|
||||
|
||||
/** Loud colors (tab bar base green, extra overlap) when true — pair with PageSettingsApiQrPairingSend.pairingQrChromeDebug. */
|
||||
property bool pairingQrChromeDebug: false
|
||||
|
||||
/** Opaque extension of tab bar background upward (iOS embedded QR); see PairingTabChrome deltaY vs stack bottom. */
|
||||
readonly property int tabBarChromeOverlapUp: (PairingUiController.embeddedPairingQrCameraActive && GC.isMobile()
|
||||
&& Qt.platform.os !== "android")
|
||||
? (root.pairingQrChromeDebug ? 24 : 18) : 0
|
||||
|
||||
/** Pull stack under tab chrome so TabBar.background overlap fully covers stack bottom pixels. */
|
||||
readonly property int tabStackPairingUnderlapDown: (PairingUiController.embeddedPairingQrCameraActive && GC.isMobile()
|
||||
&& Qt.platform.os !== "android") ? 8 : 0
|
||||
|
||||
readonly property bool pairingTabChromeLogActive: PairingUiController.embeddedPairingQrCameraActive && GC.isMobile()
|
||||
&& Qt.platform.os !== "android"
|
||||
|
||||
function logPairingTabChromeLayout(tag) {
|
||||
if (!root.pairingTabChromeLogActive) {
|
||||
return
|
||||
}
|
||||
const w = Window.window
|
||||
const ci = w && w.contentItem ? w.contentItem : null
|
||||
let msg = "[PairingTabChrome] " + tag
|
||||
msg += " PageStart=" + Math.round(root.width) + "x" + Math.round(root.height)
|
||||
msg += " tabBar=" + Math.round(tabBar.width) + "x" + Math.round(tabBar.height) + " y=" + tabBar.y.toFixed(2)
|
||||
msg += " imeBM=" + PageController.imeHeight
|
||||
msg += " stack=" + Math.round(tabBarStackView.width) + "x" + Math.round(tabBarStackView.height)
|
||||
msg += " overlapUp=" + tabBarChromeOverlapUp + " stackUnderlap=" + tabStackPairingUnderlapDown
|
||||
msg += " tabBgRootH=" + (tabBarBackgroundRoot ? tabBarBackgroundRoot.height.toFixed(2) : "n/a")
|
||||
if (ci) {
|
||||
const tabOrigin = tabBar.mapToItem(ci, 0, 0)
|
||||
const tabBandTop = tabBar.mapToItem(ci, 0, -tabBarChromeOverlapUp)
|
||||
const stackOrigin = tabBarStackView.mapToItem(ci, 0, 0)
|
||||
const stackBottomMid = tabBarStackView.mapToItem(ci, tabBarStackView.width * 0.5, tabBarStackView.height)
|
||||
const bgTopLeft = tabBarBackgroundRoot.mapToItem(ci, 0, 0)
|
||||
msg += " ci.tab(0,0)=" + tabOrigin.x.toFixed(1) + "," + tabOrigin.y.toFixed(1)
|
||||
msg += " ci.tab(0,-ov)=" + tabBandTop.x.toFixed(1) + "," + tabBandTop.y.toFixed(1)
|
||||
msg += " ci.stack(0,0)=" + stackOrigin.x.toFixed(1) + "," + stackOrigin.y.toFixed(1)
|
||||
msg += " ci.stackMidBot=" + stackBottomMid.x.toFixed(1) + "," + stackBottomMid.y.toFixed(1)
|
||||
msg += " ci.tabBgRoot(0,0)=" + bgTopLeft.x.toFixed(1) + "," + bgTopLeft.y.toFixed(1)
|
||||
msg += " deltaY_tabBandTop_minus_stackMidBot=" + (tabBandTop.y - stackBottomMid.y).toFixed(2)
|
||||
} else {
|
||||
msg += " ci=missing"
|
||||
}
|
||||
console.warn(msg)
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: pairingTabChromeLogTimer50
|
||||
interval: 50
|
||||
repeat: false
|
||||
onTriggered: root.logPairingTabChromeLayout("t50")
|
||||
}
|
||||
Timer {
|
||||
id: pairingTabChromeLogTimer350
|
||||
interval: 350
|
||||
repeat: false
|
||||
onTriggered: root.logPairingTabChromeLayout("t350")
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: PairingUiController
|
||||
|
||||
function onEmbeddedPairingQrCameraActiveChanged() {
|
||||
if (PairingUiController.embeddedPairingQrCameraActive && GC.isMobile() && Qt.platform.os !== "android") {
|
||||
pairingTabChromeLogTimer50.restart()
|
||||
pairingTabChromeLogTimer350.restart()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onWidthChanged: {
|
||||
if (root.pairingTabChromeLogActive) {
|
||||
pairingTabChromeLogTimer50.restart()
|
||||
}
|
||||
}
|
||||
onHeightChanged: {
|
||||
if (root.pairingTabChromeLogActive) {
|
||||
pairingTabChromeLogTimer50.restart()
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
objectName: "pageControllerConnection"
|
||||
|
||||
@@ -413,12 +341,10 @@ PageType {
|
||||
anchors.bottom: parent.bottom
|
||||
height: parent.height + root.tabBarChromeOverlapUp
|
||||
|
||||
/** Opaque base: Shape alone can show the window-layer camera through anti-aliased edges when the window is clear (iOS QR pairing). */
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: root.pairingQrChromeDebug ? "#00ff66" : AmneziaStyle.color.onyxBlack
|
||||
}
|
||||
/** Stroke around tab row; hidden during iOS embedded QR overlap — top horizontal slateGray reads as a hairline “strip” above tabs. */
|
||||
Shape {
|
||||
id: tabBarChromeShape
|
||||
objectName: "backgroundShape"
|
||||
|
||||
Reference in New Issue
Block a user