Skip to content

Commit

Permalink
Merge branch 'main' into qa/new-1211
Browse files Browse the repository at this point in the history
  • Loading branch information
eunjisong authored Dec 18, 2024
2 parents 213bc98 + 70f9b30 commit 4fee29b
Show file tree
Hide file tree
Showing 77 changed files with 1,958 additions and 227 deletions.
17 changes: 17 additions & 0 deletions bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,20 @@ workflows:
- tag: default
- abi: x86_64
- profile: pixel_4
_install-old-android-version:
steps:
- script-runner@0:
title: Update Android Test
is_always_run: true
inputs:
- file_path: e2e/tests/updateAppVersion/loginWithOlderVersion.sh
_install-latest-android-version:
steps:
- script-runner@0:
title: Update Android Test
is_always_run: true
inputs:
- file_path: e2e/tests/updateAppVersion/updateToLatestVersion.sh
_pull_app_files:
steps:
- pull-intermediate-files@1:
Expand Down Expand Up @@ -437,6 +451,7 @@ workflows:
- build_gradle_path: $BITRISE_SOURCE_DIR/$ANDROID_PROJECT_LOCATION/app/build.gradle
- share-pipeline-variable@1:
inputs:
- is_skippable: true
- variables: |-
APP_VERSION=$APP_VERSION
BUILD_NUMBER=$BUILD_NUMBER
Expand Down Expand Up @@ -776,6 +791,8 @@ workflows:
- _pull_external_app_files
after_run:
- _run_android_detox_tests
- _install-old-android-version
- _install-latest-android-version
- _upload-detox-artifacts
- _send-test-result-notification-slack
envs:
Expand Down
4 changes: 4 additions & 0 deletions packages/core-mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"
apply plugin: 'kotlin-kapt'

/**
* This is the configuration block to customize your React Native Android app.
Expand Down Expand Up @@ -144,6 +145,9 @@ dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'com.google.firebase:firebase-messaging:24.0.1'

implementation 'com.github.bumptech.glide:glide:4.12.0'
kapt 'com.github.bumptech.glide:compiler:4.12.0'

// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")

Expand Down
13 changes: 3 additions & 10 deletions packages/core-mobile/android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,9 @@
@org.greenrobot.eventbus.Subscribe <methods>;
}

# react-native-fast-image
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
-keep public class com.dylanvann.fastimage.* {*;}
-keep public class com.dylanvann.fastimage.** {*;}
-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}
# expo-image
-keep public class com.bumptech.glide.** { *; }
-keep @com.bumptech.glide.annotation.GlideModule class *

# react-native-skia
-keep class com.shopify.reactnative.skia.** { *; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.avaxwallet

import com.bumptech.glide.annotation.GlideModule
import com.bumptech.glide.module.AppGlideModule

@GlideModule
class CustomGlideModule : AppGlideModule() {}
24 changes: 16 additions & 8 deletions packages/core-mobile/app/components/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import BitcoinSVG from 'components/svg/BitcoinSVG'
import { TokenSymbol } from 'store/network'
import { SvgUri } from 'react-native-svg'
import { formatUriImageToPng, isContentfulImageUri } from 'utils/Contentful'
import FastImage from 'react-native-fast-image'
import { Image } from 'expo-image'
import { Text, useTheme, View } from '@avalabs/k2-mobile'
import { useGetInitials } from 'hooks/useGetInitials'
import { SuggestedSiteName } from 'store/browser/const'
Expand Down Expand Up @@ -90,30 +90,33 @@ const AvatarBase: FC<AvatarBaseProps> = ({
)
}

const borderWidth = showBorder ? 0.5 : 0
const borderColor = showBorder ? '$neutral800' : 'unset'

return logoUri?.endsWith('svg') && !isContentfulImageUri(logoUri) ? (
<SvgUri
uri={logoUri}
width={size}
height={size}
style={{
borderRadius: size,
backgroundColor: backgroundColor
backgroundColor: backgroundColor,
borderWidth,
borderColor
}}
onLoad={() => setFailedToLoad(false)}
onError={() => setFailedToLoad(true)}
testID="avatar__logo_avatar"
/>
) : (
<FastImage
// TODO: remove this workaround when we have a proper solution
// workaround for images not appearing
// https://github.com/DylanVann/react-native-fast-image/issues/974
fallback={true}
<Image
style={{
borderRadius: size,
width: size,
height: size,
backgroundColor: backgroundColor
backgroundColor: backgroundColor,
borderWidth,
borderColor
}}
source={{
uri: isContentfulImageUri(logoUri)
Expand All @@ -123,6 +126,7 @@ const AvatarBase: FC<AvatarBaseProps> = ({
onLoad={() => setFailedToLoad(false)}
onError={() => setFailedToLoad(true)}
testID="avatar__logo_avatar"
contentFit="contain"
/>
)
}
Expand All @@ -133,6 +137,8 @@ interface TokenAvatarProps {
logoUri: string | undefined
size?: number
testID?: string
backgroundColor?: string
showBorder?: boolean
}

const TokenAvatar: FC<TokenAvatarProps> = props => {
Expand All @@ -142,6 +148,8 @@ const TokenAvatar: FC<TokenAvatarProps> = props => {
title={props.name}
tokenSymbol={props.symbol}
testID={props.symbol}
backgroundColor={props.backgroundColor}
showBorder={props.showBorder}
/>
)
}
Expand Down
22 changes: 1 addition & 21 deletions packages/core-mobile/app/components/GlobalOwlLoader.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,10 @@
import React from 'react'
import { StyleSheet, View, Dimensions } from 'react-native'
import RootSiblingsManager from 'react-native-root-siblings'
import CoreOwlSVG from 'components/svg/CoreOwlSVG'
import Logger from 'utils/Logger'
import { hideModal, showModal } from 'utils/modal'

const { height: screenHeight } = Dimensions.get('window')

let rootNode: RootSiblingsManager | null = null

const showModal = (element: JSX.Element): void => {
// if there is already a modal shown, hide it first
if (rootNode !== null) {
Logger.warn(
'duplicate owl modal',
'there is already a modal shown, you should hide it first'
)
return
}
rootNode = new RootSiblingsManager(element)
}

const hideModal = (): void => {
rootNode?.destroy()
rootNode = null
}

const GlobalOwlLoader = (): JSX.Element => {
return (
<View
Expand Down
13 changes: 9 additions & 4 deletions packages/core-mobile/app/components/InputText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import {
TextInputFocusEventData,
TextStyle,
ViewStyle,
LayoutChangeEvent
LayoutChangeEvent,
KeyboardTypeOptions
} from 'react-native'
import ClearInputSVG from 'components/svg/ClearInputSVG'
import { Space } from 'components/Space'
Expand Down Expand Up @@ -60,7 +61,7 @@ export type InputTextProps = {
// Private - Hides input, shows toggle button to show input, neon color border. Will disable multiline.
mode?: Mode
// Set keyboard type (numeric, text)
keyboardType?: 'numeric'
keyboardType?: KeyboardTypeOptions
// shows popover info if provided
popOverInfoText?: string | React.ReactElement
popOverPosition?: 'left' | 'right' | 'top' | 'bottom'
Expand Down Expand Up @@ -126,6 +127,7 @@ const InputText = forwardRef<TextInput, InputTextProps>(
testID
},
ref
// eslint-disable-next-line sonarjs/cognitive-complexity
) => {
const [showInput, setShowInput] = useState(false)
const [toggleShowText, setToggleShowText] = useState('Show')
Expand Down Expand Up @@ -224,8 +226,11 @@ const InputText = forwardRef<TextInput, InputTextProps>(
autoCapitalize="none"
placeholder={placeholder}
placeholderTextColor={colors.$neutral400}
blurOnSubmit={true}
secureTextEntry={mode === 'private' && !showInput}
secureTextEntry={
// On Android, setting secureText to false causes the keyboardType to be ignored.
// To avoid this issue, secureText is set to undefined instead of false.
mode === 'private' && !showInput ? true : undefined
}
onSubmitEditing={submit}
returnKeyType={onSubmit && 'go'}
enablesReturnKeyAutomatically={true}
Expand Down
2 changes: 2 additions & 0 deletions packages/core-mobile/app/hooks/earn/useSearchNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ export const useSearchNode = ({
stakingAmount,
stakingEndTime,
minUpTime: 98,
maxFee: 4,
isEndTimeOverOneYear
})

if (filteredValidators.length === 0) {
Logger.info(noMatchError.message)
return { validator: undefined, error: noMatchError }
Expand Down
38 changes: 38 additions & 0 deletions packages/core-mobile/app/new/components/LogoModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {
K2AlpineThemeProvider,
Logos,
View,
useTheme
} from '@avalabs/k2-alpine'
import React from 'react'
import { hideModal, showModal } from 'utils/modal'

export const LogoModal = (): JSX.Element => {
const { theme } = useTheme()

return (
<View
style={{
width: '100%',
height: '100%',
backgroundColor: theme.colors.$surfacePrimary,
alignItems: 'center',
justifyContent: 'center',
position: 'absolute'
}}>
<Logos.Core color={theme.colors.$textPrimary} />
</View>
)
}

export const showLogoModal = (): void => {
showModal(
<K2AlpineThemeProvider>
<LogoModal />
</K2AlpineThemeProvider>
)
}

export const hideLogoModal = (): void => {
hideModal()
}
106 changes: 106 additions & 0 deletions packages/core-mobile/app/new/components/SlideToConfirm.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import React, { useRef } from 'react'
import { PanResponder, Animated, Dimensions } from 'react-native'
import { useTheme, View, Icons } from '@avalabs/k2-alpine'

const { width } = Dimensions.get('window')
const _sliderWidth = 64
const _sliderHeight = 64

const SlideToConfirm = ({
text,
onConfirm
}: {
text: string
onConfirm: () => void
}): JSX.Element => {
const { theme } = useTheme()
const slideWidth = width - 40 // Space for the slider to move
const unlockThreshold = slideWidth - _sliderWidth // Set unlock point near the end
const sliderWidth = useRef(new Animated.Value(_sliderWidth)).current

const textColorAnim = sliderWidth.interpolate({
inputRange: [0, unlockThreshold],
outputRange: [theme.colors.$textPrimary, theme.colors.$surfacePrimary],
extrapolate: 'clamp'
})
const iconOpacityAnim = sliderWidth.interpolate({
inputRange: [_sliderWidth, unlockThreshold / 2],
outputRange: [1, 0],
extrapolate: 'clamp'
})

// PanResponder for gesture handling
const panResponder = PanResponder.create({
onStartShouldSetPanResponder: () => true,
onPanResponderMove: (_, gestureState) => {
// Limit the slider to the width of the container
if (gestureState.dx >= 0 && gestureState.dx <= unlockThreshold) {
sliderWidth.setValue(_sliderWidth + gestureState.dx)
}
},
onPanResponderRelease: (_, gestureState) => {
if (gestureState.dx > unlockThreshold) {
onConfirm()
Animated.spring(sliderWidth, {
toValue: slideWidth,
useNativeDriver: false
}).start()
} else {
// Reset if not unlocked
Animated.spring(sliderWidth, {
toValue: _sliderWidth,
useNativeDriver: false
}).start()
}
}
})

return (
<View
sx={{
alignItems: 'center'
}}>
<View
sx={{
width: width - 40, // Full width
height: _sliderHeight,
borderRadius: 32,
backgroundColor: '#A1A1AA40',
justifyContent: 'center',
position: 'relative'
}}>
<Animated.View
{...panResponder.panHandlers}
style={{
height: _sliderHeight,
borderRadius: 32,
justifyContent: 'center',
alignItems: 'center',
position: 'absolute',
left: 0,
width: sliderWidth,
backgroundColor: theme.colors.$textPrimary
}}>
<Animated.View testID="slide" style={{ opacity: iconOpacityAnim }}>
<Icons.Navigation.ArrowForwardIOS
color={theme.colors.$surfacePrimary}
/>
</Animated.View>
</Animated.View>
<Animated.Text
style={[
{
fontSize: 15,
fontWeight: '600',
color: textColorAnim,
alignSelf: 'center'
}
]}>
{text}
</Animated.Text>
</View>
</View>
)
}

export default SlideToConfirm
Loading

0 comments on commit 4fee29b

Please sign in to comment.