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

Commit

Permalink
Updated QR Scan activity to show response & FCM icon
Browse files Browse the repository at this point in the history
  • Loading branch information
shashankmurching committed Oct 12, 2018
1 parent 2f18e7a commit 8e07799
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ 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

/**
* Service for handling push notifications.
Expand All @@ -25,6 +26,7 @@ class FCMMessageHandler : FirebaseMessagingService() {
private fun createNotification(notification: RemoteMessage.Notification) {
val builder = NotificationCompat.Builder(baseContext, mhacksGroup)
.setDefaults(Notification.DEFAULT_ALL)
.setSmallIcon(R.mipmap.ic_launcher_round)
.setContentTitle(notification.title)
.setContentText(notification.body)
.setVibrate(longArrayOf(1000, 1000, 1000, 1000, 1000))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class MapViewFragment :
BuildConfig.LNG
)
)
.zoom(16.5f)
.zoom(17.5f)
.bearing(0f)
.tilt(0f)
.build()
Expand Down
15 changes: 14 additions & 1 deletion ui/src/main/java/com/mhacks/app/ui/qrscan/QRScanActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import android.view.ScaleGestureDetector
import android.view.View
import androidx.annotation.NonNull
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.AlertDialogLayout
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.google.android.gms.common.ConnectionResult
Expand All @@ -30,6 +31,8 @@ import com.google.android.gms.vision.MultiProcessor
import com.google.android.gms.vision.barcode.Barcode
import com.google.android.gms.vision.barcode.BarcodeDetector
import com.google.android.material.snackbar.Snackbar
import com.mhacks.app.adapter.setTextMessage
import com.mhacks.app.data.models.common.TextMessage
import com.mhacks.app.extension.viewModelProvider
import com.mhacks.app.ui.common.BaseActivity
import com.mhacks.app.ui.qrscan.widget.BarcodeGraphic
Expand Down Expand Up @@ -107,7 +110,16 @@ class QRScanActivity:

private fun subscribeUi() {
qrScanViewModel?.verifyTicket?.observe(this, Observer {
showToast(R.string.checked_in)
var response = ""
for (feedback in it ) {
response += feedback.label + ": " + feedback.value + "\n"
}

AlertDialog.Builder(this)
.setTitle("QR Response")
.setMessage(response)
.setPositiveButton("Ok") { dialog, which -> Timber.i(response) }
.show()
})

qrScanViewModel?.snackBarMessage?.observe(this, Observer {
Expand Down Expand Up @@ -142,6 +154,7 @@ class QRScanActivity:
}

findViewById<View>(R.id.topLayout).setOnClickListener(listener)

Snackbar.make(graphicOverlay!!, R.string.permission_camera_rationale,
Snackbar.LENGTH_INDEFINITE)
.setAction(R.string.ok, listener)
Expand Down

0 comments on commit 8e07799

Please sign in to comment.