Skip to content
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

Packaging and refactoring #21

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@
.externalNativeBuild
.cxx
local.properties
/app/google-services.json
google-services.json
9 changes: 9 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ plugins {
id ("androidx.navigation.safeargs.kotlin")
id ("com.google.firebase.crashlytics")
id ("kotlin-kapt")
id("com.google.dagger.hilt.android")
// id("dagger.hilt.android.plugin")
id ("com.google.firebase.firebase-perf")
}

Expand All @@ -25,6 +27,7 @@ android {

buildFeatures {
viewBinding = true
buildConfig = true
}

buildTypes {
Expand Down Expand Up @@ -71,6 +74,8 @@ dependencies {
testImplementation ("com.google.truth:truth:1.1.3")
androidTestImplementation ("androidx.test:runner:1.5.2")
androidTestImplementation ("androidx.test:rules:1.5.0")
androidTestImplementation ("com.google.dagger:hilt-android-testing:2.48")
kaptAndroidTest("com.google.dagger:hilt-android-compiler:2.48")


//Navigation
Expand Down Expand Up @@ -139,4 +144,8 @@ dependencies {

// In-app update
implementation ("com.google.android.play:core:1.10.3")

//DaggerHilt
implementation("com.google.dagger:hilt-android:2.48")
kapt("com.google.dagger:hilt-compiler:2.48")
}
48 changes: 0 additions & 48 deletions app/google-services.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.binay.shaw.justap.ui.authentication.signInScreen
package com.binay.shaw.justap.presentation.auth.sign_in

import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.ViewAssertion
Expand All @@ -10,7 +10,6 @@ import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.ext.junit.rules.ActivityScenarioRule
import com.binay.shaw.justap.R
import org.junit.Assert.*

import org.junit.Rule
import org.junit.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.binay.shaw.justap.helper
package com.binay.shaw.justap.utils

import com.binay.shaw.justap.helper.Validator.Companion.isValidEmail
import com.binay.shaw.justap.utils.Validator.Companion.isValidEmail
import org.junit.Assert.*
import org.junit.Test

Expand Down
13 changes: 7 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
android:name=".JusTap"
android:allowBackup="false"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="false"
Expand All @@ -25,10 +26,10 @@
android:name="firebase_performance_logcat_enabled"
android:value="true" />
<activity
android:name=".ui.introduction.onboarding.OnboardingScreen"
android:name=".presentation.intro.onboarding.OnboardingScreen"
android:exported="false" />
<activity
android:name=".ui.introduction.SplashActivity"
android:name=".presentation.intro.SplashActivity"
android:configChanges="uiMode"
android:exported="true"
android:screenOrientation="portrait">
Expand All @@ -43,7 +44,7 @@
android:value="" />
</activity>
<activity
android:name=".ui.authentication.ForgotPasswordScreen"
android:name=".presentation.auth.ForgotPasswordScreen"
android:configChanges="uiMode"
android:exported="true"
android:screenOrientation="portrait">
Expand All @@ -52,7 +53,7 @@
android:value="" />
</activity>
<activity
android:name=".ui.authentication.signInScreen.SignInScreen"
android:name=".presentation.auth.sign_in.SignInScreen"
android:configChanges="uiMode"
android:exported="true"
android:screenOrientation="portrait">
Expand All @@ -61,7 +62,7 @@
android:value="" />
</activity>
<activity
android:name=".ui.authentication.signUpScreen.SignUpScreen"
android:name=".presentation.auth.sign_up.SignUpScreen"
android:configChanges="uiMode"
android:exported="true"
android:screenOrientation="portrait">
Expand All @@ -70,7 +71,7 @@
android:value="" />
</activity>
<activity
android:name=".ui.mainScreens.MainActivity"
android:name=".presentation.main.MainActivity"
android:exported="true"
android:screenOrientation="portrait">
<meta-data
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/com/binay/shaw/justap/JusTap.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.binay.shaw.justap

import android.app.Application
import com.binay.shaw.justap.utils.Logger
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class JusTap: Application() {
override fun onCreate() {
super.onCreate()
Logger.debugLog("JusTap Application Created")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import android.view.ViewGroup
import androidx.navigation.findNavController
import androidx.recyclerview.widget.RecyclerView
import com.binay.shaw.justap.databinding.SocialAccountLayoutBinding
import com.binay.shaw.justap.helper.Util
import com.binay.shaw.justap.model.Accounts
import com.binay.shaw.justap.ui.mainScreens.homeScreen.HomeFragmentDirections
import com.binay.shaw.justap.utils.Util
import com.binay.shaw.justap.domain.model.Accounts
import com.binay.shaw.justap.presentation.main.homeScreen.HomeFragmentDirections


private var accountsList: List<Accounts> = ArrayList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.binay.shaw.justap.databinding.LayoutCustomizeQrRecyclerViewItemBinding
import com.binay.shaw.justap.model.CustomizeQROptions
import com.binay.shaw.justap.domain.model.CustomizeQROptions

private var options: List<CustomizeQROptions> = ArrayList()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.binay.shaw.justap.databinding.HistoryItemLayoutBinding
import com.binay.shaw.justap.helper.Util
import com.binay.shaw.justap.model.LocalHistory
import com.binay.shaw.justap.utils.Util
import com.binay.shaw.justap.domain.model.LocalHistory
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import android.view.ViewGroup
import androidx.core.content.res.ResourcesCompat
import androidx.recyclerview.widget.RecyclerView
import com.binay.shaw.justap.databinding.LanguageItemBinding
import com.binay.shaw.justap.model.Language
import com.binay.shaw.justap.domain.model.Language


class LanguageItemAdapter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.binay.shaw.justap.databinding.SocialAccountLayoutBinding
import com.binay.shaw.justap.helper.Util
import com.binay.shaw.justap.model.Accounts
import com.binay.shaw.justap.utils.Util
import com.binay.shaw.justap.domain.model.Accounts


class ResultItemAdapter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import androidx.core.content.res.ResourcesCompat
import androidx.recyclerview.widget.RecyclerView
import com.binay.shaw.justap.R
import com.binay.shaw.justap.databinding.SettingsItemBinding
import com.binay.shaw.justap.helper.DarkMode
import com.binay.shaw.justap.model.SettingsItem
import com.binay.shaw.justap.utils.DarkMode
import com.binay.shaw.justap.domain.model.SettingsItem

class SettingsItemAdapter(
val context: Context,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import android.view.View
import android.view.inputmethod.InputMethodManager
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import com.binay.shaw.justap.helper.DarkMode
import com.binay.shaw.justap.utils.DarkMode
import com.google.firebase.perf.FirebasePerformance
import com.google.firebase.perf.metrics.Trace
import java.util.Locale
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import androidx.core.content.res.ResourcesCompat
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
import com.binay.shaw.justap.R
import com.binay.shaw.justap.helper.Util.clearDataAndLogout
import com.binay.shaw.justap.utils.Util.clearDataAndLogout
import com.google.firebase.auth.FirebaseAuth
import com.tapadoo.alerter.Alerter

Expand Down
15 changes: 6 additions & 9 deletions app/src/main/java/com/binay/shaw/justap/base/ViewModelFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.viewmodel.CreationExtras
import com.binay.shaw.justap.viewModel.AccountsViewModel
import com.binay.shaw.justap.viewModel.LocalUserViewModel
import com.binay.shaw.justap.ui.mainScreens.historyScreen.LocalHistoryViewModel
import com.binay.shaw.justap.ui.mainScreens.homeScreen.accountFragments.AddEditViewModel
import com.binay.shaw.justap.ui.mainScreens.qrScreens.qrGeneratorScreen.QRGeneratorViewModel
import com.binay.shaw.justap.ui.mainScreens.resultScreen.ScanResultViewModel
import com.binay.shaw.justap.ui.mainScreens.settingsScreen.customize_qr.CustomizeQRViewModel
import com.binay.shaw.justap.ui.mainScreens.settingsScreen.editScreen.EditProfileViewModel
import com.binay.shaw.justap.presentation.main.historyScreen.LocalHistoryViewModel
import com.binay.shaw.justap.presentation.main.homeScreen.accountFragments.AddEditViewModel
import com.binay.shaw.justap.presentation.main.qrScreens.qrGeneratorScreen.QRGeneratorViewModel
import com.binay.shaw.justap.presentation.main.resultScreen.ScanResultViewModel
import com.binay.shaw.justap.presentation.main.settingsScreen.customize_qr.CustomizeQRViewModel
import com.binay.shaw.justap.presentation.main.settingsScreen.editScreen.EditProfileViewModel
import com.binay.shaw.justap.viewModel.FirebaseViewModel

/**
Expand Down Expand Up @@ -38,9 +38,6 @@ class ViewModelFactory : ViewModelProvider.Factory {
isAssignableFrom(EditProfileViewModel::class.java) -> {
EditProfileViewModel()
}
isAssignableFrom(AccountsViewModel::class.java) -> {
AccountsViewModel(application)
}
isAssignableFrom(LocalUserViewModel::class.java) -> {
LocalUserViewModel(application)
}
Expand Down
22 changes: 0 additions & 22 deletions app/src/main/java/com/binay/shaw/justap/data/AccountsDAO.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
package com.binay.shaw.justap.data
package com.binay.shaw.justap.data.local.database

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import com.binay.shaw.justap.model.Accounts
import com.binay.shaw.justap.model.Converters
import com.binay.shaw.justap.model.LocalHistory
import com.binay.shaw.justap.model.LocalUser
import com.binay.shaw.justap.data.local.db.AccountsDAO
import com.binay.shaw.justap.data.local.db.LocalHistoryDAO
import com.binay.shaw.justap.data.local.db.LocalUserDAO
import com.binay.shaw.justap.domain.model.Accounts
import com.binay.shaw.justap.domain.model.Converters
import com.binay.shaw.justap.domain.model.LocalHistory
import com.binay.shaw.justap.domain.model.LocalUser
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch

/**
* Created by binay on 02,January,2023
*/

@Database(entities = [LocalUser::class, Accounts::class, LocalHistory::class], version = 4)
@TypeConverters(Converters::class)
abstract class LocalUserDatabase : RoomDatabase() {
Expand All @@ -29,24 +28,17 @@ abstract class LocalUserDatabase : RoomDatabase() {

companion object {
@Volatile
var INSTANCE: LocalUserDatabase? = null
private var INSTANCE: LocalUserDatabase? = null

@Synchronized
fun getDatabase(context: Context): LocalUserDatabase {

val tempInstance = INSTANCE

if (tempInstance != null) {
return tempInstance
}
synchronized(this) {
return INSTANCE ?: synchronized(this) {
val instance = Room.databaseBuilder(
context.applicationContext,
LocalUserDatabase::class.java,
"account_database"
).build()
INSTANCE = instance
return instance
instance
}
}
}
Expand Down
Loading
Loading