Skip to content

Commit

Permalink
Merge pull request #441 from sora-xor/mwr-995
Browse files Browse the repository at this point in the history
Mwr 995
  • Loading branch information
arvifox authored Oct 24, 2024
2 parents f872f58 + f496554 commit b7f4fea
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 146 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ kotlin {
}

// soralution 138 3.8.5.0 2024.09.06
// sora dae 116 3.8.5.1 2024.10.23
// sora dae 118 3.8.5.3 2024.10.23

android {
namespace = "jp.co.soramitsu.sora"
Expand All @@ -30,8 +30,8 @@ android {
applicationId = "jp.co.soramitsu.sora"
minSdk = 26
targetSdk = 34
versionCode = System.getenv("CI_BUILD_ID")?.toInt() ?: 116
versionName = "3.8.5.1"
versionCode = System.getenv("CI_BUILD_ID")?.toInt() ?: 118
versionName = "3.8.5.3"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled = true
// resConfigs "en", "ru", "es", "fr", "de", "nb", "in", "tr", "ar"
Expand Down Expand Up @@ -172,7 +172,7 @@ play {
serviceAccountCredentials = file(System.getenv("CI_PLAY_KEY") ?: "../key/fake.json")
track = "internal"
releaseStatus = ReleaseStatus.DRAFT
releaseName = "3.8.5.1 - Bug fixes and minor improvements"
releaseName = "3.8.5.3 - Bug fixes and minor improvements"
defaultToAppBundles = true
}

Expand Down
9 changes: 0 additions & 9 deletions feature_wallet_impl/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />

<application>
<service
android:name="androidx.work.impl.foreground.SystemForegroundService"
android:foregroundServiceType="dataSync"
tools:node="merge" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

package jp.co.soramitsu.feature_wallet_impl.presentation.claim

import android.Manifest
import android.os.Build
import android.os.Bundle
import android.view.View
import androidx.compose.foundation.Image
Expand All @@ -50,7 +48,6 @@ import androidx.fragment.app.viewModels
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
import androidx.navigation.compose.composable
import com.permissionx.guolindev.PermissionX
import dagger.hilt.android.AndroidEntryPoint
import jp.co.soramitsu.androidfoundation.intent.ShareUtil
import jp.co.soramitsu.common.R
Expand Down Expand Up @@ -84,20 +81,8 @@ class ClaimFragment : SoraBaseFragment<ClaimViewModel>() {
viewModel.claimScreenState.observeAsState().value?.let {
ClaimScreen(
claimState = it,
onSubmitClicked = {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
PermissionX.init(this@ClaimFragment)
.permissions(Manifest.permission.POST_NOTIFICATIONS)
.request { allGranted, _, _ ->
if (allGranted) {
viewModel.nextButtonClicked(this@ClaimFragment)
}
}
} else {
viewModel.nextButtonClicked(this@ClaimFragment)
}
},
onContactUsClicked = viewModel::contactsUsClicked
onSubmitClicked = viewModel::nextButtonClicked,
onContactUsClicked = viewModel::contactsUsClicked,
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,28 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

package jp.co.soramitsu.feature_wallet_impl.presentation.claim

import androidx.fragment.app.Fragment
import androidx.lifecycle.LiveData
import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import jp.co.soramitsu.androidfoundation.coroutine.CoroutineManager
import jp.co.soramitsu.androidfoundation.fragment.SingleLiveEvent
import jp.co.soramitsu.common.R
import jp.co.soramitsu.common.domain.OptionsProvider
import jp.co.soramitsu.common.logger.FirebaseWrapper
import jp.co.soramitsu.common.presentation.viewmodel.BaseViewModel
import jp.co.soramitsu.feature_wallet_api.domain.interfaces.WalletInteractor
import jp.co.soramitsu.feature_wallet_api.domain.model.MigrationStatus
import jp.co.soramitsu.feature_wallet_api.launcher.WalletRouter
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

@HiltViewModel
class ClaimViewModel @Inject constructor(
private val router: WalletRouter,
private val walletInteractor: WalletInteractor,
private val coroutineManager: CoroutineManager,
) : BaseViewModel() {

private val _openSendEmailEvent = SingleLiveEvent<String>()
Expand Down Expand Up @@ -85,10 +88,21 @@ class ClaimViewModel @Inject constructor(
_openSendEmailEvent.postValue(OptionsProvider.email)
}

fun nextButtonClicked(fragment: Fragment) {
_claimScreenState.value?.let {
_claimScreenState.value = it.copy(loading = true)
fun nextButtonClicked() {
viewModelScope.launch {
_claimScreenState.value?.let {
_claimScreenState.value = it.copy(loading = true)
}
withContext(coroutineManager.io) {
val result = runCatching { walletInteractor.migrate() }.getOrElse {
FirebaseWrapper.recordException(it)
false
}
FirebaseWrapper.log("SORA migration done $result")
walletInteractor.saveMigrationStatus(
if (result) MigrationStatus.SUCCESS else MigrationStatus.FAILED
)
}
}
ClaimWorker.start(fragment.requireContext())
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

package jp.co.soramitsu.feature_wallet_impl.presentation.claim

import android.content.Context
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import jp.co.soramitsu.androidfoundation.resource.ResourceManager
import jp.co.soramitsu.androidfoundation.coroutine.CoroutineManager
import jp.co.soramitsu.androidfoundation.testing.MainCoroutineRule
import jp.co.soramitsu.feature_wallet_api.domain.interfaces.WalletInteractor
import jp.co.soramitsu.feature_wallet_api.domain.model.MigrationStatus
Expand Down Expand Up @@ -66,24 +65,25 @@ class ClaimViewModelTest {
@get:Rule
var mainCoroutineRule = MainCoroutineRule()

@Mock
private lateinit var context: Context

@Mock
private lateinit var walletInteractor: WalletInteractor

@Mock
private lateinit var router: WalletRouter

@Mock
private lateinit var resourceManager: ResourceManager
private lateinit var cm: CoroutineManager

private lateinit var viewModel: ClaimViewModel

@Before
fun setUp() {
given(walletInteractor.observeMigrationStatus()).willReturn(flow { emit(MigrationStatus.SUCCESS) })
viewModel = ClaimViewModel(router, walletInteractor)
viewModel = ClaimViewModel(
router,
walletInteractor,
cm,
)
}

@Test
Expand Down

0 comments on commit b7f4fea

Please sign in to comment.