Skip to content
This repository was archived by the owner on May 6, 2024. It is now read-only.

Commit edf4ae9

Browse files
Merge pull request #77 from mhacks/development
Development - Mhacks 11
2 parents c775081 + 8e07799 commit edf4ae9

83 files changed

Lines changed: 490 additions & 495 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 64 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# The Official MHacks Android App
2-
<a href="https://play.google.com/store/apps/details?id=org.mhacks.android&utm_source=global_co&utm_medium=prtnr&utm_content=Mar2515&utm_campaign=PartBadge&pcampaignid=MKT-AC-global-none-all-co-pr-py-PartBadges-Oct1515-1"><img width="300" alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/images/apps/en-play-badge-border.png" /></a>
2+
<a href="https://play.google.com/store/apps/details?id=org.mhacks.app"><img width="300" alt="Get it on Google Play" src="https://play.google.com/intl/en_us/badges/images/apps/en-play-badge-border.png" /></a>
33

44
# About
55
The goal of this project is to provide a modular and open source Android client for hackathons of all sizes. Feel free to fork this project and deploy this client for your event.
@@ -18,23 +18,78 @@ If you plan on building this project for release, you'll need to add a `signingC
1818

1919
**NOTE: You may need to clean your project and sync Gradle files before your first run.** `Build > Clean project`
2020

21+
### Prerequisites
22+
23+
To build this project, there are several requirements.
24+
25+
1. `google-services.json`
26+
27+
This file is needed to use Google Play Services. More specifically, for Google Maps integration, you must register on Google's [website](https://developers.google.com/maps/documentation/android-sdk/intro) to receive this key
28+
29+
2. `gradle.properties`
30+
31+
This file contains API keys that are used throughout the app. This is not added to the project for security reasons. Note that there are not quotation marks around MHACKS_GOOGLE_MAPS_API_KEY and there are double quotation marks around GCM_SERVER_ID.
32+
33+
3. ```groovy
34+
MHACKS_GOOGLE_MAPS_API_KEY=examplekey
35+
GCM_SERVER_ID="example_key"
36+
37+
// This is needed to transform App Compat libraries in third
38+
// party libraries to be compat with the newer AndroidX
39+
// packages.
40+
android.useAndroidX = true
41+
android.enableJetifier = true
42+
43+
// Needed to use data binding for feature modules.
44+
android.enableExperimentalFeatureDatabinding = true
45+
```
46+
47+
4. Android Studio 3.2
48+
49+
This project uses tools available on a recent version of Android Studio. Older versions of the IDE may not support some aspects of the development.
50+
51+
# Goals
52+
53+
* Demonstrate a good understanding of software architecture and tooling that are important in maintaining a modern codebase.
54+
* Uses MVVM, in the form of Architecture Components ViewModel, as a solution for seperation of concerns and implementing [clean architecture](https://proandroiddev.com/a-guided-tour-inside-a-clean-architecture-code-base-48bb5cc9fc97).
55+
* Conforming to Material Design standards in creating a predictable and intuitive UI.
56+
* Sensible file and project organization.
57+
* Demonstrate the use of common Android libraries used commonly for modern codebases.
58+
* Use dependency injection with Dagger 2 to produce decoupled objects and services, reduces the amount of boilerplate.
59+
* Use Data Binding to bind UI in a declarative method.
60+
61+
# Screenshots
62+
63+
<table>
64+
<tr>
65+
<td><img style="width: 350px: height:auto; margin: 0 50px" src="/screenshots/horizontal.png"></img></td>
66+
<td><img src="/screenshots/vertical_liked.png"></img></td></img></td>
67+
</tr>
68+
<tr>
69+
<td align="center"><b>Welcome Screen / Timer<b></td>
70+
<td align="center"><b>Ticket</b></img></td>
71+
</tr>
72+
</table>
73+
2174
# Credits
75+
2276
We would like to thank the maintainers of the following for past and present version of the app:
2377
- [Square OkHTTP](http://square.github.io/okhttp/ "Square OkHTTP")
2478
- [Square Retrofit](http://square.github.io/retrofit/ "Square Retrofit")
25-
- [MaterialDrawer](http://mikepenz.github.io/MaterialDrawer/ "Mike Penz's Material Drawer")
26-
- [Parse Android](https://parse.com/docs/android_guide "Parse Android Developer Guide")
27-
- [AndroidWeekView](https://github.com/alamkanak/Android-Week-View "Alam Kanak's AndroidWeekView")
28-
- [Square Picasso](http://square.github.io/picasso/ "Square Picasso")
29-
- [Google Guava](https://code.google.com/p/guava-libraries/ "Google Guava Libraries")
30-
- [Firebase Android](https://www.firebase.com/docs/android/quickstart.html "Firebase Android Quick Start")
31-
- [Floating Action Menu](https://github.com/futuresimple/android-floating-action-button "Future Simples' Android Floating Action Button Extention Library")
79+
- [Square Moshi](https://github.com/square/moshi)
80+
- [Dagger 2](https://google.github.io/dagger/)
81+
- [RxJava 2](https://github.com/ReactiveX/RxJava)
82+
- [Architecture Components](https://developer.android.com/topic/libraries/architecture/)
83+
- [Room](https://developer.android.com/topic/libraries/architecture/room)
84+
- [ThreeTenABP](https://github.com/JakeWharton/ThreeTenABP)
85+
- [barcodescanner](https://github.com/dm77/barcodescanner)
86+
- [ArcLayout](https://github.com/florent37/ArcLayout)
3287

3388

3489
# License
3590
The MIT License (MIT)
3691

37-
Copyright (c) 2016 MHacks, Google Inc.
92+
Copyright (c) 2018 MHacks
3893

3994
Permission is hereby granted, free of charge, to any person obtaining a copy
4095
of this software and associated documentation files (the "Software"), to deal

apk/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ android {
1010
applicationId 'org.mhacks.app'
1111
minSdkVersion 21
1212
targetSdkVersion 28
13-
versionCode 1
13+
versionCode 11
1414
versionName "1.0"
1515

1616
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -30,6 +30,8 @@ android {
3030

3131
}
3232

33+
apply plugin: "com.google.gms.google-services"
34+
3335
dependencies {
3436
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
3537

apk/src/main/AndroidManifest.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@
3939
<activity android:name="com.mhacks.app.ui.signin.SignInActivity" />
4040

4141

42+
<service
43+
android:name="com.mhacks.app.data.network.fcm.FCMMessageHandler">
44+
<!--android:name=".data.network.fcm.FCMMessageHandler">-->
45+
<intent-filter>
46+
<action android:name="com.google.firebase.MESSAGING_EVENT" />
47+
</intent-filter>
48+
</service>
49+
50+
<meta-data android:name="com.google.firebase.messaging.default_notification_icon"
51+
android:resource="@mipmap/ic_launcher_round" />
52+
<meta-data
53+
android:name="com.google.firebase.messaging.default_notification_color"
54+
android:resource="@color/colorAccent" />
55+
<meta-data
56+
android:name="com.google.firebase.messaging.default_notification_channel_id"
57+
android:value="MHacks Group" />
4258
</application>
4359

4460
</manifest>

base/build.gradle

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@ apply plugin: "kotlin-android-extensions"
55
apply plugin: "kotlin-kapt"
66

77
ext {
8-
bugsnag_key = ext.MHACKS_BUGSNAG_KEY
98
google_maps_api_key = ext.MHACKS_GOOGLE_MAPS_API_KEY
109
gcm_server_id = ext.GCM_SERVER_ID
1110
}
1211

1312
android {
1413
compileSdkVersion 28
15-
buildToolsVersion '28.0.2'
14+
buildToolsVersion '28.0.3'
1615
baseFeature true
1716
dexOptions {
1817
javaMaxHeapSize "4g"
@@ -42,45 +41,60 @@ android {
4241
defaultConfig {
4342
minSdkVersion 21
4443
targetSdkVersion 28
45-
versionName "10.0.0"
44+
versionName "11.0.0"
45+
46+
buildConfigField "String", "FIXED_START_DATE", "\"2018-10-12T00:00:00\""
47+
buildConfigField "String", "INSTANT_APP_URL", "\"schedule\""
48+
49+
buildConfigField "String", "WIFI_SSID", "\"MHacks11\""
50+
buildConfigField "String", "WIFI_PASSWORD", "\"anyonecancode\""
51+
52+
buildConfigField "String", "MHACKS_EMAIL", "\"hackathon@umich.edu\""
53+
54+
buildConfigField "String",
55+
"SLACK_INVITE_URL",
56+
"\"https://join.slack.com/t/mhacks11/shared_invite/enQtNDQzMDI0MDY3ODQ1LTM3YTIyMmJmNjU3NGM2NDk1MzQzZjZmMmY3ZDliZmZlNTRjOGNiMTc2OWRiZjIyODBiNzk2ZGQ4YjBmMjlkZjU\""
57+
58+
buildConfigField 'double', 'LAT', '42.2694'
59+
buildConfigField 'double', 'LNG', '-83.7425'
60+
4661
resValue "string", "google_maps_api_key", google_maps_api_key
62+
4763
vectorDrawables.useSupportLibrary = true
48-
multiDexEnabled true
4964
}
5065
buildTypes {
5166
release {
5267
debuggable false
5368
minifyEnabled false
5469
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.txt"
55-
multiDexEnabled true
5670
resValue "string", "google_maps_api_key", google_maps_api_key
5771
signingConfig signingConfigs.release
72+
73+
buildConfigField "String", "API_URL", "\"https://mhacks.org/v1/\""
5874
}
5975
debug {
60-
debuggable true
6176
minifyEnabled false
77+
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.txt"
6278
resValue "string", "google_maps_api_key", google_maps_api_key
79+
80+
81+
buildConfigField "String", "API_URL", "\"https://staging.mhacks.org/v1/\""
6382
}
6483
}
6584

6685
dataBinding {
6786
enabled = true
6887
}
6988

70-
productFlavors {
71-
72-
}
7389
}
7490

7591
dependencies {
7692
implementation fileTree(include: ['*.jar'], dir: 'libs')
7793
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$rootProject.kotlin_version"
7894

79-
// kapt 'androidx.databinding:databinding-compiler:3.2.0'
80-
8195
// Play Services
82-
implementation 'com.google.firebase:firebase-core:16.0.3'
83-
implementation 'com.google.firebase:firebase-messaging:17.3.2'
96+
implementation 'com.google.firebase:firebase-core:16.0.4'
97+
implementation 'com.google.firebase:firebase-messaging:17.3.3'
8498

8599
implementation 'androidx.appcompat:appcompat:1.0.0'
86100
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
@@ -90,8 +104,9 @@ dependencies {
90104
implementation 'com.squareup.retrofit2:converter-moshi:2.4.0'
91105

92106
// Persistence
93-
implementation 'androidx.room:room-runtime:2.0.0-rc01'
94-
implementation 'androidx.room:room-rxjava2:2.0.0-rc01'
107+
implementation 'androidx.room:room-runtime:2.0.0'
108+
implementation 'androidx.room:room-rxjava2:2.0.0'
109+
kapt 'androidx.room:room-compiler:2.0.0'
95110

96111
// RxJava
97112
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
@@ -101,8 +116,6 @@ dependencies {
101116
// Debugging
102117
implementation 'com.jakewharton.timber:timber:4.7.0'
103118

104-
kapt 'androidx.room:room-compiler:2.0.0-rc01'
105-
106119
feature project(':ui')
107120
}
108121

base/src/main/AndroidManifest.xml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
android:name=".MHacksApplication"
2727
android:allowBackup="true"
2828
android:fullBackupContent="false"
29-
android:icon="@mipmap/launcher_icon"
29+
android:icon="@mipmap/ic_launcher"
3030
android:label="@string/app_name"
31-
android:logo="@mipmap/launcher_icon"
31+
android:logo="@mipmap/ic_launcher"
3232
android:theme="@style/SplashTheme"
3333
android:title="com.mhacks.android.MHacks"
3434
tools:ignore="GoogleAppIndexingWarning">
@@ -92,14 +92,21 @@
9292
This is required if you want to do any message handling beyond receiving
9393
notifications on apps in the background.
9494
-->
95+
9596
<service
96-
android:name=".data.network.fcm.FCMMessageHandler"
97-
android:exported="false">
97+
android:name=".data.network.fcm.FCMMessageHandler">
9898
<intent-filter>
9999
<action android:name="com.google.firebase.MESSAGING_EVENT" />
100100
</intent-filter>
101101
</service>
102-
102+
<meta-data android:name="com.google.firebase.messaging.default_notification_icon"
103+
android:resource="@mipmap/ic_launcher_round" />
104+
<meta-data
105+
android:name="com.google.firebase.messaging.default_notification_color"
106+
android:resource="@color/colorAccent" />
107+
<meta-data
108+
android:name="com.google.firebase.messaging.default_notification_channel_id"
109+
android:value="MHacks Group" />
103110
<meta-data
104111
android:name="com.google.android.geo.API_KEY"
105112
android:value="@string/google_maps_api_key" />

base/src/main/ic_launcher-web.png

20.1 KB
Loading

base/src/main/java/com/mhacks/app/data/Constants.kt

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

base/src/main/java/com/mhacks/app/data/SharedPreferencesManager.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,5 @@ class SharedPreferencesManager(private val sharedPreferences: SharedPreferences)
3737

3838
private const val FLASH_ENABLED_KEY = "FLASH_ENABLED_KEY"
3939

40-
private const val IS_ADMIN_KEY = "IS_ADMIN_KEY"
4140
}
4241
}

base/src/main/java/com/mhacks/app/data/models/common/RetrofitException.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class RetrofitException internal constructor(
99
/** The request URL which produced the error. */
1010
val url: String?,
1111
/** Response object containing status code, headers, body, etc. */
12-
val response: Response<*>?,
12+
private val response: Response<*>?,
1313
/** The event kind which triggered this error. */
1414
val kind: Kind,
1515
val exception: Throwable?) : RuntimeException(message, exception) {

base/src/main/java/com/mhacks/app/data/network/fcm/FCMMessageHandler.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import androidx.core.app.NotificationCompat
77
import androidx.core.app.NotificationManagerCompat
88
import com.google.firebase.messaging.FirebaseMessagingService
99
import com.google.firebase.messaging.RemoteMessage
10+
import timber.log.Timber
1011
import com.mhacks.app.R
1112

1213
/**
@@ -25,7 +26,7 @@ class FCMMessageHandler : FirebaseMessagingService() {
2526
private fun createNotification(notification: RemoteMessage.Notification) {
2627
val builder = NotificationCompat.Builder(baseContext, mhacksGroup)
2728
.setDefaults(Notification.DEFAULT_ALL)
28-
.setSmallIcon(R.mipmap.launcher_icon)
29+
.setSmallIcon(R.mipmap.ic_launcher_round)
2930
.setContentTitle(notification.title)
3031
.setContentText(notification.body)
3132
.setVibrate(longArrayOf(1000, 1000, 1000, 1000, 1000))
@@ -37,6 +38,8 @@ class FCMMessageHandler : FirebaseMessagingService() {
3738

3839
override fun onNewToken(newToken: String?) {
3940
super.onNewToken(newToken)
41+
Timber.d("New Token is $newToken")
42+
4043
val intent = Intent(this, RegistrationIntentService::class.java)
4144
startService(intent)
4245
}

0 commit comments

Comments
 (0)