From 501604f22316cf306d230fc746ab1087e889f545 Mon Sep 17 00:00:00 2001 From: meiron03 Date: Fri, 1 Dec 2023 18:24:03 -0500 Subject: [PATCH 1/6] Change google-services.json --- PennMobile/google-services.json | 25 ++++++------------- .../pennapps/labs/pennmobile/MainActivity.kt | 14 ++++++++++- gradle/wrapper/gradle-wrapper.properties | 4 +-- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/PennMobile/google-services.json b/PennMobile/google-services.json index 203336dd..a01c85ae 100644 --- a/PennMobile/google-services.json +++ b/PennMobile/google-services.json @@ -1,37 +1,26 @@ { "project_info": { - "project_number": "838434873871", - "firebase_url": "https://penn-mobile-release.firebaseio.com", - "project_id": "penn-mobile-release", - "storage_bucket": "penn-mobile-release.appspot.com" + "project_number": "86950866683", + "project_id": "pennmobilefbtest", + "storage_bucket": "pennmobilefbtest.appspot.com" }, "client": [ { "client_info": { - "mobilesdk_app_id": "1:838434873871:android:f03e90e8574403ad", + "mobilesdk_app_id": "1:86950866683:android:0b66c19f0e9f40617a4a5e", "android_client_info": { "package_name": "com.pennapps.labs.pennmobile" } }, - "oauth_client": [ - { - "client_id": "838434873871-amrfbe7ekhppak30c64u9a2g7dbe5mif.apps.googleusercontent.com", - "client_type": 3 - } - ], + "oauth_client": [], "api_key": [ { - "current_key": "AIzaSyCFZeo23H-LKCGD4FUDIIbzpdQPIeRgM9k" + "current_key": "AIzaSyDPyjYP8lTQFHt-uy8UBLdKGrGAmHzyhuA" } ], "services": { "appinvite_service": { - "other_platform_oauth_client": [ - { - "client_id": "838434873871-amrfbe7ekhppak30c64u9a2g7dbe5mif.apps.googleusercontent.com", - "client_type": 3 - } - ] + "other_platform_oauth_client": [] } } } diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt index b55883cc..e63b06b3 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt @@ -30,6 +30,7 @@ import androidx.preference.PreferenceManager import androidx.viewpager.widget.ViewPager import com.google.android.material.appbar.AppBarLayout import com.google.android.material.tabs.TabLayout +import com.google.firebase.analytics.FirebaseAnalytics import com.google.gson.GsonBuilder import com.google.gson.reflect.TypeToken import com.pennapps.labs.pennmobile.adapters.MainPagerAdapter @@ -52,6 +53,7 @@ import retrofit.client.OkClient import retrofit.converter.GsonConverter import java.util.concurrent.TimeUnit + class MainActivity : AppCompatActivity() { private var tabShowed = false private lateinit var fragmentManager: FragmentManager @@ -59,6 +61,8 @@ class MainActivity : AppCompatActivity() { val tokenMutex = Mutex() + private lateinit var firebaseAnalytics: FirebaseAnalytics + override fun onCreate(savedInstanceState: Bundle?) { setTheme(R.style.AppTheme) if (Build.VERSION.SDK_INT > 28) { @@ -88,6 +92,14 @@ class MainActivity : AppCompatActivity() { showBottomBar() supportActionBar?.setDisplayShowTitleEnabled(false) + // firebase test + //Firebase.analytics.logEvent("log_thing", null) + //firebaseAnalytics.logEvent + + firebaseAnalytics = FirebaseAnalytics.getInstance(this); + firebaseAnalytics.logEvent("log_thing", null) + + // Show HomeFragment if logged in, otherwise show LoginFragment val pennKey = mSharedPrefs.getString(getString(R.string.pennkey), null) val guestMode = mSharedPrefs.getBoolean(getString(R.string.guest_mode), false) @@ -100,7 +112,7 @@ class MainActivity : AppCompatActivity() { override fun onResume() { super.onResume() - showBottomBar() + //showBottomBar() } private fun onExpandableBottomNavigationItemSelected() { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7f681c19..fefc185e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Nov 01 14:54:54 EDT 2023 +#Fri Dec 01 16:55:01 EST 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From b21d5a73d14d88fba1fdcdbec4d9a9d3523f0a10 Mon Sep 17 00:00:00 2001 From: meiron03 Date: Sun, 3 Dec 2023 14:04:12 -0500 Subject: [PATCH 2/6] Add crashyltics. --- PennMobile/build.gradle | 3 +++ .../com/pennapps/labs/pennmobile/HomeFragment.kt | 4 +++- .../labs/pennmobile/LaundrySettingsFragment.kt | 2 +- .../com/pennapps/labs/pennmobile/MainActivity.kt | 16 +++------------- build.gradle | 1 + 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/PennMobile/build.gradle b/PennMobile/build.gradle index 8b258c76..a37d3b54 100644 --- a/PennMobile/build.gradle +++ b/PennMobile/build.gradle @@ -2,6 +2,7 @@ plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' id 'com.google.gms.google-services' + id("com.google.firebase.crashlytics") id 'jacoco' } @@ -42,6 +43,8 @@ dependencies { implementation(platform("com.google.firebase:firebase-bom:31.5.0")) implementation 'com.google.firebase:firebase-analytics' + implementation("com.google.firebase:firebase-crashlytics") + implementation 'androidx.multidex:multidex:2.0.1' implementation 'com.google.maps:google-maps-services:2.2.0' implementation 'org.jsoup:jsoup:1.16.2' diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/HomeFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/HomeFragment.kt index 504d233f..d7f1e882 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/HomeFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/HomeFragment.kt @@ -72,7 +72,9 @@ class HomeFragment : Fragment() { view.home_refresh_layout .setColorSchemeResources(R.color.color_accent, R.color.color_primary) view.home_refresh_layout - .setOnRefreshListener { getHomePage() } + .setOnRefreshListener { + getHomePage() + } initAppBar(view) return view diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LaundrySettingsFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LaundrySettingsFragment.kt index 22a488e6..f48a172a 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LaundrySettingsFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LaundrySettingsFragment.kt @@ -67,7 +67,7 @@ class LaundrySettingsFragment : Fragment() { editor?.apply() for (i in 0 until numRooms) { - editor?.remove(Integer.toString(i))?.apply() + editor?.remove(i.toString())?.apply() } //view.laundry_building_expandable_list?.setAdapter(mAdapter) diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt index e63b06b3..2578be1f 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt @@ -61,7 +61,7 @@ class MainActivity : AppCompatActivity() { val tokenMutex = Mutex() - private lateinit var firebaseAnalytics: FirebaseAnalytics + private lateinit var mFirebaseAnalytics: FirebaseAnalytics override fun onCreate(savedInstanceState: Bundle?) { setTheme(R.style.AppTheme) @@ -92,13 +92,8 @@ class MainActivity : AppCompatActivity() { showBottomBar() supportActionBar?.setDisplayShowTitleEnabled(false) - // firebase test - //Firebase.analytics.logEvent("log_thing", null) - //firebaseAnalytics.logEvent - - firebaseAnalytics = FirebaseAnalytics.getInstance(this); - firebaseAnalytics.logEvent("log_thing", null) - + mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); + mFirebaseAnalytics.logEvent("MainActivity", null) // Show HomeFragment if logged in, otherwise show LoginFragment val pennKey = mSharedPrefs.getString(getString(R.string.pennkey), null) @@ -110,11 +105,6 @@ class MainActivity : AppCompatActivity() { } } - override fun onResume() { - super.onResume() - //showBottomBar() - } - private fun onExpandableBottomNavigationItemSelected() { expandable_bottom_bar.setOnNavigationItemSelectedListener { item -> val position = when (item.itemId) { diff --git a/build.gradle b/build.gradle index 20e1c1ca..0594e417 100644 --- a/build.gradle +++ b/build.gradle @@ -4,4 +4,5 @@ plugins { id 'com.android.library' version '8.0.2' apply false id 'org.jetbrains.kotlin.android' version '1.7.22' apply false id 'com.google.gms.google-services' version "4.4.0" apply false + id("com.google.firebase.crashlytics") version "2.9.9" apply false } \ No newline at end of file From 082e8a8a138fdeb310f2dbc3248a360d0f164501 Mon Sep 17 00:00:00 2001 From: meiron03 Date: Tue, 5 Dec 2023 15:34:00 -0500 Subject: [PATCH 3/6] Get rid of analytics that we don't use. --- .../java/com/pennapps/labs/pennmobile/DiningFragment.kt | 6 ------ .../java/com/pennapps/labs/pennmobile/FlingFragment.kt | 6 ------ .../main/java/com/pennapps/labs/pennmobile/GsrFragment.kt | 6 ------ .../pennapps/labs/pennmobile/GsrReservationsFragment.kt | 6 ------ .../java/com/pennapps/labs/pennmobile/HomeFragment.kt | 5 ----- .../java/com/pennapps/labs/pennmobile/LaundryFragment.kt | 6 ------ .../pennapps/labs/pennmobile/LaundrySettingsFragment.kt | 8 -------- .../java/com/pennapps/labs/pennmobile/MainActivity.kt | 2 +- .../java/com/pennapps/labs/pennmobile/NewsFragment.kt | 6 ------ 9 files changed, 1 insertion(+), 50 deletions(-) diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/DiningFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/DiningFragment.kt index d98b1e61..c37d1617 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/DiningFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/DiningFragment.kt @@ -39,12 +39,6 @@ class DiningFragment : Fragment() { mActivity = activity as MainActivity mActivity.closeKeyboard() setHasOptionsMenu(true) - - val bundle = Bundle() - bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "1") - bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "Dining") - bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "App Feature") - FirebaseAnalytics.getInstance(mActivity).logEvent(FirebaseAnalytics.Event.VIEW_ITEM, bundle) } override fun onActivityCreated(savedInstanceState: Bundle?) { diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/FlingFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/FlingFragment.kt index 4608d640..13e15312 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/FlingFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/FlingFragment.kt @@ -24,12 +24,6 @@ class FlingFragment : Fragment() { setHasOptionsMenu(true) mActivity = activity as MainActivity mActivity.supportActionBar?.setDisplayHomeAsUpEnabled(true) - - val bundle = Bundle() - bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "7") - bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "Spring Fling") - bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "App Feature") - FirebaseAnalytics.getInstance(mActivity).logEvent(FirebaseAnalytics.Event.VIEW_ITEM, bundle) } override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/GsrFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/GsrFragment.kt index f6e9c913..d1e5f3f1 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/GsrFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/GsrFragment.kt @@ -81,12 +81,6 @@ class GsrFragment : Fragment() { // set default GSR selection date + time to the current date and time selectedDateTime = DateTime.now() - - val bundle = Bundle() - bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "0") - bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "GSR") - bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "App Feature") - FirebaseAnalytics.getInstance(mActivity).logEvent(FirebaseAnalytics.Event.VIEW_ITEM, bundle) } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/GsrReservationsFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/GsrReservationsFragment.kt index 79c0a374..24d0aa86 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/GsrReservationsFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/GsrReservationsFragment.kt @@ -34,12 +34,6 @@ class GsrReservationsFragment : Fragment() { mActivity = activity as MainActivity LocalBroadcastManager.getInstance(mActivity).registerReceiver(broadcastReceiver, IntentFilter("refresh")) - - val bundle = Bundle() - bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "10") - bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "GsrReservations") - bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "App Feature") - FirebaseAnalytics.getInstance(mActivity).logEvent(FirebaseAnalytics.Event.VIEW_ITEM, bundle) } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/HomeFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/HomeFragment.kt index d7f1e882..0da25263 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/HomeFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/HomeFragment.kt @@ -51,11 +51,6 @@ class HomeFragment : Fragment() { .getInstance(mActivity) .registerReceiver(broadcastReceiver, IntentFilter("refresh")) - val bundle = Bundle() - bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "11") - bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "Home") - bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "App Feature") - FirebaseAnalytics.getInstance(mActivity).logEvent(FirebaseAnalytics.Event.VIEW_ITEM, bundle) } override fun onCreateView( diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LaundryFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LaundryFragment.kt index 7f34d89d..2b90426a 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LaundryFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LaundryFragment.kt @@ -56,12 +56,6 @@ class LaundryFragment : Fragment() { mActivity = activity as MainActivity mContext = mActivity setHasOptionsMenu(true) - - val bundle = Bundle() - bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "3") - bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "Laundry") - bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "App Feature") - FirebaseAnalytics.getInstance(mContext).logEvent(FirebaseAnalytics.Event.VIEW_ITEM, bundle) } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LaundrySettingsFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LaundrySettingsFragment.kt index f48a172a..7f93e5a4 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LaundrySettingsFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LaundrySettingsFragment.kt @@ -43,12 +43,6 @@ class LaundrySettingsFragment : Fragment() { setHasOptionsMenu(true) mActivity.toolbar.visibility = View.VISIBLE mActivity.hideBottomBar() - - val bundle = Bundle() - bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "12") - bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "Laundry Settings") - bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "App Feature") - FirebaseAnalytics.getInstance(mContext).logEvent(FirebaseAnalytics.Event.VIEW_ITEM, bundle) } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { @@ -69,8 +63,6 @@ class LaundrySettingsFragment : Fragment() { for (i in 0 until numRooms) { editor?.remove(i.toString())?.apply() } - - //view.laundry_building_expandable_list?.setAdapter(mAdapter) } // set up back button diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt index 2578be1f..f136af0b 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt @@ -93,7 +93,7 @@ class MainActivity : AppCompatActivity() { supportActionBar?.setDisplayShowTitleEnabled(false) mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); - mFirebaseAnalytics.logEvent("MainActivity", null) + mFirebaseAnalytics.logEvent("MainActivityStart", null) // Show HomeFragment if logged in, otherwise show LoginFragment val pennKey = mSharedPrefs.getString(getString(R.string.pennkey), null) diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/NewsFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/NewsFragment.kt index e065488f..c3b1ced2 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/NewsFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/NewsFragment.kt @@ -139,13 +139,7 @@ class NewsFragment : ListFragment() { mActivity.closeKeyboard() setHasOptionsMenu(true) - val bundle = Bundle() - bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "5") - bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "News") - bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "App Feature") - FirebaseAnalytics.getInstance(mActivity).logEvent(FirebaseAnalytics.Event.VIEW_ITEM, bundle) sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mActivity) - } override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { From 024d57903f6635a6abbffaf0f4cbb61161dfc7dd Mon Sep 17 00:00:00 2001 From: meiron03 Date: Fri, 15 Dec 2023 00:46:55 -0500 Subject: [PATCH 4/6] create new firebase analytics account. - add google-services.json to .gitignore - update github actions to create google-services.json - some crashyltics stuff for login --- .github/workflows/android-workflow.yaml | 27 +++++++++++++++++-- .gitignore | 1 + PennMobile/build.gradle | 1 + PennMobile/google-services.json | 10 +++---- .../pennapps/labs/pennmobile/HomeFragment.kt | 2 -- .../pennapps/labs/pennmobile/LoginFragment.kt | 3 --- .../labs/pennmobile/LoginWebviewFragment.kt | 7 ++++- .../pennapps/labs/pennmobile/MainActivity.kt | 1 - .../pennmobile/api/OAuth2NetworkManager.kt | 3 +++ 9 files changed, 41 insertions(+), 14 deletions(-) diff --git a/.github/workflows/android-workflow.yaml b/.github/workflows/android-workflow.yaml index 1889a112..76c982f2 100644 --- a/.github/workflows/android-workflow.yaml +++ b/.github/workflows/android-workflow.yaml @@ -29,6 +29,14 @@ jobs: env: PLATFORM_REDIRECT_URI: ${{ secrets.PLATFORM_REDIRECT_URI }} run: echo PLATFORM_REDIRECT_URI=\"$PLATFORM_REDIRECT_URI\" >> ./local.properties + + # Create google-services.json + - name: Create google-services.json + run: | + cat << EOF > PennMobile/google-services.json + ${{ secrets.GOOGLE_SERVICES_JSON }} + EOF + # Run unit tests - name: Run Unit Tests run: ./gradlew testDebugUnitTest @@ -60,7 +68,14 @@ jobs: env: PLATFORM_REDIRECT_URI: ${{ secrets.PLATFORM_REDIRECT_URI }} run: echo PLATFORM_REDIRECT_URI=\"$PLATFORM_REDIRECT_URI\" >> ./local.properties - + + # Create google-services.json + - name: Create google-services.json + run: | + cat << EOF > PennMobile/google-services.json + ${{ secrets.GOOGLE_SERVICES_JSON }} + EOF + # Generate Signed APK - name: Generate Release APK run: ./gradlew assembleRelease @@ -108,6 +123,13 @@ jobs: PLATFORM_REDIRECT_URI: ${{ secrets.PLATFORM_REDIRECT_URI }} run: echo PLATFORM_REDIRECT_URI=\"$PLATFORM_REDIRECT_URI\" >> ./local.properties + # Create google-services.json + - name: Create google-services.json + run: | + cat << EOF > PennMobile/google-services.json + ${{ secrets.GOOGLE_SERVICES_JSON }} + EOF + # Run JaCoCo, generate Test Report - name: Check Code Coverage run: ./gradlew jacocoTestReport --stacktrace @@ -120,6 +142,7 @@ jobs: path: PennMobile/build/reports # Publish to Firebase App Distribution + # https://github.com/wzieba/Firebase-Distribution-Github-Action deploy-firebase: needs: generate-apk if: startsWith(github.ref, 'refs/tags/v') @@ -132,7 +155,7 @@ jobs: uses: wzieba/Firebase-Distribution-Github-Action@v1 with: appId: ${{secrets.FIREBASE_APP_ID}} - token: ${{secrets.FIREBASE_TOKEN}} + serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }} groups: tester file: PennMobile-release-unsigned-signed.apk diff --git a/.gitignore b/.gitignore index e55e199a..87530f17 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ gradle/wrapper/ # Local configuration file (sdk path, etc) local.properties +google-services.json # Proguard folder generated by Eclipse proguard/ diff --git a/PennMobile/build.gradle b/PennMobile/build.gradle index a37d3b54..ef5ca789 100644 --- a/PennMobile/build.gradle +++ b/PennMobile/build.gradle @@ -71,6 +71,7 @@ dependencies { implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'com.daimajia.swipelayout:library:1.2.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'com.google.firebase:firebase-crashlytics-ktx:18.6.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'org.testng:testng:7.8.0' implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0' diff --git a/PennMobile/google-services.json b/PennMobile/google-services.json index a01c85ae..b4ec266d 100644 --- a/PennMobile/google-services.json +++ b/PennMobile/google-services.json @@ -1,13 +1,13 @@ { "project_info": { - "project_number": "86950866683", - "project_id": "pennmobilefbtest", - "storage_bucket": "pennmobilefbtest.appspot.com" + "project_number": "261196915337", + "project_id": "penn-mobile-android", + "storage_bucket": "penn-mobile-android.appspot.com" }, "client": [ { "client_info": { - "mobilesdk_app_id": "1:86950866683:android:0b66c19f0e9f40617a4a5e", + "mobilesdk_app_id": "1:261196915337:android:82e48698e3df3cdf3bdc58", "android_client_info": { "package_name": "com.pennapps.labs.pennmobile" } @@ -15,7 +15,7 @@ "oauth_client": [], "api_key": [ { - "current_key": "AIzaSyDPyjYP8lTQFHt-uy8UBLdKGrGAmHzyhuA" + "current_key": "AIzaSyCavOsfwwY54_dlm_oW4wMDLJgdXghLYP8" } ], "services": { diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/HomeFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/HomeFragment.kt index 0da25263..ca3b9a51 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/HomeFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/HomeFragment.kt @@ -16,7 +16,6 @@ import androidx.fragment.app.Fragment import androidx.localbroadcastmanager.content.LocalBroadcastManager import androidx.preference.PreferenceManager import androidx.recyclerview.widget.LinearLayoutManager -import com.google.firebase.analytics.FirebaseAnalytics import com.pennapps.labs.pennmobile.adapters.HomeAdapter import com.pennapps.labs.pennmobile.api.OAuth2NetworkManager import com.pennapps.labs.pennmobile.classes.HomeCell @@ -32,7 +31,6 @@ import kotlinx.android.synthetic.main.loading_panel.* import java.util.* import kotlin.collections.ArrayList - class HomeFragment : Fragment() { private lateinit var mActivity: MainActivity diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LoginFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LoginFragment.kt index 85f18706..fa189159 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LoginFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LoginFragment.kt @@ -34,9 +34,6 @@ class LoginFragment : Fragment() { val fragmentManager = mActivity.supportFragmentManager val gif = R.drawable.login_background -// if (Build.VERSION.SDK_INT > 28 && (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES) { -// gif = R.drawable.login_background_dark -// } Glide.with(this).asGif().load(gif).listener(object : RequestListener { override fun onLoadFailed(e: GlideException?, model: Any?, target: com.bumptech.glide.request.target.Target?, isFirstResource: Boolean): Boolean { diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LoginWebviewFragment.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LoginWebviewFragment.kt index fc037680..1c960a4e 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LoginWebviewFragment.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/LoginWebviewFragment.kt @@ -15,6 +15,8 @@ import android.widget.LinearLayout import android.widget.Toast import androidx.fragment.app.Fragment import androidx.preference.PreferenceManager +import com.google.firebase.analytics.FirebaseAnalytics +import com.google.firebase.crashlytics.FirebaseCrashlytics import com.pennapps.labs.pennmobile.api.StudentLife import com.pennapps.labs.pennmobile.api.Platform import com.pennapps.labs.pennmobile.api.Platform.platformBaseUrl @@ -92,7 +94,6 @@ class LoginWebviewFragment : Fragment() { cancelButton.setOnClickListener { mActivity.startLoginFragment() } - } private fun encryptPassword(password: String) { @@ -193,6 +194,9 @@ class LoginWebviewFragment : Fragment() { override fun success(t: AccessTokenResponse?, response: Response?) { if (response?.status == 200) { + + FirebaseAnalytics.getInstance(mActivity).logEvent("LoginEvent", null) + val accessToken = t?.accessToken val editor = sp.edit() editor.putString(getString(R.string.access_token), accessToken) @@ -209,6 +213,7 @@ class LoginWebviewFragment : Fragment() { } override fun failure(error: RetrofitError) { + FirebaseCrashlytics.getInstance().recordException(error) Log.e("Accounts", "Error fetching access token $error", error) Toast.makeText(mActivity, "Error logging in", Toast.LENGTH_SHORT).show() mActivity.startLoginFragment() diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt index f136af0b..6f5a1ac6 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt @@ -35,7 +35,6 @@ import com.google.gson.GsonBuilder import com.google.gson.reflect.TypeToken import com.pennapps.labs.pennmobile.adapters.MainPagerAdapter import com.pennapps.labs.pennmobile.api.CampusExpress -import com.pennapps.labs.pennmobile.api.OAuth2NetworkManager import com.pennapps.labs.pennmobile.api.Platform import com.pennapps.labs.pennmobile.api.Serializer.* import com.pennapps.labs.pennmobile.api.StudentLife diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/api/OAuth2NetworkManager.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/api/OAuth2NetworkManager.kt index 72aa78ae..6dd4dbc9 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/api/OAuth2NetworkManager.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/api/OAuth2NetworkManager.kt @@ -4,6 +4,8 @@ import android.preference.PreferenceManager import android.provider.Settings import android.util.Log import androidx.lifecycle.lifecycleScope +import com.google.firebase.crashlytics.FirebaseCrashlytics + import com.pennapps.labs.pennmobile.BuildConfig import com.pennapps.labs.pennmobile.MainActivity import com.pennapps.labs.pennmobile.R @@ -80,6 +82,7 @@ class OAuth2NetworkManager(private var mActivity: MainActivity) { override fun failure(error: RetrofitError) { + FirebaseCrashlytics.getInstance().recordException(error) Log.e("Accounts", "Error refreshing access token $error") if (error.response != null && error.response.status == 400) { From 4362657860acab6964cae3c951c8b4fae6d2cc96 Mon Sep 17 00:00:00 2001 From: meiron03 Date: Fri, 15 Dec 2023 00:52:20 -0500 Subject: [PATCH 5/6] Delete PennMobile/google-services.json remove google-services.json --- PennMobile/google-services.json | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 PennMobile/google-services.json diff --git a/PennMobile/google-services.json b/PennMobile/google-services.json deleted file mode 100644 index b4ec266d..00000000 --- a/PennMobile/google-services.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "project_info": { - "project_number": "261196915337", - "project_id": "penn-mobile-android", - "storage_bucket": "penn-mobile-android.appspot.com" - }, - "client": [ - { - "client_info": { - "mobilesdk_app_id": "1:261196915337:android:82e48698e3df3cdf3bdc58", - "android_client_info": { - "package_name": "com.pennapps.labs.pennmobile" - } - }, - "oauth_client": [], - "api_key": [ - { - "current_key": "AIzaSyCavOsfwwY54_dlm_oW4wMDLJgdXghLYP8" - } - ], - "services": { - "appinvite_service": { - "other_platform_oauth_client": [] - } - } - } - ], - "configuration_version": "1" -} \ No newline at end of file From 8e67913528c72a0f840db8c939313f99e7d0eaea Mon Sep 17 00:00:00 2001 From: meiron03 Date: Wed, 20 Dec 2023 22:47:36 -0500 Subject: [PATCH 6/6] Update MainActivity.kt --- .../src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt index 144d1b0a..84761b0d 100644 --- a/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt +++ b/PennMobile/src/main/java/com/pennapps/labs/pennmobile/MainActivity.kt @@ -35,6 +35,7 @@ import com.google.gson.GsonBuilder import com.google.gson.reflect.TypeToken import com.pennapps.labs.pennmobile.adapters.MainPagerAdapter import com.pennapps.labs.pennmobile.api.CampusExpress +import com.pennapps.labs.pennmobile.api.OAuth2NetworkManager import com.pennapps.labs.pennmobile.api.Platform import com.pennapps.labs.pennmobile.api.Serializer.* import com.pennapps.labs.pennmobile.api.StudentLife @@ -404,4 +405,4 @@ fun ViewGroup.showSneakerToast(message: String, doOnRetry: (() -> Unit)?, sneake messageView.text = message sneaker.sneakCustom(view).setCornerRadius(12, 16).setMessage(message) -} \ No newline at end of file +}