You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
42 lines
1.1 KiB
6 months ago
|
/* eslint-disable react/button-has-type */
|
||
|
/* eslint-disable jsx-a11y/img-redundant-alt */
|
||
|
import React from 'react';
|
||
|
import bgPng from './images/bg.png';
|
||
|
import styles from './index.less';
|
||
|
|
||
|
function isAndroid() {
|
||
|
const u = navigator.userAgent;
|
||
|
return u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
|
||
|
}
|
||
|
|
||
|
function isIOS() {
|
||
|
const u = navigator.userAgent;
|
||
|
return !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
|
||
|
}
|
||
|
|
||
|
export default function Download() {
|
||
|
return (
|
||
|
<>
|
||
|
<div className={styles.download}>
|
||
|
<img className={styles.bgImage} src={bgPng} alt="background image" />
|
||
|
<button onClick={() => {
|
||
|
if (isAndroid()) {
|
||
|
window.open(
|
||
|
`http://hn-fm-oss.mangguonews.com/bkb/BKB_release.apk?${new Date().getTime()}`);
|
||
|
} else if(isIOS()) {
|
||
|
window.open(
|
||
|
`https://apps.apple.com/us/app/bkb-app/id6474423781`);
|
||
|
} else {
|
||
|
window.open(
|
||
|
`http://hn-fm-oss.mangguonews.com/bkb/BKB_release.apk?${new Date().getTime()}`);
|
||
|
}
|
||
|
}}
|
||
|
className={styles.button}
|
||
|
>
|
||
|
Download
|
||
|
</button>
|
||
|
</div>
|
||
|
</>
|
||
|
);
|
||
|
}
|