Coder Social home page Coder Social logo

make-it-so-android's Introduction

showcase.mp4

Make it So

This is a sample Android app that demonstrates how to use Firebase Authentication, Crashlytics, Cloud Firestore, Performance Monitoring and Remote Config with Jetpack Compose UI. Make it So is a simple to-do list application that allows the user to add and edit to-do items, add flags, priorities, due dates, and mark the tasks as completed.

To explain how each product above was used in the code, we've written a series of articles that delve into creating this app from scratch. Navigate to part 1 of this series to understand how this app is structured. There you will find the links to all articles in the series.

Setting up

In order for this app to work, you will need to create a Firebase project:

  • Clone this repository
  • Create a Firebase project in the Firebase Console
  • Follow these steps to register Make it So app in your Firebase project
  • Follow these steps to add the Firebase Android configuration file to Make it So
  • Create a Cloud Firestore database in your Firebase project
  • Enable Anonymous Authentication in your Firebase project
  • Enable Email/Password Authentication in your Firebase project
  • Run the app using Android Studio Flamingo+ on a device/emulator with API level 21 or above
  • Create your first to-do item in the app
  • In the Firebase console, navigate to the Firestore Indexes tab
  • Create a new composite index for the collection tasks with 2 fields: userId and createdAt (both Ascending)
  • Choose the "Collection" option in Query scopes (you won't be using collectionGroup in this app)

This index is necessary when fetching documents because this app uses where and orderBy operators in different fields: where uses the userId field and orderBy uses the createdAt field (see StorageServiceImpl). Learn more on the Firebase documentation about Index types.

Contact

Please navigate to the discussions page if you have any questions or want to suggest changes to the Make it So app.

make-it-so-android's People

Contributors

jonsmirl avatar juanalejandro avatar marinacoelho avatar riyasvaliyadan avatar thatfiredev avatar vkryachko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

make-it-so-android's Issues

Use Firestore's auto-generated id instead of a random UUID

I've noticed how this app is using UUID.randomUUID().toString() to generate a document ID and save it on Firestore:

Firebase.firestore
.collection(TASK_COLLECTION)
.document(task.id)
.set(task)
.addOnCompleteListener { onResult(it.exception) }

It would be nice to demonstrate Firestore's auto-generated ids instead:

 Firebase.firestore 
     .collection(TASK_COLLECTION) 
     .add(task) 
     .addOnCompleteListener { onResult(it.exception) } 

And when reading the tasks, we'd manually set the id:

value?.documentChanges?.forEach {
    val wasDocumentDeleted = it.type == REMOVED
    val task = it.document.toObject<Task>().apply { task.id = it.document.id  }
    onDocumentEvent(wasDocumentDeleted, task)
}

viewModelScope.launch(showErrorExceptionHandler) what is this?

Could you tell me, please, in simple words, what does the line mean?
viewModelScope.launch(showErrorExceptionHandler)

  1. In which Dispatcher does the coroutine run?
  2. How to run in Dispatchers.IO or do I need to add withContext(Dispatchers.IO) later?

Multiple snackbar messages shown

An old Snackbar message gets displayed when launching the app from the recent list

Steps to reproduce

  • Open the app, and do anything to trigger Snackbar message i.e. invalid login
  • Close the app by clicking the back button
  • Reopen the app from the recent app list
  • Snackbar message will be displayed

Create Account doesn't work.

I followed the four steps from the Codelab section (#3 Firebase Authentication) and ran the application in the Simulator.

I tried to create an Account, but when I click the "create account" button, it "clicks" but nothing happens. Firestore Authentication doesn't show a new entry, the create account screen is still visible.

I also tried to use the code from the completed project I downloaded from GitHub. I also compared it to the code I modified from the Codelab - my changes are the same lines found in the completed project.

Error linking account

Hi, I'm following this tutorial and when I reach the Firebase Authentication step, I get the following snackbar error while trying to create an account:

The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section [ Please verify the new email before changing email. ]

However, in the Firebase Console I've already added the access provider for email/password (and the anonymous, which is added by default), both have a green tick saying correctly enabled.

I've recreated the Firebase project and the local code, and reproduced the steps (there are very few steps) as straightforward as possible, but I still get this error.

Any ideas of why this could be happening?

The given sign-in provider is disabled for this Firebase project

Hello, I've been following the steps outlined in this codelab (https://firebase.google.com/codelabs/build-android-app-with-firebase-compose). However, upon reaching step 3 and attempting to create an account using my email and password, I encounter an error message stating, "The given sign-in provider is disabled for this Firebase project." I've already added both the email/password and anonymous sign-in providers in the Firebase console. I believe the issue doesn't lie with the google-services.json file since the Anonymous sign-in provider functions correctly (an anonymous user is created every time I uninstall and run the app again). Could you assist me in resolving this problem?

Where is TASK_DEFAULT_ID?

In the code I see a reference to TASK_DEFAULT _ID, but there is no such file. Am I missing anything?

@Preview

Can you make @Preview work for the screens in Android Studio? I can't figure out how to deal with the injected parameters using Preview.

The EditTask ViewModel is not being initialized correctly.

The way code is written it will reinitialize the viewmodel on each compose (rotate the phone).

LaunchedEffect(Unit) { viewModel.initialize(taskId) }

Instead the ViewModel should have code like this

class EditTaskViewModel @Inject constructor(
  savedStateHandle: SavedStateHandle,
  logService: LogService,
  private val storageService: StorageService,
) : MakeItSoViewModel(logService) {
    val task = mutableStateOf(Task())

    init {
        val taskId = savedStateHandle.get<String>(TASK_ID)
        launchCatching {
            if (taskId != TASK_DEFAULT_ID) {
              task.value = storageService.getTask(taskId.idFromParameter()) ?: Task()
            }
        }
    }

Then remove the taskId parameter on the Screen

fun EditTaskScreen(
  popUpScreen: () -> Unit,
  taskId: String,   ----> remove this
  modifier: Modifier = Modifier,
  viewModel: EditTaskViewModel = hiltViewModel()
) {

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.