Skip to content

Instantly share code, notes, and snippets.

@Audhil
Created September 30, 2020 14:34
Show Gist options
  • Save Audhil/3b8e2cba291fa53bf3182928342710cf to your computer and use it in GitHub Desktop.
Save Audhil/3b8e2cba291fa53bf3182928342710cf to your computer and use it in GitHub Desktop.
designing a Swiggy app!
Designing Swiggy-app!
requirements
Kotlin
MVVM - MVI etc
android arch components
Dagger-Hilt, MockK
retrofit2
kotlin coroutines
multi geographic & accessibility
flavors
jP strings - based on user device language
security
design
ask location permission
it'll get your curreent location
dashboard
offers, restaurants, coupens, if order is confirmed you'll track delivery boy live location
search
restaurant, food
choose -> make menu -> order(cart+payment)
settings / account
user minimal, logout etc.
MVVM
Coroutines
ROOM DB, LiveData
getting User location - scenario
it'll ask the permission - location - deny - we'll educate - allow
track the location
make an api to backend details to shown in dashboard - activity <- viewModel <- repository <- success -
populate views - recyclerview
order tracking
delivery boy -> he'll share location with Swiggy backend -> google location apis -> periodic tracking
when open
data bar -> delivery boy's details -> google map
websocket -> swiggy backend
make websocket connection
SocketUtilClass -> make, disconnect, handle msgs ->
DashBoardViewClass
DashBoardViewModel
DashBoardRepository ->
msg from SocketUtilClass -> orderLiveData(Mutable) -> _orderLiveData(Immutable) DashBoardViewModel -> DashBoardView -> I'll do UI changes
only in foreground
in bg -> disconnect websocket
kill app -> disconnect websocket
interface APIs{
suspend fun getMenu() : List<Items>
}
DashBoardRepository()
suspend getMenu(){
retrofitServce.getMenu()
}
DashBoardViewModel
repository
fun getMenu(){
viewmodelscope.launch{
repo.getmenu()
}
}
Dagger-Hilt -> FakeRepository
DashBoardViewModelTest{
@Test
fun getMenuTest(){
// given
fake.getMenu -> itemsList(FakeList)
// when
}
}
polling -> https
fcm ->
main() {
(1,2,3,4).forEach{
it.mapIs{
}
}
}
emitted.mapIs(callBack: (Boolean) -> Unit){
val isAvailable = this.map{
it * 2
}.map{
val value = it + 5
value
}.map{
it % 2 == 0
}.toBoolean()
callback.invoke(isAvailable)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment