diff --git a/application/AppScope/app.json b/application/AppScope/app.json index 18db4803a95d331844dafad55be127594bb12354..d4da570775a2a010ac3eb152ed31526a40f8b6b1 100644 --- a/application/AppScope/app.json +++ b/application/AppScope/app.json @@ -2,8 +2,8 @@ "app": { "bundleName": "com.ohos.dhardwareui", "vendor": "example", - "versionCode": 10000030, - "versionName": "1.0.30", + "versionCode": 10000031, + "versionName": "1.0.31", "icon": "$media:app_icon", "label": "$string:app_name", "minAPIVersion": 12, diff --git a/application/AppScope/app.json5 b/application/AppScope/app.json5 index dc6b20249eb299bed0a335653ab5d6c47ac70afb..0d683326abe5b455095be3a78515d6eb90fe7508 100644 --- a/application/AppScope/app.json5 +++ b/application/AppScope/app.json5 @@ -16,8 +16,8 @@ "app": { "bundleName": "com.ohos.dhardwareui", "vendor": "example", - "versionCode": 10000030, - "versionName": "1.0.30", + "versionCode": 10000031, + "versionName": "1.0.31", "icon": "$media:app_icon", "label": "$string:app_name", "minAPIVersion": 12, diff --git a/application/entry/src/main/ets/pages/ContinueSwitch.ets b/application/entry/src/main/ets/pages/ContinueSwitch.ets index 927ccbbb7c6b7b231737f7106a9e1380103ab746..c56637109b0fbbe48fe607a3195362815fbe6fe5 100644 --- a/application/entry/src/main/ets/pages/ContinueSwitch.ets +++ b/application/entry/src/main/ets/pages/ContinueSwitch.ets @@ -79,6 +79,7 @@ struct ContinueSwitch { } @State paddingStartNormal: LengthMetrics = LengthMetrics.resource($r('sys.float.margin_left')); @State paddingStartPc: LengthMetrics = LengthMetrics.vp(16); + @State isBacked: boolean = false; private listener: mediaQuery.MediaQueryListener = mediaQuery.matchMediaSync('(dark-mode:true)'); private extContext?: common.UIExtensionContext; private scroller: Scroller = new Scroller(); @@ -286,10 +287,20 @@ struct ContinueSwitch { isSaveIconRequired: false, contentMargin: this.is2in1 ? this.titleBarMarginPc : this.titleBarMargin, onCancel: () => { - if (this.continueSession) { - this.continueSession.sendData({ 'action': 'pop' }) - } else { - logger.error(`${TAG} continueSession is undefined`); + logger.info(`${TAG} onCancel in.`); + if (this.isBacked) { + logger.info(`${TAG} onCancel: The back button has been clicked.`); + return; + } + try { + if (this.continueSession) { + this.continueSession.sendData({ 'action': 'pop' }); + this.isBacked = true; + } else { + logger.error(`${TAG} continueSession is undefined`); + } + } catch (error) { + logger.error(`${TAG} continueSession sendData failed. error.message: ${error.message}`); } } })