Skip to content

Commit

Permalink
Merge pull request #412 from alephium/next
Browse files Browse the repository at this point in the history
Next
  • Loading branch information
nop33 authored Mar 8, 2024
2 parents 8160fb1 + 6c856e9 commit 65832ae
Show file tree
Hide file tree
Showing 74 changed files with 3,385 additions and 2,458 deletions.
5 changes: 5 additions & 0 deletions .changeset/brave-onions-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@alephium/mobile-wallet": patch
---

Sort tokens based on fiat worth
5 changes: 5 additions & 0 deletions .changeset/curly-zebras-hide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@alephium/mobile-wallet": patch
---

Always display WalletConnect icon if enabled in settings
5 changes: 5 additions & 0 deletions .changeset/empty-icons-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@alephium/mobile-wallet": patch
---

Clear WalletConnect cache when disabling WalletConnect
5 changes: 5 additions & 0 deletions .changeset/fresh-donkeys-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@alephium/mobile-wallet": patch
---

Display error when WalletConnect connection failed
5 changes: 5 additions & 0 deletions .changeset/lovely-ads-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@alephium/mobile-wallet": patch
---

Upgrade to Expo 50
5 changes: 5 additions & 0 deletions .changeset/quick-worms-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@alephium/mobile-wallet": patch
---

Display token prices
5 changes: 5 additions & 0 deletions .changeset/stale-moles-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@alephium/mobile-wallet": patch
---

Refactored the LandingScreen
5 changes: 5 additions & 0 deletions .changeset/thick-zebras-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"alephium-desktop-wallet": patch
---

Sort tokens based on fiat worth
6 changes: 0 additions & 6 deletions .github/workflows/deploy-mainnet-explorer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,3 @@ jobs:

- name: Notify CloudFront about the changes
run: aws cloudfront create-invalidation --distribution-id ${AWS_DISTRIBUTION_ID} --paths "/*"

- name: Deploy mainnet via webhook
uses: distributhor/workflow-webhook@v3
env:
webhook_url: ${{ secrets.MAINNET_WEBHOOK_URL }}
webhook_secret: ${{ secrets.MAINNET_WEBHOOK_SECRET }}
6 changes: 0 additions & 6 deletions .github/workflows/deploy-testnet-explorer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,3 @@ jobs:

- name: Notify CloudFront about the changes
run: aws cloudfront create-invalidation --distribution-id ${AWS_DISTRIBUTION_ID} --paths "/*"

- name: Deploy testnet via webhook
uses: distributhor/workflow-webhook@v3
env:
webhook_url: ${{ secrets.TESTNET_WEBHOOK_URL }}
webhook_secret: ${{ secrets.TESTNET_WEBHOOK_SECRET }}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You should have received a copy of the GNU Lesser General Public License
along with the library. If not, see <http://www.gnu.org/licenses/>.
*/

import { AddressHash, Asset, calculateAmountWorth, CURRENCIES, selectPriceById } from '@alephium/shared'
import { AddressHash, Asset, CURRENCIES } from '@alephium/shared'
import { motion } from 'framer-motion'
import { useEffect, useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
Expand Down Expand Up @@ -170,7 +170,6 @@ const TokenListRow = ({ asset, isExpanded }: TokenListRowProps) => {
const theme = useTheme()
const stateUninitialized = useAppSelector(selectIsStateUninitialized)
const fiatCurrency = useAppSelector((s) => s.settings.fiatCurrency)
const assetPrice = useAppSelector((s) => selectPriceById(s, asset.symbol || ''))

return (
<TableRow key={asset.id} role="row" tabIndex={isExpanded ? 0 : -1}>
Expand Down Expand Up @@ -213,13 +212,9 @@ const TokenListRow = ({ asset, isExpanded }: TokenListRowProps) => {
</AmountSubtitle>
)}
{!asset.symbol && <AmountSubtitle>{t('Raw amount')}</AmountSubtitle>}
{assetPrice && assetPrice.price !== null && asset?.verified && (
{asset.worth !== undefined && (
<Price>
<Amount
value={calculateAmountWorth(asset.balance, assetPrice.price)}
isFiat
suffix={CURRENCIES[fiatCurrency].symbol}
/>
<Amount value={asset.worth} isFiat suffix={CURRENCIES[fiatCurrency].symbol} />
</Price>
)}
</>
Expand Down
32 changes: 7 additions & 25 deletions apps/desktop-wallet/src/storage/addresses/addressesSelectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@ import {
AddressHash,
Asset,
calculateAmountWorth,
calculateAssetsData,
contactsAdapter,
NFT,
selectAllFungibleTokens,
selectAllNFTs,
selectAllPrices,
selectAllPricesHistories,
selectNFTIds,
sortAssets,
TokenDisplayBalances
} from '@alephium/shared'
import { ALPH } from '@alephium/token-list'
import { AddressGroup } from '@alephium/walletconnect-provider'
import { createSelector } from '@reduxjs/toolkit'
import { sortBy } from 'lodash'

import { addressesAdapter } from '@/storage/addresses/addressesAdapters'
import { RootState } from '@/storage/store'
Expand Down Expand Up @@ -84,31 +85,12 @@ export const makeSelectAddressesAlphAsset = () =>

export const makeSelectAddressesTokens = () =>
createSelector(
[selectAllFungibleTokens, selectAllNFTs, makeSelectAddressesAlphAsset(), makeSelectAddresses()],
(fungibleTokens, nfts, alphAsset, addresses): Asset[] => {
const tokens = getAddressesTokenBalances(addresses).reduce((acc, token) => {
const fungibleToken = fungibleTokens.find((t) => t.id === token.id)
const nftInfo = nfts.find((nft) => nft.id === token.id)
[selectAllFungibleTokens, selectAllNFTs, makeSelectAddressesAlphAsset(), makeSelectAddresses(), selectAllPrices],
(fungibleTokens, nfts, alphAsset, addresses, tokenPrices): Asset[] => {
const tokenBalances = getAddressesTokenBalances(addresses)
const tokens = calculateAssetsData([alphAsset, ...tokenBalances], fungibleTokens, nfts, tokenPrices)

acc.push({
id: token.id,
balance: BigInt(token.balance.toString()),
lockedBalance: BigInt(token.lockedBalance.toString()),
name: fungibleToken?.name ?? nftInfo?.name,
symbol: fungibleToken?.symbol,
description: fungibleToken?.description ?? nftInfo?.description,
logoURI: fungibleToken?.logoURI ?? nftInfo?.image,
decimals: fungibleToken?.decimals ?? 0,
verified: fungibleToken?.verified
})

return acc
}, [] as Asset[])

return [
alphAsset,
...sortBy(tokens, [(a) => !a.verified, (a) => a.verified === undefined, (a) => a.name?.toLowerCase(), 'id'])
]
return sortAssets(tokens)
}
)

Expand Down
34 changes: 15 additions & 19 deletions apps/mobile-wallet/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"

def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
Expand All @@ -11,11 +12,11 @@ react {
entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim())
reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc"
codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()

// Use Expo CLI to bundle the app, this ensures the Metro config
// works correctly with Expo projects.
cliFile = new File(["node", "--print", "require.resolve('@expo/cli')"].execute(null, rootDir).text.trim())
cliFile = new File(["node", "--print", "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim())
bundleCommand = "export:embed"

/* Folders */
Expand Down Expand Up @@ -79,7 +80,8 @@ def jscFlavor = 'org.webkit:android-jsc:+'
android {
ndkVersion rootProject.ext.ndkVersion

compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdk rootProject.ext.compileSdkVersion

namespace 'org.alephium.wallet'
defaultConfig {
Expand Down Expand Up @@ -112,6 +114,11 @@ android {
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
packagingOptions {
jniLibs {
useLegacyPackaging (findProperty('expo.useLegacyPackaging')?.toBoolean() ?: false)
}
}
}

// Apply static values from `gradle.properties` to the `android.packagingOptions`
Expand Down Expand Up @@ -141,33 +148,22 @@ dependencies {
def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
def isWebpAnimatedEnabled = (findProperty('expo.webp.animated') ?: "") == "true";
def frescoVersion = rootProject.ext.frescoVersion

// If your app supports Android versions before Ice Cream Sandwich (API level 14)
if (isGifEnabled || isWebpEnabled) {
implementation("com.facebook.fresco:fresco:${frescoVersion}")
implementation("com.facebook.fresco:imagepipeline-okhttp3:${frescoVersion}")
}

if (isGifEnabled) {
// For animated gif support
implementation("com.facebook.fresco:animated-gif:${frescoVersion}")
implementation("com.facebook.fresco:animated-gif:${reactAndroidLibs.versions.fresco.get()}")
}

if (isWebpEnabled) {
// For webp support
implementation("com.facebook.fresco:webpsupport:${frescoVersion}")
implementation("com.facebook.fresco:webpsupport:${reactAndroidLibs.versions.fresco.get()}")
if (isWebpAnimatedEnabled) {
// Animated webp support
implementation("com.facebook.fresco:animated-webp:${frescoVersion}")
implementation("com.facebook.fresco:animated-webp:${reactAndroidLibs.versions.fresco.get()}")
}
}

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.squareup.okhttp3', module:'okhttp'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
implementation("com.facebook.react:flipper-integration")

if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
Expand All @@ -176,5 +172,5 @@ dependencies {
}
}

apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
applyNativeModulesAppBuildGradle(project)

This file was deleted.

8 changes: 4 additions & 4 deletions apps/mobile-wallet/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
</queries>
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme">
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="49.0.0"/>
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="50.0.0"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS" android:value="0"/>
<activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode|locale|layoutDirection" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="portrait">
<activity android:name=".MainActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|uiMode|locale|layoutDirection" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:theme="@style/Theme.App.SplashScreen" android:exported="true" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand All @@ -31,10 +31,10 @@
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="org.alephium.wallet"/>
<data android:scheme="exp+alephium-mobile-wallet"/>
<data android:scheme="wc"/>
<data android:scheme="alephium"/>
<data android:scheme="org.alephium.wallet"/>
<data android:scheme="exp+alephium-mobile-wallet"/>
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false"/>
Expand Down
Loading

0 comments on commit 65832ae

Please sign in to comment.