Skip to content

Commit

Permalink
Fix bugs (#476)
Browse files Browse the repository at this point in the history
* #454 issue, prefill only on debug mode

* #454 issue, prefill only on debug mode

* added myself <3

* -

* -

* fix #478 LateInitializationError

* add consts, make the funcs private

* latest update, change the name of prod, adding test server in debug mode

* -

---------

Co-authored-by: allohibihanaa <[email protected]>
Co-authored-by: Roland Geider <[email protected]>
  • Loading branch information
3 people authored Jan 11, 2024
1 parent cf1bedd commit 4d90b8f
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 24 deletions.
4 changes: 4 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
- artchiee - <https://github.com/artchiee>
- Tejas Bir Singh - <https://github.com/tejasbirsingh>
- Abhishek Saini - <https://github.com/Abhisheksainii>
- Hanaa Allohibi - <https://github.com/hn-n>
- Shey Alnasrawi - <https://github.com/Milksheyke>

## Translators

- Saudi Arabian
- Hanaa Allohibi <Gmail: programmerHanaa>

- German

- mondstern <[email protected]> (2)
Expand Down
35 changes: 24 additions & 11 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
PODS:
- camera_avfoundation (0.0.1):
- Flutter
- Flutter (1.0.0)
- flutter_barcode_scanner (2.0.0):
- Flutter
- flutter_keyboard_visibility (0.0.1):
- Flutter
- flutter_zxing (0.0.1):
- Flutter
- image_picker_ios (0.0.1):
- Flutter
- integration_test (0.0.1):
Expand All @@ -19,26 +23,33 @@ PODS:
- Flutter
- video_player_avfoundation (0.0.1):
- Flutter
- FlutterMacOS

DEPENDENCIES:
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
- Flutter (from `Flutter`)
- flutter_barcode_scanner (from `.symlinks/plugins/flutter_barcode_scanner/ios`)
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
- flutter_zxing (from `.symlinks/plugins/flutter_zxing/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- integration_test (from `.symlinks/plugins/integration_test/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- rive_common (from `.symlinks/plugins/rive_common/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`)

EXTERNAL SOURCES:
camera_avfoundation:
:path: ".symlinks/plugins/camera_avfoundation/ios"
Flutter:
:path: Flutter
flutter_barcode_scanner:
:path: ".symlinks/plugins/flutter_barcode_scanner/ios"
flutter_keyboard_visibility:
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
flutter_zxing:
:path: ".symlinks/plugins/flutter_zxing/ios"
image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios"
integration_test:
Expand All @@ -48,24 +59,26 @@ EXTERNAL SOURCES:
rive_common:
:path: ".symlinks/plugins/rive_common/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/ios"
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
video_player_avfoundation:
:path: ".symlinks/plugins/video_player_avfoundation/ios"
:path: ".symlinks/plugins/video_player_avfoundation/darwin"

SPEC CHECKSUMS:
camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_barcode_scanner: 7a1144744c28dc0c57a8de7218ffe5ec59a9e4bf
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
flutter_zxing: 19a866d17c8a87ee1026d68521c69d2f008635f6
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
rive_common: b5b1aa30c63b8f0f00f32cddc9ea394d3d3473b5
shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126
integration_test: 13825b8a9334a850581300559b8839134b124670
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
rive_common: 3a4c254c6e4db7e4b9e05daeb3d1f47ae4f7bf76
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
url_launcher_ios: 68d46cc9766d0c41dbdc884310529557e3cd7a86
video_player_avfoundation: 8563f13d8fc8b2c29dc2d09e60b660e4e8128837

PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048

COCOAPODS: 1.12.0
COCOAPODS: 1.14.3
3 changes: 2 additions & 1 deletion ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -204,6 +204,7 @@
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
7 changes: 6 additions & 1 deletion lib/helpers/consts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ import 'package:intl/intl.dart';
const double ICON_SIZE_SMALL = 20;

/// Default wger server during login
const DEFAULT_SERVER = 'https://wger.de';
const DEFAULT_SERVER_PROD = 'https://wger.de';
const DEFAULT_SERVER_TEST = 'https://wger-master.rge.uber.space/';

// Debug mode Login Data
const USER_NAME = 'user';
const PASSWORD = 'flutteruser';

/// Keys used in the android manifest
const MANIFEST_KEY_API = 'wger.api_key';
Expand Down
2 changes: 1 addition & 1 deletion lib/providers/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class AuthProvider with ChangeNotifier {
Future<String> getServerUrlFromPrefs() async {
final prefs = await SharedPreferences.getInstance();
if (!prefs.containsKey('lastServer')) {
return DEFAULT_SERVER;
return DEFAULT_SERVER_PROD;
}

final userData = json.decode(prefs.getString('lastServer')!);
Expand Down
26 changes: 23 additions & 3 deletions lib/screens/auth_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
Expand Down Expand Up @@ -124,7 +125,8 @@ class _AuthCardState extends State<AuthCard> {
final _passwordController = TextEditingController();
final _password2Controller = TextEditingController();
final _emailController = TextEditingController();
final _serverUrlController = TextEditingController(text: DEFAULT_SERVER);
final _serverUrlController =
TextEditingController(text: kDebugMode ? DEFAULT_SERVER_TEST : DEFAULT_SERVER_PROD);

@override
void initState() {
Expand All @@ -144,6 +146,21 @@ class _AuthCardState extends State<AuthCard> {
} on PlatformException {
_canRegister = false;
}
_preFillTextfields();
}

void _preFillTextfields() {
if (kDebugMode && _authMode == AuthMode.Login) {
setState(() {
_usernameController.text = USER_NAME;
_passwordController.text = PASSWORD;
});
}
}

void _resetTextfields() {
_usernameController.clear();
_passwordController.clear();
}

void _submit(BuildContext context) async {
Expand Down Expand Up @@ -204,18 +221,20 @@ class _AuthCardState extends State<AuthCard> {

void _switchAuthMode() {
if (!_canRegister) {
launchURL(DEFAULT_SERVER, context);
launchURL(DEFAULT_SERVER_PROD, context);
return;
}

if (_authMode == AuthMode.Login) {
setState(() {
_authMode = AuthMode.Signup;
});
_resetTextfields();
} else {
setState(() {
_authMode = AuthMode.Login;
});
_preFillTextfields();
}
}

Expand Down Expand Up @@ -384,7 +403,8 @@ class _AuthCardState extends State<AuthCard> {
IconButton(
icon: const Icon(Icons.undo),
onPressed: () {
_serverUrlController.text = DEFAULT_SERVER;
_serverUrlController.text =
kDebugMode ? DEFAULT_SERVER_TEST : DEFAULT_SERVER_PROD;
},
),
Text(AppLocalizations.of(context).reset)
Expand Down
18 changes: 12 additions & 6 deletions lib/screens/exercises_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ class ExercisesScreen extends StatefulWidget {
class _ExercisesScreenState extends State<ExercisesScreen> {
late final TextEditingController _exerciseNameController;

@override
void initState() {
_exerciseNameController = TextEditingController();
super.initState();
}

@override
void dispose() {
_exerciseNameController.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
//final size = MediaQuery.of(context).size;
Expand All @@ -43,12 +55,6 @@ class _ExercisesScreenState extends State<ExercisesScreen> {
),
);
}

@override
void dispose() {
_exerciseNameController.dispose();
super.dispose();
}
}

class _ExercisesList extends StatelessWidget {
Expand Down

0 comments on commit 4d90b8f

Please sign in to comment.