svthalia / Reaxit

The latest ThaliApp built on Flutter.
GNU General Public License v3.0
11 stars 3 forks source link

Enable picking between concrexit servers #459

Closed DeD1rk closed 1 year ago

DeD1rk commented 1 year ago

Closes #457.

Summary

This adds a button on the LoginScreen to pick an environment (production, staging or local) from options that depend on variables provided at build-time. That is, in development, only staging will be possible (and default). In CI builds, production will be added and defaulted to. And if you set --dart-define=LOCAL_THALIA_OAUTH_APP_ID=XXX --dart-define=LOCAL_THALIA_OAUTH_APP_SECRET=XXX, a local environment is also available (not picked by default), using http://127.0.0.1:8000.

I also got rid of a hack we used, removing the navigator around the LoginScreen.

TODO:

How to test

Steps to test the changes you made:

  1. Make a production build
  2. Sign in to production
  3. Sign out
  4. Sign in to staging
  5. If you like, also try a build with local settings
JAicewizard commented 1 year ago

Although I like the idea, I also think this will be a horrible experience if the API changes. Doing this adds a responsibility to concrexit to postpone API changes to last-minute, or at least together with a reaxit release. (Or have stricter API versioning, where any removal would constitute a new API version)

DeD1rk commented 1 year ago

a horrible experience if the API changes

That's true, but also already true with a single hardcoded server. Normal users don't have the possibility to log in elsewhere anyway

DeD1rk commented 1 year ago

Tried the iOS testflight on staging and production, worked like a charm

JAicewizard commented 1 year ago

I will test this evening as well, looks good to test otherwise

JAicewizard commented 1 year ago

I can open links in the app! that is very nice I will look into opening staging links in the release app as well

JAicewizard commented 1 year ago

I tested with deeplinks, they still work on both staging and release. I opened an issue about a cool idea that you can easily switch accounts. Its probably a cool side-project, but has no usage besides us testing things without logging out and back in