diff --git a/.gitignore b/.gitignore index 8d640dd..5217df4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ scp/ios/Flutter/flutter_export_environment.sh .idea/ .github/ scp/android/encodedOutputFileName +scp/.flutter-plugins-dependencies +.vscode/ diff --git a/README.md b/README.md index d48ac1f..f893be7 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ Your appreciation makes us grow and glow up. ⭐ - Timetable selector - Manage your mentors - Get Notifications +- Attendance Tracker +- Freshers Chat Support ## Contributors ✨ diff --git a/scp/.flutter-plugins-dependencies b/scp/.flutter-plugins-dependencies deleted file mode 100644 index 8f3ba45..0000000 --- a/scp/.flutter-plugins-dependencies +++ /dev/null @@ -1 +0,0 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"camera","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\camera-0.5.8+11\\\\","dependencies":[]},{"name":"cloud_firestore","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\cloud_firestore-0.12.11\\\\","dependencies":["firebase_core"]},{"name":"connectivity","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity-0.4.9+5\\\\","dependencies":[]},{"name":"firebase_auth","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_auth-0.11.1+12\\\\","dependencies":["firebase_core"]},{"name":"firebase_core","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_core-0.4.5\\\\","dependencies":[]},{"name":"firebase_crashlytics","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_crashlytics-0.1.4+1\\\\","dependencies":[]},{"name":"firebase_database","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_database-3.1.6\\\\","dependencies":["firebase_core"]},{"name":"firebase_messaging","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_messaging-5.1.8\\\\","dependencies":[]},{"name":"firebase_remote_config","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_remote_config-0.2.1\\\\","dependencies":[]},{"name":"firebase_storage","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_storage-3.1.6\\\\","dependencies":["firebase_core"]},{"name":"native_contact_dialog","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\native_contact_dialog-0.2.2\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.22\\\\","dependencies":[]},{"name":"shared_preferences","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences-0.5.12+2\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.7.8\\\\","dependencies":[]}],"android":[{"name":"camera","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\camera-0.5.8+11\\\\","dependencies":[]},{"name":"cloud_firestore","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\cloud_firestore-0.12.11\\\\","dependencies":["firebase_core"]},{"name":"connectivity","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity-0.4.9+5\\\\","dependencies":[]},{"name":"firebase_auth","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_auth-0.11.1+12\\\\","dependencies":["firebase_core"]},{"name":"firebase_core","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_core-0.4.5\\\\","dependencies":[]},{"name":"firebase_crashlytics","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_crashlytics-0.1.4+1\\\\","dependencies":[]},{"name":"firebase_database","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_database-3.1.6\\\\","dependencies":["firebase_core"]},{"name":"firebase_messaging","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_messaging-5.1.8\\\\","dependencies":[]},{"name":"firebase_remote_config","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_remote_config-0.2.1\\\\","dependencies":[]},{"name":"firebase_storage","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_storage-3.1.6\\\\","dependencies":["firebase_core"]},{"name":"native_contact_dialog","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\native_contact_dialog-0.2.2\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.22\\\\","dependencies":[]},{"name":"shared_preferences","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences-0.5.12+2\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.7.8\\\\","dependencies":[]}],"macos":[{"name":"connectivity_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity_macos-0.1.0+5\\\\","dependencies":[]},{"name":"firebase_core","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_core-0.4.5\\\\","dependencies":[]},{"name":"firebase_crashlytics","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_crashlytics-0.1.4+1\\\\","dependencies":[]},{"name":"firebase_storage","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_storage-3.1.6\\\\","dependencies":["firebase_core"]},{"name":"path_provider_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4+4\\\\","dependencies":[]},{"name":"shared_preferences_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_macos-0.0.1+10\\\\","dependencies":[]},{"name":"url_launcher_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_macos-0.0.1+8\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-0.0.1+2\\\\","dependencies":[]},{"name":"shared_preferences_linux","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_linux-0.0.2+2\\\\","dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_linux-0.0.1+3\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-0.0.4+1\\\\","dependencies":[]},{"name":"shared_preferences_windows","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_windows-0.0.1+1\\\\","dependencies":["path_provider_windows"]},{"name":"url_launcher_windows","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_windows-0.0.1+1\\\\","dependencies":[]}],"web":[{"name":"connectivity_for_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\connectivity_for_web-0.3.1+2\\\\","dependencies":[]},{"name":"firebase_core_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_core_web-0.1.1+2\\\\","dependencies":[]},{"name":"shared_preferences_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\shared_preferences_web-0.1.2+7\\\\","dependencies":[]},{"name":"url_launcher_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_web-0.1.5\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"camera","dependencies":[]},{"name":"cloud_firestore","dependencies":["firebase_core"]},{"name":"connectivity","dependencies":["connectivity_macos","connectivity_for_web"]},{"name":"connectivity_for_web","dependencies":[]},{"name":"connectivity_macos","dependencies":[]},{"name":"firebase_auth","dependencies":["firebase_core"]},{"name":"firebase_core","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","dependencies":[]},{"name":"firebase_crashlytics","dependencies":[]},{"name":"firebase_database","dependencies":["firebase_core"]},{"name":"firebase_messaging","dependencies":[]},{"name":"firebase_remote_config","dependencies":[]},{"name":"firebase_storage","dependencies":["firebase_core"]},{"name":"native_contact_dialog","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_linux","url_launcher_macos","url_launcher_windows"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2020-11-03 00:08:24.762952","version":"1.22.1"} \ No newline at end of file diff --git a/scp/android/app/build.gradle b/scp/android/app/build.gradle index b3b7bc9..28f6020 100644 --- a/scp/android/app/build.gradle +++ b/scp/android/app/build.gradle @@ -13,12 +13,12 @@ if (flutterRoot == null) { def flutterVersionCode = localProperties.getProperty('flutter.versionCode') //if (flutterVersionCode == null) { - flutterVersionCode = '30' + flutterVersionCode = '35' //} def flutterVersionName = localProperties.getProperty('flutter.versionName') //if (flutterVersionName == null) { - flutterVersionName = '3.0' + flutterVersionName = '3.5' //} apply plugin: 'com.android.application' apply plugin: 'kotlin-android' @@ -31,7 +31,7 @@ if (keystorePropertiesFile.exists()) { } android { - compileSdkVersion 30 + compileSdkVersion 29 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -45,7 +45,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "in.ac.nitrkl.scp.scp" minSdkVersion 21 - targetSdkVersion 30 + targetSdkVersion 29 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/scp/android/app/src/main/AndroidManifest.xml b/scp/android/app/src/main/AndroidManifest.xml index b971d7e..1f7d41f 100644 --- a/scp/android/app/src/main/AndroidManifest.xml +++ b/scp/android/app/src/main/AndroidManifest.xml @@ -16,7 +16,8 @@ + android:icon="@mipmap/ic_launcher" + android:roundIcon="@mipmap/ic_launcher_round"> diff --git a/scp/android/app/src/main/ic_launcher-playstore.png b/scp/android/app/src/main/ic_launcher-playstore.png index 804b2d6..8f55560 100644 Binary files a/scp/android/app/src/main/ic_launcher-playstore.png and b/scp/android/app/src/main/ic_launcher-playstore.png differ diff --git a/scp/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/scp/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index cbc9fe8..8371a67 100644 Binary files a/scp/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/scp/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/scp/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/scp/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png index 642f3e9..d07bd2d 100644 Binary files a/scp/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png and b/scp/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/scp/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/scp/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png index cbc9fe8..633bdee 100644 Binary files a/scp/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and b/scp/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/scp/android/app/src/main/res/mipmap-hdpi/launcher_icon.png b/scp/android/app/src/main/res/mipmap-hdpi/launcher_icon.png deleted file mode 100644 index daa24c3..0000000 Binary files a/scp/android/app/src/main/res/mipmap-hdpi/launcher_icon.png and /dev/null differ diff --git a/scp/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/scp/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index c119dab..4c4c010 100644 Binary files a/scp/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/scp/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/scp/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/scp/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png index 1fd69f0..5d49550 100644 Binary files a/scp/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png and b/scp/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/scp/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/scp/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png index c119dab..d3879cc 100644 Binary files a/scp/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and b/scp/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/scp/android/app/src/main/res/mipmap-mdpi/launcher_icon.png b/scp/android/app/src/main/res/mipmap-mdpi/launcher_icon.png deleted file mode 100644 index 2736dfe..0000000 Binary files a/scp/android/app/src/main/res/mipmap-mdpi/launcher_icon.png and /dev/null differ diff --git a/scp/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/scp/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 2e6800c..f014967 100644 Binary files a/scp/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/scp/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/scp/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/scp/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png index e943280..4c693b6 100644 Binary files a/scp/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png and b/scp/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/scp/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/scp/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png index 2e6800c..85cd459 100644 Binary files a/scp/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and b/scp/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/scp/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png b/scp/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png deleted file mode 100644 index 5a28d90..0000000 Binary files a/scp/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png and /dev/null differ diff --git a/scp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/scp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 38207c5..d6b7aa2 100644 Binary files a/scp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/scp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/scp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/scp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png index 6bccf74..a9771d8 100644 Binary files a/scp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png and b/scp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/scp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/scp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png index 38207c5..47c3fbc 100644 Binary files a/scp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and b/scp/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/scp/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png b/scp/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png deleted file mode 100644 index e28a45f..0000000 Binary files a/scp/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png and /dev/null differ diff --git a/scp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/scp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index 473cd95..0e6e033 100644 Binary files a/scp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/scp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/scp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/scp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png index 697c6a0..910f03c 100644 Binary files a/scp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png and b/scp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/scp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/scp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png index 473cd95..76ab74e 100644 Binary files a/scp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and b/scp/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/scp/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png b/scp/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png deleted file mode 100644 index 2bd86ec..0000000 Binary files a/scp/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png and /dev/null differ diff --git a/scp/lib/HomePage.dart b/scp/lib/HomePage.dart index c5d544c..d73b008 100644 --- a/scp/lib/HomePage.dart +++ b/scp/lib/HomePage.dart @@ -1,5 +1,8 @@ +import 'package:firebase_remote_config/firebase_remote_config.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; +import 'package:scp/utils/chatArgs.dart'; import 'package:scp/utils/routes.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:scp/utils/sizeConfig.dart'; @@ -25,6 +28,9 @@ class _HomePageState extends State { String username = " ", rollNo = " ", phoneNo = " "; DatabaseReference slotsRefMain; final GlobalKey _scaffoldKey = new GlobalKey(); + RemoteConfig remoteConfig; + bool isChat = false; + String chatUrl; static const platform = const MethodChannel("FAQ_ACTIVITY"); @@ -84,6 +90,7 @@ class _HomePageState extends State { ], )), Expanded( + flex: 4, child: Column( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.spaceEvenly, @@ -99,6 +106,28 @@ class _HomePageState extends State { fontFamily: 'PfDin'), ), ), + ListTile( + onTap: () { + Navigator.pushNamed(context, Routes.rNots); + }, + title: Text( + "Notifications", + style: TextStyle( + fontSize: SizeConfig.drawerItemTextSize, + fontFamily: 'PfDin'), + ), + ), + ListTile( + onTap: () { + Navigator.of(context).pushNamed(Routes.rSettings); + }, + title: Text( + "Settings", + style: TextStyle( + fontSize: SizeConfig.drawerItemTextSize, + fontFamily: 'PfDin'), + ), + ), ListTile( onTap: () { Navigator.pushNamed(context, Routes.rAboutScp); @@ -136,29 +165,30 @@ class _HomePageState extends State { ), ), Expanded( + flex: 2, child: Align( - alignment: Alignment.center, - child: ButtonTheme( - minWidth: SizeConfig.screenWidth * 0.463, - height: SizeConfig.screenWidth * 0.093, - child: RaisedButton( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8.0)), - color: Color.fromRGBO(25, 39, 45, 1), - onPressed: () { - _removeUserData(context); - }, - child: Text( - "Log Out", - style: TextStyle( - fontWeight: FontWeight.w400, - fontFamily: 'PfDin', - color: Colors.white, - fontSize: SizeConfig.screenWidth * 0.046), + alignment: Alignment.center, + child: ButtonTheme( + minWidth: SizeConfig.screenWidth * 0.463, + height: SizeConfig.screenWidth * 0.093, + child: RaisedButton( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8.0)), + color: Color.fromRGBO(25, 39, 45, 1), + onPressed: () { + _removeUserData(context); + }, + child: Text( + "Log Out", + style: TextStyle( + fontWeight: FontWeight.w400, + fontFamily: 'PfDin', + color: Colors.white, + fontSize: SizeConfig.screenWidth * 0.046), + ), + ), ), - ), - ), - )) + )) ], )), appBar: AppBar( @@ -173,19 +203,25 @@ class _HomePageState extends State { onPressed: () => _scaffoldKey.currentState.openDrawer()), ), actions: [ - IconButton( - padding: EdgeInsets.only( - top: SizeConfig.screenWidth * 0.048, - right: SizeConfig.screenWidth * 0.06), - icon: Icon( - Icons.notifications, - color: Colors.black, - size: 35.0, - ), - onPressed: () { - Navigator.pushNamed(context, Routes.rNots); - }, - ) + (snap.connectionState != ConnectionState.waiting || + snap.connectionState != ConnectionState.waiting) + ? (isChat + ? IconButton( + padding: EdgeInsets.only( + top: SizeConfig.screenWidth * 0.048, + right: SizeConfig.screenWidth * 0.06), + icon: Icon( + Icons.chat, + color: Colors.black, + size: 35.0, + ), + onPressed: () { + Navigator.pushNamed(context, Routes.rChat, + arguments: ChatArguments(chatUrl)); + }, + ) + : Container()) + : Container(), ], backgroundColor: Colors.white, elevation: 0, @@ -226,6 +262,7 @@ class _HomePageState extends State { _removeUserData(BuildContext context) async { SharedPreferences prefs = await SharedPreferences.getInstance(); + prefs.getKeys(); prefs.clear(); await firebaseInstance.signOut(); Navigator.of(context).pushNamedAndRemoveUntil( @@ -269,15 +306,14 @@ class _HomePageState extends State { // print(e.message); // } // } + FirebaseMessaging _fcm = new FirebaseMessaging(); @override void initState() { super.initState(); DateConfig().init(); - fetchUserData(context); - reset(); - _fcm.subscribeToTopic('ics-not'); + _fcm.subscribeToTopic('academic'); _fcm.configure( onMessage: (Map message) async { Navigator.pushNamed(context, Routes.rNots); @@ -306,11 +342,34 @@ class _HomePageState extends State { Future fetchUserData(BuildContext context) async { SharedPreferences prefs = await SharedPreferences.getInstance(); + prefs.getKeys(); + remoteConfig = await RemoteConfig.instance; + remoteConfig.setConfigSettings(RemoteConfigSettings(debugMode: true)); + try { + await remoteConfig.fetch(expiration: const Duration(seconds: 0)); + await remoteConfig.activateFetched(); + isChat = remoteConfig.getBool('is_chat_active'); + chatUrl = remoteConfig.getString('chatLink'); + await prefs.setBool('is_chat_active', isChat); + await prefs.setString('chatLink', chatUrl); + } on FetchThrottledException catch (exception) { + isChat = prefs.getBool('is_chat_active'); + chatUrl = prefs.getString('chatLink'); + // Fetch throttled. + print(exception); + } catch (exception) { + isChat = prefs.getBool('is_chat_active'); + chatUrl = prefs.getString('chatLink'); + } + + isChat = remoteConfig.getBool('is_chat_active'); + chatUrl = remoteConfig.getString('chatLink'); username = prefs.getString('username'); rollNo = prefs.getString('roll_no'); phoneNo = prefs.getString('phone_no'); - prefs.setBool('hasBooked', prefs.getBool('hasBooked') ?? false); + await prefs.setBool('hasBooked', prefs.getBool('hasBooked') ?? false); print(username + rollNo + phoneNo); + reset(); } _launchURL() async { diff --git a/scp/lib/appointments.dart b/scp/lib/appointments.dart index ce40f0e..2c19561 100644 --- a/scp/lib/appointments.dart +++ b/scp/lib/appointments.dart @@ -33,11 +33,6 @@ class _AppointmentsState extends State { getDate(); //isBookingAnonymously = false; scpDatabase = ScpDatabase(); - scpDatabase.init(); - _onCounselChangedSubscription = - ScpDatabase.counselRef.onChildChanged.listen(_onSlotsUpdated); - _onPsychChangedSubscription = - ScpDatabase.psychRef.onChildChanged.listen(_onSlotsUpdated); super.initState(); } @@ -54,54 +49,58 @@ class _AppointmentsState extends State { textScaleFactor = MediaQuery.of(context).textScaleFactor; return Scaffold( - backgroundColor: Colors.white, - appBar: PreferredSize( - preferredSize: Size.fromHeight( - 60.0, - ), - child: AppBar( - title: Padding( - padding: const EdgeInsets.only( - top: 8.0, - ), - child: Text( - 'Book your appointment', - style: TextStyle( - fontSize: queryWidth * 0.065, - fontFamily: 'PfDin', - fontWeight: FontWeight.w500), - ), + backgroundColor: Colors.white, + appBar: PreferredSize( + preferredSize: Size.fromHeight( + 60.0, + ), + child: AppBar( + title: Padding( + padding: const EdgeInsets.only( + top: 8.0, ), - backgroundColor: Color.fromRGBO( - 54, - 66, - 87, - 1.0, + child: Text( + 'Book your appointment', + style: TextStyle( + fontSize: queryWidth * 0.065, + fontFamily: 'PfDin', + fontWeight: FontWeight.w500), ), - leading: Padding( - padding: const EdgeInsets.only(top: 8.0), - child: IconButton( - onPressed: () { - Navigator.of(context); - Navigator.pushNamed(context, Routes.rHomepage); - }, - icon: Icon( - Icons.arrow_back_ios, - ), + ), + backgroundColor: Color.fromRGBO( + 54, + 66, + 87, + 1.0, + ), + leading: Padding( + padding: const EdgeInsets.only(top: 8.0), + child: IconButton( + onPressed: () { + Navigator.of(context); + Navigator.pushNamed(context, Routes.rHomepage); + }, + icon: Icon( + Icons.arrow_back_ios, ), ), - elevation: 0.0, ), + elevation: 0.0, ), - body: FutureBuilder( - future: _setupRemoteConfig(), - builder: - (BuildContext context, AsyncSnapshot snapshot) { - return Center( - child: snapshot.hasData - ? appointmentScreen(context, snapshot.data) - : CircularProgressIndicator()); - })); + ), + body: FutureBuilder( + future: _setupRemoteConfig(), + builder: (BuildContext context, AsyncSnapshot snapshot) { + return Center( + child: snapshot.hasData + ? appointmentScreen(context, snapshot.data) + : Center( + child: CircularProgressIndicator(), + ), + ); + }, + ), + ); } Widget appointmentScreen(BuildContext context, RemoteConfig remoteConfig) { @@ -127,6 +126,7 @@ class _AppointmentsState extends State { getDate() async { SharedPreferences prefs = await SharedPreferences.getInstance(); + prefs.getKeys(); psychDate = prefs.getString('psychDate'); counselDate = prefs.getString('counselDate'); } @@ -142,6 +142,11 @@ class _AppointmentsState extends State { psychName = remoteConfig.getString('psych_name'); psychDay = remoteConfig.getString('psych_day'); print(counselDay + 'hola'); + await scpDatabase.init(); // TODO: Makeshift + _onCounselChangedSubscription = + ScpDatabase.counselRef.onChildChanged.listen(_onSlotsUpdated); + _onPsychChangedSubscription = + ScpDatabase.psychRef.onChildChanged.listen(_onSlotsUpdated); return remoteConfig; } } diff --git a/scp/lib/attendance_tracker.dart b/scp/lib/attendance_tracker.dart index 61a8714..524a022 100644 --- a/scp/lib/attendance_tracker.dart +++ b/scp/lib/attendance_tracker.dart @@ -37,9 +37,7 @@ List arch = [ ]; class AttendanceTracker extends StatefulWidget { - AttendanceTracker(String theorySection) { - theory = theorySection; - } + AttendanceTracker() {} @override _AttendanceTrackerState createState() => _AttendanceTrackerState(); } @@ -72,7 +70,10 @@ class _AttendanceTrackerState extends State { initPrefs() async { pref = await SharedPreferences.getInstance(); + pref.getKeys(); setState(() { + theory = pref.getString('theory_section'); + print("Abel" + theory.toString()); _events = Map>.from( decodeMap(json.decode(pref.getString('events') ?? "{}"))); _absents = Map.from( @@ -315,6 +316,24 @@ class _AttendanceTrackerState extends State { pref.setString( 'events', json.encode(encodeMap(_events))); }); + }), + IconButton( + icon: Icon( + Icons.delete, + color: primaryColor, + ), + onPressed: () { + setState(() { + for (String selectClass in _selectedEvents) { + if (_absents.containsKey(selectClass)) { + _absents[selectClass]--; + } + } + _selectedEvents.clear(); + _events[_calendarController.selectedDay] + .clear(); + print(_selectedEvents); + }); }) ], ) diff --git a/scp/lib/booking.dart b/scp/lib/booking.dart index fbe3b9a..e1996e9 100644 --- a/scp/lib/booking.dart +++ b/scp/lib/booking.dart @@ -33,6 +33,7 @@ class _BookingState extends State { getSharedPrefs() async { SharedPreferences prefs = await SharedPreferences.getInstance(); + prefs.getKeys(); type = prefs.getString('bookingType'); hasBooked = prefs.getBool('hasBooked'); bookedDate = prefs.getString('bookedDate'); diff --git a/scp/lib/chat.dart b/scp/lib/chat.dart new file mode 100644 index 0000000..379cecd --- /dev/null +++ b/scp/lib/chat.dart @@ -0,0 +1,22 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; +import 'package:scp/utils/chatArgs.dart'; + +class ChatView extends StatelessWidget { + @override + Widget build(BuildContext context) { + final ChatArguments args = ModalRoute.of(context).settings.arguments; + return SafeArea( + child: WebviewScaffold( + url:args.url, + withZoom: true, + hidden: true, + withJavascript: true, + resizeToAvoidBottomInset: true, + initialChild: Center( + child: CircularProgressIndicator(), + ), + ), + ); + } +} diff --git a/scp/lib/drawer_screens/dev_info.dart b/scp/lib/drawer_screens/dev_info.dart index b552f9e..3f55d13 100644 --- a/scp/lib/drawer_screens/dev_info.dart +++ b/scp/lib/drawer_screens/dev_info.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'package:scp/ui/dsc_social.dart'; final String aboutText = "Developer Student Clubs (DSC) is a Google Developers powered program for university students to learn mobile and web development skills. The clubs will be open to any student interested to learn, ranging from novice developers who are just starting, to advanced developers who want to further their skills. The clubs are intended as a space for students to try out new ideas and collaborate to solve mobile and web development problems.\n\n" @@ -55,6 +56,7 @@ class DevInfo extends StatelessWidget { ), ), ), + dscSocial(), Padding( padding: const EdgeInsets.only(top: 10, bottom: 10), child: Center( diff --git a/scp/lib/drawer_screens/important_documents.dart b/scp/lib/drawer_screens/important_documents.dart index 00bbbfb..d04fc8e 100644 --- a/scp/lib/drawer_screens/important_documents.dart +++ b/scp/lib/drawer_screens/important_documents.dart @@ -1,86 +1,109 @@ import 'package:flutter/material.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:scp/utils/sizeConfig.dart'; + +class ImpDocs extends StatefulWidget { + @override + _ImpDocsState createState() => _ImpDocsState(); +} + +List doc = []; + +class _ImpDocsState extends State { + final fireDocs = Firestore.instance; -class ImpDocs extends StatelessWidget { @override Widget build(BuildContext context) { + doc = []; return Scaffold( appBar: AppBar( - backgroundColor: Color.fromRGBO(25, 39, 45, 1), - title: Text( - "Important Documents", - style: TextStyle( - color: Colors.white, - fontFamily: 'PfDin', - fontWeight: FontWeight.w600), - ) + backgroundColor: Color.fromRGBO(25, 39, 45, 1), + title: Text( + "Important Documents", + style: TextStyle( + color: Colors.white, + fontFamily: 'PfDin', + fontWeight: FontWeight.w600), + ), ), body: SingleChildScrollView( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - docCard(context, "Academic Calendar", "https://nitrkl.ac.in/Academics/AcademicProcess/AcademicCalendar.aspx"), - docCard(context, "Academic Forms", "https://nitrkl.ac.in/Academics/AcademicProcess/AcademicForms.aspx"), - docCard(context, "Academic Regulations", "https://nitrkl.ac.in/Academics/AcademicProcess/AcademicRegulations.aspx"), - docCard(context, "Branch-wise Syllabus", "https://nitrkl.ac.in/Academics/AcademicProcess/Curricula-Syllabi/aspx"), - docCard(context, "Communication Handbook", "https://nitrkl.ac.in/docs/Misc/CommunicationHandBook.pdf"), - docCard(context, "Curriculum", "https://nitrkl.ac.in/Academics/AcademicProcess/Curricula.aspx"), - docCard(context, "Faculty Directory", "https://nitrkl.ac.in/FacultyStaff/EmployeeDirectory/Faculty.aspx"), - docCard(context, "Timetable", "https://nitrkl.ac.in/Academics/AcademicProcess/AcademicTimeTable.aspx"), - docCard(context, "Counsellor Slot Booking for Online Session", "https://bit.ly/slot_booking"), - ], - ), - ) + child: FutureBuilder( + future: fetchData(), + builder: (context, snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.done: + return SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: doc, + )); + default: + return Container( + child: Center( + child: CircularProgressIndicator(), + ), + ); + } + })), ); } - Widget docCard(BuildContext context,String name,String contact){ - //var queryWidth = MediaQuery.of(context).size.width; - var textScaleFactor = MediaQuery.of(context).textScaleFactor; - return Padding( - padding: const EdgeInsets.all(8.0), - child: InkWell( - onTap: (){ - if(contact!=""){ - _launchURL(contact); - } - else{} - }, - child: Card( - elevation: 5.0, - child: Padding( + var textScaleFactor = SizeConfig.drawerItemTextSize * 0.05; + + Future fetchData() async { + QuerySnapshot snapshot = await fireDocs + .collection("impdocs") + .getDocuments() + .then((QuerySnapshot snapshot) { + snapshot.documents.forEach((f) => doc.add(new Padding( padding: const EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Center( - child: Text(name, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: textScaleFactor*20, - fontFamily: 'PfDin', - fontWeight: FontWeight.w800 - ),), + child: InkWell( + onTap: () { + if (f.data['link'] != null) _launchURL(f.data['link']); + }, + child: Card( + elevation: 5.0, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: Text( + f.data['title'], + textAlign: TextAlign.center, + style: TextStyle( + fontSize: textScaleFactor * 20, + fontFamily: 'PfDin', + fontWeight: FontWeight.w800), + ), + ), + Center( + child: Text( + f.data['link'] == null ? "" : f.data['link'], + textAlign: TextAlign.center, + style: TextStyle( + fontSize: textScaleFactor * 15, + fontFamily: 'PfDin', + fontWeight: FontWeight.w500, + color: Colors.blue, + ), + ), + ), + ], + ), ), - - Center( - child: Text(contact, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: textScaleFactor*15, - color: Colors.blue, - fontFamily: 'PfDin', - fontWeight: FontWeight.w500 - ),)), - ], + ), ), - ), - ), - ), - ); + ))); + return snapshot; + }); + snapshot.documents.forEach((f) => print(snapshot.documents.length)); + return snapshot; } _launchURL(String url) async { @@ -90,6 +113,4 @@ class ImpDocs extends StatelessWidget { throw 'Could not launch $url'; } } - - } diff --git a/scp/lib/drawer_screens/notifications.dart b/scp/lib/drawer_screens/notifications.dart index 77d4dca..1c5ab2c 100644 --- a/scp/lib/drawer_screens/notifications.dart +++ b/scp/lib/drawer_screens/notifications.dart @@ -3,16 +3,18 @@ import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:scp/utils/sizeConfig.dart'; import 'package:url_launcher/url_launcher.dart'; -class Nots extends StatefulWidget{ +class Nots extends StatefulWidget { @override _Nots createState() => _Nots(); } + List v = []; + class _Nots extends State { final databaseReference = Firestore.instance; @override Widget build(BuildContext context) { - v=[]; + v = []; return Scaffold( appBar: AppBar( backgroundColor: Color.fromRGBO(25, 39, 45, 1), @@ -22,97 +24,92 @@ class _Nots extends State { color: Colors.white, fontFamily: 'PfDin', fontWeight: FontWeight.w600), - ) - ), - body: SingleChildScrollView( - child: FutureBuilder( + )), + body: FutureBuilder( future: getData(), - builder: (context,snapshot){ - switch(snapshot.connectionState){ + builder: (context, snapshot) { + switch (snapshot.connectionState) { case ConnectionState.done: return SingleChildScrollView( child: Column( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: v - ) - ); + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: v)); default: - return Container( - child:Center( - child: CircularProgressIndicator(), - ), + return Center( + child: CircularProgressIndicator(), ); } - } - ) - ) - ); + })); } - var textScaleFactor = SizeConfig.drawerItemTextSize*0.05; + + var textScaleFactor = SizeConfig.drawerItemTextSize * 0.05; Future getData() async { - QuerySnapshot snapshot=await databaseReference + QuerySnapshot snapshot = await databaseReference .collection("nots") .getDocuments() .then((QuerySnapshot snapshot) { snapshot.documents.forEach((f) => v.add(new Padding( - padding: const EdgeInsets.all(8.0), - child: InkWell( - child: Card( - elevation: 5.0, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Center( - child: Text(f.data['title'], - textAlign: TextAlign.center, - style: TextStyle( - fontSize: textScaleFactor*20, - fontFamily: 'PfDin', - fontWeight: FontWeight.w800 - ),), - ), - - Center( - child: Text(f.data['description'], - textAlign: TextAlign.center, - style: TextStyle( - fontSize: textScaleFactor*15, - fontFamily: 'PfDin', - fontWeight: FontWeight.w500 - ),)), - Center( - child: InkWell( - onTap: () { - if(f.data['link']!=null) - _launchURL(f.data['link']); - }, - child: Text(f.data['link']==null?"":f.data['link'], + padding: const EdgeInsets.all(8.0), + child: InkWell( + child: Card( + elevation: 5.0, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Center( + child: Text( + f.data['title'], textAlign: TextAlign.center, style: TextStyle( - fontSize: textScaleFactor*15, + fontSize: textScaleFactor * 20, + fontFamily: 'PfDin', + fontWeight: FontWeight.w800), + ), + ), + Center( + child: Text( + f.data['description'], + textAlign: TextAlign.center, + style: TextStyle( + fontSize: textScaleFactor * 15, fontFamily: 'PfDin', - fontWeight: FontWeight.w500, - color: Colors.blue, - ),) + fontWeight: FontWeight.w500), + )), + Center( + child: InkWell( + onTap: () { + if (f.data['link'] != null) + _launchURL(f.data['link']); + }, + child: Text( + f.data['link'] == null ? "" : f.data['link'], + textAlign: TextAlign.center, + style: TextStyle( + fontSize: textScaleFactor * 15, + fontFamily: 'PfDin', + fontWeight: FontWeight.w500, + color: Colors.blue, + ), + )), ), + ], ), - ], + ), ), ), - ), - ), - ))); + ))); return snapshot; }); snapshot.documents.forEach((f) => print(snapshot.documents.length)); return snapshot; } + _launchURL(String url) async { if (await canLaunch(url)) { await launch(url); diff --git a/scp/lib/drawer_screens/settings.dart b/scp/lib/drawer_screens/settings.dart new file mode 100644 index 0000000..c0c533a --- /dev/null +++ b/scp/lib/drawer_screens/settings.dart @@ -0,0 +1,98 @@ +import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:firebase_messaging/firebase_messaging.dart'; +import 'package:flutter/material.dart'; +import 'package:lite_rolling_switch/lite_rolling_switch.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class Settings extends StatefulWidget { + @override + _SettingsState createState() => _SettingsState(); +} + +class _SettingsState extends State { + String phoneNo = " "; + bool state; + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: Color.fromRGBO(25, 39, 45, 1), + title: Text( + "Settings", + style: TextStyle( + color: Colors.white, + fontFamily: 'PfDin', + fontWeight: FontWeight.w600), + )), + body: FutureBuilder( + future: fetchUserData(context), + builder: (context, snapshot) { + switch (snapshot.connectionState) { + case ConnectionState.done: + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Receive Non Academic Notifications', + style: TextStyle( + fontSize: 20.0, fontWeight: FontWeight.bold), + ), + SizedBox( + height: 10.0, + ), + LiteRollingSwitch( + value: state, + textOff: 'No', + textOn: 'Yes', + colorOff: Colors.redAccent, + colorOn: Colors.green, + iconOff: Icons.notifications_off_outlined, + iconOn: Icons.notifications_outlined, + textSize: 16.0, + onChanged: (state) async { + unSubOther(state); + }, + ) + ], + ), + ); + default: + return Container( + child: Center( + child: CircularProgressIndicator(), + ), + ); + } + }), + ); + } + + Future fetchUserData(BuildContext context) async { + SharedPreferences prefs = await SharedPreferences.getInstance(); + phoneNo = prefs.getString('phone_no'); + DocumentSnapshot qn = + await Firestore.instance.collection('tokens').document(phoneNo).get(); + state = await qn.data['optionalSub']; + + return qn; + } + + FirebaseMessaging _fcm = FirebaseMessaging(); + + unSubOther(state) { + if (state == false) { + Firestore.instance + .collection('tokens') + .document(phoneNo) + .updateData({'optionalSub': false}); + _fcm.unsubscribeFromTopic('other'); + } else { + Firestore.instance + .collection('tokens') + .document(phoneNo) + .updateData({'optionalSub': true}); + _fcm.subscribeToTopic('other'); + } + } +} diff --git a/scp/lib/myApp.dart b/scp/lib/myApp.dart index 1bc3bcc..d9e3b66 100644 --- a/scp/lib/myApp.dart +++ b/scp/lib/myApp.dart @@ -5,7 +5,6 @@ import 'package:scp/connectivity/connectivity_handler_widget.dart'; import 'package:scp/firebase/firebaseDBHandler.dart'; import 'login.dart'; - class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); @@ -37,6 +36,7 @@ class _MyAppState extends State { Future checkLogin() async { SharedPreferences prefs = await SharedPreferences.getInstance(); + prefs.getKeys(); _loggedin = (prefs.getBool('loggedin') ?? false); print(_loggedin); } @@ -46,4 +46,4 @@ class _MyAppState extends State { super.initState(); // ... } -} \ No newline at end of file +} diff --git a/scp/lib/time_table.dart b/scp/lib/time_table.dart index a2d8fd6..d65cc16 100644 --- a/scp/lib/time_table.dart +++ b/scp/lib/time_table.dart @@ -5,7 +5,6 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'time_table_resources.dart'; import 'package:url_launcher/url_launcher.dart'; - class TimeTable extends StatefulWidget { TimeTable(); @@ -16,7 +15,7 @@ class TimeTable extends StatefulWidget { class TimeTableState extends State { String theorySection = 'E'; String practicalSection = 'P6'; - String sectionSequence = 'pt'; + String sectionSequence = 'pt'; bool allowedSection = true; bool showTimeTable = false; @@ -30,6 +29,7 @@ class TimeTableState extends State { Future _fetchSectionData(BuildContext context) async { TimeTableResources.setCourseNumber(); SharedPreferences prefs = await SharedPreferences.getInstance(); + prefs.getKeys(); theorySection = prefs.getString('theory_section'); practicalSection = prefs.getString('prac_section'); bool isAutumnSemester = TimeTableResources.isAutumnSemester(); @@ -38,13 +38,14 @@ class TimeTableState extends State { (theorySection.compareTo('D') == 0) || (theorySection.compareTo('C') == 0) || (theorySection.compareTo('B') == 0)) { - sectionSequence = isAutumnSemester ? 'tp' :'pt'; - }else{ - sectionSequence = isAutumnSemester? 'pt' : 'tp'; + sectionSequence = isAutumnSemester ? 'tp' : 'pt'; + } else { + sectionSequence = isAutumnSemester ? 'pt' : 'tp'; } - if(!isAutumnSemester && theorySection.compareTo('Ar.')!=0){ + if (!isAutumnSemester && theorySection.compareTo('Ar.') != 0) { theorySection = TimeTableResources.subsituteTheorySection[theorySection]; - practicalSection = TimeTableResources.substitutePracticalSection[practicalSection]; + practicalSection = + TimeTableResources.substitutePracticalSection[practicalSection]; } } diff --git a/scp/lib/timetable/pracSection.dart b/scp/lib/timetable/pracSection.dart index e172df8..84bdc8e 100755 --- a/scp/lib/timetable/pracSection.dart +++ b/scp/lib/timetable/pracSection.dart @@ -168,8 +168,10 @@ class _PracticalSectionState extends State { Padding( padding: const EdgeInsets.all(8.0), child: Align( - alignment: Alignment.bottomCenter, - child: Text("The timetable is subject to change")), + alignment: Alignment.bottomCenter, + child: Text( + ' The timetable is subject to change \n Data will get reset on re-installation'), + ), ) ], )), @@ -192,11 +194,7 @@ storeSectionData(BuildContext context) async { ); } else if (cardNumber == 1) { Navigator.push( - context, - MaterialPageRoute( - builder: (context) => AttendanceTracker( - theorySection, - ))); + context, MaterialPageRoute(builder: (context) => AttendanceTracker())); } } diff --git a/scp/lib/timetable/theorySection.dart b/scp/lib/timetable/theorySection.dart index f7505bb..ae04cd8 100755 --- a/scp/lib/timetable/theorySection.dart +++ b/scp/lib/timetable/theorySection.dart @@ -45,6 +45,7 @@ class _TheorySectionState extends State { SharedPreferences prefs = await SharedPreferences.getInstance(); bool showTimeTable = prefs.getBool('show_timetable'); if (showTimeTable) { + String theorySection = prefs.getString('theorySection'); if (cardNumber == 0) { Navigator.of(context).pop(); Navigator.push( @@ -52,12 +53,9 @@ class _TheorySectionState extends State { MaterialPageRoute(builder: (context) => TimeTable()), ); } else if (cardNumber == 1) { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => AttendanceTracker( - theorySection, - ))); + Navigator.of(context).pop(); + Navigator.push(context, + MaterialPageRoute(builder: (context) => AttendanceTracker())); } } } @@ -155,7 +153,8 @@ class _TheorySectionState extends State { padding: const EdgeInsets.all(8.0), child: Align( alignment: Alignment.bottomCenter, - child: Text("The timetable is subject to change")), + child: Text( + ' The timetable is subject to change \n Data will get reset on re-installation')), ) ], )), diff --git a/scp/lib/timetablecardsplit.dart b/scp/lib/timetablecardsplit.dart index 38dc046..013b5e4 100644 --- a/scp/lib/timetablecardsplit.dart +++ b/scp/lib/timetablecardsplit.dart @@ -71,7 +71,6 @@ class _TimetableCardSplitState extends State { if (cardType == 0) //Regular Navigator.pushNamed(context, Routes.rTimetable); if (cardType == 1) //Remedial - Navigator.pushNamed(context, Routes.rAttendance); } }); @@ -155,7 +154,7 @@ class _TimetableCardSplitState extends State { CrossAxisAlignment.end, children: [ Text( - 'Set your personal timetable and track your attendance', + 'Set your personal timetable and track your attendance', textAlign: TextAlign.left, style: TextStyle( fontSize: heightFactor * 0.038, @@ -167,16 +166,6 @@ class _TimetableCardSplitState extends State { SizedBox( height: heightFactor * 0.055, ), - Text( - 'Data will get reset on re-installation', - textAlign: TextAlign.left, - style: TextStyle( - fontSize: heightFactor * 0.028, - color: Colors.white, - fontWeight: FontWeight.w500, - fontFamily: 'PfDin', - ), - ), ], ), ), diff --git a/scp/lib/ui/dsc_social.dart b/scp/lib/ui/dsc_social.dart new file mode 100644 index 0000000..19845c0 --- /dev/null +++ b/scp/lib/ui/dsc_social.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:url_launcher/url_launcher.dart'; + +Widget dscSocial() { + return Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + IconButton( + icon: FaIcon(FontAwesomeIcons.globe), + onPressed: () { + _launchURL('https://dscnitrourkela.org'); + }), + IconButton( + icon: FaIcon(FontAwesomeIcons.github), + onPressed: () { + _launchURL('https://github.com/dscnitrourkela'); + }), + IconButton( + icon: FaIcon(FontAwesomeIcons.medium), + onPressed: () { + _launchURL('https://medium.com/dsc-nit-rourkela'); + }), + IconButton( + icon: FaIcon(FontAwesomeIcons.linkedin), + onPressed: () { + _launchURL('https://www.linkedin.com/company/dscnitrourkela'); + }), + IconButton( + icon: FaIcon(FontAwesomeIcons.facebook), + onPressed: () { + _launchURL('https://www.facebook.com/dscnitrourkela'); + }), + IconButton( + icon: FaIcon(FontAwesomeIcons.instagram), + onPressed: () { + _launchURL('https://www.instagram.com/dscnitrourkela'); + }), + IconButton( + icon: FaIcon(FontAwesomeIcons.twitter), + onPressed: () { + _launchURL('https://twitter.com/dscnitrourkela'); + }), + ], + ); +} + +_launchURL(String url) async { + if (await canLaunch(url)) { + await launch(url); + } else { + throw 'Could not launch $url'; + } +} diff --git a/scp/lib/userdata.dart b/scp/lib/userdata.dart index 236f074..9404b7a 100644 --- a/scp/lib/userdata.dart +++ b/scp/lib/userdata.dart @@ -1,5 +1,7 @@ import 'dart:async'; +import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:scp/utils/routes.dart'; @@ -151,6 +153,10 @@ class UserdataState extends State { updateUser.displayName = rollNo; val.updateProfile(updateUser); _storeUserData(context); + final token = _fcm.getToken().then( + (token) async => + await saveTokenToFirestore( + token.toString())); }); } } else { @@ -197,6 +203,7 @@ class UserdataState extends State { _storeUserData(BuildContext context) async { SharedPreferences prefs = await SharedPreferences.getInstance(); + prefs.getKeys(); await prefs.setString('username', username); await prefs.setString('roll_no', rollNo.toUpperCase()); await prefs.setString('phone_no', phoneNo); @@ -220,4 +227,36 @@ class UserdataState extends State { phoneNo = user.phoneNumber; return "return"; } + + FirebaseMessaging _fcm = new FirebaseMessaging(); + + Future saveTokenToFirestore(String token) async { + Firestore.instance + .collection('tokens') + .where('mobile', isEqualTo: phoneNo) + .getDocuments() + .then((QuerySnapshot deviceToken) async { + if (deviceToken.documents.isEmpty) { + await Firestore.instance + .collection('tokens') + .document(phoneNo) + .setData({ + 'devToken': token, + 'displayName': username, + 'roll': rollNo, + 'mobile': phoneNo, + 'optionalSub': true, + 'createdAt': FieldValue.serverTimestamp(), + }); + } else { + await Firestore.instance + .collection('tokens') + .document(phoneNo) + .updateData({ + 'devToken': token, + 'displayName': username, + }); + } + }); + } } diff --git a/scp/lib/utils/chatArgs.dart b/scp/lib/utils/chatArgs.dart new file mode 100644 index 0000000..a133dc9 --- /dev/null +++ b/scp/lib/utils/chatArgs.dart @@ -0,0 +1,5 @@ +class ChatArguments { + final String url; + + ChatArguments(this.url); +} diff --git a/scp/lib/utils/routes.dart b/scp/lib/utils/routes.dart index 2121885..a09920f 100644 --- a/scp/lib/utils/routes.dart +++ b/scp/lib/utils/routes.dart @@ -2,10 +2,12 @@ import 'package:flutter/material.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.dart'; +import 'package:scp/drawer_screens/settings.dart'; import 'package:scp/login.dart'; import 'package:scp/mentor_search/mentors.dart'; import 'package:scp/timetable/theorySection.dart'; @@ -25,6 +27,8 @@ class Routes { static const String rDevInfo = '/dev_info'; static const String rNots = '/nots'; static const String rAttendance = '/attendance'; + static const String rSettings = '/settings'; + static const String rChat = '/chat'; static Map getRoutes() { return { @@ -39,7 +43,9 @@ class Routes { Routes.rImpDocs: (context) => ImpDocs(), Routes.rDevInfo: (context) => DevInfo(), Routes.rNots: (context) => Nots(), + Routes.rSettings: (context) => Settings(), Routes.rAttendance: (context) => TheorySection(1), //1 for right card + Routes.rChat:(context)=>ChatView(), }; } } diff --git a/scp/pubspec.yaml b/scp/pubspec.yaml index 7971215..0d66660 100644 --- a/scp/pubspec.yaml +++ b/scp/pubspec.yaml @@ -35,6 +35,9 @@ dependencies: path_provider: ^1.0.0 firebase_storage: ^3.0.8 table_calendar: ^2.2.3 + lite_rolling_switch: ^0.1.1 + flutter_webview_plugin: ^0.3.11 + font_awesome_flutter: ^8.10.0 dev_dependencies: flutter_launcher_icons: "^0.7.2"