[Bug report] Progress only updates when the download is complete
cambo2015 opened this issue · comments
cambo2015 commented
Describe the bug
When downloading a translation language model and calling .observe on the Progress object using .fractionCompleted, it only updates when the download is finished instead of incrementally updating; the result, updated one time, is 1.0. Thank you in advance.
To Reproduce
Example Steps to reproduce the behavior in the sample app:
- open xCode,
- install pod 'GoogleMLKit/Translate', '3.2.0'
- use the following below:
If applicable, please includecode snippet
andsample input(image, video, text, etc)
func downloadModel(language:TranslateLanguage){
let model = TranslateRemoteModel.translateRemoteModel(language: language)
let progress = ModelManager.modelManager().download(
model,
conditions: ModelDownloadConditions(
allowsCellularAccess: true,
allowsBackgroundDownloading: true
)
)
progress.observe(\.fractionCompleted){ progress, _ in
print(progress.fractionCompleted) // only prints 1 .0 only 1 time. Need it to print multiple times and give percentage.
self.downloadProgressHandler!(progress.fractionCompleted,language) // a callback within the class that will go to the Swift UI
}
}
Expected behavior
Expect
SDK Info:
- SDK Name & Version 'GoogleMLKit/Translate', '3.2.0'
Smartphone:
- Device/Simulator: IOS simulator, physical iPhone 11
- Device/Simulator OS: iPhone 15 iOS 17.3
Development Environment:
(For Android issue feel free to skip this section)
- IDE Eversion: Xcode 15.2
- Laptop/Desktop: MacBook Pro m1 2020
- Laptop/Desktop OS/version: Sonoma 14.3