gargakshit / unpaprd

An audiobook 🎧 📔 app made using Flutter
GNU Affero General Public License v3.0
99 stars 25 forks source link

Bookmark feature issue #4

Closed costaalex closed 3 years ago

costaalex commented 3 years ago

The bookmark feature doesn't seem to be working.

gargakshit commented 3 years ago

Hello Alex Currently I am occupied with my exams and college. I will look into the issue as soon as they are over :)

costaalex commented 3 years ago

Great. I'm new into Flutter but I'll try to look into it too :))

costaalex commented 3 years ago

So, it is keeping the bookmarks after reinstalling, but the problem is that if I quit the app at a certain minute, (for example 6), the next time I open the audiobook, it replays aproximately at a double position (12) compared to the last session.

costaalex commented 3 years ago

I found the problem. In the updateSharedPrefs() function (components/player.dart), the position.inSeconds returns the number of seconds from the beginning of the audio. For minute 2, second 2, position.inSeconds will be 112. So it adds to the position 2 times the same thing. In the function updateSharedPrefs(), replace: position.inSeconds, with (position.inSeconds - (position.inMinutes * 60)).toString(),

costaalex commented 3 years ago

The same logic applies to minutes:

(position.inMinutes - position.inHours * 60).toString(),