已合并
fix remove notification. #2030
liuqian创建于 17 天前
fix remove notification. #2030
已合并
共 4 个文件变更+9-8
| @@ -227,7 +227,6 @@ export default class BluetoothReceiveUIAbility extends UIAbility { | |||
| 227 | console.info(TAG, `unlink file begin`); | 227 | console.info(TAG, `unlink file begin`); |
| 228 | const uri = new fileUri.FileUri(this.receiveDirectory); | 228 | const uri = new fileUri.FileUri(this.receiveDirectory); |
| 229 | let deleteSandBoxUri = uri.path; | 229 | let deleteSandBoxUri = uri.path; |
| 230 | - console.info(TAG, `unlink file begin fileUri ${this.receiveDirectory} sandBoxUri ${deleteSandBoxUri}`); | ||
| 231 | if (this.fileFd != -1) { | 230 | if (this.fileFd != -1) { |
| 232 | fs.close(this.fileFd); | 231 | fs.close(this.fileFd); |
| 233 | this.fileFd = -1; | 232 | this.fileFd = -1; |
| @@ -238,7 +237,7 @@ export default class BluetoothReceiveUIAbility extends UIAbility { | |||
| 238 | this.cancelSendProgressNotification(); | 237 | this.cancelSendProgressNotification(); |
| 239 | this.oppProfile.off('transferStateChange'); | 238 | this.oppProfile.off('transferStateChange'); |
| 240 | let err: BusinessError = error as BusinessError; | 239 | let err: BusinessError = error as BusinessError; |
| 241 | - console.error(TAG, `unlink failed, uri ${this.receiveDirectory} code ${err.code}, message ${err.message}`); | 240 | + console.error(TAG, `unlink failed, code ${err.code}, message ${err.message}`); |
| 242 | this.oppProfile.setLastReceivedFileUri('removeFile: ' + this.receiveDirectory); | 241 | this.oppProfile.setLastReceivedFileUri('removeFile: ' + this.receiveDirectory); |
| 243 | } | 242 | } |
| 244 | } | 243 | } |
| @@ -333,6 +332,7 @@ export default class BluetoothReceiveUIAbility extends UIAbility { | |||
| 333 | } | 332 | } |
| 334 | case 'usual.event.bluetooth.OPP.FINISH.NOTIFICATION': { | 333 | case 'usual.event.bluetooth.OPP.FINISH.NOTIFICATION': { |
| 335 | this.oppProfile.setLastReceivedFileUri(this.receiveDirectory); | 334 | this.oppProfile.setLastReceivedFileUri(this.receiveDirectory); |
| 335 | + this.tapEventIsAllowed = true; | ||
| 336 | setTimeout(() => { | 336 | setTimeout(() => { |
| 337 | if (this.transfering) { | 337 | if (this.transfering) { |
| 338 | console.info(TAG, 'still transfering, do not terminate'); | 338 | console.info(TAG, 'still transfering, do not terminate'); |
| @@ -345,6 +345,10 @@ export default class BluetoothReceiveUIAbility extends UIAbility { | |||
| 345 | } | 345 | } |
| 346 | case 'usual.event.bluetooth.OPP.FINISH.REMOVE': { | 346 | case 'usual.event.bluetooth.OPP.FINISH.REMOVE': { |
| 347 | console.info(TAG, 'user OPP.FINISH.REMOVE tapEventIsAllowed is ' + this.tapEventIsAllowed); | 347 | console.info(TAG, 'user OPP.FINISH.REMOVE tapEventIsAllowed is ' + this.tapEventIsAllowed); |
| 348 | + if (this.transfering) { | ||
| 349 | + console.info(TAG, 'still transfering, do not terminate'); | ||
| 350 | + return; | ||
| 351 | + } | ||
| 348 | clearTimeout(this.timerIdReceive); | 352 | clearTimeout(this.timerIdReceive); |
| 349 | this.transfering = false; | 353 | this.transfering = false; |
| 350 | this.oppProfile.setIncomingFileConfirmation(false, -1); | 354 | this.oppProfile.setIncomingFileConfirmation(false, -1); |
| @@ -440,7 +444,6 @@ export default class BluetoothReceiveUIAbility extends UIAbility { | |||
| 440 | } else { | 444 | } else { |
| 441 | this.sandBoxUri = this.receiveDirectory; | 445 | this.sandBoxUri = this.receiveDirectory; |
| 442 | } | 446 | } |
| 443 | - console.info(TAG, `openFile begin fileUri ${this.sandBoxUri}`); | ||
| 444 | let file = fs.openSync(this.sandBoxUri, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE); | 447 | let file = fs.openSync(this.sandBoxUri, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE); |
| 445 | this.fileFd = file.fd; | 448 | this.fileFd = file.fd; |
| 446 | await this.oppProfile.setIncomingFileConfirmation(true, file.fd); | 449 | await this.oppProfile.setIncomingFileConfirmation(true, file.fd); |
| @@ -244,7 +244,6 @@ export default class BluetoothSendUIAbility extends UIAbility { | |||
| 244 | } | 244 | } |
| 245 | console.info(TAG, 'transfer finished'); | 245 | console.info(TAG, 'transfer finished'); |
| 246 | let dirPath = this.context.filesDir; | 246 | let dirPath = this.context.filesDir; |
| 247 | - console.info(TAG, `transfer finished rmdirSync ${dirPath}`); | ||
| 248 | fs.rmdirSync(dirPath); | 247 | fs.rmdirSync(dirPath); |
| 249 | } | 248 | } |
| 250 | }); | 249 | }); |
| @@ -66,7 +66,7 @@ struct btCreateFilePickerPage { | |||
| 66 | console.info('removeAssets successfully'); | 66 | console.info('removeAssets successfully'); |
| 67 | } catch (error) { | 67 | } catch (error) { |
| 68 | let err: BusinessError = error as BusinessError; | 68 | let err: BusinessError = error as BusinessError; |
| 69 | - console.error(TAG, `unlink ${this.removeFileUri} failed, code is ${err.code}, message is ${err.message}`); | 69 | + console.error(TAG, `unlink failed, code is ${err.code}, message is ${err.message}`); |
| 70 | } | 70 | } |
| 71 | this.context.terminateSelf(); | 71 | this.context.terminateSelf(); |
| 72 | } | 72 | } |