Skip to content

Commit

Permalink
Merge branch 'main' into feature/AND-87_WC_library_update
Browse files Browse the repository at this point in the history
  • Loading branch information
zaiatsartem committed Nov 28, 2024
2 parents 6e134a5 + 33967e3 commit 9f5a8cf
Show file tree
Hide file tree
Showing 38 changed files with 132 additions and 32,481 deletions.
26 changes: 16 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,24 @@

- Optimized user experience during the onboarding process

### Changed

- When going to Concordex DEX, there's no need to select or copy account address,
as it is a WalletConnect-based DEX which fetches the wallet data itself.
- The "," separator sign used on all balances in the wallet - to make it easier to read
large numbers
- Use the new customizable page allowing pre-setting the address and the token for the Swipelux
payment gateway

## [1.3.2] - 2024-11-27

### Fixed

- Crash on launch when Google Play Services is disabled
- Inconsistent transaction fee for invoke smart contract
- Crashing when first launching the app offline
- Not receiving CIS-2 transaction notifications when they are disabled for CCD transactions

### Changed

- When going to Concordex DEX, there's no need to select or copy account address,
as it is a WalletConnect-based DEX which fetches the wallet data itself.
- The "," separator sign used on all balances in the wallet - to make it easier to read
large numbers
- Use the new customizable page allowing pre-setting the address and the token for the Swipelux
payment gateway

## [1.3.1] - 2024-11-07

### Fixed
Expand Down Expand Up @@ -145,7 +149,9 @@
attributes
- CIS-2 tokens with corrupted or missing metadata can no longer be added

[Unreleased]: https://github.com/Concordium/cryptox-android/compare/1.3.1...HEAD
[Unreleased]: https://github.com/Concordium/cryptox-android/compare/1.3.2...HEAD

[1.3.2]: https://github.com/Concordium/cryptox-android/compare/1.3.1...1.3.2

[1.3.1]: https://github.com/Concordium/cryptox-android/compare/1.3.0...1.3.1

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ Update the version in `main`, tag the commit with the version name and push the

APKs can be downloaded from the GitHub workflow artifacts or from the Firebase console.

This project is tested with BrowserStack.

### Building for release
Builds for releases tagged with semver version (`X.Y.Z`) or release candidate (`-rc.X`)
are assembled by the [corresponding pipeline](.github/workflows/release_build.yml).
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ android {
// https://semver.org/
def versionMajor = 1
def versionMinor = 3
def versionPatch = 1
def versionPatch = 2
def versionMeta = ""
def versionCodeIncremental = 1409
def versionCodeIncremental = 1416

compileSdkVersion 34

Expand Down
8 changes: 0 additions & 8 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -236,19 +236,11 @@
android:name=".ui.auth.setupbiometrics.AuthSetupBiometricsActivity"
android:screenOrientation="portrait"
android:theme="@style/CCX_Screen" />
<activity
android:name=".ui.identity.identitycreate.IdentityIntroFlow"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<activity
android:name=".ui.identity.identityproviderlist.IdentityProviderListActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/CCX_Screen" />
<activity
android:name=".ui.identity.identityproviderpolicywebview.IdentityProviderPolicyWebViewActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait" />
<activity
android:name=".ui.identity.identityproviderwebview.IdentityProviderWebviewActivity"
android:exported="true"
Expand Down
17 changes: 0 additions & 17 deletions app/src/main/assets/identity_intro_flow_en_1.html

This file was deleted.

22 changes: 0 additions & 22 deletions app/src/main/assets/identity_intro_flow_en_2.html

This file was deleted.

21 changes: 0 additions & 21 deletions app/src/main/assets/identity_intro_flow_en_3.html

This file was deleted.

20 changes: 0 additions & 20 deletions app/src/main/assets/identity_intro_flow_en_4.html

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class TransactionNotificationsManager(
get() = areNotificationsEnabled && notificationsPreferences.areCcdTxNotificationsEnabled

private val areCis2TxNotificationsEnabled: Boolean
get() = areNotificationsEnabled && notificationsPreferences.areCcdTxNotificationsEnabled
get() = areNotificationsEnabled && notificationsPreferences.areCis2TxNotificationsEnabled

@SuppressLint("MissingPermission")
fun notifyCcdTransaction(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class UpdateNotificationsSubscriptionUseCase(
private val accountRepository: AccountRepository,
private val notificationsPreferences: NotificationsPreferences,
private val notificationsBackend: NotificationsBackend,
private val application: Application
private val application: Application,
) {
constructor(application: Application) : this(
accountRepository = WalletDatabase.getDatabase(application).accountDao()
Expand All @@ -31,16 +31,28 @@ class UpdateNotificationsSubscriptionUseCase(
application = application
)

/**
* @return **true** on successful update
*/
suspend operator fun invoke(
isCcdTxEnabled: Boolean = notificationsPreferences.areCcdTxNotificationsEnabled,
isCis2TxEnabled: Boolean = notificationsPreferences.areCis2TxNotificationsEnabled
isCis2TxEnabled: Boolean = notificationsPreferences.areCis2TxNotificationsEnabled,
): Boolean {
val googleApiAvailability = GoogleApiAvailability.getInstance()
val resultCode = googleApiAvailability.isGooglePlayServicesAvailable(application)
var fcmToken = ""
val fcmToken = when (googleApiAvailability.isGooglePlayServicesAvailable(application)) {
ConnectionResult.SUCCESS -> {
try {
FirebaseMessaging.getInstance().token.await()
} catch (e: Exception) {
Log.e("token_not_available", e)
return false
}
}

if (resultCode == ConnectionResult.SUCCESS) {
fcmToken = FirebaseMessaging.getInstance().token.await()
else -> {
Log.e("google_api_not_available")
return false
}
}

val accounts = accountRepository.getAllDone()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.concordium.wallet.data.backend

import okhttp3.Cookie
import okhttp3.CookieJar
import okhttp3.HttpUrl

/**
* A simple [CookieJar] which stores the cookies in the memory, without a persistence.
*/
class InMemoryCookieJar : CookieJar {
private val cookieSet = mutableSetOf<StoredCookie>()

override fun loadForRequest(url: HttpUrl): List<Cookie> = synchronized(this) {
cookieSet.removeAll(StoredCookie::isExpired)
return@synchronized cookieSet.mapNotNull { it.takeIf { it.matches(url) }?.cookie }
}

override fun saveFromResponse(url: HttpUrl, cookies: List<Cookie>) {
synchronized(this) {
cookies.mapTo(cookieSet, ::StoredCookie)
}
}

private class StoredCookie(val cookie: Cookie) {
val isExpired: Boolean
get() = cookie.expiresAt < System.currentTimeMillis()

fun matches(url: HttpUrl) =
cookie.matches(url)

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is StoredCookie) return false

return this.cookie.name == other.cookie.name
&& this.cookie.domain == other.cookie.domain
&& this.cookie.path == other.cookie.path
&& this.cookie.secure == other.cookie.secure
&& this.cookie.hostOnly == other.cookie.hostOnly
}

override fun hashCode(): Int = with(cookie) {
var result = 17
result = 31 * result + name.hashCode()
result = 31 * result + domain.hashCode()
result = 31 * result + path.hashCode()
result = 31 * result + secure.hashCode()
result = 31 * result + hostOnly.hashCode()
return result
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package com.concordium.wallet.data.backend

import com.concordium.wallet.AppConfig
import com.google.gson.Gson
import com.ihsanbal.logging.Level
import com.ihsanbal.logging.LoggingInterceptor
import okhttp3.OkHttpClient
import okhttp3.internal.platform.Platform
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import java.util.concurrent.TimeUnit
import com.ihsanbal.logging.Level
import com.ihsanbal.logging.LoggingInterceptor

class ProxyBackendConfig(val gson: Gson) {

Expand All @@ -34,17 +34,16 @@ class ProxyBackendConfig(val gson: Gson) {
.readTimeout(30, TimeUnit.SECONDS)
.writeTimeout(30, TimeUnit.SECONDS)
.cache(null)
.cookieJar(InMemoryCookieJar())
.addInterceptor(ModifyHeaderInterceptor())
.addInterceptor(
LoggingInterceptor.Builder()
.setLevel(Level.BASIC)
.log(Platform.INFO)
// .logger(LoggerX())
.request("Request")
.response("Response")
.addHeader("Accept", "application/json")
.addHeader("Content-Type", "application/json")
// .addHeader("Authorization", t)
.build()
)

Expand All @@ -53,4 +52,4 @@ class ProxyBackendConfig(val gson: Gson) {
}
return okHttpClientBuilder.build()
}
}
}
12 changes: 0 additions & 12 deletions app/src/main/java/com/concordium/wallet/ui/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import com.concordium.wallet.ui.common.delegates.AuthDelegate
import com.concordium.wallet.ui.common.delegates.AuthDelegateImpl
import com.concordium.wallet.ui.common.delegates.IdentityStatusDelegate
import com.concordium.wallet.ui.common.delegates.IdentityStatusDelegateImpl
import com.concordium.wallet.ui.identity.identityproviderlist.IdentityProviderListActivity
import com.concordium.wallet.ui.more.import.ImportActivity
import com.concordium.wallet.ui.more.moreoverview.MoreOverviewFragment
import com.concordium.wallet.ui.news.NewsOverviewFragment
Expand All @@ -36,7 +35,6 @@ class MainActivity : BaseActivity(R.layout.activity_main, R.string.accounts_over
IdentityStatusDelegate by IdentityStatusDelegateImpl() {

companion object {
const val EXTRA_CREATE_FIRST_IDENTITY = "EXTRA_CREATE_FIRST_IDENTITY"
const val EXTRA_WALLET_CONNECT_URI = "wc_uri"
}

Expand Down Expand Up @@ -75,10 +73,6 @@ class MainActivity : BaseActivity(R.layout.activity_main, R.string.accounts_over
}

handlePossibleWalletConnectUri(intent)

if (intent.getBooleanExtra(EXTRA_CREATE_FIRST_IDENTITY, false)) {
goToFirstIdentityCreation()
}
}

override fun onResume() {
Expand Down Expand Up @@ -282,11 +276,5 @@ class MainActivity : BaseActivity(R.layout.activity_main, R.string.accounts_over
walletConnectViewModel.handleWcUri(walletConnectUri)
}
}

private fun goToFirstIdentityCreation() {
val intent = Intent(this, IdentityProviderListActivity::class.java)
intent.putExtra(IdentityProviderListActivity.SHOW_FOR_FIRST_IDENTITY, true)
startActivity(intent)
}
//endregion
}
Loading

0 comments on commit 9f5a8cf

Please sign in to comment.