Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteZhang1024 committed Oct 23, 2023
1 parent 648a6c2 commit 94059b0
Show file tree
Hide file tree
Showing 19 changed files with 157 additions and 344 deletions.
7 changes: 7 additions & 0 deletions .easignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
build/
dist/

__generated__/
build-electron/
web-build/
1 change: 1 addition & 0 deletions .github/workflows/release-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
uses: OneKeyHQ/actions/expo-server@main
with:
eas-version: 5.x
token: ${{ secrets.EXPO_TOKEN }}

- name: Setup ENV BUILD_NUMBER to 1
if: ${{ !github.event.workflow_run }}
Expand Down
3 changes: 3 additions & 0 deletions apps/mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ android {
shrinkResources (findProperty('android.enableShrinkResourcesInReleaseBuilds')?.toBoolean() ?: false)
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
ndk {
abiFilters "arm64-v8a"
}
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions apps/mobile/android/build-logic/convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ plugins {

group = "so.onekey.apps.buildlogic"

// Configure the build-logic plugins to target JDK 17
// Configure the build-logic plugins to target JDK 11
// This matches the JDK used to build the project, and is not related to what is running on device.
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
jvmTarget = JavaVersion.VERSION_11.toString()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,30 @@ object EnvManager {
}

fun readRootEnvFile(fileName: String): Properties {
// base file path: apps/mobile/android/
val rootEnvPath = "./../../../"
val maxDepth = 8
var currentDepth = 0
var currentPath = "./"

val props = Properties()
try {
File(rootEnvPath + File.separator + fileName).inputStream().use { stream ->
props.load(stream)
while (currentDepth < maxDepth) {
val potentialFile = File(currentPath + fileName)
if (potentialFile.exists()) {
try {
potentialFile.inputStream().use { stream ->
props.load(stream)
}
println("Success Load $fileName at ${potentialFile.absolutePath}")
} catch (ignore: Exception) {
// ignore
}
return props
}
} catch (ignore: Exception) {
// ignore

currentPath += "../" // Go one directory up
currentDepth++
}
return props

return props // Return empty properties if file wasn't found
}
}

Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/eas.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"cli": {
"version": ">= 0.37.0"
"version": ">= 5.4.0"
},
"build": {
"base": {
Expand Down
6 changes: 4 additions & 2 deletions apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
"version": "1.0.0",
"main": "index.js",
"scripts": {
"android": "expo run:android",
"android:device": "expo run:android --device",
"android": "NDROID_CHANNEL=direct expo run:android --variant=ProdDebug",
"android:device": "ANDROID_CHANNEL=direct expo run:android --variant=ProdDebug --device",
"android:huawei": "ANDROID_CHANNEL=huawei expo run:android --variant=ProdDebug",
"android:google": "ANDROID_CHANNEL=google expo run:android --variant=GoogleDebug",
"ios": "expo run:ios",
"ios:device": "expo run:ios --device",
"native-bundle": "react-native start"
Expand Down
18 changes: 5 additions & 13 deletions development/copy-injected.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
set -x

# copy to Desktop preload.js
cp ./node_modules/@onekeyfe/cross-inpage-provider-injected/dist/injected/injectedDesktop.js ./packages/desktop/public/static/preload.js
cp ./node_modules/@onekeyfe/cross-inpage-provider-injected/dist/injected/injectedDesktop.js ./apps/desktop/public/static/preload.js

# copy to Extension injected.js
cp ./node_modules/@onekeyfe/cross-inpage-provider-injected/dist/injected/injectedExtension.js ./packages/ext/src/entry/injected.js
cp ./packages/ext/src/entry/injected.js ./packages/ext/src/entry/injected.text-js
cp ./node_modules/@onekeyfe/cross-inpage-provider-injected/dist/injected/injectedExtension.js ./apps/ext/src/entry/injected.js
cp ./apps/ext/src/entry/injected.js ./apps/ext/src/entry/injected.text-js

# copy to Native injectedCode
cp ./node_modules/@onekeyfe/cross-inpage-provider-injected/dist/injected/injectedNative.js ./packages/kit/src/components/WebView/injectedNative.text-js
Expand All @@ -16,14 +16,6 @@ cp ./node_modules/@onekeyfe/cross-inpage-provider-injected/dist/injected/injecte
cp ./packages/shared/src/web/index.html.ejs ./packages/shared/src/web/index.html

# copy hardware js-sdk iframe files to desktop
mkdir -p ./packages/desktop/public/static/js-sdk/
rsync ./node_modules/@onekeyfe/hd-web-sdk/build/ ./packages/desktop/public/static/js-sdk/ --checksum --recursive --verbose

# build and copy web-embed
if [ "$EAS_BUILD" == "true" ];
then
yarn workspace @onekeyhq/web-embed build
elif [ ! -d "packages/web-embed/web-build" ]; then
yarn workspace @onekeyhq/web-embed build
fi
mkdir -p ./apps/desktop/public/static/js-sdk/
rsync ./node_modules/@onekeyfe/hd-web-sdk/build/ ./apps/desktop/public/static/js-sdk/ --checksum --recursive --verbose

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"node": ">=16"
},
"scripts": {
"postinstall": "patch-package",
"postinstall": "patch-package && yarn copy:inject",
"copy:inject": "bash development/copy-injected.sh",
"app:desktop": "yarn workspace @onekeyhq/desktop start",
"app:ext": "yarn workspace @onekeyhq/ext start",
"app:ext:v3": "yarn workspace @onekeyhq/ext start:v3",
Expand Down
129 changes: 66 additions & 63 deletions packages/components/src/Navigation/Header/HeaderView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Header } from '@react-navigation/elements';
import { get } from 'lodash';
import { StyleSheet } from 'react-native';

import { Stack, useThemeValue } from '../../index';
import { DesktopDragZoneBox, Stack, useThemeValue } from '../../index';

import HeaderButtonBack from './HeaderButtonBack';
import HeaderSearchBar from './HeaderSearchBar';
Expand Down Expand Up @@ -81,83 +81,86 @@ function HeaderView({
);

return (
<Stack
px="$5"
$md={{
flexDirection: 'column',
}}
$gtMd={{
flexDirection: isModelScreen ? 'column' : 'row',
}}
borderTopLeftRadius={isModelScreen ? '$2' : 0}
borderTopRightRadius={isModelScreen ? '$2' : 0}
backgroundColor="$bg"
overflow="hidden"
borderBottomWidth={StyleSheet.hairlineWidth}
borderBottomColor="$borderSubdued"
>
<DesktopDragZoneBox>
<Stack
px="$5"
$md={{
width: '100%',
flexDirection: 'column',
}}
$gtMd={{
flex: isModelScreen ? 0 : 1,
width: isModelScreen ? '100%' : undefined,
flexDirection: isModelScreen ? 'column' : 'row',
}}
borderTopLeftRadius={isModelScreen ? '$2' : 0}
borderTopRightRadius={isModelScreen ? '$2' : 0}
backgroundColor="$bg"
overflow="hidden"
borderBottomWidth={StyleSheet.hairlineWidth}
borderBottomColor="$borderSubdued"
pointerEvents="box-none"
>
<Header
title={getHeaderTitle(options, route.name)}
// @ts-expect-error
headerTintColor={headerTintColor}
headerLeft={headerLeftView}
headerRight={
typeof headerRight === 'function'
? ({ tintColor }) => headerRight({ tintColor, canGoBack })
: headerRight
}
headerTitle={
typeof headerTitle === 'function'
? ({ children, tintColor }) =>
headerTitle({ children, tintColor })
: headerTitle
}
headerTitleAlign={headerTitleAlign}
headerTitleStyle={{
fontSize: 18,
lineHeight: 28,
fontWeight: '600',
}}
headerTransparent={headerTransparent}
headerShadowVisible={false}
headerBackground={headerBackground}
headerStyle={headerStyle}
/>
</Stack>
{!!headerSearchBarOptions && (
<Stack
flex={0}
$md={{
pb: '$4',
width: '100%',
}}
$gtMd={{
pl: isModelScreen ? '$0' : '$5',
py: isModelScreen ? '$0' : '$3.5',
pb: isModelScreen ? '$4' : '$0',
width: isModelScreen ? '100%' : '$60',
alignItems: isModelScreen ? 'flex-start' : 'center',
flex: isModelScreen ? 0 : 1,
width: isModelScreen ? '100%' : undefined,
}}
>
<HeaderSearchBar
placeholder={headerSearchBarOptions?.placeholder}
onChangeText={headerSearchBarOptions?.onChangeText}
onBlur={headerSearchBarOptions?.onBlur}
onFocus={headerSearchBarOptions?.onFocus}
onSearchButtonPress={headerSearchBarOptions?.onSearchButtonPress}
<Header
title={getHeaderTitle(options, route.name)}
// @ts-expect-error
headerTintColor={headerTintColor}
headerLeft={headerLeftView}
headerRight={
typeof headerRight === 'function'
? ({ tintColor }) => headerRight({ tintColor, canGoBack })
: headerRight
}
headerTitle={
typeof headerTitle === 'function'
? ({ children, tintColor }) =>
headerTitle({ children, tintColor })
: headerTitle
}
headerTitleAlign={headerTitleAlign}
headerTitleStyle={{
fontSize: 18,
lineHeight: 28,
fontWeight: '600',
}}
headerTransparent={headerTransparent}
headerShadowVisible={false}
headerBackground={headerBackground}
headerStyle={headerStyle}
/>
</Stack>
)}
</Stack>
{!!headerSearchBarOptions && (
<Stack
flex={0}
$md={{
pb: '$4',
width: '100%',
}}
$gtMd={{
pl: isModelScreen ? '$0' : '$5',
py: isModelScreen ? '$0' : '$3.5',
pb: isModelScreen ? '$4' : '$0',
width: isModelScreen ? '100%' : '$60',
alignItems: isModelScreen ? 'flex-start' : 'center',
}}
>
<HeaderSearchBar
placeholder={headerSearchBarOptions?.placeholder}
onChangeText={headerSearchBarOptions?.onChangeText}
onBlur={headerSearchBarOptions?.onBlur}
onFocus={headerSearchBarOptions?.onFocus}
onSearchButtonPress={headerSearchBarOptions?.onSearchButtonPress}
/>
</Stack>
)}
</Stack>
</DesktopDragZoneBox>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ const Sidebar: FC<BottomTabBarProps> = ({ navigation, state, descriptors }) => {
width: slideBarWidth,
backgroundColor: slideBg,
paddingTop: paddingTopValue,
borderRightColor: isCollapse ? undefined : slideBorder,
borderRightWidth: StyleSheet.hairlineWidth,
borderRightColor: slideBorder,
borderRightWidth: isCollapse ? 0 : StyleSheet.hairlineWidth,
}}
testID="Desktop-AppSideBar-Container"
>
Expand Down
2 changes: 0 additions & 2 deletions packages/components/src/Provider/hooks/useDeviceScreenSize.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { useMemo } from 'react';

import useProviderDeviceScreenSize from './useProviderDeviceScreenSize';

export default function useDeviceScreenSize() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import { Stack } from '../../Stack';

import NativeNestedTabView from './NativeNestedTabView';

import type { Route } from '../types';
import type { PagerViewViewManagerType } from './NativeNestedTabView';
import type {
NestedTabViewProps,
OnPageChangeEvent,
OnPageScrollStateChangeEvent,
} from './types';
import type { Route } from '../types';
import type { LayoutChangeEvent } from 'react-native';

export type ForwardRefHandle = {
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/provider/NavigationProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { createRef, memo, useEffect } from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { useTheme } from 'tamagui';

import { RootNavigator } from '@onekeyhq/kit/src/routes';
import { setBackgroundColor } from '@onekeyhq/components/src/Navigation/utils/StatusBarUtils';
import { RootNavigator } from '@onekeyhq/kit/src/routes';

export const navigationRef = createRef();
global.$navigationRef = navigationRef as any;
Expand Down
4 changes: 2 additions & 2 deletions packages/kit/src/provider/ThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import type { ComponentProps, FC } from 'react';
import { memo, useEffect } from 'react';

import { Provider } from '@onekeyhq/components';

import { useThemeProviderVariant } from '../hooks/useThemeVariant';
import {
setDarkContent,
setLightContent,
} from '@onekeyhq/components/src/Navigation/utils/StatusBarUtils';

import { useThemeProviderVariant } from '../hooks/useThemeVariant';

const ThemeApp: FC = ({ children }) => {
const { themeVariant, localeVariant } = useThemeProviderVariant();

Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/routes/Gallery/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import ActionListGallery from '@onekeyhq/kit/src/views/Components/stories/Action
import BadgeGallery from '@onekeyhq/kit/src/views/Components/stories/Badge';
import ButtonGallery from '@onekeyhq/kit/src/views/Components/stories/Button';
import CheckboxGallery from '@onekeyhq/kit/src/views/Components/stories/Checkbox';
import TabViewGallery from '@onekeyhq/kit/src/views/Components/stories/TabView';
import DialogGallery from '@onekeyhq/kit/src/views/Components/stories/Dialog';
import EmptyGallery from '@onekeyhq/kit/src/views/Components/stories/Empty';
import IconGallery from '@onekeyhq/kit/src/views/Components/stories/Icon';
Expand All @@ -18,6 +17,7 @@ import RadioGallery from '@onekeyhq/kit/src/views/Components/stories/Radio';
import SelectGallery from '@onekeyhq/kit/src/views/Components/stories/Select';
import SliderGallery from '@onekeyhq/kit/src/views/Components/stories/Slider';
import SwitchGallery from '@onekeyhq/kit/src/views/Components/stories/Switch';
import TabViewGallery from '@onekeyhq/kit/src/views/Components/stories/TabView';
import ToastGallery from '@onekeyhq/kit/src/views/Components/stories/Toast';
import ToggleGroupGallery from '@onekeyhq/kit/src/views/Components/stories/ToggleGroup';
import TooltipGallery from '@onekeyhq/kit/src/views/Components/stories/Tooltip';
Expand Down
Loading

0 comments on commit 94059b0

Please sign in to comment.