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

Commit

Permalink
Merge pull request #77 from mhacks/development
Browse files Browse the repository at this point in the history
Development - Mhacks 11
  • Loading branch information
shashankmurching authored Oct 12, 2018
2 parents c775081 + 8e07799 commit edf4ae9
Show file tree
Hide file tree
Showing 83 changed files with 490 additions and 495 deletions.
73 changes: 64 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# The Official MHacks Android App
<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>
<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>

# About
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.
Expand All @@ -18,23 +18,78 @@ If you plan on building this project for release, you'll need to add a `signingC

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

### Prerequisites

To build this project, there are several requirements.

1. `google-services.json`

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

2. `gradle.properties`

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.

3. ```groovy
MHACKS_GOOGLE_MAPS_API_KEY=examplekey
GCM_SERVER_ID="example_key"
// This is needed to transform App Compat libraries in third
// party libraries to be compat with the newer AndroidX
// packages.
android.useAndroidX = true
android.enableJetifier = true
// Needed to use data binding for feature modules.
android.enableExperimentalFeatureDatabinding = true
```

4. Android Studio 3.2

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.

# Goals

* Demonstrate a good understanding of software architecture and tooling that are important in maintaining a modern codebase.
* 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).
* Conforming to Material Design standards in creating a predictable and intuitive UI.
* Sensible file and project organization.
* Demonstrate the use of common Android libraries used commonly for modern codebases.
* Use dependency injection with Dagger 2 to produce decoupled objects and services, reduces the amount of boilerplate.
* Use Data Binding to bind UI in a declarative method.

# Screenshots

<table>
<tr>
<td><img style="width: 350px: height:auto; margin: 0 50px" src="/screenshots/horizontal.png"></img></td>
<td><img src="/screenshots/vertical_liked.png"></img></td></img></td>
</tr>
<tr>
<td align="center"><b>Welcome Screen / Timer<b></td>
<td align="center"><b>Ticket</b></img></td>
</tr>
</table>

# Credits

We would like to thank the maintainers of the following for past and present version of the app:
- [Square OkHTTP](http://square.github.io/okhttp/ "Square OkHTTP")
- [Square Retrofit](http://square.github.io/retrofit/ "Square Retrofit")
- [MaterialDrawer](http://mikepenz.github.io/MaterialDrawer/ "Mike Penz's Material Drawer")
- [Parse Android](https://parse.com/docs/android_guide "Parse Android Developer Guide")
- [AndroidWeekView](https://github.com/alamkanak/Android-Week-View "Alam Kanak's AndroidWeekView")
- [Square Picasso](http://square.github.io/picasso/ "Square Picasso")
- [Google Guava](https://code.google.com/p/guava-libraries/ "Google Guava Libraries")
- [Firebase Android](https://www.firebase.com/docs/android/quickstart.html "Firebase Android Quick Start")
- [Floating Action Menu](https://github.com/futuresimple/android-floating-action-button "Future Simples' Android Floating Action Button Extention Library")
- [Square Moshi](https://github.com/square/moshi)
- [Dagger 2](https://google.github.io/dagger/)
- [RxJava 2](https://github.com/ReactiveX/RxJava)
- [Architecture Components](https://developer.android.com/topic/libraries/architecture/)
- [Room](https://developer.android.com/topic/libraries/architecture/room)
- [ThreeTenABP](https://github.com/JakeWharton/ThreeTenABP)
- [barcodescanner](https://github.com/dm77/barcodescanner)
- [ArcLayout](https://github.com/florent37/ArcLayout)


# License
The MIT License (MIT)

Copyright (c) 2016 MHacks, Google Inc.
Copyright (c) 2018 MHacks

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 3 additions & 1 deletion apk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ android {
applicationId 'org.mhacks.app'
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionCode 11
versionName "1.0"

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

}

apply plugin: "com.google.gms.google-services"

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

Expand Down
16 changes: 16 additions & 0 deletions apk/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@
<activity android:name="com.mhacks.app.ui.signin.SignInActivity" />


<service
android:name="com.mhacks.app.data.network.fcm.FCMMessageHandler">
<!--android:name=".data.network.fcm.FCMMessageHandler">-->
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>

<meta-data android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@mipmap/ic_launcher_round" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/colorAccent" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="MHacks Group" />
</application>

</manifest>
47 changes: 30 additions & 17 deletions base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ apply plugin: "kotlin-android-extensions"
apply plugin: "kotlin-kapt"

ext {
bugsnag_key = ext.MHACKS_BUGSNAG_KEY
google_maps_api_key = ext.MHACKS_GOOGLE_MAPS_API_KEY
gcm_server_id = ext.GCM_SERVER_ID
}

android {
compileSdkVersion 28
buildToolsVersion '28.0.2'
buildToolsVersion '28.0.3'
baseFeature true
dexOptions {
javaMaxHeapSize "4g"
Expand Down Expand Up @@ -42,45 +41,60 @@ android {
defaultConfig {
minSdkVersion 21
targetSdkVersion 28
versionName "10.0.0"
versionName "11.0.0"

buildConfigField "String", "FIXED_START_DATE", "\"2018-10-12T00:00:00\""
buildConfigField "String", "INSTANT_APP_URL", "\"schedule\""

buildConfigField "String", "WIFI_SSID", "\"MHacks11\""
buildConfigField "String", "WIFI_PASSWORD", "\"anyonecancode\""

buildConfigField "String", "MHACKS_EMAIL", "\"[email protected]\""

buildConfigField "String",
"SLACK_INVITE_URL",
"\"https://join.slack.com/t/mhacks11/shared_invite/enQtNDQzMDI0MDY3ODQ1LTM3YTIyMmJmNjU3NGM2NDk1MzQzZjZmMmY3ZDliZmZlNTRjOGNiMTc2OWRiZjIyODBiNzk2ZGQ4YjBmMjlkZjU\""

buildConfigField 'double', 'LAT', '42.2694'
buildConfigField 'double', 'LNG', '-83.7425'

resValue "string", "google_maps_api_key", google_maps_api_key

vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
debuggable false
minifyEnabled false
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.txt"
multiDexEnabled true
resValue "string", "google_maps_api_key", google_maps_api_key
signingConfig signingConfigs.release

buildConfigField "String", "API_URL", "\"https://mhacks.org/v1/\""
}
debug {
debuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.txt"
resValue "string", "google_maps_api_key", google_maps_api_key


buildConfigField "String", "API_URL", "\"https://staging.mhacks.org/v1/\""
}
}

dataBinding {
enabled = true
}

productFlavors {

}
}

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

// kapt 'androidx.databinding:databinding-compiler:3.2.0'

// Play Services
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-messaging:17.3.2'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.3'

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

// Persistence
implementation 'androidx.room:room-runtime:2.0.0-rc01'
implementation 'androidx.room:room-rxjava2:2.0.0-rc01'
implementation 'androidx.room:room-runtime:2.0.0'
implementation 'androidx.room:room-rxjava2:2.0.0'
kapt 'androidx.room:room-compiler:2.0.0'

// RxJava
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
Expand All @@ -101,8 +116,6 @@ dependencies {
// Debugging
implementation 'com.jakewharton.timber:timber:4.7.0'

kapt 'androidx.room:room-compiler:2.0.0-rc01'

feature project(':ui')
}

Expand Down
17 changes: 12 additions & 5 deletions base/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
android:name=".MHacksApplication"
android:allowBackup="true"
android:fullBackupContent="false"
android:icon="@mipmap/launcher_icon"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:logo="@mipmap/launcher_icon"
android:logo="@mipmap/ic_launcher"
android:theme="@style/SplashTheme"
android:title="com.mhacks.android.MHacks"
tools:ignore="GoogleAppIndexingWarning">
Expand Down Expand Up @@ -92,14 +92,21 @@
This is required if you want to do any message handling beyond receiving
notifications on apps in the background.
-->

<service
android:name=".data.network.fcm.FCMMessageHandler"
android:exported="false">
android:name=".data.network.fcm.FCMMessageHandler">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>

<meta-data android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@mipmap/ic_launcher_round" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/colorAccent" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="MHacks Group" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_api_key" />
Expand Down
Binary file modified base/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 0 additions & 34 deletions base/src/main/java/com/mhacks/app/data/Constants.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,5 @@ class SharedPreferencesManager(private val sharedPreferences: SharedPreferences)

private const val FLASH_ENABLED_KEY = "FLASH_ENABLED_KEY"

private const val IS_ADMIN_KEY = "IS_ADMIN_KEY"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class RetrofitException internal constructor(
/** The request URL which produced the error. */
val url: String?,
/** Response object containing status code, headers, body, etc. */
val response: Response<*>?,
private val response: Response<*>?,
/** The event kind which triggered this error. */
val kind: Kind,
val exception: Throwable?) : RuntimeException(message, exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import timber.log.Timber
import com.mhacks.app.R

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

override fun onNewToken(newToken: String?) {
super.onNewToken(newToken)
Timber.d("New Token is $newToken")

val intent = Intent(this, RegistrationIntentService::class.java)
startService(intent)
}
Expand Down
Loading

0 comments on commit edf4ae9

Please sign in to comment.