Skip to content

Commit 6154269

Browse files
authored
Merge pull request #148 from syscoin/dev
Dev
2 parents 6d0d9fb + 6ed40bc commit 6154269

File tree

13 files changed

+180
-62
lines changed

13 files changed

+180
-62
lines changed

app/android/app/build.gradle

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
apply plugin: "com.android.application"
22
apply plugin: 'com.google.gms.google-services'
33

4-
import com.android.build.OutputFile
54

65
project.ext.react = [
76
entryFile: "index.js",
@@ -47,13 +46,12 @@ android {
4746

4847
compileSdkVersion rootProject.ext.compileSdkVersion
4948

50-
5149
defaultConfig {
5250
applicationId "io.paliwallet"
5351
minSdkVersion rootProject.ext.minSdkVersion
5452
targetSdkVersion rootProject.ext.targetSdkVersion
55-
versionCode 33
56-
versionName "1.2.1"
53+
versionCode 36
54+
versionName "1.2.3"
5755
multiDexEnabled true
5856
missingDimensionStrategy "minReactNative", "minReactNative46"
5957
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -117,7 +115,7 @@ dependencies {
117115
implementation project(':react-native-gesture-handler')
118116
implementation project(path: ":@react-native-firebase_analytics")
119117
implementation project(':react-native-theme-switch-animation')
120-
118+
121119
implementation 'androidx.multidex:multidex:2.0.1'
122120
implementation 'androidx.annotation:annotation:1.1.0'
123121
implementation 'androidx.appcompat:appcompat:1.2.0'

app/android/app/src/main/java/io/gopocket/MainApplication.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
import io.paliwallet.nativeModules.PreventScreenshotPackage;
1919
import com.swmansion.reanimated.ReanimatedJSIModulePackage;
2020
import com.facebook.react.bridge.JSIModulePackage;
21+
import android.content.BroadcastReceiver;
22+
import android.content.Intent;
23+
import android.content.IntentFilter;
24+
import android.os.Build;
25+
import org.jetbrains.annotations.Nullable;
2126

2227

2328
import android.text.TextUtils;
@@ -120,6 +125,16 @@ public ReactNativeHost getReactNativeHost() {
120125
return mReactNativeHost;
121126
}
122127

128+
// Put this above "public void onCreate()":
129+
@Override
130+
public Intent registerReceiver(@Nullable BroadcastReceiver receiver, IntentFilter filter) {
131+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE && getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
132+
return super.registerReceiver(receiver, filter, Context.RECEIVER_EXPORTED);
133+
} else {
134+
return super.registerReceiver(receiver, filter);
135+
}
136+
}
137+
123138
@Override
124139
public void onCreate() {
125140
super.onCreate();

app/android/app/src/main/res/values-night/colors.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
<color name="white">#0e223a</color>
44
<color name="lightgray">#EBEBED</color>
55
<color name="splash_background">#111E33</color>
6+
<color name="app_background_light">#FFFFFF</color>
67
<color name="app_background_dark">#111E33</color>
78
</resources>

app/android/app/src/main/res/values/colors.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
<color name="lightgray">#EBEBED</color>
55
<color name="splash_background">#FFFFFF</color>
66
<color name="app_background_light">#FFFFFF</color>
7+
<color name="app_background_dark">#111E33</color>
78
</resources>

app/android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ buildscript {
66
ext {
77
buildToolsVersion = "30.0.3"
88
minSdkVersion = 21
9-
compileSdkVersion = 33
10-
targetSdkVersion = 33
9+
compileSdkVersion = 34
10+
targetSdkVersion = 34
1111
kotlin_version = "1.9.20"
1212
kotlinVersion = "$kotlin_version"
1313
}
@@ -19,7 +19,7 @@ buildscript {
1919
}
2020

2121
dependencies {
22-
classpath('com.android.tools.build:gradle:7.0.0-rc01')
22+
classpath('com.android.tools.build:gradle:7.3.0')
2323
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
2424
classpath('com.google.gms:google-services:4.3.3')
2525
}

app/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip

app/app/components/App/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { createAppContainer, createSwitchNavigator, NavigationActions } from 're
44
import codePush from 'react-native-code-push';
55
import { setCustomText } from 'react-native-global-props';
66
import { createStackNavigator } from 'react-navigation-stack';
7+
import { firebase } from '@react-native-firebase/analytics';
8+
import I18n from 'react-native-i18n';
79

810
import Login from '../Views/Login';
911
import Onboarding from '../Views/Onboarding';
@@ -171,6 +173,15 @@ class App extends PureComponent {
171173
this.handleDeepLinkEvent({ url });
172174
}, 4000);
173175
}
176+
// Set user properties in Firebase Analytics for the user theme
177+
const { theme } = this.context;
178+
const language = I18n.locale;
179+
try {
180+
await firebase.analytics().setUserProperty('user_theme', theme);
181+
await firebase.analytics().setUserProperty('user_language', language);
182+
} catch (error) {
183+
console.error('Error setting user theme and language properties:', error);
184+
}
174185
};
175186

176187
componentWillUnmount = () => {

app/app/components/UI/AssetView/index.js

Lines changed: 48 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ class AssetView extends PureComponent {
10221022
};
10231023

10241024
navigateToRequestNowButton = () => {
1025-
if (this.requestNowButtonRef.current) {
1025+
if (this.requestNowButtonRef.current && this.props.scrollViewRef) {
10261026
this.requestNowButtonRef.current.measure((fx, fy, width, height, px, py) => {
10271027
this.props.scrollViewRef.scrollTo({ x: 0, y: py - fy - 300, animated: true });
10281028
});
@@ -1140,49 +1140,52 @@ class AssetView extends PureComponent {
11401140
capInsets={baseStyles.capInsets}
11411141
>
11421142
<View style={[styles.otherBody]}>{header}</View>
1143-
{(asset.type === ChainType.Syscoin || asset.type === ChainType.Rollux) && asset.nativeCurrency && (
1144-
<TouchableOpacity
1145-
activeOpacity={0.8}
1146-
style={styles.grabFaucetButton}
1147-
onPress={() => {
1148-
this.navigateToRequestNowButton();
1149-
}}
1150-
>
1151-
<View style={styles.grabFaucetButtonContainer}>
1152-
<View style={styles.grabFaucetIcon}>
1153-
<Icon name="faucet" style={{ color: colors.white }} />
1154-
</View>
1155-
<View style={styles.iconsContainer}>
1156-
{asset.type === ChainType.Rollux && (
1143+
{(asset.type === ChainType.Syscoin || asset.type === ChainType.Rollux) &&
1144+
!Device.isAndroid() &&
1145+
asset.nativeCurrency && (
1146+
<TouchableOpacity
1147+
activeOpacity={0.8}
1148+
style={styles.grabFaucetButton}
1149+
onPress={() => {
1150+
this.navigateToRequestNowButton();
1151+
}}
1152+
>
1153+
<View style={styles.grabFaucetButtonContainer}>
1154+
<View style={styles.grabFaucetIcon}>
1155+
<Icon name="faucet" style={{ color: colors.white }} />
1156+
</View>
1157+
<View style={styles.iconsContainer}>
1158+
{asset.type === ChainType.Rollux && (
1159+
<Image
1160+
source={require('../../../images/rollux_logo.png')}
1161+
style={[styles.iconAssetStyle, { zIndex: 1 }]}
1162+
/>
1163+
)}
11571164
<Image
1158-
source={require('../../../images/rollux_logo.png')}
1159-
style={[styles.iconAssetStyle, { zIndex: 1 }]}
1165+
source={require('../../../images/syscoin_logo.png')}
1166+
style={[
1167+
styles.iconAssetStyle,
1168+
{
1169+
marginLeft: asset.type === ChainType.Rollux ? -5 : 0
1170+
}
1171+
]}
11601172
/>
1161-
)}
1162-
<Image
1163-
source={require('../../../images/syscoin_logo.png')}
1164-
style={[
1165-
styles.iconAssetStyle,
1166-
{
1167-
marginLeft: asset.type === ChainType.Rollux ? -5 : 0
1168-
}
1169-
]}
1170-
/>
1173+
</View>
1174+
<Text style={{ color: colors.white, ...fontStyles.normal, marginLeft: 8 }}>
1175+
<Text style={{ textDecorationLine: 'underline' }}>
1176+
{strings('faucet.grab_with_faucet', { symbol: asset.symbol })}
1177+
</Text>{' '}
1178+
{strings('faucet.with_our_faucet')}
1179+
</Text>
11711180
</View>
1172-
<Text style={{ color: colors.white, ...fontStyles.normal, marginLeft: 8 }}>
1173-
<Text style={{ textDecorationLine: 'underline' }}>
1174-
{strings('faucet.grab_with_faucet', { symbol: asset.symbol })}
1175-
</Text>{' '}
1176-
{strings('faucet.with_our_faucet')}
1177-
</Text>
1178-
</View>
1179-
</TouchableOpacity>
1180-
)}
1181+
</TouchableOpacity>
1182+
)}
11811183
</ImageCapInset>
11821184
<View
11831185
style={{
11841186
marginTop:
11851187
(asset.type === ChainType.Syscoin || asset.type === ChainType.Rollux) &&
1188+
!Device.isAndroid() &&
11861189
asset.nativeCurrency
11871190
? 40
11881191
: 0
@@ -1270,17 +1273,23 @@ class AssetView extends PureComponent {
12701273
ref={this.requestNowButtonRef}
12711274
activeOpacity={0.6}
12721275
style={[
1273-
styles.faucetButton,
1276+
{
1277+
...styles.faucetButton,
1278+
justifyContent: 'center',
1279+
alignItems: 'center'
1280+
},
12741281
isDarkMode && { backgroundColor: colors.paliBlue400 },
1275-
{ height: 40, opacity: this.state.faucetButtonDisabled ? 0.5 : 1 }
1282+
{ height: 45, opacity: this.state.faucetButtonDisabled ? 0.5 : 1 }
12761283
]}
12771284
onPress={requestFaucet}
12781285
disabled={this.state.isLoading || this.state.faucetButtonDisabled}
12791286
>
12801287
{this.state.isLoading ? (
12811288
<ActivityIndicator size="small" color={colors.white} />
12821289
) : (
1283-
<Text style={styles.faucetButtonText}>{strings('faucet.request_now')}</Text>
1290+
<Text style={[styles.faucetButtonText, { textAlign: 'center' }]}>
1291+
{strings('faucet.request_now')}
1292+
</Text>
12841293
)}
12851294
</TouchableOpacity>
12861295
</View>

app/app/components/UI/TransactionEditor/index.js

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ import {
1010
getTokenBalance,
1111
hexToBN
1212
} from '../../../util/number';
13+
import { WALLET_CONNECT_ORIGIN } from '../../../util/walletconnect';
14+
1315
import { strings } from '../../../../locales/i18n';
16+
import { getActiveUrl } from '../../../util/browser';
17+
1418
import { connect } from 'react-redux';
1519
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
1620
import { getNormalizedTxState, getTicker } from '../../../util/transactions';
@@ -25,6 +29,7 @@ import AsyncStorage from '@react-native-async-storage/async-storage';
2529
import { VERIFICATION_DISABLED } from '../../../constants/storage';
2630
import ReactNativeHapticFeedback from 'react-native-haptic-feedback';
2731
import { ThemeContext } from '../../../theme/ThemeProvider';
32+
import { firebase } from '@react-native-firebase/analytics';
2833

2934
const options = {
3035
enableVibrateFallback: true,
@@ -126,7 +131,11 @@ class TransactionEditor extends PureComponent {
126131
/**
127132
* Whether was prompted from approval
128133
*/
129-
promptedFromApproval: PropTypes.bool
134+
promptedFromApproval: PropTypes.bool,
135+
136+
/** Browser/tab information
137+
*/
138+
browser: PropTypes.object
130139
};
131140

132141
state = {
@@ -170,11 +179,30 @@ class TransactionEditor extends PureComponent {
170179
this.setState({ checkPassword: false });
171180
};
172181

182+
getUrlFromBrowser() {
183+
const { browser, transaction } = this.props;
184+
if (transaction.origin && transaction.origin.includes(WALLET_CONNECT_ORIGIN)) {
185+
return transaction.origin.split(WALLET_CONNECT_ORIGIN)[1];
186+
}
187+
return getActiveUrl(browser);
188+
}
189+
173190
/**
174191
* Call callback when transaction is confirmed, after being validated
175192
*/
176193
doConfirm = async () => {
177-
const { onConfirm } = this.props;
194+
const { onConfirm, transaction, browser } = this.props;
195+
const origin = transaction.origin;
196+
// Add transaction information to Firebase Analytics
197+
const currentPageInformation = { url: this.getUrlFromBrowser(), origin };
198+
199+
await firebase.analytics().logEvent('transaction_dapp_sent', {
200+
chainId: transaction.chainId,
201+
url: currentPageInformation.url,
202+
origin: currentPageInformation.origin,
203+
symbol: transaction.symbol
204+
});
205+
178206
onConfirm && (await onConfirm());
179207
this.setState({ loading: false });
180208
};
@@ -449,7 +477,8 @@ const mapStateToProps = state => ({
449477
state.engine.backgroundState.PreferencesController.selectedAddress
450478
] || {},
451479
selectedAddress: state.engine.backgroundState.PreferencesController.selectedAddress,
452-
transaction: getNormalizedTxState(state)
480+
transaction: getNormalizedTxState(state),
481+
browser: state.browser
453482
});
454483

455484
const mapDispatchToProps = dispatch => ({

app/app/components/Views/SendFlow/MoveTab/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,7 +1619,8 @@ class MoveTab extends PureComponent {
16191619
{/*<Text style={styles.bridgeText}>{strings('other.arb_bridge_withdraw_limit')}</Text>*/}
16201620
</>
16211621
)}
1622-
{isCBridge && (
1622+
1623+
{/* {isCBridge && (
16231624
<>
16241625
<TouchableOpacity onPress={this.todoLifi} activeOpacity={activeOpacity}>
16251626
<Image
@@ -1629,7 +1630,7 @@ class MoveTab extends PureComponent {
16291630
/>
16301631
</TouchableOpacity>
16311632
</>
1632-
)}
1633+
)} */}
16331634
<View style={baseStyles.flexGrow} />
16341635
</View>
16351636
</ScrollView>

app/app/components/Views/SendFlow/SendNFTTab/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
TextInput,
1414
LayoutAnimation
1515
} from 'react-native';
16+
import { firebase } from '@react-native-firebase/analytics';
1617
import { AddressTo } from '../AddressInputs';
1718
import NetworkFee from '../../../UI/NetworkFee';
1819
import { connect } from 'react-redux';
@@ -561,8 +562,16 @@ class SendNFTTab extends PureComponent {
561562

562563
onInputPwdResult = async result => {
563564
if (result) {
564-
this.onConfirm().then(() => {
565+
this.onConfirm().then(async () => {
565566
this.setLoading(false);
567+
const { asset } = this.props;
568+
await firebase.analytics().logEvent('transaction_nft_sent', {
569+
contract_address: asset.address,
570+
chain_id: getChainIdByType(asset.type),
571+
network: getChainTypeName(asset.type),
572+
symbol: asset.symbol,
573+
timestamp: new Date().toLocaleString('pt-BR', { timeZone: 'America/Sao_Paulo' })
574+
});
566575
ReactNativeHapticFeedback.trigger('notificationSuccess', options);
567576
});
568577
} else {

0 commit comments

Comments
 (0)