SHORT DESCRIPTION
🚧 This app is currently under development 🚧
This is social media application made using Kotlin and Firebase App is made using Jetpack Compose and Kotlin For database features, Firebase is used.
To be added..
📂src/
├── 📂androidTest/
├── 📂main/
│ ├── 📂java/{app_name}/
│ │ ├── 📂data/
│ │ ├── 📂di/
│ │ ├── 📂domain/
│ │ ├── 📂presentation/
│ │ ├── 📂ui/
│ │ ├── 📂utils/
│ │ ├── 📃MainActivity.kt
│ │ ├── 📃JNViewModel.kt
│ │ └── 📃JNApplication.kt
│ └── 📂res/
└── 📂test/
└── 📂java/{app_name}/
data
- contains the implementation of the firebase repository functionsdi
- contains the dependency injection filesdomain
- contains the interfaces, and modelspresentation
- contains the viewmodels and composablesui
- contains Theme, Typography and Colors files, and Main UI Stateutils
- contains utility functions likes, name formatters, date formatters, etc.
To be added ...
- For
login
®istration
- Google FirebaseAuth is used, Other than that, Anonymous user and email & password login is also supported. - The latest
Android Credential Manager
API is being is used in this application, for seamless login and registration. See API here - On the app startup,
Anonymous User
is created in the background, so that if someone does not want to login with credentials, can skip the login process.
- Currently in the feed page, displays all the posts, which are set to
public
visibility. - Users can
comment
,like
the post. - Each
Feed Item
has comment button, which opens up aModal Bottom Sheet
, that renders the comments related to that post.
- Currently
Anonymous Users
cannot create posts with public visibility. This is done to mimic how a real world can give certain features of the app for testing purposes.
- When user opens the
ConversationList
Screen then, achat user
is created for easing fetching and search, as Firebase Auth does not allow querying on other users. ConversationList
has aSearch bar
which helps in finding users. The query used in searching users isThis is used, as firebase does not have query operations, and recommends using Third Party APIs like ElasticSearch, TypeSense, etc. This is a simpler version.override suspend fun getUsers(searchQuery: String): List<User> { val searchQueryLC = searchQuery.lowercase() return Firebase.firestore .collection(USERS_COLLECTION) .whereGreaterThanOrEqualTo(DISPLAY_NAME_FIELD, searchQueryLC) .whereLessThanOrEqualTo(DISPLAY_NAME_FIELD, searchQueryLC + '\u8FFF') .get() .await() .toObjects<User>() .filter { user -> user.id != authRepository.currentUserId } }
- A
compositeId
is stored in the database, for easing searching, alsooverride suspend fun conversationExists(targetUser: User): Boolean { val currentUserId = authRepository.currentUserId val pair1 = "${currentUserId}_${targetUser.id}" val pair2 = "${targetUser.id}_${currentUserId}" return !Firebase.firestore .collection(CONVERSATION_COLLECTION) .whereIn(COMPOSITE_FIELD, listOf(pair1, pair2)) .get() .await() .isEmpty }