Skip to content

latest reading, recent history and authentication features #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MinchalaVenkatSunil
Copy link

NOTE: Initially i have create a private repo and committed feature by feature and bug fixes and merged to the master by raising a pull request . Here I am committing all at once.

  1. latest screen: to display the latest timestamp data recent screen: to display all the recent timestamp data Login visibility
  2. Firebase authentication
  3. Error handling
  4. Added progress bar on Sign up or sign in
  5. Included navigation map functionality as we have more than one screen redefine folder structure for maintainability
  6. Scalability Bug fixing for auth logic
  7. partial cleanup
  8. Syntax rules
  9. Code comments or documentation
  10. Few proper naming conventions or corrections

TODO:

  1. Implementing test cases
  2. Logic implementation for sorting with name and category
  3. Use EncryptedSharedPreferences to store token or secure credential as applicable in future.

New thoughts are drafted in the at the end of readme file.

… feature and bug fixes and merged to the master by rasing a pull request . Here I am commiting all at once.

latest screen: to display the latest timestamp data
recent screen: to display all the recent timestamp data
Login visibility
Firebase authentication
Error handling
Added progress bar on Sign up or sign in
Included navigation map functionality as we have more than one screen
redefine folder structure for maintainability and scalability
Bug fixing for auth logic
partial cleanup
Syntax rules
Code comments or documentation
Few proper naming conventions or corrections

TODO:

test cases
Logic implementation for sorting with name and category
use EncryptedSharedPreferences to store token or secure credential

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manifest file to launch the Main Activity which is EnergyMeterActivity

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this Kotlin file, we have the base repository class. The safeApiCall function allows for safe execution of API calls with error handling. It utilizes Kotlin Flow to emit loading state, success, or failure based on the API call result or encountered exceptions.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Kotlin data class defines the structure for representing meter data, including category, unit, value, and variable name. The structure is used to model the data received from the meter.

TODO: Consider adding a GUID property to uniquely identify each meter data entry if needed for tracking or identification purposes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Kotlin data class defines the structure for an individual entry in the recent meter data list, including a GUID and a timestamp.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Kotlin interface represents the API service contract for fetching meter data and recent data from the server.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Kotlin sealed class represents the result of a network operation, which can be either loading, successful with data, or a failure with an error message.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Dagger Hilt module provides network-related dependencies such as OkHttpClient, Retrofit, and ApiService. It configures the HTTP client, logging, and base URL for API requests.


@Singleton
@Provides
fun provideLoggingInterceptor(): HttpLoggingInterceptor {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provides an instance of the HTTP logging interceptor used for logging network requests and responses. The logging level is set to 'BODY' for detailed logging.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Kotlin class represents the authentication fragment responsible for user login and signup. It uses ViewModel and data binding for handling user interactions and authentication.

TODO: Due to time constraint the comments in the code are missing for now. It's a good practice to provide the method and class comments for important stuff.

import com.tuf2000m.energymeter.data.model.recent.RecentData
import com.tuf2000m.energymeter.databinding.ItemRecyclerRecentsBinding

interface OnItemClickListener {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This interface defines a click listener for items in the RecyclerView. Implement it to handle item clicks.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Kotlin class represents a RecyclerView adapter for displaying recent items. It takes a list of recent items and an item click listener as parameters.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This XML layout represents the UI for the authentication screen. It includes EditTexts for email and password, a login button, a progress bar, and various constraints for proper positioning.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This XML file defines the navigation graph for the app, specifying the start destination as AuthFragment.

These elements define fragments within the navigation graph, including AuthFragment and HomeFragment. Each fragment is associated with a unique ID and class, and HomeFragment is linked to AuthFragment through a navigation action.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: customizing based on light and dark theme

Copy link
Author

@MinchalaVenkatSunil MinchalaVenkatSunil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request includes changes to several essential components of the app. Here's a brief overview:

  1. BaseRepository: Modified the base repository to handle safe API calls using Kotlin Flow, providing more robust error handling and better network result management.

  2. Data and RecentData classes: Added these data models to represent specific information related to the app's functionality, facilitating cleaner data management and usage.

  3. AuthFragment, RecentAdapter, and Navigation XML: Implemented key UI features like authentication flow, a RecyclerView adapter for recent data, and defined navigation flow between authentication and home fragments in the app.

The changes have been thoroughly tested and are ready for review. Your feedback and suggestions are highly appreciated. Thank you!

@MinchalaVenkatSunil MinchalaVenkatSunil marked this pull request as ready for review October 16, 2023 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant