Skip to content

Commit 4d90b8f

Browse files
hn-nDigitalHanaarolandgeider
authored
Fix bugs (#476)
* #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]>
1 parent cf1bedd commit 4d90b8f

File tree

8 files changed

+73
-24
lines changed

8 files changed

+73
-24
lines changed

AUTHORS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,14 @@
2323
- artchiee - <https://github.com/artchiee>
2424
- Tejas Bir Singh - <https://github.com/tejasbirsingh>
2525
- Abhishek Saini - <https://github.com/Abhisheksainii>
26+
- Hanaa Allohibi - <https://github.com/hn-n>
2627
- Shey Alnasrawi - <https://github.com/Milksheyke>
2728

2829
## Translators
2930

31+
- Saudi Arabian
32+
- Hanaa Allohibi <Gmail: programmerHanaa>
33+
3034
- German
3135

3236
- mondstern <[email protected]> (2)

ios/Podfile.lock

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
PODS:
2+
- camera_avfoundation (0.0.1):
3+
- Flutter
24
- Flutter (1.0.0)
35
- flutter_barcode_scanner (2.0.0):
46
- Flutter
57
- flutter_keyboard_visibility (0.0.1):
68
- Flutter
9+
- flutter_zxing (0.0.1):
10+
- Flutter
711
- image_picker_ios (0.0.1):
812
- Flutter
913
- integration_test (0.0.1):
@@ -19,26 +23,33 @@ PODS:
1923
- Flutter
2024
- video_player_avfoundation (0.0.1):
2125
- Flutter
26+
- FlutterMacOS
2227

2328
DEPENDENCIES:
29+
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
2430
- Flutter (from `Flutter`)
2531
- flutter_barcode_scanner (from `.symlinks/plugins/flutter_barcode_scanner/ios`)
2632
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
33+
- flutter_zxing (from `.symlinks/plugins/flutter_zxing/ios`)
2734
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
2835
- integration_test (from `.symlinks/plugins/integration_test/ios`)
2936
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
3037
- rive_common (from `.symlinks/plugins/rive_common/ios`)
31-
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
38+
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
3239
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
33-
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`)
40+
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`)
3441

3542
EXTERNAL SOURCES:
43+
camera_avfoundation:
44+
:path: ".symlinks/plugins/camera_avfoundation/ios"
3645
Flutter:
3746
:path: Flutter
3847
flutter_barcode_scanner:
3948
:path: ".symlinks/plugins/flutter_barcode_scanner/ios"
4049
flutter_keyboard_visibility:
4150
:path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
51+
flutter_zxing:
52+
:path: ".symlinks/plugins/flutter_zxing/ios"
4253
image_picker_ios:
4354
:path: ".symlinks/plugins/image_picker_ios/ios"
4455
integration_test:
@@ -48,24 +59,26 @@ EXTERNAL SOURCES:
4859
rive_common:
4960
:path: ".symlinks/plugins/rive_common/ios"
5061
shared_preferences_foundation:
51-
:path: ".symlinks/plugins/shared_preferences_foundation/ios"
62+
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
5263
url_launcher_ios:
5364
:path: ".symlinks/plugins/url_launcher_ios/ios"
5465
video_player_avfoundation:
55-
:path: ".symlinks/plugins/video_player_avfoundation/ios"
66+
:path: ".symlinks/plugins/video_player_avfoundation/darwin"
5667

5768
SPEC CHECKSUMS:
69+
camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb
5870
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
5971
flutter_barcode_scanner: 7a1144744c28dc0c57a8de7218ffe5ec59a9e4bf
6072
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
73+
flutter_zxing: 19a866d17c8a87ee1026d68521c69d2f008635f6
6174
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
62-
integration_test: a1e7d09bd98eca2fc37aefd79d4f41ad37bdbbe5
63-
package_info_plus: 6c92f08e1f853dc01228d6f553146438dafcd14e
64-
rive_common: b5b1aa30c63b8f0f00f32cddc9ea394d3d3473b5
65-
shared_preferences_foundation: 986fc17f3d3251412d18b0265f9c64113a8c2472
66-
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
67-
video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126
75+
integration_test: 13825b8a9334a850581300559b8839134b124670
76+
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
77+
rive_common: 3a4c254c6e4db7e4b9e05daeb3d1f47ae4f7bf76
78+
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
79+
url_launcher_ios: 68d46cc9766d0c41dbdc884310529557e3cd7a86
80+
video_player_avfoundation: 8563f13d8fc8b2c29dc2d09e60b660e4e8128837
6881

6982
PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048
7083

71-
COCOAPODS: 1.12.0
84+
COCOAPODS: 1.14.3

ios/Runner.xcodeproj/project.pbxproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
97C146E61CF9000F007C117D /* Project object */ = {
156156
isa = PBXProject;
157157
attributes = {
158-
LastUpgradeCheck = 1300;
158+
LastUpgradeCheck = 1430;
159159
ORGANIZATIONNAME = "";
160160
TargetAttributes = {
161161
97C146ED1CF9000F007C117D = {
@@ -204,6 +204,7 @@
204204
files = (
205205
);
206206
inputPaths = (
207+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
207208
);
208209
name = "Thin Binary";
209210
outputPaths = (

ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1300"
3+
LastUpgradeVersion = "1430"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

lib/helpers/consts.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ import 'package:intl/intl.dart';
2424
const double ICON_SIZE_SMALL = 20;
2525

2626
/// Default wger server during login
27-
const DEFAULT_SERVER = 'https://wger.de';
27+
const DEFAULT_SERVER_PROD = 'https://wger.de';
28+
const DEFAULT_SERVER_TEST = 'https://wger-master.rge.uber.space/';
29+
30+
// Debug mode Login Data
31+
const USER_NAME = 'user';
32+
const PASSWORD = 'flutteruser';
2833

2934
/// Keys used in the android manifest
3035
const MANIFEST_KEY_API = 'wger.api_key';

lib/providers/auth.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class AuthProvider with ChangeNotifier {
208208
Future<String> getServerUrlFromPrefs() async {
209209
final prefs = await SharedPreferences.getInstance();
210210
if (!prefs.containsKey('lastServer')) {
211-
return DEFAULT_SERVER;
211+
return DEFAULT_SERVER_PROD;
212212
}
213213

214214
final userData = json.decode(prefs.getString('lastServer')!);

lib/screens/auth_screen.dart

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
*/
1818

19+
import 'package:flutter/foundation.dart';
1920
import 'package:flutter/material.dart';
2021
import 'package:flutter/services.dart';
2122
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
@@ -124,7 +125,8 @@ class _AuthCardState extends State<AuthCard> {
124125
final _passwordController = TextEditingController();
125126
final _password2Controller = TextEditingController();
126127
final _emailController = TextEditingController();
127-
final _serverUrlController = TextEditingController(text: DEFAULT_SERVER);
128+
final _serverUrlController =
129+
TextEditingController(text: kDebugMode ? DEFAULT_SERVER_TEST : DEFAULT_SERVER_PROD);
128130

129131
@override
130132
void initState() {
@@ -144,6 +146,21 @@ class _AuthCardState extends State<AuthCard> {
144146
} on PlatformException {
145147
_canRegister = false;
146148
}
149+
_preFillTextfields();
150+
}
151+
152+
void _preFillTextfields() {
153+
if (kDebugMode && _authMode == AuthMode.Login) {
154+
setState(() {
155+
_usernameController.text = USER_NAME;
156+
_passwordController.text = PASSWORD;
157+
});
158+
}
159+
}
160+
161+
void _resetTextfields() {
162+
_usernameController.clear();
163+
_passwordController.clear();
147164
}
148165

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

205222
void _switchAuthMode() {
206223
if (!_canRegister) {
207-
launchURL(DEFAULT_SERVER, context);
224+
launchURL(DEFAULT_SERVER_PROD, context);
208225
return;
209226
}
210227

211228
if (_authMode == AuthMode.Login) {
212229
setState(() {
213230
_authMode = AuthMode.Signup;
214231
});
232+
_resetTextfields();
215233
} else {
216234
setState(() {
217235
_authMode = AuthMode.Login;
218236
});
237+
_preFillTextfields();
219238
}
220239
}
221240

@@ -384,7 +403,8 @@ class _AuthCardState extends State<AuthCard> {
384403
IconButton(
385404
icon: const Icon(Icons.undo),
386405
onPressed: () {
387-
_serverUrlController.text = DEFAULT_SERVER;
406+
_serverUrlController.text =
407+
kDebugMode ? DEFAULT_SERVER_TEST : DEFAULT_SERVER_PROD;
388408
},
389409
),
390410
Text(AppLocalizations.of(context).reset)

lib/screens/exercises_screen.dart

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@ class ExercisesScreen extends StatefulWidget {
1818
class _ExercisesScreenState extends State<ExercisesScreen> {
1919
late final TextEditingController _exerciseNameController;
2020

21+
@override
22+
void initState() {
23+
_exerciseNameController = TextEditingController();
24+
super.initState();
25+
}
26+
27+
@override
28+
void dispose() {
29+
_exerciseNameController.dispose();
30+
super.dispose();
31+
}
32+
2133
@override
2234
Widget build(BuildContext context) {
2335
//final size = MediaQuery.of(context).size;
@@ -43,12 +55,6 @@ class _ExercisesScreenState extends State<ExercisesScreen> {
4355
),
4456
);
4557
}
46-
47-
@override
48-
void dispose() {
49-
_exerciseNameController.dispose();
50-
super.dispose();
51-
}
5258
}
5359

5460
class _ExercisesList extends StatelessWidget {

0 commit comments

Comments
 (0)