Skip to content

Commit

Permalink
feat: Fixed build fail
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya-gupta99 committed Dec 8, 2024
1 parent 061067b commit 7148115
Show file tree
Hide file tree
Showing 22 changed files with 194 additions and 207 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object NetworkModule {
baseManager.createService(
usernamePassword.first,
usernamePassword.second,
prefManager.getServerConfig.getInstanceUrl(),
prefManager.getServerConfig.getInstanceUrl().dropLast(3),
prefManager.getServerConfig.tenant,
false
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.mifos.feature.auth.login

import android.content.Context
import android.util.Log
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.mifos.core.common.utils.Network
Expand Down Expand Up @@ -64,7 +65,7 @@ class LoginViewModel @Inject constructor(
baseApiManager.createService(
username,
password,
prefManager.getServerConfig.getInstanceUrl(),
prefManager.getServerConfig.getInstanceUrl().dropLast(3),
prefManager.getServerConfig.tenant,
true
)
Expand All @@ -84,6 +85,7 @@ class LoginViewModel @Inject constructor(
is Resource.Error -> {
_loginUiState.value =
LoginUiState.ShowError(R.string.feature_auth_error_login_failed)
Log.e("@@@", "login: ${result.message}")
}

is Resource.Loading -> {
Expand Down
2 changes: 0 additions & 2 deletions mifosng-android/src/main/java/com/mifos/application/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import com.facebook.stetho.Stetho
import com.joanzapata.iconify.Iconify
import com.joanzapata.iconify.fonts.MaterialModule
import com.mifos.mifosxdroid.offlinejobs.OfflineJobCreator
import com.mifos.mobile.passcode.utils.ForegroundChecker
import com.mifos.utils.LanguageHelper.onAttach
import com.mifos.utils.ThemeHelper
import com.raizlabs.android.dbflow.config.FlowConfig
Expand Down Expand Up @@ -44,7 +43,6 @@ class App : MultiDexApplication() {
.detectFileUriExposure()
.build()
StrictMode.setVmPolicy(policy)
ForegroundChecker.init(this)
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ open class HomeActivity : ComponentActivity(), NavigationView.OnNavigationItemSe
super.onCreate(savedInstanceState)
binding = ActivityHomeBinding.inflate(layoutInflater)
setContentView(binding.root)
setSupportActionBar(toolbar)
// setSupportActionBar(toolbar)
appBarConfiguration = AppBarConfiguration.Builder()
.setDrawerLayout(binding.drawer)
.build()
Expand All @@ -58,7 +58,7 @@ open class HomeActivity : ComponentActivity(), NavigationView.OnNavigationItemSe
} else if (binding.navView.selectedItemId == R.id.navigation_dashboard) {
doubleBackToExit()
}
supportFragmentManager.popBackStackImmediate()
// supportFragmentManager.popBackStackImmediate()
}
})
}
Expand All @@ -74,7 +74,7 @@ open class HomeActivity : ComponentActivity(), NavigationView.OnNavigationItemSe
mDrawerLayout.closeDrawer(Gravity.LEFT);
return false;
}*/
clearFragmentBackStack()
// clearFragmentBackStack()
when (item.itemId) {
R.id.item_checker_inbox -> {
findNavController(R.id.nav_host_fragment).navigate(R.id.checkerInboxPendingTasksActivity)
Expand Down Expand Up @@ -170,23 +170,23 @@ open class HomeActivity : ComponentActivity(), NavigationView.OnNavigationItemSe
binding.navigationView.setNavigationItemSelectedListener(this as NavigationView.OnNavigationItemSelectedListener)

// setup drawer layout and sync to toolbar
val actionBarDrawerToggle: ActionBarDrawerToggle = object : ActionBarDrawerToggle(
this,
binding.drawer, toolbar, R.string.open_drawer, R.string.close_drawer
) {

override fun onDrawerOpened(drawerView: View) {
super.onDrawerOpened(drawerView)
setUserStatus(userStatusToggle)
hideKeyboard(binding.drawer)
}

override fun onDrawerSlide(drawerView: View, slideOffset: Float) {
if (slideOffset != 0f) super.onDrawerSlide(drawerView, slideOffset)
}
}
binding.drawer.addDrawerListener(actionBarDrawerToggle)
actionBarDrawerToggle.syncState()
// val actionBarDrawerToggle: ActionBarDrawerToggle = object : ActionBarDrawerToggle(
// this,
// binding.drawer, toolbar, R.string.open_drawer, R.string.close_drawer
// ) {
//
// override fun onDrawerOpened(drawerView: View) {
// super.onDrawerOpened(drawerView)
// setUserStatus(userStatusToggle)
// hideKeyboard(binding.drawer)
// }
//
// override fun onDrawerSlide(drawerView: View, slideOffset: Float) {
// if (slideOffset != 0f) super.onDrawerSlide(drawerView, slideOffset)
// }
// }
// binding.drawer.addDrawerListener(actionBarDrawerToggle)
// actionBarDrawerToggle.syncState()

// make an API call to fetch logged in client's details
loadClientDetails()
Expand All @@ -200,7 +200,7 @@ open class HomeActivity : ComponentActivity(), NavigationView.OnNavigationItemSe

override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == R.id.logout) {
logout()
// logout()
}
return super.onOptionsItemSelected(item)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.mifos.mifosxdroid.activity.login

import org.apache.fineract.client.models.PostAuthenticationResponse
import org.openapitools.client.models.PostAuthenticationResponse

/**
* Created by Aditya Gupta on 06/08/23.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import com.mifos.core.common.utils.Constants
import com.mifos.feature.settings.settings.SettingsScreen
import com.mifos.mifosxdroid.R
import com.mifos.mifosxdroid.activity.login.LoginActivity
import com.mifos.mifosxdroid.passcode.PassCodeActivity
import com.mifos.mobile.passcode.utils.PasscodePreferencesHelper

/**
* Created by mayankjindal on 22/07/17.
Expand All @@ -40,14 +37,14 @@ class SettingsFragment : Fragment() {
}
},
changePasscode = {
val passCodePreferencesHelper = PasscodePreferencesHelper(activity)
val currPassCode = passCodePreferencesHelper.passCode
passCodePreferencesHelper.savePassCode("")
val intent = Intent(requireContext(), PassCodeActivity::class.java).apply {
putExtra(Constants.CURR_PASSWORD, currPassCode)
putExtra(Constants.IS_TO_UPDATE_PASS_CODE, true)
}
startActivity(intent)
// val passCodePreferencesHelper = PasscodePreferencesHelper(activity)
// val currPassCode = passCodePreferencesHelper.passCode
// passCodePreferencesHelper.savePassCode("")
// val intent = Intent(requireContext(), PassCodeActivity::class.java).apply {
// putExtra(Constants.CURR_PASSWORD, currPassCode)
// putExtra(Constants.IS_TO_UPDATE_PASS_CODE, true)
// }
// startActivity(intent)
},
languageChanged = {
val intent = Intent(activity, activity?.javaClass)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ import android.view.MenuItem
import android.view.View
import android.view.inputmethod.InputMethodManager
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.SwitchCompat
import androidx.appcompat.widget.Toolbar
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import com.mifos.mifosxdroid.AndroidClientActivity
import com.mifos.mifosxdroid.R
import com.mifos.mifosxdroid.passcode.PassCodeActivity
import com.mifos.mobile.passcode.BasePassCodeActivity
import com.mifos.utils.Constants
import com.mifos.utils.LanguageHelper
import com.mifos.utils.PrefManager

/**
* @author fomenkoo
*/
open class MifosBaseActivity : BasePassCodeActivity(), BaseActivityCallback {
open class MifosBaseActivity : AppCompatActivity(), BaseActivityCallback {
var toolbar: Toolbar? = null
private var progress: ProgressDialog? = null
override fun setContentView(layoutResID: Int) {
Expand Down Expand Up @@ -159,8 +159,4 @@ open class MifosBaseActivity : BasePassCodeActivity(), BaseActivityCallback {
fm.popBackStack(backStackId, FragmentManager.POP_BACK_STACK_INCLUSIVE)
}
}

override fun getPassCodeClass(): Class<*> {
return PassCodeActivity::class.java
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package com.mifos.mifosxdroid.online.activate

import com.mifos.core.network.GenericResponse
import com.mifos.core.objects.client.ActivatePayload
import org.apache.fineract.client.models.PostCentersCenterIdResponse
import org.apache.fineract.client.models.PostClientsClientIdResponse
import org.openapitools.client.models.PostCentersCenterIdResponse
import org.openapitools.client.models.PostClientsClientIdResponse
import rx.Observable

/**
Expand All @@ -12,15 +12,15 @@ import rx.Observable

interface ActivateRepository {

fun activateClient(
suspend fun activateClient(
clientId: Int,
clientActivate: ActivatePayload?
): Observable<PostClientsClientIdResponse>
): PostClientsClientIdResponse

fun activateCenter(
suspend fun activateCenter(
centerId: Int,
activatePayload: ActivatePayload?
): Observable<PostCentersCenterIdResponse>
): PostCentersCenterIdResponse

fun activateGroup(
groupId: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import com.mifos.core.network.datamanager.DataManagerCenter
import com.mifos.core.network.datamanager.DataManagerClient
import com.mifos.core.network.datamanager.DataManagerGroups
import com.mifos.core.objects.client.ActivatePayload
import org.apache.fineract.client.models.PostCentersCenterIdResponse
import org.apache.fineract.client.models.PostClientsClientIdResponse
import org.openapitools.client.models.PostCentersCenterIdResponse
import org.openapitools.client.models.PostClientsClientIdResponse
import rx.Observable
import javax.inject.Inject

Expand All @@ -19,17 +19,17 @@ class ActivateRepositoryImp @Inject constructor(
private val dataManagerGroups: DataManagerGroups
) : ActivateRepository {

override fun activateClient(
override suspend fun activateClient(
clientId: Int,
clientActivate: ActivatePayload?
): Observable<PostClientsClientIdResponse> {
): PostClientsClientIdResponse {
return dataManagerClient.activateClient(clientId, clientActivate)
}

override fun activateCenter(
override suspend fun activateCenter(
centerId: Int,
activatePayload: ActivatePayload?
): Observable<PostCentersCenterIdResponse> {
): PostCentersCenterIdResponse {
return dataManagerCenter.activateCenter(centerId, activatePayload)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import com.mifos.core.network.GenericResponse
import com.mifos.core.objects.client.ActivatePayload
import com.mifos.mifosxdroid.R
import dagger.hilt.android.lifecycle.HiltViewModel
import org.apache.fineract.client.models.PostCentersCenterIdResponse
import org.apache.fineract.client.models.PostClientsClientIdResponse
import org.openapitools.client.models.PostCentersCenterIdResponse
import org.openapitools.client.models.PostClientsClientIdResponse
import rx.Subscriber
import rx.android.schedulers.AndroidSchedulers
import rx.schedulers.Schedulers
Expand All @@ -27,40 +27,40 @@ class ActivateViewModel @Inject constructor(private val repository: ActivateRepo
get() = _activateUiState

fun activateClient(clientId: Int, clientActivate: ActivatePayload?) {
_activateUiState.value = ActivateUiState.ShowProgressbar(true)
repository.activateClient(clientId, clientActivate)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(object : Subscriber<PostClientsClientIdResponse>() {
override fun onCompleted() {}
override fun onError(e: Throwable) {
_activateUiState.value = ActivateUiState.ShowError(e.message.toString())
}

override fun onNext(genericResponse: PostClientsClientIdResponse) {
_activateUiState.value =
ActivateUiState.ShowActivatedSuccessfully(R.string.client_activated_successfully)
}
})

}

fun activateCenter(centerId: Int, activatePayload: ActivatePayload?) {
_activateUiState.value = ActivateUiState.ShowProgressbar(true)
repository.activateCenter(centerId, activatePayload)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(object : Subscriber<PostCentersCenterIdResponse>() {
override fun onCompleted() {}
override fun onError(e: Throwable) {
_activateUiState.value = ActivateUiState.ShowError(e.message.toString())
}

override fun onNext(genericResponse: PostCentersCenterIdResponse) {
_activateUiState.value =
ActivateUiState.ShowActivatedSuccessfully(R.string.center_activated_successfully)
}
})
// _activateUiState.value = ActivateUiState.ShowProgressbar(true)
// repository.activateClient(clientId, clientActivate)
// .observeOn(AndroidSchedulers.mainThread())
// .subscribeOn(Schedulers.io())
// .subscribe(object : Subscriber<PostClientsClientIdResponse>() {
// override fun onCompleted() {}
// override fun onError(e: Throwable) {
// _activateUiState.value = ActivateUiState.ShowError(e.message.toString())
// }
//
// override fun onNext(genericResponse: PostClientsClientIdResponse) {
// _activateUiState.value =
// ActivateUiState.ShowActivatedSuccessfully(R.string.client_activated_successfully)
// }
// })
//
// }
//
// fun activateCenter(centerId: Int, activatePayload: ActivatePayload?) {
// _activateUiState.value = ActivateUiState.ShowProgressbar(true)
// repository.activateCenter(centerId, activatePayload)
// .observeOn(AndroidSchedulers.mainThread())
// .subscribeOn(Schedulers.io())
// .subscribe(object : Subscriber<PostCentersCenterIdResponse>() {
// override fun onCompleted() {}
// override fun onError(e: Throwable) {
// _activateUiState.value = ActivateUiState.ShowError(e.message.toString())
// }
//
// override fun onNext(genericResponse: PostCentersCenterIdResponse) {
// _activateUiState.value =
// ActivateUiState.ShowActivatedSuccessfully(R.string.center_activated_successfully)
// }
// })
}

fun activateGroup(groupId: Int, activatePayload: ActivatePayload?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CenterListFragment : MifosBaseFragment() {
savedInstanceState: Bundle?
): View {
return ComposeView(requireActivity()).apply {
(activity as HomeActivity).supportActionBar?.title = getString(R.string.centers)
// (activity as HomeActivity).supportActionBar?.title = getString(R.string.centers)
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
setContent {
// CenterListScreen(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import rx.Observable
*/
interface CenterListRepository {

fun getCenters(paged: Boolean, offset: Int, limit: Int): Observable<Page<Center>>
suspend fun getCenters(paged: Boolean, offset: Int, limit: Int): Page<Center>

suspend fun getCentersGroupAndMeeting(id: Int): CenterWithAssociations

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import javax.inject.Inject
class CenterListRepositoryImp @Inject constructor(private val dataManagerCenter: DataManagerCenter) :
CenterListRepository {

override fun getCenters(paged: Boolean, offset: Int, limit: Int): Observable<Page<Center>> {
override suspend fun getCenters(paged: Boolean, offset: Int, limit: Int): Page<Center> {
return dataManagerCenter.getCenters(paged, offset, limit)
}

Expand Down
Loading

0 comments on commit 7148115

Please sign in to comment.