Skip to content

Commit ad05889

Browse files
authored
Merge pull request #594 from pennlabs/firebase-analytics
Firebase analytics
2 parents 298bbab + 8e67913 commit ad05889

17 files changed

+54
-96
lines changed

.github/workflows/android-workflow.yaml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ jobs:
2929
env:
3030
PLATFORM_REDIRECT_URI: ${{ secrets.PLATFORM_REDIRECT_URI }}
3131
run: echo PLATFORM_REDIRECT_URI=\"$PLATFORM_REDIRECT_URI\" >> ./local.properties
32+
33+
# Create google-services.json
34+
- name: Create google-services.json
35+
run: |
36+
cat << EOF > PennMobile/google-services.json
37+
${{ secrets.GOOGLE_SERVICES_JSON }}
38+
EOF
39+
3240
# Run unit tests
3341
- name: Run Unit Tests
3442
run: ./gradlew testDebugUnitTest
@@ -60,7 +68,14 @@ jobs:
6068
env:
6169
PLATFORM_REDIRECT_URI: ${{ secrets.PLATFORM_REDIRECT_URI }}
6270
run: echo PLATFORM_REDIRECT_URI=\"$PLATFORM_REDIRECT_URI\" >> ./local.properties
63-
71+
72+
# Create google-services.json
73+
- name: Create google-services.json
74+
run: |
75+
cat << EOF > PennMobile/google-services.json
76+
${{ secrets.GOOGLE_SERVICES_JSON }}
77+
EOF
78+
6479
# Generate Signed APK
6580
- name: Generate Release APK
6681
run: ./gradlew assembleRelease
@@ -108,6 +123,13 @@ jobs:
108123
PLATFORM_REDIRECT_URI: ${{ secrets.PLATFORM_REDIRECT_URI }}
109124
run: echo PLATFORM_REDIRECT_URI=\"$PLATFORM_REDIRECT_URI\" >> ./local.properties
110125

126+
# Create google-services.json
127+
- name: Create google-services.json
128+
run: |
129+
cat << EOF > PennMobile/google-services.json
130+
${{ secrets.GOOGLE_SERVICES_JSON }}
131+
EOF
132+
111133
# Run JaCoCo, generate Test Report
112134
- name: Check Code Coverage
113135
run: ./gradlew jacocoTestReport --stacktrace
@@ -120,6 +142,7 @@ jobs:
120142
path: PennMobile/build/reports
121143

122144
# Publish to Firebase App Distribution
145+
# https://github.com/wzieba/Firebase-Distribution-Github-Action
123146
deploy-firebase:
124147
needs: generate-apk
125148
if: startsWith(github.ref, 'refs/tags/v')
@@ -132,7 +155,7 @@ jobs:
132155
uses: wzieba/Firebase-Distribution-Github-Action@v1
133156
with:
134157
appId: ${{secrets.FIREBASE_APP_ID}}
135-
token: ${{secrets.FIREBASE_TOKEN}}
158+
serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
136159
groups: tester
137160
file: PennMobile-release-unsigned-signed.apk
138161

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ gradle/wrapper/
2222

2323
# Local configuration file (sdk path, etc)
2424
local.properties
25+
google-services.json
2526

2627
# Proguard folder generated by Eclipse
2728
proguard/

PennMobile/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id 'com.android.application'
33
id 'org.jetbrains.kotlin.android'
44
id 'com.google.gms.google-services'
5+
id("com.google.firebase.crashlytics")
56
id 'jacoco'
67
}
78

@@ -42,6 +43,8 @@ dependencies {
4243
implementation(platform("com.google.firebase:firebase-bom:31.5.0"))
4344

4445
implementation 'com.google.firebase:firebase-analytics'
46+
implementation("com.google.firebase:firebase-crashlytics")
47+
4548
implementation 'androidx.multidex:multidex:2.0.1'
4649
implementation 'com.google.maps:google-maps-services:2.2.0'
4750
implementation 'org.jsoup:jsoup:1.16.2'
@@ -68,6 +71,7 @@ dependencies {
6871
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
6972
implementation 'com.daimajia.swipelayout:library:1.2.0'
7073
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
74+
implementation 'com.google.firebase:firebase-crashlytics-ktx:18.6.0'
7175
testImplementation 'junit:junit:4.13.2'
7276
androidTestImplementation 'org.testng:testng:7.8.0'
7377
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'

PennMobile/google-services.json

Lines changed: 0 additions & 40 deletions
This file was deleted.

PennMobile/src/main/java/com/pennapps/labs/pennmobile/DiningFragment.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,6 @@ class DiningFragment : Fragment() {
3939
mActivity = activity as MainActivity
4040
mActivity.closeKeyboard()
4141
setHasOptionsMenu(true)
42-
43-
val bundle = Bundle()
44-
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "1")
45-
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "Dining")
46-
bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "App Feature")
47-
FirebaseAnalytics.getInstance(mActivity).logEvent(FirebaseAnalytics.Event.VIEW_ITEM, bundle)
4842
}
4943

5044
override fun onActivityCreated(savedInstanceState: Bundle?) {

PennMobile/src/main/java/com/pennapps/labs/pennmobile/FlingFragment.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@ class FlingFragment : Fragment() {
2424
setHasOptionsMenu(true)
2525
mActivity = activity as MainActivity
2626
mActivity.supportActionBar?.setDisplayHomeAsUpEnabled(true)
27-
28-
val bundle = Bundle()
29-
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "7")
30-
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "Spring Fling")
31-
bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "App Feature")
32-
FirebaseAnalytics.getInstance(mActivity).logEvent(FirebaseAnalytics.Event.VIEW_ITEM, bundle)
3327
}
3428

3529
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {

PennMobile/src/main/java/com/pennapps/labs/pennmobile/GsrFragment.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,6 @@ class GsrFragment : Fragment() {
7878

7979
// set default GSR selection date + time to the current date and time
8080
selectedDateTime = DateTime.now()
81-
82-
val bundle = Bundle()
83-
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "0")
84-
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "GSR")
85-
bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "App Feature")
86-
FirebaseAnalytics.getInstance(mActivity).logEvent(FirebaseAnalytics.Event.VIEW_ITEM, bundle)
8781
}
8882

8983
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {

PennMobile/src/main/java/com/pennapps/labs/pennmobile/GsrReservationsFragment.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ class GsrReservationsFragment : Fragment() {
3333
mActivity = activity as MainActivity
3434

3535
LocalBroadcastManager.getInstance(mActivity).registerReceiver(broadcastReceiver, IntentFilter("refresh"))
36-
37-
val bundle = Bundle()
38-
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "10")
39-
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "GsrReservations")
40-
bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "App Feature")
41-
FirebaseAnalytics.getInstance(mActivity).logEvent(FirebaseAnalytics.Event.VIEW_ITEM, bundle)
4236
}
4337

4438
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,

PennMobile/src/main/java/com/pennapps/labs/pennmobile/HomeFragment.kt

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import androidx.fragment.app.Fragment
1616
import androidx.localbroadcastmanager.content.LocalBroadcastManager
1717
import androidx.preference.PreferenceManager
1818
import androidx.recyclerview.widget.LinearLayoutManager
19-
import com.google.firebase.analytics.FirebaseAnalytics
2019
import com.pennapps.labs.pennmobile.adapters.HomeAdapter
2120
import com.pennapps.labs.pennmobile.api.OAuth2NetworkManager
2221
import com.pennapps.labs.pennmobile.classes.HomeCell
@@ -32,7 +31,6 @@ import kotlinx.android.synthetic.main.loading_panel.*
3231
import java.util.*
3332
import kotlin.collections.ArrayList
3433

35-
3634
class HomeFragment : Fragment() {
3735

3836
private lateinit var mActivity: MainActivity
@@ -51,11 +49,6 @@ class HomeFragment : Fragment() {
5149
.getInstance(mActivity)
5250
.registerReceiver(broadcastReceiver, IntentFilter("refresh"))
5351

54-
val bundle = Bundle()
55-
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "11")
56-
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "Home")
57-
bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "App Feature")
58-
FirebaseAnalytics.getInstance(mActivity).logEvent(FirebaseAnalytics.Event.VIEW_ITEM, bundle)
5952
}
6053

6154
override fun onCreateView(
@@ -72,7 +65,9 @@ class HomeFragment : Fragment() {
7265
view.home_refresh_layout
7366
.setColorSchemeResources(R.color.color_accent, R.color.color_primary)
7467
view.home_refresh_layout
75-
.setOnRefreshListener { getHomePage() }
68+
.setOnRefreshListener {
69+
getHomePage()
70+
}
7671

7772
initAppBar(view)
7873
return view

PennMobile/src/main/java/com/pennapps/labs/pennmobile/LaundrySettingsFragment.kt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ class LaundrySettingsFragment : Fragment() {
4343
setHasOptionsMenu(true)
4444
mActivity.toolbar.visibility = View.VISIBLE
4545
mActivity.hideBottomBar()
46-
47-
val bundle = Bundle()
48-
bundle.putString(FirebaseAnalytics.Param.ITEM_ID, "12")
49-
bundle.putString(FirebaseAnalytics.Param.ITEM_NAME, "Laundry Settings")
50-
bundle.putString(FirebaseAnalytics.Param.ITEM_CATEGORY, "App Feature")
51-
FirebaseAnalytics.getInstance(mContext).logEvent(FirebaseAnalytics.Event.VIEW_ITEM, bundle)
5246
}
5347

5448
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
@@ -67,10 +61,8 @@ class LaundrySettingsFragment : Fragment() {
6761
editor?.apply()
6862

6963
for (i in 0 until numRooms) {
70-
editor?.remove(Integer.toString(i))?.apply()
64+
editor?.remove(i.toString())?.apply()
7165
}
72-
73-
//view.laundry_building_expandable_list?.setAdapter(mAdapter)
7466
}
7567

7668
// set up back button

0 commit comments

Comments
 (0)