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 4d7fef7
Show file tree
Hide file tree
Showing 17 changed files with 100 additions and 280 deletions.
9 changes: 9 additions & 0 deletions .easignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules
__generated__

.expo-shared
.expo
dist
build-electron
.next
build
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
9 changes: 6 additions & 3 deletions apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
"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"
"native-bundle": "react-native start",
"eas-build-pre-install": "bash ./scripts/eas-build-pre-install.sh"
},
"private": true,
"devDependencies": {
Expand Down
8 changes: 8 additions & 0 deletions apps/mobile/scripts/eas-build-pre-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
# EAS Environment Secrets
# Run Path: apps/mobile

echo "@onekeyhq:registry=https://npm.pkg.github.com\n//npm.pkg.github.com/:_authToken=${NPM_TOKEN}" > ~/.npmrc

# Install Secret Keys
echo $IOS_SECRET | base64 -d > .env
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
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 4d7fef7

Please sign in to comment.