import React from 'react'; import { Linking, View } from 'react-native'; import { ScrollView } from 'react-native-gesture-handler'; import { useThemeStore } from '../../../stores/use-theme-store'; import { STORE_LINK } from '../../../utils/constants'; import { SIZE } from '../../../utils/size'; import { Button } from '../../ui/button'; import { SvgView } from '../../ui/svg'; import Seperator from '../../ui/seperator'; import Heading from '../../ui/typography/heading'; import Paragraph from '../../ui/typography/paragraph'; import Config from 'react-native-config'; import deviceInfoModule from 'react-native-device-info'; const UPDATE_SVG = color => ``; export const Update = ({ version, fwdRef }) => { const colors = useThemeStore(state => state.colors); let notes = version.notes ? version.notes.replace('Thank you for using Notesnook!', '').split('- ') : ['Bug fixes and performance improvements']; notes = notes.map(n => n.replace(/\n/g, '')); const isGithubRelease = Config.GITHUB_RELEASE === 'true'; const getSupportedAbi = () => { let abi = deviceInfoModule.supportedAbisSync(); let armv8a = abi.find(a => a === 'arm64-v8a'); let armv7 = abi.find(a => a === 'armeabi-v7a'); return armv8a || armv7 || abi[0]; }; const GITHUB_URL = `https://github.com/streetwriters/notesnook/releases/download/${ version.version }-android/notesnook-${getSupportedAbi()}.apk`; const GITHUB_PAGE_URL = `https://github.com/streetwriters/notesnook/releases/tag/${version.version}-android`; return ( Update available v{version.version} has been released {isGithubRelease ? 'on Github' : ''} { fwdRef?.current?.handleChildScrollEnd(); }} style={{ width: '100%' }} > Release notes: {notes.map(item => ( • {item} ))}