1
0
mirror of https://gitcode.com/gh_mirrors/re/react-native-pushy.git synced 2025-10-31 13:23:12 +08:00
Code Issues Packages Projects Releases Wiki Activity GitHub Gitee

feat: project init

This commit is contained in:
steven
2023-03-15 23:27:25 +08:00
parent 992b17d25a
commit 92675ed37c
43 changed files with 6448 additions and 546 deletions

Binary file not shown.

View File

@@ -0,0 +1,111 @@
/** @type {Detox.DetoxConfig} */
module.exports = {
logger: {
level: process.env.CI ? 'debug' : undefined,
},
testRunner: {
args: {
config: 'e2e/jest.config.js',
maxWorkers: process.env.CI ? 2 : undefined,
_: ['e2e'],
},
},
artifacts: {
plugins: {
log: process.env.CI ? 'failing' : undefined,
screenshot: process.env.CI ? 'failing' : undefined,
},
},
apps: {
'ios.release': {
type: 'ios.app',
binaryPath:
'ios/build/Build/Products/Release-iphonesimulator/testHotUpdate.app',
build:
'export RCT_NO_LAUNCH_PACKAGER=true && xcodebuild -workspace ios/testHotUpdate.xcworkspace -UseNewBuildSystem=NO -scheme testHotUpdate -configuration Release -sdk iphonesimulator -derivedDataPath ios/build -quiet',
},
'ios.debug': {
type: 'ios.app',
binaryPath:
'ios/build/Build/Products/Debug-iphonesimulator/testHotUpdate.app',
build:
'xcodebuild -workspace ios/testHotUpdate.xcworkspace -UseNewBuildSystem=NO -scheme testHotUpdate -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build',
start: 'scripts/start-rn.sh ios',
},
'android.debug': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/debug/app-debug.apk',
build:
'cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -',
start: 'scripts/start-rn.sh android',
},
'android.release': {
type: 'android.apk',
binaryPath: 'android/app/build/outputs/apk/release/app-release.apk',
build:
'cd android ; ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release ; cd -',
},
},
devices: {
simulator: {
type: 'ios.simulator',
headless: Boolean(process.env.CI),
device: {
type: 'iPhone 14',
},
},
emulator: {
type: 'android.emulator',
headless: Boolean(process.env.CI),
gpuMode: process.env.CI ? 'off' : undefined,
device: {
avdName: 'Pixel_3a_API_33_arm64-v8a',
},
utilBinaryPaths: ['./cache/test-butler-app.apk'],
},
'genymotion.emulator.uuid': {
type: 'android.genycloud',
device: {
recipeUUID: 'a50a71d6-da90-4c67-bdfa-5b602b0bbd15',
},
utilBinaryPaths: ['./cache/test-butler-app.apk'],
},
'genymotion.emulator.name': {
type: 'android.genycloud',
device: {
recipeName: 'Pixel_3a_API_33_arm64-v8a',
},
utilBinaryPaths: ['./cache/test-butler-app.apk'],
},
},
configurations: {
'ios.sim.release': {
device: 'simulator',
app: 'ios.release',
},
'ios.sim.debug': {
device: 'simulator',
app: 'ios.debug',
},
'ios.manual': {
type: 'ios.manual',
behavior: {
launchApp: 'manual',
},
artifacts: false,
session: {
autoStart: true,
server: 'ws://localhost:8099',
sessionId: 'com.wix.demo.react.native',
},
},
'android.emu.debug': {
device: 'emulator',
app: 'android.debug',
},
'android.emu.release': {
device: 'emulator',
app: 'android.release',
},
},
};

View File

@@ -0,0 +1,89 @@
import {by, device, element, expect} from 'detox';
describe('测试Native模块的方法', () => {
beforeAll(async () => {
await device.launchApp();
});
it('setLocalHashInfo', async () => {
await element(by.id('testcase')).longPress();
await element(by.id('setLocalHashInfo')).tap();
await element(by.id('submit')).tap();
await expect(element(by.text('done'))).toBeVisible();
await element(by.text('OK')).tap();
});
it('getLocalHashInfo', async () => {
await element(by.id('getLocalHashInfo')).tap();
await element(by.id('submit')).tap();
await expect(element(by.text('done'))).toBeVisible();
await element(by.text('OK')).tap();
});
it('setUuid', async () => {
await element(by.id('setUuid')).tap();
await element(by.id('submit')).tap();
await expect(element(by.text('done'))).toBeVisible();
await element(by.text('OK')).tap();
});
it('setBlockUpdate', async () => {
await element(by.id('setBlockUpdate')).tap();
await element(by.id('submit')).tap();
await expect(element(by.text('done'))).toBeVisible();
await element(by.text('OK')).tap();
});
it('reloadUpdate', async () => {
await element(by.id('reloadUpdate')).tap();
await element(by.id('submit')).tap();
await expect(element(by.text('刚刚更新失败了,版本被回滚.'))).toBeVisible();
await element(by.text('OK')).tap();
});
it('setNeedUpdate', async () => {
await element(by.id('testcase')).longPress();
await element(by.id('setNeedUpdate')).tap();
await element(by.id('submit')).tap();
await expect(element(by.text('done'))).toBeVisible();
await element(by.text('OK')).tap();
});
it('markSuccess', async () => {
await element(by.id('markSuccess')).tap();
await element(by.id('submit')).tap();
await expect(element(by.text('done'))).toBeVisible();
await element(by.text('OK')).tap();
});
it('downloadPatchFromPpk', async () => {
await element(by.id('downloadPatchFromPpk')).tap();
await element(by.id('submit')).tap();
await expect(element(by.text('failed to open zip file'))).toBeVisible();
await element(by.text('OK')).tap();
});
it('downloadPatchFromPackage', async () => {
await element(by.id('downloadPatchFromPackage')).tap();
await element(by.id('submit')).tap();
await expect(element(by.text('failed to open zip file'))).toBeVisible();
await element(by.text('OK')).tap();
});
it('downloadFullUpdate', async () => {
await element(by.id('downloadFullUpdate')).tap();
await element(by.id('submit')).tap();
await expect(element(by.text('failed to open zip file'))).toBeVisible();
await element(by.text('OK')).tap();
});
if (device.getPlatform() === 'android') {
it('downloadAndInstallApk', async () => {
await element(by.id('testcase')).longPress();
await element(by.id('downloadAndInstallApk')).tap();
await element(by.id('submit')).tap();
await expect(element(by.text('failed to open zip file'))).toBeVisible();
await element(by.text('OK')).tap();
});
}
});

View File

@@ -0,0 +1,29 @@
import { execSync } from 'child_process';
import { pathExists, ensureDir } from 'fs-extra';
import { resolveConfig } from 'detox/internals';
import { globalSetup } from 'detox/runners/jest';
export default async function customGlobalSetup() {
const config = await resolveConfig();
if (config.device.type === 'android.emulator') {
await downloadTestButlerAPK();
}
await globalSetup();
}
async function downloadTestButlerAPK() {
const version = '2.2.1';
const artifactUrl = `https://repo1.maven.org/maven2/com/linkedin/testbutler/test-butler-app/${version}/test-butler-app-${version}.apk`;
const filePath = `cache/test-butler-app.apk`;
await ensureDir('cache');
if (!(await pathExists(filePath))) {
console.log(`\nDownloading Test-Butler APK v${version}...`);
execSync(`curl -f -o ${filePath} ${artifactUrl}`);
}
}
module.exports = customGlobalSetup;

View File

@@ -0,0 +1,16 @@
/** @type {import('jest').Config} */
module.exports = {
maxWorkers: 1,
globalSetup: './globalSetup.ts',
globalTeardown: 'detox/runners/jest/globalTeardown',
testEnvironment: 'detox/runners/jest/testEnvironment',
setupFilesAfterEnv: ['./setup.ts'],
testRunner: 'jest-circus/runner',
testTimeout: 120000,
testMatch: ['**/*.test.ts'],
transform: {
'\\.tsx?$': 'ts-jest',
},
reporters: ['detox/runners/jest/reporter'],
verbose: true,
};

View File

@@ -0,0 +1,5 @@
import { device } from 'detox';
beforeAll(async () => {
await device.launchApp();
});

View File

@@ -89,11 +89,6 @@ PODS:
- DoubleConversion
- fmt (~> 6.2.1)
- glog
- RCT-Folly/Fabric (2021.07.22.00):
- boost
- DoubleConversion
- fmt (~> 6.2.1)
- glog
- RCT-Folly/Futures (2021.07.22.00):
- boost
- DoubleConversion
@@ -126,10 +121,8 @@ PODS:
- RCTRequired
- RCTTypeSafety
- React-Core
- React-graphics
- React-jsi
- React-jsiexecutor
- React-rncore
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- React-Core (0.71.1):
@@ -278,326 +271,6 @@ PODS:
- React-logger (= 0.71.1)
- React-perflogger (= 0.71.1)
- React-runtimeexecutor (= 0.71.1)
- React-Fabric (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-Fabric/animations (= 0.71.1)
- React-Fabric/attributedstring (= 0.71.1)
- React-Fabric/butter (= 0.71.1)
- React-Fabric/componentregistry (= 0.71.1)
- React-Fabric/componentregistrynative (= 0.71.1)
- React-Fabric/components (= 0.71.1)
- React-Fabric/config (= 0.71.1)
- React-Fabric/core (= 0.71.1)
- React-Fabric/debug_core (= 0.71.1)
- React-Fabric/debug_renderer (= 0.71.1)
- React-Fabric/imagemanager (= 0.71.1)
- React-Fabric/leakchecker (= 0.71.1)
- React-Fabric/mapbuffer (= 0.71.1)
- React-Fabric/mounting (= 0.71.1)
- React-Fabric/runtimescheduler (= 0.71.1)
- React-Fabric/scheduler (= 0.71.1)
- React-Fabric/telemetry (= 0.71.1)
- React-Fabric/templateprocessor (= 0.71.1)
- React-Fabric/textlayoutmanager (= 0.71.1)
- React-Fabric/uimanager (= 0.71.1)
- React-Fabric/utils (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/animations (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/attributedstring (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/butter (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/componentregistry (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/componentregistrynative (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/components (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-Fabric/components/activityindicator (= 0.71.1)
- React-Fabric/components/image (= 0.71.1)
- React-Fabric/components/inputaccessory (= 0.71.1)
- React-Fabric/components/legacyviewmanagerinterop (= 0.71.1)
- React-Fabric/components/modal (= 0.71.1)
- React-Fabric/components/root (= 0.71.1)
- React-Fabric/components/safeareaview (= 0.71.1)
- React-Fabric/components/scrollview (= 0.71.1)
- React-Fabric/components/slider (= 0.71.1)
- React-Fabric/components/text (= 0.71.1)
- React-Fabric/components/textinput (= 0.71.1)
- React-Fabric/components/unimplementedview (= 0.71.1)
- React-Fabric/components/view (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/components/activityindicator (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/components/image (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/components/inputaccessory (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/components/legacyviewmanagerinterop (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/components/modal (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/components/root (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/components/safeareaview (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/components/scrollview (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/components/slider (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/components/text (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/components/textinput (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/components/unimplementedview (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/components/view (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- Yoga
- React-Fabric/config (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/core (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/debug_core (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/debug_renderer (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/imagemanager (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- React-RCTImage (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/leakchecker (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/mapbuffer (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/mounting (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/runtimescheduler (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/scheduler (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/telemetry (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/templateprocessor (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/textlayoutmanager (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-Fabric/uimanager
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/uimanager (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-Fabric/utils (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- RCTRequired (= 0.71.1)
- RCTTypeSafety (= 0.71.1)
- React-graphics (= 0.71.1)
- React-jsi (= 0.71.1)
- React-jsiexecutor (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-graphics (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- React-Core/Default (= 0.71.1)
- React-hermes (0.71.1):
- DoubleConversion
- glog
@@ -624,34 +297,19 @@ PODS:
- React-jsinspector (0.71.1)
- React-logger (0.71.1):
- glog
- react-native-update (9.1.0):
- RCT-Folly (= 2021.07.22.00)
- RCTRequired
- RCTTypeSafety
- react-native-update (9.0.0):
- React
- React-Codegen
- React-Core
- react-native-update/HDiffPatch (= 9.1.0)
- react-native-update/RCTPushy (= 9.1.0)
- ReactCommon/turbomodule/core
- react-native-update/HDiffPatch (= 9.0.0)
- react-native-update/RCTPushy (= 9.0.0)
- SSZipArchive
- react-native-update/HDiffPatch (9.1.0):
- RCT-Folly (= 2021.07.22.00)
- RCTRequired
- RCTTypeSafety
- react-native-update/HDiffPatch (9.0.0):
- React
- React-Codegen
- React-Core
- ReactCommon/turbomodule/core
- SSZipArchive
- react-native-update/RCTPushy (9.1.0):
- RCT-Folly (= 2021.07.22.00)
- RCTRequired
- RCTTypeSafety
- react-native-update/RCTPushy (9.0.0):
- React
- React-Codegen
- React-Core
- ReactCommon/turbomodule/core
- SSZipArchive
- React-perflogger (0.71.1)
- React-RCTActionSheet (0.71.1):
@@ -668,8 +326,6 @@ PODS:
- RCTRequired
- RCTTypeSafety
- React-Core
- React-graphics
- React-RCTFabric
- ReactCommon/turbomodule/core
- React-RCTBlob (0.71.1):
- RCT-Folly (= 2021.07.22.00)
@@ -679,11 +335,6 @@ PODS:
- React-jsi (= 0.71.1)
- React-RCTNetwork (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-RCTFabric (0.71.1):
- RCT-Folly/Fabric (= 2021.07.22.00)
- React-Core (= 0.71.1)
- React-Fabric (= 0.71.1)
- React-RCTImage (= 0.71.1)
- React-RCTImage (0.71.1):
- RCT-Folly (= 2021.07.22.00)
- RCTTypeSafety (= 0.71.1)
@@ -719,7 +370,6 @@ PODS:
- React-Core/RCTVibrationHeaders (= 0.71.1)
- React-jsi (= 0.71.1)
- ReactCommon/turbomodule/core (= 0.71.1)
- React-rncore (0.71.1)
- React-runtimeexecutor (0.71.1):
- React-jsi (= 0.71.1)
- ReactCommon/turbomodule/bridging (0.71.1):
@@ -779,7 +429,6 @@ DEPENDENCIES:
- libevent (~> 2.1.12)
- OpenSSL-Universal (= 1.1.1100)
- RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
- RCT-Folly/Fabric (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
- RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
- RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
- React (from `../node_modules/react-native/`)
@@ -790,8 +439,6 @@ DEPENDENCIES:
- React-Core/RCTWebSocket (from `../node_modules/react-native/`)
- React-CoreModules (from `../node_modules/react-native/React/CoreModules`)
- React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`)
- React-Fabric (from `../node_modules/react-native/ReactCommon`)
- React-graphics (from `../node_modules/react-native/ReactCommon/react/renderer/graphics`)
- React-hermes (from `../node_modules/react-native/ReactCommon/hermes`)
- React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
@@ -803,14 +450,12 @@ DEPENDENCIES:
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
- React-RCTAppDelegate (from `../node_modules/react-native/Libraries/AppDelegate`)
- React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
- React-RCTFabric (from `../node_modules/react-native/React`)
- React-RCTImage (from `../node_modules/react-native/Libraries/Image`)
- React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`)
- React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`)
- React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`)
- React-RCTText (from `../node_modules/react-native/Libraries/Text`)
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- React-rncore (from `../node_modules/react-native/ReactCommon`)
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
@@ -865,10 +510,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/React/CoreModules"
React-cxxreact:
:path: "../node_modules/react-native/ReactCommon/cxxreact"
React-Fabric:
:path: "../node_modules/react-native/ReactCommon"
React-graphics:
:path: "../node_modules/react-native/ReactCommon/react/renderer/graphics"
React-hermes:
:path: "../node_modules/react-native/ReactCommon/hermes"
React-jsi:
@@ -891,8 +532,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/Libraries/AppDelegate"
React-RCTBlob:
:path: "../node_modules/react-native/Libraries/Blob"
React-RCTFabric:
:path: "../node_modules/react-native/React"
React-RCTImage:
:path: "../node_modules/react-native/Libraries/Image"
React-RCTLinking:
@@ -905,8 +544,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/Libraries/Text"
React-RCTVibration:
:path: "../node_modules/react-native/Libraries/Vibration"
React-rncore:
:path: "../node_modules/react-native/ReactCommon"
React-runtimeexecutor:
:path: "../node_modules/react-native/ReactCommon/runtimeexecutor"
ReactCommon:
@@ -919,7 +556,7 @@ SPEC CHECKSUMS:
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: ad72713385db5289b19f1ead07e8e4aa26dcb01d
FBReactNativeSpec: 06fc2a521838dc240b499699d43467b071c66908
FBReactNativeSpec: df2602c11e33d310433496e28a48b4b2be652a61
Flipper: 26fc4b7382499f1281eb8cb921e5c3ad6de91fe0
Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c
Flipper-DoubleConversion: 2dc99b02f658daf147069aad9dbd29d8feb06d30
@@ -939,31 +576,27 @@ SPEC CHECKSUMS:
RCTTypeSafety: c276d85975bde3d8448907235c70bf0da257adfd
React: e481a67971af1ce9639c9f746b753dd0e84ca108
React-callinvoker: 1051c04a94fa9d243786b86380606bad701a3b31
React-Codegen: d4bc58865453b6a797405aa99f9fa1da3c9e58c6
React-Codegen: 14b1e716d361d5ad95e0ce1a338f3fa0733a98b5
React-Core: 698fc3baecb80d511d987475a16d036cec6d287f
React-CoreModules: 59245305f41ff0adfeac334acc0594dea4585a7c
React-cxxreact: 49accd2954b0f532805dbcd1918fa6962f32f247
React-Fabric: 30982dc19c7511bedf1751b0a0c21a5b816e2a3e
React-graphics: beabc29b026e7472ced1482557effedd15a09cf1
React-hermes: d068733294581a085e95b6024e8d951b005e26d3
React-jsi: 122b9bce14f4c6c7cb58f28f87912cfe091885fa
React-jsiexecutor: 60cf272aababc5212410e4249d17cea14fc36caa
React-jsinspector: ff56004b0c974b688a6548c156d5830ad751ae07
React-logger: 60a0b5f8bed667ecf9e24fecca1f30d125de6d75
react-native-update: b9d44d250953e61f1b42c22fa4d585a6bb5dd4d6
react-native-update: 2b5ef06bfeaa668614c8deb7ec4d20dcf56f9278
React-perflogger: ec8eef2a8f03ecfa6361c2c5fb9197ef4a29cc85
React-RCTActionSheet: a0c023b86cf4c862fa9c4eb0f6f91fbe878fb2de
React-RCTAnimation: 168d53718c74153947c0109f55900faa64d79439
React-RCTAppDelegate: 5f34addd2f9d8c542c129b562b7f3db0cc599a3d
React-RCTAppDelegate: a8efbab128b34aa07a9491c85a41401210b1bec5
React-RCTBlob: 9bcbfc893bfda9f6b2eb016329d38c0f6366d31a
React-RCTFabric: cec4e89720e8778aa132e5515be1af251d2e9b6a
React-RCTImage: 3fcd4570b4b0f1ac2f4b4b6308dba33ce66c5b50
React-RCTLinking: 1edb8e1bb3fc39bf9e13c63d6aaaa3f0c3d18683
React-RCTNetwork: 500a79e0e0f67678077df727fabba87a55c043e1
React-RCTSettings: cc4414eb84ad756d619076c3999fecbf12896d6f
React-RCTText: 2a34261f3da6e34f47a62154def657546ebfa5e1
React-RCTVibration: 49d531ec8498e0afa2c9b22c2205784372e3d4f3
React-rncore: b802bc9f6985c482127b066c869999a09d25edeb
React-runtimeexecutor: 311feb67600774723fe10eb8801d3138cae9ad67
ReactCommon: 03be76588338a27a88d103b35c3c44a3fd43d136
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608

View File

@@ -211,7 +211,7 @@
};
};
};
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "testHotupdate" */;
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "testHotUpdate" */;
compatibilityVersion = "Xcode 12.0";
developmentRegion = en;
hasScannedForEncodings = 0;
@@ -689,7 +689,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "testHotupdate" */ = {
83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "testHotUpdate" */ = {
isa = XCConfigurationList;
buildConfigurations = (
83CBBA201A601CBA00E9B192 /* Debug */,

View File

@@ -7,4 +7,7 @@
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
<FileRef
location = "group:testHotUpdate.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -24,17 +24,6 @@
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UILaunchStoryboardName</key>
@@ -51,5 +40,18 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key>
<dict>
<key>localhost</key>
<dict>
<key>NSExceptionAllowsInsecureHTTPLoads</key>
<true/>
</dict>
</dict>
</dict>
</dict>
</plist>

View File

@@ -25,11 +25,15 @@
"@types/react": "^18.0.24",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.2.1",
"detox": "^20.5.0",
"eslint": "^8.19.0",
"fs-extra": "^11.1.0",
"jest": "^29.2.1",
"metro-react-native-babel-preset": "0.73.7",
"prettier": "^2.4.1",
"react-test-renderer": "18.2.0"
"react-test-renderer": "18.2.0",
"ts-jest": "^29.0.5",
"typescript": "^4.9.5"
},
"jest": {
"preset": "react-native"

View File

@@ -1,6 +1,6 @@
/* eslint-disable react-native/no-inline-styles */
/* eslint-disable react/react-in-jsx-scope */
import {useState} from 'react';
import {useCallback, useMemo, useState} from 'react';
import {
ActivityIndicator,
Alert,
@@ -10,14 +10,117 @@ import {
StyleSheet,
SafeAreaView,
Text,
ScrollView,
View,
TouchableOpacity,
} from 'react-native';
import {PushyModule} from 'react-native-update';
const Hash = '9D5CE6EBA420717BE7E7D308B11F8207681B066C951D68F3994D19828F342474';
const UUID = '00000000-0000-0000-0000-000000000000';
const DownloadUrl =
'http://cos.pgyer.com/697913e94d7441f20c686e2b0996a1aa.apk?sign=363b035b7ef52c199c268abfacee3712&t=1678603669&response-content-disposition=attachment%3Bfilename%3DtestHotupdate_1.0.apk';
export default function TestConsole({visible}) {
const [text, setText] = useState('');
const [running, setRunning] = useState(false);
const [options, setOptions] = useState();
const NativeTestMethod = useMemo(() => {
return [
{
name: 'setLocalHashInfo',
invoke: () => {
setText(
`setLocalHashInfo\n${Hash}\n{\"version\":\"1.0.0\",\"size\":\"19M\"}`,
);
},
},
{
name: 'getLocalHashInfo',
invoke: () => {
setText(`getLocalHashInfo\n${Hash}`);
},
},
{
name: 'setUuid',
invoke: () => {
setText(`setUuid\n${UUID}`);
},
},
{
name: 'setBlockUpdate',
invoke: () => {
setText('setBlockUpdate');
setOptions({reason: 'application has been block', until: 1673082950});
},
},
{
name: 'reloadUpdate',
invoke: () => {
setText('reloadUpdate');
setOptions({hash: Hash});
},
},
{
name: 'setNeedUpdate',
invoke: () => {
setText('setNeedUpdate');
setOptions({hash: Hash});
},
},
{
name: 'markSuccess',
invoke: () => {
setText('markSuccess');
},
},
{
name: 'downloadPatchFromPpk',
invoke: () => {
setText('downloadPatchFromPpk');
setOptions({updateUrl: DownloadUrl, hash: Hash, originHash: Hash});
},
},
{
name: 'downloadPatchFromPackage',
invoke: () => {
setText('downloadPatchFromPackage');
setOptions({updateUrl: DownloadUrl, hash: Hash});
},
},
{
name: 'downloadFullUpdate',
invoke: () => {
setText('downloadFullUpdate');
setOptions({updateUrl: DownloadUrl, hash: Hash});
},
},
{
name: 'downloadAndInstallApk',
invoke: () => {
setText('downloadAndInstallApk');
setOptions({url: DownloadUrl, target: Hash, hash: Hash});
},
},
];
}, []);
const renderTestView = useCallback(() => {
const views = [];
for (let i = 0; i < NativeTestMethod.length; i++) {
views.push(
<TouchableOpacity
key={i}
testID={NativeTestMethod[i].name}
onPress={() => {
NativeTestMethod[i].invoke();
}}
style={{width: 10, height: 10, backgroundColor: 'red'}}
/>,
);
}
return <View>{views}</View>;
}, [NativeTestMethod]);
return (
<Modal visible={visible}>
<SafeAreaView style={{flex: 1, padding: 10}}>
@@ -42,25 +145,27 @@ export default function TestConsole({visible}) {
{running && <ActivityIndicator />}
<Button
title="执行"
testID="submit"
onPress={async () => {
setRunning(true);
try {
const inputs = text.split('\n');
const methodName = inputs[0];
let params;
let params = [];
if (inputs.length === 1) {
await PushyModule[methodName]();
if (options) {
await PushyModule[methodName](options);
} else {
await PushyModule[methodName]();
}
} else {
if (inputs.length === 2) {
params = inputs[1];
params = [inputs[1]];
} else {
params = {};
for (let i = 1; i < inputs.length; i += 2) {
params[inputs[i]] = inputs[i + 1];
}
params = [inputs[1], inputs[2]];
console.log({inputs, params});
}
await PushyModule[methodName](params);
await PushyModule[methodName](...params);
}
Alert.alert('done');
} catch (e) {
@@ -69,9 +174,11 @@ export default function TestConsole({visible}) {
setRunning(false);
}}
/>
<View style={{marginTop: 15}}>
<ScrollView style={{marginTop: 15}}>
<Button title="重置" onPress={() => setText('')} />
</View>
{renderTestView()}
</ScrollView>
</SafeAreaView>
</Modal>
);

View File

@@ -170,6 +170,7 @@ export default class App extends Component {
</TouchableOpacity>
<TouchableOpacity
testID="testcase"
style={{marginTop: 15}}
onLongPress={() => {
this.setState({showTestConsole: true});

File diff suppressed because it is too large Load Diff