khamidjon-khamidov / flutter_telegram_web_app

MIT License
12 stars 6 forks source link

Add versioning support #13

Open OlegNovosad opened 1 week ago

OlegNovosad commented 1 week ago

It might make sense to add versioning support for APIs, e.g. CloudStorage is available since 6.9, BiometricManager since 7.2 etc. I suggest to add general approach on throwing UnsupportedError error. This also might be controlled with annotations on classes / methods if used.

Any thoughts?

khamidjon-khamidov commented 6 days ago

@OlegNovosad handling versions is a very good idea. if we throw UnsupportedError for methods, devs would needs to wrap almost every method with try/catch (+upcoming new api). I am think about adding docs and printing 'unsupported' silent logs. What do you think? Do you have better idea?

OlegNovosad commented 6 days ago

I thought on annotations but they are not supported well on web (especially dart:mirrors). Idea I had was something like:

@version('6.1')
Future show() {
  // annotation value processing, throw / log if isVersionAtLeast is lower
  return tg.show()
}

maybe we should wait for macros and until then do simple silent logging as you suggest.

khamidjon-khamidov commented 6 days ago

Great! If you would like to do then it is cool! Otherwise I will do it