Skip to content

Commit

Permalink
Merge branch 'develop' into @jin/remove-account-assets-redux
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahimtaveras00 committed Oct 25, 2023
2 parents 17d7d9a + 4f8dd58 commit e07905d
Show file tree
Hide file tree
Showing 24 changed files with 469 additions and 168 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/)

### Fixed

## [1.9.7] (https://github.com/rainbow-me/rainbow/releases/tag/v1.9.7)

### Added

- points v0
- prompt app reviews
- bug fixes

## [1.9.6] (https://github.com/rainbow-me/rainbow/releases/tag/v1.9.6)

### Added
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ android {
applicationId "me.rainbow"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 191
versionName "1.9.7"
versionCode 192
versionName "1.9.8"
missingDimensionStrategy 'react-native-camera', 'general'
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package me.rainbow.NativeModules.RNReview;

import android.app.Activity;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.google.android.play.core.review.ReviewInfo;
Expand All @@ -9,23 +11,44 @@
import com.google.android.play.core.tasks.Task;

public class RNReviewModule extends ReactContextBaseJavaModule {
private final ReactApplicationContext reactContext;

public RNReviewModule(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
}

@Override
public String getName() {
return "RNReview";
}

@ReactMethod

public void show(final Promise promise) {
ReviewManager manager = ReviewManagerFactory.create(getReactApplicationContext());
final Activity activity = reactContext.getCurrentActivity();
if (activity == null) {
promise.reject("E_ACTIVITY_DOES_NOT_EXIST", "Activity doesn't exist");
return;
}

ReviewManager manager = ReviewManagerFactory.create(reactContext);
Task<ReviewInfo> request = manager.requestReviewFlow();
request.addOnCompleteListener(task -> {
if (task.isSuccessful()) {
// We can get the ReviewInfo object
ReviewInfo reviewInfo = task.getResult();
Task<Void> flow = manager.launchReviewFlow(activity, reviewInfo);
flow.addOnCompleteListener(task1 -> {
if (task1.isSuccessful()) {
promise.resolve(null);
} else {
promise.reject("E_REVIEW_FLOW_FAILED", "Review flow failed");
}
});
} else {
// There was some problem, continue regardless of the result.
promise.reject("E_REQUEST_REVIEW_FAILED", "Request review flow failed");
}
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class RNReviewPackage implements ReactPackage {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
return Arrays.asList(new RNReviewModule());
return Arrays.asList(new RNReviewModule(reactContext));
}

@Override
Expand Down
8 changes: 4 additions & 4 deletions ios/Rainbow.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1517,7 +1517,7 @@
"$(PROJECT_DIR)",
);
LLVM_LTO = YES;
MARKETING_VERSION = 1.9.7;
MARKETING_VERSION = 1.9.8;
OTHER_CFLAGS = "$(inherited)";
OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1580,7 +1580,7 @@
"$(PROJECT_DIR)",
);
LLVM_LTO = YES;
MARKETING_VERSION = 1.9.7;
MARKETING_VERSION = 1.9.8;
OTHER_CFLAGS = "$(inherited)";
OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1688,7 +1688,7 @@
"$(PROJECT_DIR)",
);
LLVM_LTO = YES;
MARKETING_VERSION = 1.9.7;
MARKETING_VERSION = 1.9.8;
OTHER_CFLAGS = "$(inherited)";
OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1797,7 +1797,7 @@
"$(PROJECT_DIR)",
);
LLVM_LTO = YES;
MARKETING_VERSION = 1.9.7;
MARKETING_VERSION = 1.9.8;
OTHER_CFLAGS = "$(inherited)";
OTHER_CPLUSPLUSFLAGS = "$(OTHER_CFLAGS)";
OTHER_LDFLAGS = (
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Rainbow",
"version": "1.9.7-1",
"version": "1.9.8-1",
"private": true,
"scripts": {
"setup": "yarn install && yarn graphql-codegen:install && yarn ds:install && yarn allow-scripts && yarn postinstall && yarn graphql-codegen",
Expand Down
16 changes: 16 additions & 0 deletions patches/react-native+0.72.0.patch
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ index 26961d7..ee5943d 100644
} else if (!global.nativeExtensions) {
const bridgeConfig = global.__fbBatchedBridgeConfig;
invariant(
diff --git a/node_modules/react-native/React/Views/RCTView.m b/node_modules/react-native/React/Views/RCTView.m
index 619509f..a9477e5 100644
--- a/node_modules/react-native/React/Views/RCTView.m
+++ b/node_modules/react-native/React/Views/RCTView.m
@@ -831,6 +831,11 @@ static CGFloat RCTDefaultIfNegativeTo(CGFloat defaultValue, CGFloat x)
layer.backgroundColor = backgroundColor;
layer.contents = nil;
layer.needsDisplayOnBoundsChange = NO;
+ if (@available(iOS 13.0, *)) {
+ if (layer.cornerRadius < MIN(self.bounds.size.height, self.bounds.size.width) / 2) {
+ layer.cornerCurve = kCACornerCurveContinuous;
+ }
+ }
layer.mask = nil;
return;
}
diff --git a/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h b/node_modules/react-native/ReactCommon/react/renderer/components/rncore/ComponentDescriptors.h
new file mode 100644
index 0000000..37b7d8d
Expand Down
13 changes: 13 additions & 0 deletions patches/react-native-pager-view+5.4.24.patch
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,16 @@ index 81070b2..2f1d2b9 100644
vp.adapter = ViewPagerAdapter()
//https://github.com/callstack/react-native-viewpager/issues/183
vp.isSaveEnabled = false
diff --git a/node_modules/react-native-pager-view/ios/ReactNativePageView.m b/node_modules/react-native-pager-view/ios/ReactNativePageView.m
index 9f8ed5b..9a1f8c9 100644
--- a/node_modules/react-native-pager-view/ios/ReactNativePageView.m
+++ b/node_modules/react-native-pager-view/ios/ReactNativePageView.m
@@ -107,7 +107,7 @@
if([subview isKindOfClass:UIScrollView.class]){
((UIScrollView *)subview).delegate = self;
((UIScrollView *)subview).keyboardDismissMode = _dismissKeyboard;
- ((UIScrollView *)subview).delaysContentTouches = YES;
+ ((UIScrollView *)subview).delaysContentTouches = NO;
self.scrollView = (UIScrollView *)subview;
}
}
4 changes: 4 additions & 0 deletions src/components/activity-list/ActivityList.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import RecyclerActivityList from './RecyclerActivityList';
import styled from '@/styled-thing';
import { useTheme } from '@/theme';
import { useSectionListScrollToTopContext } from '@/navigation/SectionListScrollToTopContext';
import { safeAreaInsetValues } from '@/utils';

const sx = StyleSheet.create({
sectionHeader: {
Expand Down Expand Up @@ -162,6 +163,9 @@ const ActivityList = ({
keyExtractor={keyExtractor}
removeClippedSubviews
renderSectionHeader={renderSectionHeaderWithTheme}
scrollIndicatorInsets={{
bottom: safeAreaInsetValues.bottom + 14,
}}
sections={sections}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export default function ButtonPressAnimation({
wrapperStyle,
hapticType = 'selection',
enableHapticFeedback = true,
disallowInterruption = true,
disallowInterruption = false,
}: Props) {
const normalizedTransformOrigin = useMemo(
() => normalizeTransformOrigin(transformOrigin),
Expand Down
18 changes: 10 additions & 8 deletions src/components/asset-list/RecyclerAssetList2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ function RecyclerAssetList({
briefSectionsData={briefSectionsData}
disablePullDownToRefresh={!!disablePullDownToRefresh}
extendedState={extendedState}
scrollIndicatorInsets={{ bottom: 40, top: 132 }}
scrollIndicatorInsets={{
bottom: insets.bottom + 14,
top: 132,
}}
type={type}
/>
</StickyHeaderManager>
Expand Down Expand Up @@ -177,13 +180,12 @@ function NavbarOverlay({
actionTitle: lang.t('button.my_qr_code'),
icon: { iconType: 'SYSTEM', iconValue: 'qrcode' },
},
mostRecentWalletConnectors.length > 0 || activeWCV2Sessions.length > 0
? {
actionKey: 'connectedApps',
actionTitle: lang.t('wallet.connected_apps'),
icon: { iconType: 'SYSTEM', iconValue: 'app.badge.checkmark' },
}
: null,

{
actionKey: 'connectedApps',
actionTitle: lang.t('wallet.connected_apps'),
icon: { iconType: 'SYSTEM', iconValue: 'app.badge.checkmark' },
},
].filter(Boolean),
...(ios ? { menuTitle: '' } : {}),
}),
Expand Down
34 changes: 27 additions & 7 deletions src/components/change-wallet/AddressRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { Icon } from '../icons';
import { Centered, Column, ColumnWithMargins, Row } from '../layout';
import { Text, TruncatedText } from '../text';
import ContextMenuButton from '@/components/native-context-menu/contextMenu';
import ContextMenuAndroid from '@/components/native-context-menu/contextMenu.android';
import useExperimentalFlag, { NOTIFICATIONS } from '@/config/experimentalHooks';
import {
removeFirstEmojiFromString,
Expand All @@ -25,6 +24,7 @@ import { abbreviations, deviceUtils, profileUtils } from '@/utils';
import { EditWalletContextMenuActions } from '@/screens/ChangeWalletSheet';
import { toChecksumAddress } from '@/handlers/web3';
import { IS_IOS, IS_ANDROID } from '@/env';
import { ContextMenu } from '../context-menu';

const maxAccountLabelWidth = deviceUtils.dimensions.width - 88;
const NOOP = () => undefined;
Expand Down Expand Up @@ -219,6 +219,25 @@ export default function AddressRow({
menuTitle: walletName,
};

const handleSelectActionMenuItem = useCallback(
(buttonIndex: number) => {
switch (buttonIndex) {
case 0:
contextMenuActions?.edit(walletId, address);
break;
case 1:
contextMenuActions?.notifications(walletName, address);
break;
case 2:
contextMenuActions?.remove(walletId, address);
break;
default:
break;
}
},
[contextMenuActions, walletName, walletId, address]
);

const handleSelectMenuItem = useCallback(
// @ts-expect-error ContextMenu is an untyped JS component and can't type its onPress handler properly
({ nativeEvent: { actionKey } }) => {
Expand Down Expand Up @@ -316,14 +335,15 @@ export default function AddressRow({
<OptionsIcon onPress={NOOP} />
</ContextMenuButton>
) : (
// @ts-expect-error js component
<ContextMenuAndroid
menuConfig={menuConfig}
<ContextMenu
options={menuConfig.menuItems.map(item => item.actionTitle)}
isAnchoredToRight
onPressMenuItem={handleSelectMenuItem}
onPressActionSheet={handleSelectActionMenuItem}
>
<OptionsIcon onPress={NOOP} />
</ContextMenuAndroid>
<Centered>
<OptionsIcon onPress={NOOP} />
</Centered>
</ContextMenu>
))}
</Column>
</Row>
Expand Down
45 changes: 45 additions & 0 deletions src/components/gas/GasSpeedButton.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-nested-ternary */
/* eslint-disable no-undef */
import AnimateNumber from '@bankify/react-native-animate-number';
import lang from 'i18n-js';
Expand Down Expand Up @@ -34,6 +35,8 @@ import styled from '@/styled-thing';
import { fonts, fontWithWidth, margin, padding } from '@/styles';
import { ethereumUtils, gasUtils } from '@/utils';
import { getNetworkObj } from '@/networks';
import { IS_ANDROID } from '@/env';
import { ContextMenu } from '../context-menu';

const {
GAS_EMOJIS,
Expand Down Expand Up @@ -249,6 +252,7 @@ const GasSpeedButton = ({
shouldOpenCustomGasSheet.focusTo,
flashbotTransaction,
speeds,
fallbackColor,
]);

const openCustomOptions = useCallback(
Expand Down Expand Up @@ -377,6 +381,25 @@ const GasSpeedButton = ({
[handlePressSpeedOption]
);

const handlePressActionSheet = useCallback(
buttonIndex => {
switch (buttonIndex) {
case 0:
handlePressSpeedOption(NORMAL);
break;
case 1:
handlePressSpeedOption(FAST);
break;
case 2:
handlePressSpeedOption(URGENT);
break;
case 3:
handlePressSpeedOption(CUSTOM);
}
},
[handlePressSpeedOption]
);

const nativeFeeCurrency = useMemo(() => {
switch (currentNetwork) {
case networkTypes.polygon:
Expand All @@ -399,6 +422,8 @@ const GasSpeedButton = ({

const menuConfig = useMemo(() => {
const menuOptions = speedOptions.map(gasOption => {
if (IS_ANDROID) return gasOption;

const totalGwei = add(
gasFeeParamsBySpeed[gasOption]?.maxBaseFee?.gwei,
gasFeeParamsBySpeed[gasOption]?.maxPriorityFeePerGas?.gwei
Expand Down Expand Up @@ -441,6 +466,7 @@ const GasSpeedButton = ({
gasFeeParamsBySpeed,
selectedGasFeeOption,
speedOptions,
isL2,
]);

const gasOptionsAvailable = useMemo(() => speedOptions.length > 1, [
Expand Down Expand Up @@ -477,6 +503,24 @@ const GasSpeedButton = ({
/>
);
if (!gasOptionsAvailable || gasIsNotReady) return pager;

if (IS_ANDROID) {
return (
<ContextMenu
activeOpacity={0}
enableContextMenu
isAnchoredToRight
isMenuPrimaryAction
onPressActionSheet={handlePressActionSheet}
options={menuConfig.menuItems}
useActionSheetFallback={false}
wrapNativeComponent={false}
>
<Centered>{pager}</Centered>
</ContextMenu>
);
}

return (
<ContextMenuButton
activeOpacity={0}
Expand Down Expand Up @@ -543,6 +587,7 @@ const GasSpeedButton = ({
onPress={openGasHelper}
scaleTo={0.9}
testID="estimated-fee-label"
disallowInterruption={false}
>
<Row>
<NativeCoinIconWrapper>
Expand Down
Loading

0 comments on commit e07905d

Please sign in to comment.