Skip to content

amrk000/Daily-Deal-Android-App

Repository files navigation

Repo Cover

Simple MVVM android app that built with local database using room. It allows ordering one deal per day for user. Providing admin dashboard to add, delete & update data.

App Features:

  • Ordering Meals (One Per Day)
  • tracking orders history
  • Admin dashboard
  • Permissions & Roles Management based on permission matrix Json file
  • Built using Mvvm, RoomDB, Kotlin coroutines
  • Contains Implementation for:
    • DateTimeHelper to convert UTC DatTime to local with specific pattern
    • ImageBase64Converter to convert Images from/to Base64
    • TextFieldValidator to validate text fields using regex

Video Demo:

Daily.Deal.Demo-1.mp4

App Apk:

Database ERD:

Daily Deal ERD

Json Configs:

default data are stored in project/raw as json files you can edit them

default_permissions.json (roles and permissions data)

edit to change roles permissions

[
    {
        "addItem": true,
        "adminDashboard": true,
        "deleteItem": true,
        "editItem": true,
        "orderItem": true,
        "role": "admin"
    },
    {
        "addItem": false,
        "adminDashboard": false,
        "deleteItem": false,
        "editItem": false,
        "orderItem": true,
        "role": "user"
    }
]

default_users.json (contains default admin)

[
  {
    "address": "-",
    "email": "admin@dailydeal.co",
    "id": 0,
    "name": "admin",
    "password": "Admin123456789$",
    "phone": "0",
    "role": "admin"
  }
]

Random data generator code to populate database

        lifecycleScope.launch {
            for(day in arrayOf("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")){
                for(i in 0..10){

                    val images = arrayOf(R.drawable.test_image1, R.drawable.test_image2, R.drawable.test_image3)

                    val base64Image = ImageBase64Converter.encode(ContextCompat.getDrawable(applicationContext, images.random())!!,false)

                    AppDatabase.get(applicationContext).dao().addItem(ItemData(
                        name= arrayOf("Family Meal", "Ranchit", "Beef Bomb", "Chicken Fajita", "Urban X").random(),
                        description = "description text test",
                        restaurant = arrayOf("Big Meal", "EatMore", "Grilled", "Chief Ahmed", "Fast & Food").random(),
                        image = base64Image,
                        originalPrice = DecimalFormat("#.#").format(Random.nextDouble(80.0, 150.0)).toDouble(),
                        discountPrice = DecimalFormat("#.#").format(Random.nextDouble(50.0, 120.0)).toDouble(),
                        day = day.uppercase()
                    ))

                }
            }
        }

About

Simple android app built with local database

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages