Skip to content

Commit f53dc30

Browse files
Merge pull request #50 from angrezichatterbox/main
Bringing in the onboarding page
2 parents 51de26b + bd208ef commit f53dc30

22 files changed

+367
-137
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
*.swp
66
.DS_Store
77
.atom/
8+
.build/
89
.buildlog/
910
.history
1011
.svn/
12+
.swiftpm/
1113
migrate_working_dir/
1214

1315
# IntelliJ related

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip

android/settings.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ pluginManagement {
1919

2020
plugins {
2121
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
22-
id "com.android.application" version "7.3.0" apply false
23-
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
22+
id "com.android.application" version "8.2.0" apply false
23+
id "org.jetbrains.kotlin.android" version "1.9.10" apply false
2424
}
2525

2626
include ":app"

assets/bunked.png

3.91 KB
Loading

assets/cancelled.png

4.23 KB
Loading

assets/present.png

3.97 KB
Loading

ios/Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ SPEC CHECKSUMS:
3333

3434
PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796
3535

36-
COCOAPODS: 1.15.2
36+
COCOAPODS: 1.16.2

ios/Runner.xcodeproj/project.pbxproj

Lines changed: 47 additions & 44 deletions
Large diffs are not rendered by default.

lib/controllers/auth/login_controller.dart

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import 'package:http/http.dart' as http;
88
import 'dart:io';
99

1010
class LoginController extends GetxController {
11-
final CourseSummaryController courseSummaryController = Get.put(CourseSummaryController());
11+
final CourseSummaryController courseSummaryController =
12+
Get.put(CourseSummaryController());
1213
final _storage = const FlutterSecureStorage();
1314
var isLogged = false.obs;
1415

@@ -18,34 +19,37 @@ class LoginController extends GetxController {
1819
Future<String?> getToken() async {
1920
return await _storage.read(key: 'token');
2021
}
21-
Future<bool> logoutfunction() async {
22-
var headers = { HttpHeaders.authorizationHeader: "Token ${await getToken()}"};
23-
try {
24-
var url = Uri.parse(
25-
ApiEndPoints.baseUrl + ApiEndPoints.authEndPoints.logoutEmail);
26-
http.Response response =
27-
await http.post(url, headers: headers);
28-
if (response.statusCode == 200) {
29-
await _storage.delete(key: 'token');
30-
isLogged.value = false;
3122

32-
} else {
33-
throw jsonDecode(response.body);
34-
}
35-
} catch (error) {
36-
Get.back();
37-
showDialog(
38-
context: Get.context!,
39-
builder: (context) {
40-
return SimpleDialog(
41-
title: const Text('Error'),
42-
contentPadding: const EdgeInsets.all(20),
43-
children: [Text(error.toString())],
44-
);
45-
});
23+
Future<bool> logoutfunction() async {
24+
var headers = {
25+
HttpHeaders.authorizationHeader: "Token ${await getToken()}"
26+
};
27+
try {
28+
var url = Uri.parse(
29+
ApiEndPoints.baseUrl + ApiEndPoints.authEndPoints.logoutEmail);
30+
http.Response response = await http.post(url, headers: headers);
31+
if (response.statusCode == 200) {
32+
await _storage.delete(key: 'token');
33+
await _storage.delete(key: 'onboarding');
34+
isLogged.value = false;
35+
} else {
36+
throw jsonDecode(response.body);
4637
}
47-
return isLogged.value;
38+
} catch (error) {
39+
Get.back();
40+
showDialog(
41+
context: Get.context!,
42+
builder: (context) {
43+
return SimpleDialog(
44+
title: const Text('Error'),
45+
contentPadding: const EdgeInsets.all(20),
46+
children: [Text(error.toString())],
47+
);
48+
});
4849
}
50+
return isLogged.value;
51+
}
52+
4953
Future<bool> loginFunction() async {
5054
var headers = {"Content-Type": "application/json"};
5155
try {
@@ -80,6 +84,6 @@ Future<bool> logoutfunction() async {
8084
);
8185
});
8286
}
83-
return isLogged.value ;
87+
return isLogged.value;
88+
}
8489
}
85-
}

lib/controllers/auth/signup_controller.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class SignupController extends GetxController {
2828
if (response.statusCode == 201) {
2929
usernameController.clear();
3030
passwordController.clear();
31-
Get.off(const AuthScreen());
31+
Get.off(const LoginScreen());
3232
}
3333
else {
3434
throw jsonDecode(response.body) ?? 'Unknown Error occured' ;

0 commit comments

Comments
 (0)