Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release PRs Sync #1454

Merged
merged 60 commits into from Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
8ef9da2
fix/androidManifest_generating
ElenaDiachenko Mar 4, 2024
5e35e70
added UT for getAllSuitableTasks
mihaiblaga89 Mar 4, 2024
85967bf
rename templateAndroid properties
ElenaDiachenko Mar 4, 2024
46e5763
fix app header, add Logger
ElenaDiachenko Mar 6, 2024
68fdb98
reworked test
mihaiblaga89 Mar 6, 2024
033308f
fix logger
ElenaDiachenko Mar 7, 2024
0051978
fix project version in app-harness
ElenaDiachenko Mar 7, 2024
6658a5d
remove unnecessary changes
ElenaDiachenko Mar 7, 2024
003e2f0
add correct xmlbuilder before running ios for the first time
ElenaDiachenko Mar 7, 2024
e3078fc
fix kaios sim path
Marius456 Mar 7, 2024
1670063
set kaios sim to run in its directory
Marius456 Mar 8, 2024
93158c6
fixed package versions for first run
ElenaDiachenko Mar 8, 2024
8104aea
fix styling for tv
mihaiblaga89 Mar 8, 2024
617923e
move requiredfiles logic, fixed ui on tv
mihaiblaga89 Mar 8, 2024
fa0e7d2
update schemas
pavjacko Mar 8, 2024
8f8b67d
add support for engine filters for template includedPaths
pavjacko Mar 8, 2024
9d7f405
fix template merging
pavjacko Mar 8, 2024
91f2f64
fix obj merges
pavjacko Mar 8, 2024
d0df09e
add context
ElenaDiachenko Mar 9, 2024
7f82b64
fix kaios sim selection
Marius456 Mar 9, 2024
27763ba
fix kaios sdk path
Marius456 Mar 9, 2024
24db6a3
small fix
Marius456 Mar 10, 2024
ad6c6f4
fix styles
ElenaDiachenko Mar 10, 2024
8fd2593
Merge branch 'release/1.0' into fix/schema_fixes
pavjacko Mar 10, 2024
d8f7772
Merge branch 'feat/get_tasks_ut' into chore/release_sync_2
pavjacko Mar 10, 2024
5078d28
fix UTs
pavjacko Mar 10, 2024
482889c
Merge branch 'fix/first_ios_run' into chore/release_sync_2
pavjacko Mar 10, 2024
4d4df7a
refactor template schema
pavjacko Mar 11, 2024
a24b6a3
fix bootstrap questions schema
pavjacko Mar 11, 2024
c5538fb
Merge branch 'fix/app-harness' into chore/release_sync_2
pavjacko Mar 11, 2024
e011b06
refactor app-harness to use single SplashScreen api for all platforms
pavjacko Mar 11, 2024
05db9a9
fix styles
pavjacko Mar 11, 2024
cb2cf9e
removed screen styling, removed unused imports
mihaiblaga89 Mar 11, 2024
acfb840
add wrapper background color
mihaiblaga89 Mar 11, 2024
f8996a9
Merge branch 'fix/tizen' into chore/release_sync_2
pavjacko Mar 11, 2024
5616134
Merge branch 'fix/androidManifest_generating' into chore/release_sync_2
pavjacko Mar 11, 2024
98d5594
Merge branch 'fix/run_kaios_sim' into chore/release_sync_2
pavjacko Mar 11, 2024
cef1e16
add linter coverage to PRs , fix code
pavjacko Mar 11, 2024
67ab88f
migrate to getContext PT1
pavjacko Mar 11, 2024
d3a5a98
migrate to getContext PT2
pavjacko Mar 11, 2024
dafd634
migrate to getContext PT3
pavjacko Mar 11, 2024
51f9a51
migrate to getConfig PT4
pavjacko Mar 11, 2024
9c17a35
migrate to getContext PT5
pavjacko Mar 11, 2024
79217a6
refactor copyAssetsFolder
pavjacko Mar 11, 2024
73e984f
refactor isPlatformActive, getServerHost
pavjacko Mar 11, 2024
6d33e17
refactor executeOrSkipTask
pavjacko Mar 11, 2024
eecb6d1
additional c cleanup
pavjacko Mar 11, 2024
c6ceacf
refactor getConfigProp PT1
pavjacko Mar 11, 2024
27c1ac6
more c cleanup
pavjacko Mar 11, 2024
51ecb5a
additional c cleanup
pavjacko Mar 11, 2024
042d2ec
fix UTs, linter
pavjacko Mar 12, 2024
2e5e7b9
alternative execute
pavjacko Mar 12, 2024
cfb8be1
add await
pavjacko Mar 12, 2024
8a88f74
regen schema, move rnvNewPatchDependencies to bootstrapConfig, add te…
pavjacko Mar 12, 2024
526b1af
small fix
Marius456 Mar 12, 2024
01d9643
update logger
pavjacko Mar 12, 2024
f02b9bd
fix kaios sim run command
Marius456 Mar 12, 2024
aa748c9
Merge pull request #1450 from flexn-io/fix/run_kaios_sim
pavjacko Mar 12, 2024
78a2a58
use build folder only when bundling assets
mihaiblaga89 Mar 15, 2024
f5ce83d
fix styling on tizenwear
mihaiblaga89 Mar 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/rnvUnitTest.yml
Expand Up @@ -20,6 +20,7 @@ jobs:
run: |
yarn
yarn bootstrap
yarn lint
yarn test
env:
CI: true
Expand Down
7 changes: 0 additions & 7 deletions packages/app-harness/buildHooks/tsconfig.json

This file was deleted.

12 changes: 9 additions & 3 deletions packages/app-harness/renative.json
Expand Up @@ -12,7 +12,7 @@
"react-native-splash-screen": {
"android": {
"templateAndroid": {
"MainActivity_java": {
"MainActivity_kt": {
"createMethods": ["SplashScreen.show(this)"],
"imports": ["org.devio.rn.splashscreen.SplashScreen"]
}
Expand Down Expand Up @@ -40,7 +40,7 @@
"TestNativeModule": {
"android": {
"templateAndroid": {
"MainApplication_java": {
"MainApplication_kt": {
"packages": ["MyAppPackage"]
}
},
Expand Down Expand Up @@ -100,6 +100,11 @@
"tag": "manifest",
"android:name": "",
"children": [
{
"tag": "uses-permission ",
"android:name": "android.permission.WRITE_EXTERNAL_STORAGE",
"children": []
},
{
"tag": "application",
"android:name": ".MainApplication",
Expand All @@ -108,7 +113,8 @@
"tag": "activity",
"android:name": "com.ahmedadeltito.photoeditor.PhotoEditorActivity",
"children": []
}
},
{ "tag": "activity", "android:name": "com.yalantis.ucrop.UCropActivity" }
]
}
]
Expand Down
71 changes: 54 additions & 17 deletions packages/app-harness/src/app/index.tsx
@@ -1,41 +1,65 @@
import React, { useEffect, useState } from 'react';
import { Button, Image, ScrollView, Text, View } from 'react-native';
import { Api } from '@rnv/renative';
import { OrientationLocker, PORTRAIT, LANDSCAPE } from '../components/OrientationLocker';
import { NewModuleButton } from '../components/NewModuleButton';
import { SplashScreen } from '../components/SplashScreen';
import { useSplashScreen } from '../components/SplashScreen';
import { ICON_LOGO, testProps } from '../config';
import styles from '../styles';
import { addNotificationListeners, removeNotificationListeners } from '../components/Notifications';
import { requestPermissions } from '../components/Permissions';
import { TestCase } from '../components/TestCase';

const App = () => {
import config from '../../package.json';
import { LoggerProvider, useLoggerContext } from '../context';
import { NotificationCallback } from '../components/types';

const App = () => (
<LoggerProvider>
<AppContent />
</LoggerProvider>
);

const AppContent = () => {
const [showVideo, setShowVideo] = useState(false);
const { logDebug, logs } = useLoggerContext();
const { SplashScreen } = useSplashScreen();

useEffect(() => {
SplashScreen.hide();
addNotificationListeners();
addNotificationListeners(handleNotification);

return () => {
removeNotificationListeners();
removeNotificationListeners(handleNotification);
};
}, []);

const handleNotification: NotificationCallback = (message) => logDebug(message);

const handleRequestPermissions = async () => {
try {
const permission = await requestPermissions();
logDebug('Permissions:', permission);
} catch (error) {
logDebug(`${error}`);
}
};

return (
<View style={{ flex: 1 }}>
<View style={styles.wrapper}>
<View style={styles.header}>
<Image
style={styles.logo}
source={ICON_LOGO}
{...testProps('template-starter-home-screen-renative-image')}
/>
<Text
style={{ color: 'black', fontWeight: 'bold', marginHorizontal: 10 }}
{...testProps('app-harness-home-screen-intro-text')}
>
<Text style={styles.introText} {...testProps('app-harness-home-screen-intro-text')}>
ReNative Harness
</Text>
<View style={{ flex: 1, alignItems: 'flex-end' }}>
<Text style={{ color: 'black' }}>v1.0.0-rc.12, platform: macos, formFactor: desktop</Text>
<Text style={styles.dynamicText}>
{`v${config.version}, platform: ${Api.platform}, factor: ${Api.formFactor}, engine: ${Api.engine}`}
</Text>
</View>
</View>

Expand All @@ -58,8 +82,8 @@ const App = () => {
<TestCase id={3} title="Orientation support ">
<OrientationLocker
orientation={PORTRAIT}
onChange={(orientation) => console.log('onChange', orientation)}
onDeviceChange={(orientation) => console.log('onDeviceChange', orientation)}
onChange={(orientation) => logDebug(`onChange ${orientation}`)}
mihaiblaga89 marked this conversation as resolved.
Show resolved Hide resolved
onDeviceChange={(orientation) => logDebug(`onDeviceChange ${orientation}`)}
/>
<Button title="Toggle Video" onPress={() => setShowVideo(!showVideo)} />
{showVideo && (
Expand All @@ -72,25 +96,38 @@ const App = () => {
)}
</TestCase>
<TestCase id={4} title="Permissions">
<Button onPress={requestPermissions} title="Request permissions" />
<Button onPress={handleRequestPermissions} title="Request permissions" />
</TestCase>
<TestCase id={5} title="Image Support">
<Image source={ICON_LOGO} style={{ width: 100, height: 100 }} />
</TestCase>
<TestCase id={6} title="Splash Screen">
<Button onPress={() => SplashScreen.show()} title="Show SplashScreen" />
</TestCase>
</ScrollView>
</View>
<View
<ScrollView
style={{
backgroundColor: '#EEEEEE',
height: 100,
maxHeight: '20%',
width: '100%',
borderTopWidth: 1,
borderTopColor: 'black',
padding: 10,
}}
contentContainerStyle={{
paddingBottom: 10,
}}
>
<Text style={{ color: 'black' }}>Logs:</Text>
</View>
<Text style={[styles.dynamicText, { fontWeight: 'bold' }]}>{`Logs: `}</Text>
{logs
? logs.map((it, idx) => (
<Text key={idx} style={styles.dynamicText}>
{it}
</Text>
))
: null}
</ScrollView>
</View>
);
};
Expand Down
@@ -1,17 +1,23 @@
import React from 'react';
import { NativeModules, Button } from 'react-native';
import { useLoggerContext } from '../../context';

export const NewModuleButton = () => {
const { TestNativeModule } = NativeModules;
const { logDebug } = useLoggerContext();
const callback = (error: any, result: string) => {
if (error) {
console.log(error);
logDebug(error);
} else {
console.log(result);
logDebug(result);
}
};
const onPress = () => {
TestNativeModule.createTestEvent('testName', 'testLocation', callback);
if (TestNativeModule) {
TestNativeModule.createTestEvent('testName', 'testLocation', callback);
} else {
logDebug('NativeModules not supported for this platform');
}
};
return <Button title="Click to invoke native module!" color="#841584" onPress={onPress} />;
};
@@ -1,9 +1,11 @@
import React from 'react';
import { Button } from 'react-native';
import { useLoggerContext } from '../../context';

export const NewModuleButton = () => {
const { logDebug } = useLoggerContext();
const onPress = () => {
console.log('NativeModules not supported in web');
logDebug('NativeModules not supported in web');
};
return <Button title="Click to invoke native module!" color="#841584" onPress={onPress} />;
};
@@ -1,10 +1,11 @@
import PushNotificationIOS from '@react-native-community/push-notification-ios';
import { NotificationCallback, NotificationError } from '../types';

export const addNotificationListeners = () => {
export const addNotificationListeners = (callback: NotificationCallback) => {
PushNotificationIOS.requestPermissions();
PushNotificationIOS.addEventListener('notification', onRemoteNotification);
PushNotificationIOS.addEventListener('register', onRegistered);
PushNotificationIOS.addEventListener('registrationError', onError);
PushNotificationIOS.addEventListener('register', onRegistered(callback));
PushNotificationIOS.addEventListener('registrationError', onError(callback));
};

export const removeNotificationListeners = () => {
Expand All @@ -13,12 +14,12 @@ export const removeNotificationListeners = () => {
PushNotificationIOS.removeEventListener('registrationError');
};

const onRegistered = (deviceToken) => {
console.log(`Device Token: ${deviceToken}`);
const onRegistered = (callback: NotificationCallback) => (deviceToken: string) => {
callback(`Device Token: ${deviceToken}`);
};

const onError = (error) => {
console.log(`Error on notification register: ${error}`);
const onError = (callback: NotificationCallback) => (error: NotificationError) => {
callback(`Error on notification register: ${error.message}`);
};

const onRemoteNotification = (notification) => {
Expand Down
10 changes: 6 additions & 4 deletions packages/app-harness/src/components/Notifications/index.ts
@@ -1,7 +1,9 @@
export const addNotificationListeners = () => {
console.log('addNotificationListeners not supported on this platform');
import { NotificationCallback } from '../types';

export const addNotificationListeners = (callback: NotificationCallback) => {
callback('addNotificationListeners not supported on this platform');
};

export const removeNotificationListeners = () => {
console.log('removeNotificationListeners not supported on this platform');
export const removeNotificationListeners = (callback: NotificationCallback) => {
callback('removeNotificationListeners not supported on this platform');
};
@@ -1,7 +1,5 @@
import { request, PERMISSIONS } from 'react-native-permissions';

export const requestPermissions = () => {
request(PERMISSIONS.IOS.CONTACTS).then((result) => {
console.log(result);
});
return request(PERMISSIONS.IOS.CONTACTS);
};
2 changes: 1 addition & 1 deletion packages/app-harness/src/components/Permissions/index.ts
@@ -1,3 +1,3 @@
export const requestPermissions = () => {
console.log('requestPermissions not supported on this platform');
return 'requestPermissions not supported on this platform';
};
@@ -1,3 +1,5 @@
import SplashScreen from 'react-native-splash-screen';

export { SplashScreen };
export function useSplashScreen() {
return { SplashScreen };
}
20 changes: 15 additions & 5 deletions packages/app-harness/src/components/SplashScreen/index.ts
@@ -1,10 +1,20 @@
const SplashScreen = {
import { useEffect } from 'react';
import { NotificationCallback } from '../types';
import { useLoggerContext } from '../../context';

const SplashScreen = (callback: NotificationCallback) => ({
hide: () => {
console.log('SplashScreen.hide not supported on this platform');
callback('SplashScreen.hide not supported on this platform');
},
show: () => {
console.log('SplashScreen.show not supported on this platform');
callback('SplashScreen.show not supported on this platform');
},
};
});

export { SplashScreen };
export function useSplashScreen() {
const { logDebug } = useLoggerContext();
useEffect(() => {
//TODO: We could also cache SplashScreen here
}, []);
return { SplashScreen: SplashScreen(logDebug) };
}
4 changes: 4 additions & 0 deletions packages/app-harness/src/components/SplashScreen/types.ts
@@ -0,0 +1,4 @@
export type SplashscreenType = {
hide: () => void;
show: () => void;
};
2 changes: 2 additions & 0 deletions packages/app-harness/src/components/types.ts
@@ -0,0 +1,2 @@
export type NotificationCallback = (message: string) => void;
export type NotificationError = { message: string; code: number; details: any };
25 changes: 25 additions & 0 deletions packages/app-harness/src/context/index.tsx
@@ -0,0 +1,25 @@
import React, { createContext, useContext, useState, ReactNode, FC } from 'react';

type LogMessage = string;

type LoggerContextType = {
logs: LogMessage[];
logDebug: (...msg: LogMessage[]) => void;
};
type LoggerProviderProps = {
children: ReactNode;
};

const LoggerContext = createContext<LoggerContextType>({} as LoggerContextType);

export const LoggerProvider: FC<LoggerProviderProps> = ({ children }) => {
const [logs, setLogs] = useState<LogMessage[]>([]);
const logDebug = (...msg: LogMessage[]) => {
setLogs((prevLogs) => prevLogs.concat(msg));
console.log(...msg);

Check warning on line 19 in packages/app-harness/src/context/index.tsx

View workflow job for this annotation

GitHub Actions / build (18.x)

Unexpected console statement
};

return <LoggerContext.Provider value={{ logs, logDebug }}>{children}</LoggerContext.Provider>;
};

export const useLoggerContext = (): LoggerContextType => useContext(LoggerContext);
22 changes: 20 additions & 2 deletions packages/app-harness/src/styles/index.ts
@@ -1,7 +1,15 @@
import { isPlatformIos } from '@rnv/renative';
import { isPlatformIos, isFactorMobile, isFactorWatch } from '@rnv/renative';
import { StyleSheet } from 'react-native';

const styles = StyleSheet.create({
wrapper: {
backgroundColor: 'white',
position: 'absolute',
left: 0,
right: 0,
bottom: 0,
top: 0,
},
container: {
flex: 1,
justifyContent: 'center',
Expand All @@ -18,13 +26,23 @@ const styles = StyleSheet.create({
header: {
marginTop: isPlatformIos ? 50 : 0, // TODO: remove once safe area view is implemented
flexDirection: 'row',
height: 50,
height: 60,
backgroundColor: 'white',
borderBottomColor: 'black',
borderBottomWidth: 1,
alignItems: 'center',
padding: 10,
},
introText: {
color: 'black',
fontWeight: 'bold',
marginHorizontal: 10,
display: isFactorMobile || isFactorWatch ? 'none' : 'flex',
},
dynamicText: {
color: 'black',
fontSize: isFactorWatch ? 10 : 14,
},
});

export default styles;