Skip to content

Commit

Permalink
Merge branch 'main' into gsr-notifs2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rchhaya authored Oct 27, 2023
2 parents a2e9b14 + 6c584f4 commit c9e0c56
Show file tree
Hide file tree
Showing 191 changed files with 7,185 additions and 1,899 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ out/
.gradle/
build/
.idea/
gradle/wrapper/

# Local configuration file (sdk path, etc)
local.properties
Expand Down Expand Up @@ -71,4 +72,4 @@ fastlane/readme.md
# Crashlytics and API keys
src/main/assets/crashlytics-build.properties
src/main/res/values/com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics.properties
28 changes: 19 additions & 9 deletions PennMobile/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.android.tools.build:gradle:4.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jacoco:org.jacoco.core:0.8.5"
}
Expand Down Expand Up @@ -35,11 +35,11 @@ android {
}
release {}
}
compileSdkVersion 32
compileSdkVersion 33
buildToolsVersion '29.0.3'
defaultConfig {
minSdkVersion 18
targetSdkVersion 32
minSdkVersion 26
targetSdkVersion 33
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
buildConfigField ("String", "PLATFORM_REDIRECT_URI", getPlatformRedirectUri())
Expand All @@ -53,6 +53,9 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
}

dependencies {
Expand All @@ -62,38 +65,40 @@ dependencies {
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.maps:google-maps-services:0.13.0'
implementation 'org.jsoup:jsoup:1.13.1'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.2.0'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'joda-time:joda-time:2.10.6'
implementation 'org.apache.commons:commons-lang3:3.10'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.jakewharton:butterknife:10.2.1'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation ("androidx.lifecycle:lifecycle-extensions:2.2.0@aar") {
transitive = true
}
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
implementation 'com.squareup.retrofit:retrofit:1.9.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.squareup.okhttp:okhttp:2.7.5'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'androidx.browser:browser:1.2.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.daimajia.swipelayout:library:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'org.testng:testng:7.1.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.github.ahorn:android-rss:master-SNAPSHOT'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// official release is several years old and is not thread-safe
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7"
implementation 'com.eightbitlab:supportrenderscriptblur:1.0.2'
implementation 'com.eightbitlab:blurview:1.6.3'
implementation 'androidx.palette:palette-ktx:1.0.0'
implementation 'com.github.searchy2:CustomAlertViewDialogue:2.6.1'
implementation 'com.airbnb.android:lottie:4.2.0'
Expand All @@ -104,6 +109,11 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'com.kaspersky.android-components:kaspresso:1.1.0'
implementation "com.squareup.retrofit2:retrofit:2.6.2"
implementation "com.squareup.retrofit2:converter-moshi:2.5.0"
implementation 'com.squareup.retrofit2:converter-scalars:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'

}

String getPlatformClientID() {
Expand Down
4 changes: 2 additions & 2 deletions PennMobile/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.pennapps.labs.pennmobile"
android:versionCode="62"
android:versionName="2.1.0">
android:versionCode="70"
android:versionName="3.0.0">

<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.content.Intent
import android.content.SharedPreferences
import android.graphics.drawable.AnimatedVectorDrawable
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
Expand All @@ -22,8 +21,6 @@ import com.bumptech.glide.load.resource.gif.GifDrawable
import com.bumptech.glide.request.RequestListener
import com.pennapps.labs.pennmobile.adapters.AboutAdapter
import kotlinx.android.synthetic.main.fragment_about.view.*
import kotlinx.android.synthetic.main.fragment_home.*
import kotlinx.android.synthetic.main.include_main.*

class AboutFragment : Fragment() {

Expand All @@ -35,16 +32,13 @@ class AboutFragment : Fragment() {
mActivity = activity as MainActivity
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mActivity)
mActivity.closeKeyboard()
mActivity.toolbar.visibility = View.VISIBLE
mActivity.toolbar.setNavigationIcon(R.drawable.ic_back_navigation)
mActivity.toolbar.setNavigationOnClickListener { mActivity.onBackPressed() }
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_about, container, false)

val gif = view.logo_gif_iv?.drawable
if (Build.VERSION.SDK_INT > 20 && gif is AnimatedVectorDrawable) {
if (gif is AnimatedVectorDrawable) {
gif.start()
} else {
Glide.with(this).asGif().load(R.drawable.logo_gif_transparent).listener(object : RequestListener<GifDrawable> {
Expand All @@ -60,10 +54,9 @@ class AboutFragment : Fragment() {

view.our_team_rv?.layoutManager = GridLayoutManager(context, 3)
view.alumni_rv?.layoutManager = GridLayoutManager(context, 3)
val members = arrayListOf("Rohan Chhaya", "Anna Jiang", "Julius Snipes",
"Zhiyan Lu", "Belinda Xi","Vishesh Patel", "Ali Krema", "Jenny Li", "Sruthi Kurada")
val members = arrayListOf("Rohan Chhaya", "Julius Snipes", "Aaron Mei", "Trini Feng", "Vedha Avali")
val alumni = arrayListOf("Marta García Ferreiro", "Varun Ramakrishnan", "Sahit Penmatcha",
"Anna Wang", "Sophia Ye", "Awad Irfan", "Liz Powell", "Davies Lumumba")
"Anna Wang", "Sophia Ye", "Awad Irfan", "Liz Powell", "Davies Lumumba", "Anna Jiang", "Ali Krema")
view.our_team_rv?.adapter = AboutAdapter(members)
view.alumni_rv?.adapter = AboutAdapter(alumni)

Expand All @@ -74,24 +67,17 @@ class AboutFragment : Fragment() {
startActivity(i)
}

view.feedback_btn?.setOnClickListener {
val link = Intent(Intent.ACTION_VIEW, Uri.parse("https://airtable.com/shr1oylDR3qzCpTXq"))
startActivity(link)
}

view.licenses_btn?.setOnClickListener {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val webView = LayoutInflater.from(mActivity).inflate(R.layout.dialog_licenses, null) as WebView
webView.loadUrl("file:///android_asset/open_source_licenses.html")
AlertDialog.Builder(mActivity, R.style.Theme_AppCompat_Light_Dialog_Alert)
.setTitle(getString(R.string.action_licenses))
.setView(webView)
.setPositiveButton(android.R.string.ok, null)
.show()
}
val webView = LayoutInflater.from(mActivity).inflate(R.layout.dialog_licenses, null) as WebView
webView.loadUrl("file:///android_asset/open_source_licenses.html")
AlertDialog.Builder(mActivity, R.style.Theme_AppCompat_Light_Dialog_Alert)
.setTitle(getString(R.string.action_licenses))
.setView(webView)
.setPositiveButton(android.R.string.ok, null)
.show()
}

mActivity.toolbar.visibility = View.VISIBLE
//mActivity.toolbar.visibility = View.VISIBLE
mActivity.hideBottomBar()
mActivity.setTitle(R.string.contacts)

Expand All @@ -103,9 +89,7 @@ class AboutFragment : Fragment() {
val mActivity : MainActivity = activity as MainActivity
mActivity.removeTabs()
mActivity.setTitle(R.string.about)
if (Build.VERSION.SDK_INT > 17) {
mActivity.setSelectedTab(MainActivity.MORE)
}
mActivity.setSelectedTab(MainActivity.MORE)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import android.content.Context
import android.content.Context.ALARM_SERVICE
import android.content.Intent
import android.os.Build
import android.graphics.Color
import android.graphics.PorterDuff
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
Expand All @@ -25,7 +27,9 @@ import androidx.fragment.app.FragmentTransaction
import androidx.preference.PreferenceManager
import com.pennapps.labs.pennmobile.api.StudentLife
import com.pennapps.labs.pennmobile.classes.GSRBookingResult
import kotlinx.android.synthetic.main.gsr_details_book.*
import kotlinx.android.synthetic.main.gsr_details_book.view.*
import kotlinx.android.synthetic.main.loading_panel.*
import retrofit.Callback
import retrofit.RetrofitError
import retrofit.client.Response
Expand Down Expand Up @@ -106,29 +110,38 @@ class BookGsrFragment : Fragment() {
} else if (!emailEt.text.toString().matches("""[\w]+@(seas\.|sas\.|wharton\.|nursing\.)?upenn\.edu""".toRegex())) {
Toast.makeText(activity, "Please enter a valid Penn email", Toast.LENGTH_LONG).show()
} else {
bookGSR(Integer.parseInt(gsrID), Integer.parseInt(gsrLocationCode), startTime, endTime, gid, roomId, roomName)
submit.isClickable = false
submit.background.setColorFilter(Color.GRAY, PorterDuff.Mode.MULTIPLY)
loading?.visibility = View.VISIBLE
bookGSR(Integer.parseInt(gsrID), gsrLocationCode, startTime, endTime, gid, roomId, roomName)
}
}
return v
}

private fun bookGSR(gsrId: Int, gsrLocationCode: Int, startTime: String?, endTime: String?, gid: Int, roomId: Int, roomName: String) {
private fun bookGSR(gsrId: Int, gsrLocationCode: String, startTime: String?, endTime: String?, gid: Int, roomId: Int, roomName: String) {

var sessionID = ""
var bearerToken = ""
activity?.let { activity ->


OAuth2NetworkManager(activity as MainActivity).getAccessToken {
var sessionID = ""
var bearerToken = ""
val sp = PreferenceManager.getDefaultSharedPreferences(activity)
sessionID = sp.getString(getString(R.string.huntsmanGSR_SessionID), "") ?: ""
bearerToken = "Bearer " + sp.getString(getString(R.string.access_token), "").toString()
Log.i("BookGSRFragment", "$bearerToken");
Log.i("Bearer Token", sp.getString(getString(R.string.access_token), "").toString());
activity?.let { activity ->
val sp = PreferenceManager.getDefaultSharedPreferences(activity)
sessionID = sp.getString(getString(R.string.huntsmanGSR_SessionID), "") ?: ""
bearerToken = "Bearer " + sp.getString(getString(R.string.access_token), "").toString()
Log.i("BookGSRFragment", bearerToken)
}
Log.i("BookGSRFragment", "Bearer $bearerToken")
Log.i("BookGSRFragment", "Start $startTime")
Log.i("BookGSRFragment", "End $endTime")
Log.i("BookGSRFragment", "GID $gid")
Log.i("BookGSRFragment", "ID $roomId")
Log.i("BookGSRFragment", "Room Name $roomName")


}
Log.i("BookGSRFragment", "Bearer $bearerToken")
Log.i("BookGSRFragment", "Start $startTime")
Log.i("BookGSRFragment", "End $endTime")
Log.i("BookGSRFragment", "GID $gid")
Log.i("BookGSRFragment", "ID $roomId")
Log.i("BookGSRFragment", "Room Name $roomName")
mStudentLife.bookGSR(
//Passing the values
bearerToken,
Expand Down Expand Up @@ -191,27 +204,19 @@ class BookGsrFragment : Fragment() {
Log.e("BookGsrFragment", "GSR booking failed with " + result.getError())
}
// go back to GSR fragment
val fragmentManager = (context as MainActivity).supportFragmentManager
fragmentManager.beginTransaction()
.replace(R.id.content_frame, GsrTabbedFragment())
.addToBackStack("GSR Fragment")
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.commit()
loading?.visibility = View.GONE
activity?.onBackPressed()
}

override fun failure(error: RetrofitError) {
//If any error occurred displaying the error as toast
Log.e("BookGSRFragment", "Error booking gsr", error)
Toast.makeText(activity, "An error has occurred. Please try again.", Toast.LENGTH_LONG).show()
val fragmentManager = (context as MainActivity).supportFragmentManager
fragmentManager.beginTransaction()
.replace(R.id.content_frame, GsrTabbedFragment())
.addToBackStack("GSR Fragment")
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.commit()
loading?.visibility = View.GONE
activity?.onBackPressed()
}
}
)
)}
}

@RequiresApi(Build.VERSION_CODES.O)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.pennapps.labs.pennmobile

import android.content.SharedPreferences
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
Expand Down Expand Up @@ -92,8 +91,8 @@ class CampusExpressLoginFragment : Fragment() {
.build()
webView.loadUrl(uri.toString())
val webSettings = webView.settings
webSettings.setJavaScriptEnabled(true)
webSettings.javaScriptCanOpenWindowsAutomatically = true;
webSettings.javaScriptEnabled = true
webSettings.javaScriptCanOpenWindowsAutomatically = true
webView.webViewClient = MyWebViewClient()

cancelButton.setOnClickListener {
Expand Down Expand Up @@ -173,13 +172,8 @@ class CampusExpressLoginFragment : Fragment() {
val byteArr = md.digest(codeVerifier.toByteArray())

// Base-64 encode
var codeChallenge = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
var codeChallenge =
Base64.getEncoder().encodeToString(byteArr)
} else {
String(
android.util.Base64.encode(byteArr, android.util.Base64.DEFAULT),
Charsets.UTF_8)
}

// Replace characters to make it web safe
codeChallenge = codeChallenge.replace("=", "")
Expand Down
Loading

0 comments on commit c9e0c56

Please sign in to comment.