From ddfb6639f7a3cbb219eec999b9bcea65aed2bc00 Mon Sep 17 00:00:00 2001 From: Trong Date: Wed, 7 Jul 2021 20:32:08 +0700 Subject: [PATCH] Final fix --- README.md | 2 +- android/app/build.gradle | 2 +- android/app/google-services.json | 4 ++-- android/app/src/debug/AndroidManifest.xml | 2 +- android/app/src/main/AndroidManifest.xml | 2 +- .../src/main/kotlin/com/ajent/ajent/MainActivity.kt | 2 +- android/app/src/profile/AndroidManifest.xml | 2 +- ios/Runner.xcodeproj/project.pbxproj | 6 +++--- .../modules/add_course/add_course_controller.dart | 8 ++++++-- lib/app/modules/auth/auth_controller.dart | 1 + .../modules/edit_course/edit_course_controller.dart | 5 +++++ .../calendar_content/teaching_calendar_event.dart | 5 ++++- .../my_course_detail_controller.dart | 3 ++- .../modules/my_profile/my_profile_controller.dart | 3 ++- lib/app/modules/request/widgets/request_card.dart | 12 ++++++------ 15 files changed, 37 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 9135fd6..40f1f9a 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ An app bridges the Gap between Tutors and Learners ./ - Enjoy! --- -- Or get the **[APK](https://apkfab.com/ajent/com.tneja.ajent/apk)** +- Or get the **[APK](https://apkfab.com/ajent/com.example.ajent/apk)** ## Authors - [Dương Bình Trọng - 19521056](https://www.github.com/princ3od) diff --git a/android/app/build.gradle b/android/app/build.gradle index ea37236..5e555cd 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -35,7 +35,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.tneja.ajent" + applicationId "com.example.ajent" minSdkVersion 16 targetSdkVersion 29 versionCode flutterVersionCode.toInteger() diff --git a/android/app/google-services.json b/android/app/google-services.json index af34537..94e045a 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -9,7 +9,7 @@ "client_info": { "mobilesdk_app_id": "1:930529302228:android:58d3ab0afbcf701c6acd41", "android_client_info": { - "package_name": "com.tneja.ajent" + "package_name": "com.example.ajent" } }, "oauth_client": [ @@ -17,7 +17,7 @@ "client_id": "930529302228-1u2aafi0m55q6ugbng4l7n2tvc0c0ta6.apps.googleusercontent.com", "client_type": 1, "android_info": { - "package_name": "com.tneja.ajent", + "package_name": "com.example.ajent", "certificate_hash": "c804d02a70569e8eb3734d57e0cd51638beaf452" } }, diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index f6d8d0c..d2edb96 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.example.ajent"> diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 686da31..ec06736 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.example.ajent"> diff --git a/android/app/src/main/kotlin/com/ajent/ajent/MainActivity.kt b/android/app/src/main/kotlin/com/ajent/ajent/MainActivity.kt index 24db42b..b4e0df7 100644 --- a/android/app/src/main/kotlin/com/ajent/ajent/MainActivity.kt +++ b/android/app/src/main/kotlin/com/ajent/ajent/MainActivity.kt @@ -1,4 +1,4 @@ -package com.tneja.ajent +package com.example.ajent import io.flutter.embedding.android.FlutterActivity diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml index 65bbe7f..c785690 100644 --- a/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.example.ajent"> diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 840a337..c7c4170 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -291,7 +291,7 @@ ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.tneja.ajent; + PRODUCT_BUNDLE_IDENTIFIER = com.example.ajent; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -415,7 +415,7 @@ ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.tneja.ajent; + PRODUCT_BUNDLE_IDENTIFIER = com.example.ajent; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -434,7 +434,7 @@ ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.tneja.ajent; + PRODUCT_BUNDLE_IDENTIFIER = com.example.ajent; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/lib/app/modules/add_course/add_course_controller.dart b/lib/app/modules/add_course/add_course_controller.dart index 890b433..7569e35 100644 --- a/lib/app/modules/add_course/add_course_controller.dart +++ b/lib/app/modules/add_course/add_course_controller.dart @@ -78,9 +78,13 @@ class AddCourseController extends GetxController { ..requirements = txtCourseRequirements.text ..photoUrl = imageUrl ..subjects = subjects; + if (course.maxLearner < 1 || course.price < 50000) { + Get.snackbar("data_error".tr, "check_course_info_warning".tr); + isAddingCourse.value = false; + return; + } } catch (e) { - Get.snackbar( - "data_error".tr, "check_course_info_warning".tr); + Get.snackbar("data_error".tr, "check_course_info_warning".tr); isAddingCourse.value = false; return; } diff --git a/lib/app/modules/auth/auth_controller.dart b/lib/app/modules/auth/auth_controller.dart index 96731f5..f01d0aa 100644 --- a/lib/app/modules/auth/auth_controller.dart +++ b/lib/app/modules/auth/auth_controller.dart @@ -63,6 +63,7 @@ class AuthController extends GetxController { "", ); HomeController.mainUser = await UserService.instance.addUser(ajentUser); + HomeController.mainUser.degrees = []; await SubscribeService.instance.subscribeOnLogin(user.uid); } else { HomeController.mainUser = await UserService.instance.getUser(user.uid); diff --git a/lib/app/modules/edit_course/edit_course_controller.dart b/lib/app/modules/edit_course/edit_course_controller.dart index 1ec1d95..5ac41a0 100644 --- a/lib/app/modules/edit_course/edit_course_controller.dart +++ b/lib/app/modules/edit_course/edit_course_controller.dart @@ -80,6 +80,11 @@ class EditCourseController extends GetxController { ..requirements = txtCourseRequirements.text ..photoUrl = course.photoUrl ?? "" ..subjects = subjects; + if (course.maxLearner < course.learners.length || course.price < 50000) { + Get.snackbar("data_error".tr, "check_course_info_warning".tr); + isUpdating.value = false; + return; + } } catch (e) { print(e); Get.snackbar("data_error".tr, "check_course_info_warning".tr); diff --git a/lib/app/modules/home/widgets/calendar_content/teaching_calendar_event.dart b/lib/app/modules/home/widgets/calendar_content/teaching_calendar_event.dart index 5770058..3abe643 100644 --- a/lib/app/modules/home/widgets/calendar_content/teaching_calendar_event.dart +++ b/lib/app/modules/home/widgets/calendar_content/teaching_calendar_event.dart @@ -4,6 +4,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:get/get.dart'; + class TeachingCalendarEventCard extends StatelessWidget { final Course course; @@ -77,7 +78,9 @@ class TeachingCalendarEventCard extends StatelessWidget { child: Row( children: [ Flexible( - child: Text(course.maxLearner.toString()+"students".tr, + child: Text( + "${course.maxLearner.toString()} " + + "students".tr, overflow: TextOverflow.ellipsis, style: GoogleFonts.nunitoSans( fontWeight: FontWeight.w700, diff --git a/lib/app/modules/my_course_detail/my_course_detail_controller.dart b/lib/app/modules/my_course_detail/my_course_detail_controller.dart index 13ed273..b447964 100644 --- a/lib/app/modules/my_course_detail/my_course_detail_controller.dart +++ b/lib/app/modules/my_course_detail/my_course_detail_controller.dart @@ -97,7 +97,8 @@ class MyCourseDetailController extends GetxController { unEnrollable.value = (course.value.status == CourseStatus.upcoming && (course.value.learners.contains(HomeController.mainUser.uid) && course.value.owner != HomeController.mainUser.uid)); - requestable.value = (joinable.value && + requestable.value = (course.value.status == CourseStatus.upcoming && + !course.value.learners.contains(HomeController.mainUser.uid) && course.value.owner != HomeController.mainUser.uid && !requestors.contains(user.uid) && (!course.value.hasTeacher())); diff --git a/lib/app/modules/my_profile/my_profile_controller.dart b/lib/app/modules/my_profile/my_profile_controller.dart index e4dae2d..cf150ae 100644 --- a/lib/app/modules/my_profile/my_profile_controller.dart +++ b/lib/app/modules/my_profile/my_profile_controller.dart @@ -15,7 +15,7 @@ class MyProfileController extends GetxController { var tabIndex = 0.obs; var ajentUser = HomeController.mainUser.obs; var dropdownValue = ''.obs; - var startDate = DateTime.now().obs; + var startDate = HomeController.mainUser.birthDay.obs; var ajenGender = HomeController.mainUser.gender.obs; var ajenDegree = HomeController.mainUser.degrees.obs; @@ -152,6 +152,7 @@ class MyProfileController extends GetxController { Future updateInformation() async { isUpdatingInfo.value = true; AjentUser ajentUser = HomeController.mainUser; + ajentUser.birthDay = startDate.value; ajentUser.name = txtName.text; ajentUser.mail = txtMail.text; ajentUser.schoolName = txtSchool.text; diff --git a/lib/app/modules/request/widgets/request_card.dart b/lib/app/modules/request/widgets/request_card.dart index 7707337..fd9a559 100644 --- a/lib/app/modules/request/widgets/request_card.dart +++ b/lib/app/modules/request/widgets/request_card.dart @@ -117,12 +117,12 @@ class RequestCard extends StatelessWidget { size: 16, ), ), - InkWell( - onTap: () async { - Get.toNamed(Routes.PROFILEVIEW, - arguments: data.requestor); - }, - child: Flexible( + Flexible( + child: InkWell( + onTap: () { + Get.toNamed(Routes.PROFILEVIEW, + arguments: data.requestor); + }, child: Column( crossAxisAlignment: CrossAxisAlignment.start,