mirror of
https://github.com/mattermost/mattermost-mobile.git
synced 2026-11-05 02:18:56 +00:00
* bumps minSdkVersion to 30 Older versions are past end-of-life for security patches. voximplant service patch is also updated with minSdkVersion set to 30. * removes manifest attributes no longer needed when minSdk is 30 * removes guard to for version lower than O * removes permission check for versions lower than 28 * remove tests related to unsupported android sdk versions * bumps iOS minSdkVersion to 18 * removes iOS 13/15 guards in hardware-keyboard * removes iOS 15 guards in NotificationService * removes iOS 15 guard in Gekidou network delegate since gekidou is iOS only other platform guards are not needed * removes version guard no longer needed in voximplant patch * removes hasWriteStoragePermission dead stub and its call site * removes unused setSoftKeyboardToAdjustResize from rnutils The function had no call sites in JS/TS code and the iOS implementation was a no-op. * removes version guards and updates config after min version bump * updates stale iOS 17 simulator references in CI to iOS 18.1 Co-Authored-By: Carlos Garcia <carlos.garcia@mattermost.com> * fixes malformed patch file headers - voximplant patch: restore missing diff --git header and index line for VIForegroundServiceModule.java, fix stale hunk counter (+11 -> +7) - notifications patch: fix stale hunk line count (+91 -> +89) after KITKAT branch removal Co-Authored-By: Carlos Garcia <carlos.garcia@mattermost.com> * remove code below the supported OS versions * Bump IntuneMAM SDK to 21.8.0 and MSAL to 2.15.0 --------- Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
77 lines
2.3 KiB
TypeScript
77 lines
2.3 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import React, {useCallback, useState} from 'react';
|
|
import {Modal, Platform, View, useWindowDimensions} from 'react-native';
|
|
|
|
import {useTutorial} from '@context/tutorial';
|
|
|
|
import HighlightItem from './item';
|
|
|
|
type Props = {
|
|
children?: React.ReactNode;
|
|
itemRef: React.RefObject<View | null>;
|
|
itemBorderRadius?: number;
|
|
onDismiss: () => void;
|
|
onShow?: () => void;
|
|
inModal?: boolean;
|
|
}
|
|
|
|
const EMPTY_BOUNDS: TutorialItemBounds = {startX: 0, startY: 0, endX: 0, endY: 0};
|
|
|
|
const TutorialHighlight = ({children, itemRef, itemBorderRadius, inModal, onDismiss, onShow}: Props) => {
|
|
const {width, height} = useWindowDimensions();
|
|
const {rootOffset} = useTutorial();
|
|
const [itemBounds, setItemBounds] = useState<TutorialItemBounds>(EMPTY_BOUNDS);
|
|
|
|
const onRootLayout = useCallback(() => {
|
|
itemRef.current?.measure((x, y, w, h, pageX, pageY) => {
|
|
const offset = inModal && Platform.OS === 'ios' ? rootOffset : 0;
|
|
|
|
setItemBounds({
|
|
startX: pageX,
|
|
startY: pageY + offset,
|
|
endX: pageX + w,
|
|
endY: pageY + h + offset,
|
|
});
|
|
});
|
|
}, [itemRef, inModal, rootOffset]);
|
|
|
|
const handleShowTutorial = useCallback(() => {
|
|
if (onShow) {
|
|
setTimeout(onShow, 1000);
|
|
}
|
|
}, [onShow]);
|
|
|
|
return (
|
|
<Modal
|
|
visible={true}
|
|
transparent={true}
|
|
animationType='fade'
|
|
onDismiss={onDismiss}
|
|
onRequestClose={onDismiss}
|
|
testID='tutorial_highlight'
|
|
statusBarTranslucent={true}
|
|
>
|
|
<View
|
|
style={{flex: 1}}
|
|
onLayout={onRootLayout}
|
|
>
|
|
{itemBounds.endX > 0 &&
|
|
<HighlightItem
|
|
borderRadius={itemBorderRadius}
|
|
itemBounds={itemBounds}
|
|
height={height}
|
|
onDismiss={onDismiss}
|
|
width={width}
|
|
onLayout={handleShowTutorial}
|
|
/>
|
|
}
|
|
{itemBounds.endX > 0 && children}
|
|
</View>
|
|
</Modal>
|
|
);
|
|
};
|
|
|
|
export default TutorialHighlight;
|