Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate sem change to Remote Config, Levelling of the repository with the play store version and minor fixes #205

Merged
merged 5 commits into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scp/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ if (flutterRoot == null) {

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
//if (flutterVersionCode == null) {
flutterVersionCode = '37'
flutterVersionCode = '41'
//}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
//if (flutterVersionName == null) {
flutterVersionName = '3.7'
flutterVersionName = '4.1'
nayakastha marked this conversation as resolved.
Show resolved Hide resolved
//}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
Expand Down
12 changes: 11 additions & 1 deletion scp/lib/HomePage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class _HomePageState extends State<HomePage> {
RemoteConfig remoteConfig;
bool isChat = false;
String chatUrl;
bool isAutumn;
int buildNumber;
int publishVersion;

Expand Down Expand Up @@ -375,28 +376,37 @@ class _HomePageState extends State<HomePage> {
await remoteConfig.fetch(expiration: const Duration(seconds: 0));
await remoteConfig.activateFetched();
isChat = remoteConfig.getBool('is_chat_active');

chatUrl = remoteConfig.getString('chatLink');
isAutumn = remoteConfig.getBool('is_autumn');

publishVersion = int.parse(remoteConfig.getString("version"));
print(publishVersion);
await prefs.setBool('is_chat_active', isChat);
await prefs.setString('chatLink', chatUrl);
await prefs.setBool('is_autumn', isAutumn);
} on FetchThrottledException catch (exception) {
isChat = prefs.getBool('is_chat_active');
chatUrl = prefs.getString('chatLink');
isAutumn = prefs.getBool('is_autumn');
// Fetch throttled.
print(exception);
} catch (exception) {
isChat = prefs.getBool('is_chat_active');
chatUrl = prefs.getString('chatLink');
isAutumn = prefs.getBool('is_autumn');
}

isChat = remoteConfig.getBool('is_chat_active');
chatUrl = remoteConfig.getString('chatLink');
username = prefs.getString('username');
isAutumn = prefs.getBool('is_autumn');
rollNo = prefs.getString('roll_no');
phoneNo = prefs.getString('phone_no');
await prefs.setBool('hasBooked', prefs.getBool('hasBooked') ?? false);
print(username + rollNo + phoneNo);
print(username + rollNo + phoneNo + isAutumn.toString());
reset();

print(
"Version number is $buildNumber and version on remote config is $publishVersion");
if (buildNumber < publishVersion) {}
Expand Down
2 changes: 1 addition & 1 deletion scp/lib/appointments.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class _AppointmentsState extends State<Appointments> {
psychName = remoteConfig.getString('psych_name');
psychDay = remoteConfig.getString('psych_day');
print(counselDay + 'hola');
await scpDatabase.init(); // TODO: Makeshift
await scpDatabase.init();
_onCounselChangedSubscription =
ScpDatabase.counselRef.onChildChanged.listen(_onSlotsUpdated);
_onPsychChangedSubscription =
Expand Down
396 changes: 211 additions & 185 deletions scp/lib/attendance_tracker.dart

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions scp/lib/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class _LoginState extends State<Login> {
var textScaleFactor = MediaQuery.of(context).textScaleFactor;
countryCodeController.text = countryCode;
return Scaffold(
resizeToAvoidBottomPadding: false,
nayakastha marked this conversation as resolved.
Show resolved Hide resolved
resizeToAvoidBottomInset: false,
backgroundColor: Colors.white,
body: Stack(
children: <Widget>[
Expand Down Expand Up @@ -194,7 +194,7 @@ class _LoginState extends State<Login> {
style: TextStyle(
fontWeight: FontWeight.w400,
fontFamily: 'PfDin',
fontSize: SizeConfig.screenWidth*0.047,
fontSize: SizeConfig.screenWidth * 0.047,
),
),
textColor: Colors.white,
Expand Down
2 changes: 1 addition & 1 deletion scp/lib/time_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class TimeTableState extends State<TimeTable> {
prefs.getKeys();
theorySection = prefs.getString('theory_section');
practicalSection = prefs.getString('prac_section');
bool isAutumnSemester = TimeTableResources.isAutumnSemester();
bool isAutumnSemester = await TimeTableResources.isAutumnSem();
if ((theorySection.compareTo('Ar.') == 0) ||
(theorySection.compareTo('A') == 0) ||
(theorySection.compareTo('D') == 0) ||
Expand Down
14 changes: 11 additions & 3 deletions scp/lib/time_table_resources.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import 'package:shared_preferences/shared_preferences.dart';

abstract class TimeTableResources {
static bool isAutumnSemester() => true;
static Future<bool> isAutumnSem() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
prefs.getKeys();
return prefs.getBool('is_autumn');
}

//static bool isAutumnSemester() => true;
static String courseNumber = 'I';
static void setCourseNumber() {
courseNumber = isAutumnSemester() ? 'I' : 'II';
static void setCourseNumber() async {
courseNumber = await isAutumnSem() ? 'I' : 'II';
theory['A']['TA'] = theory['B']['TA'] = theory['C']['TB'] =
theory['D']['TB'] = theory['E']['TK'] = theory['F']['TK'] =
theory['G']['TM'] = theory['H']['TM'] = 'Physics-$courseNumber';
Expand Down
11 changes: 5 additions & 6 deletions scp/lib/ui/background.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Background extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomPadding: false,
resizeToAvoidBottomInset: false,
backgroundColor: Colors.white,
body: Column(
children: <Widget>[
Expand All @@ -15,8 +15,7 @@ class Background extends StatelessWidget {
],
),
Expanded(
child: Container(
),
child: Container(),
),
Stack(
alignment: Alignment.bottomLeft,
Expand All @@ -34,12 +33,12 @@ class Background extends StatelessWidget {

const List<Color> aquaGradients = [
Color.fromRGBO(107, 195, 145, 1.0),
Color.fromRGBO(8, 121, 191, 1.0),
Color.fromRGBO(8, 121, 191, 1.0),
];

const List<Color> blueGradients = [
Color.fromRGBO(48, 72, 142, 1.0),
Color.fromRGBO(0, 173, 239, 1.0),
Color.fromRGBO(0, 173, 239, 1.0),
];

class WavyHeader extends StatelessWidget {
Expand Down Expand Up @@ -170,4 +169,4 @@ class YellowCircleClipper extends CustomClipper<Rect> {

@override
bool shouldReclip(CustomClipper<Rect> oldClipper) => false;
}
}
4 changes: 2 additions & 2 deletions scp/lib/ui/cards.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:scp/booking.dart';
import 'package:scp/mentor_search/mentee_page.dart';
import 'package:scp/mentor_search/mentor_page.dart';
import 'package:scp/ui/views/mentor_search/mentee_page.dart';
import 'package:scp/ui/views/mentor_search/mentor_page.dart';
import 'package:scp/ui/gradients.dart';
import 'package:scp/firebase/firebaseDBHandler.dart';
import 'package:scp/utils/routes.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:scp/dateConfig.dart';
import 'package:intl/intl.dart';
import '../main.dart';
import 'package:scp/main.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:package_info/package_info.dart';
import 'package:rate_my_app/rate_my_app.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import '../utils/grapgQLconfig.dart';
import 'package:scp/utils/grapgQLconfig.dart';

final Color primaryColor = Color.fromARGB(255, 49, 68, 76);
final Color secondaryColor = Color.fromARGB(255, 158, 218, 224);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'package:flutter/material.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:scp/mentor_search/mentee_page_viewmodel.dart';
import 'package:scp/ui/views/mentor_search/mentee_page_viewmodel.dart';
import 'package:stacked/stacked.dart';
import '../utils/grapgQLconfig.dart';

final Color primaryColor = Color.fromARGB(255, 49, 68, 76);
final Color secondaryColor = Color.fromARGB(255, 158, 218, 224);
Expand Down Expand Up @@ -54,15 +53,15 @@ class ListDetails extends StatelessWidget {
),
),
body: ViewModelBuilder.reactive(
builder: (context, model, child) {
if (model.isBusy())
return CircularProgressIndicator();
else
return MenteeDetails(model);
},
viewModelBuilder: () => MenteePageViewModel(rollNo),
onModelReady: (model)=>model.init(),
),
builder: (context, model, child) {
if (model.isBusy())
return CircularProgressIndicator();
else
return MenteeDetails(model);
},
viewModelBuilder: () => MenteePageViewModel(rollNo),
onModelReady: (model) => model.init(),
),
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:graphql_flutter/graphql_flutter.dart';

import 'package:url_launcher/url_launcher.dart';
import 'package:native_contact_dialog/native_contact_dialog.dart';
import '../utils/grapgQLconfig.dart';
import 'package:scp/utils/grapgQLconfig.dart';

final Color primaryColor = Color.fromARGB(255, 49, 68, 76);
final Color secondaryColor = Color.fromARGB(255, 158, 218, 224);
Expand Down
2 changes: 1 addition & 1 deletion scp/lib/userdata.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class UserdataState extends State<Userdata> {
var textScaleFactor = MediaQuery.of(context).textScaleFactor;
_fetchUserData(context);
return Scaffold(
resizeToAvoidBottomPadding: true,
resizeToAvoidBottomInset: true,
appBar: AppBar(
backgroundColor: Color.fromRGBO(25, 39, 45, 1),
title: Text(
Expand Down
7 changes: 2 additions & 5 deletions scp/lib/utils/routes.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import 'package:flutter/material.dart';
import 'package:scp/Appointments/appointments_view.dart';
import 'package:scp/HomePage.dart';

import 'package:scp/booking.dart';
import 'package:scp/chat.dart';
import 'package:scp/drawer_screens/about_scs.dart';
import 'package:scp/drawer_screens/dev_info.dart';
import 'package:scp/drawer_screens/important_documents.dart';
import 'package:scp/drawer_screens/notifications/notifications_view.dart';
import 'package:scp/drawer_screens/settings.dart';
import 'package:scp/homePage/homePage_view.dart';
import 'package:scp/login.dart';
import 'package:scp/timetable/theorySection.dart';
import 'package:scp/appointments.dart';
Expand All @@ -32,8 +29,8 @@ class Routes {

static Map<String, WidgetBuilder> getRoutes() {
return {
Routes.rHomepage: (context) => HomeView(),
Routes.rAppointments: (context) => AppointmentView(),
Routes.rHomepage: (context) => HomePage(),
Routes.rAppointments: (context) => Appointments(),
Routes.rTimetable: (context) => TheorySection(0), //0 for left card
Routes.rUserData: (context) => Userdata(),
Routes.rLogin: (context) => Login(),
Expand Down