Skip to content

Commit

Permalink
fixes gradle issues
Browse files Browse the repository at this point in the history
  • Loading branch information
swciitg committed Aug 20, 2024
1 parent f1bac09 commit 9b1c6bc
Show file tree
Hide file tree
Showing 16 changed files with 115 additions and 129 deletions.
5 changes: 5 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ android {
compileSdkVersion 34

compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Expand Down Expand Up @@ -81,13 +84,15 @@ android {
signingConfig signingConfigs.release
}
}
namespace 'com.swciitg.onestop2'
}

flutter {
source '../..'
}

dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'
implementation "com.android.support:multidex:1.0.3"
}

3 changes: 1 addition & 2 deletions android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.swciitg.onestop2">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
3 changes: 1 addition & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.swciitg.onestop2">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Expand Down
3 changes: 1 addition & 2 deletions android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.swciitg.onestop2">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
7 changes: 6 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
buildscript {
ext {
agp_version = '8.5.1'
}
}
allprojects {
repositories {
google()
Expand All @@ -14,5 +19,5 @@ subprojects {
}

tasks.register("clean", Delete) {
delete rootProject.buildDir
delete getLayout().getBuildDirectory()
}
3 changes: 3 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.1.2" apply false
id "com.android.application" version '8.5.2' apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
id "com.google.gms.google-services" version "4.3.13" apply false
id "com.google.gms.google-services" version "4.4.2" apply false
}

include ":app"
106 changes: 53 additions & 53 deletions lib/pages/elections/election_login.dart
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
import 'package:flutter/material.dart';
import 'package:onestop_dev/pages/elections/register_screen.dart';
import 'package:webview_cookie_manager/webview_cookie_manager.dart';
import 'package:webview_flutter/webview_flutter.dart';

class ElectionLoginWebView extends StatefulWidget {
static const String id = "/electionView";

const ElectionLoginWebView({super.key});

@override
State<ElectionLoginWebView> createState() => _ElectionLoginWebViewState();
}

class _ElectionLoginWebViewState extends State<ElectionLoginWebView> {
late WebViewController controller;

@override
void initState() {
super.initState();
controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setNavigationDelegate(NavigationDelegate(
onPageFinished: (url) async {
final nav = Navigator.of(context);
if (url.startsWith('https://swc.iitg.ac.in/election_portal')) {
List cookies = await WebviewCookieManager().getCookies(
'https://swc.iitg.ac.in/elections_api/auth/login_success');
nav.pushReplacement(MaterialPageRoute(
builder: (context) =>
RegisterScreen(authCookie: cookies.join("; "))));
}
},
))
..loadRequest(Uri.parse(
"https://swc.iitg.ac.in/elections_api/auth/accounts/microsoft/login/"));
}

@override
void dispose() {
WebviewCookieManager().clearCookies();
super.dispose();
}

@override
Widget build(BuildContext context) {
return Scaffold(
body: WebViewWidget(
controller: controller,
),
);
}
}
// import 'package:flutter/material.dart';
// import 'package:onestop_dev/pages/elections/register_screen.dart';
// import 'package:webview_cookie_manager/webview_cookie_manager.dart';
// import 'package:webview_flutter/webview_flutter.dart';
//
// class ElectionLoginWebView extends StatefulWidget {
// static const String id = "/electionView";
//
// const ElectionLoginWebView({super.key});
//
// @override
// State<ElectionLoginWebView> createState() => _ElectionLoginWebViewState();
// }
//
// class _ElectionLoginWebViewState extends State<ElectionLoginWebView> {
// late WebViewController controller;
//
// @override
// void initState() {
// super.initState();
// controller = WebViewController()
// ..setJavaScriptMode(JavaScriptMode.unrestricted)
// ..setNavigationDelegate(NavigationDelegate(
// onPageFinished: (url) async {
// final nav = Navigator.of(context);
// if (url.startsWith('https://swc.iitg.ac.in/election_portal')) {
// List cookies = await WebviewCookieManager().getCookies(
// 'https://swc.iitg.ac.in/elections_api/auth/login_success');
// nav.pushReplacement(MaterialPageRoute(
// builder: (context) =>
// RegisterScreen(authCookie: cookies.join("; "))));
// }
// },
// ))
// ..loadRequest(Uri.parse(
// "https://swc.iitg.ac.in/elections_api/auth/accounts/microsoft/login/"));
// }
//
// @override
// void dispose() {
// WebviewCookieManager().clearCookies();
// super.dispose();
// }
//
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// body: WebViewWidget(
// controller: controller,
// ),
// );
// }
// }
2 changes: 1 addition & 1 deletion lib/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ final routes = {
ComplaintsPage.id: (context) => const ComplaintsPage(),
MessOpiFormPage.id: (context) => const MessOpiFormPage(),
MessSubscriptionPage.id: (context) => const MessSubscriptionPage(),
ElectionLoginWebView.id: (context) => const ElectionLoginWebView(),
// ElectionLoginWebView.id: (context) => const ElectionLoginWebView(),
GateLogPage.id: (context) => const GateLogPage(),
};
14 changes: 6 additions & 8 deletions lib/services/data_provider.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import 'dart:async';
import 'dart:collection';

import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:onestop_dev/globals/database_strings.dart';
import 'package:onestop_dev/models/contacts/contact_model.dart';
import 'package:onestop_dev/models/food/mess_menu_model.dart';
import 'package:onestop_dev/models/food/restaurant_model.dart';
import 'package:onestop_dev/models/notifications/notification_model.dart';
import 'package:onestop_dev/models/timetable/registered_courses.dart';
import 'package:onestop_dev/models/travel/travel_timing_model.dart';
import 'package:onestop_dev/pages/elections/election_login.dart';
import 'package:onestop_dev/services/api.dart';
import 'package:onestop_dev/services/local_storage.dart';
import 'package:onestop_dev/widgets/home/home_tab_tile.dart';
Expand Down Expand Up @@ -139,12 +137,12 @@ class DataProvider {
}
for (var link in quickLinks) {
if (link['name'] == "election_id") {
res.add(const HomeTabTile(
label: "Election Register",
icon: FluentIcons.person_arrow_right_16_regular,
routeId: ElectionLoginWebView.id,
newBadge: true,
));
// res.add(const HomeTabTile(
// label: "Election Register",
// icon: FluentIcons.person_arrow_right_16_regular,
// routeId: ElectionLoginWebView.id,
// newBadge: true,
// ));
} else {
res.add(HomeTabTile(
label: link['name'],
Expand Down
4 changes: 2 additions & 2 deletions lib/stores/login_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import 'package:onestop_dev/globals/enums.dart';
import 'package:onestop_dev/services/api.dart';
import 'package:onestop_dev/services/local_storage.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:webview_cookie_manager/webview_cookie_manager.dart';
import 'package:webview_flutter/webview_flutter.dart';

class LoginStore {
static Map<String, dynamic> userData = {};
final cookieManager = WebviewCookieManager();
final cookieManager = WebViewCookieManager();
static bool isGuest = false;
static bool isProfileComplete = false;

Expand Down
1 change: 1 addition & 0 deletions lib/widgets/home/service_links.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:onestop_dev/pages/buy_sell/bns_home.dart';
import 'package:onestop_dev/pages/complaints/complaints_page.dart';
import 'package:onestop_dev/pages/contact/contact.dart';
import 'package:onestop_dev/pages/elections/election_login.dart';
import 'package:onestop_dev/pages/ip/ip_carousel.dart';
import 'package:onestop_dev/pages/lost_found/lnf_home.dart';
import 'package:onestop_dev/pages/services/cab_share.dart';
Expand Down
4 changes: 1 addition & 3 deletions lib/widgets/login/login_webview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:onestop_dev/pages/profile/edit_profile.dart';
import 'package:onestop_dev/stores/login_store.dart';
import 'package:onestop_kit/onestop_kit.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:webview_cookie_manager/webview_cookie_manager.dart';
import 'package:webview_flutter/webview_flutter.dart';

class LoginWebView extends StatefulWidget {
Expand Down Expand Up @@ -36,7 +35,6 @@ class _LoginWebViewState extends State<LoginWebView> {
@override
void initState() {
super.initState();

controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setNavigationDelegate(NavigationDelegate(
Expand All @@ -56,7 +54,7 @@ class _LoginWebViewState extends State<LoginWebView> {
};
await LoginStore().saveToPreferences(user, userTokens);
await LoginStore().saveToUserInfo(user);
await WebviewCookieManager().clearCookies();
await WebViewCookieManager().clearCookies();
navigatorKey.currentState!.pushAndRemoveUntil(
MaterialPageRoute(
builder: (context) => EditProfile(
Expand Down
Loading

0 comments on commit 9b1c6bc

Please sign in to comment.