Skip to content

Commit

Permalink
feat: update app download universal for macos (janhq#4230)
Browse files Browse the repository at this point in the history
  • Loading branch information
urmauur authored Dec 5, 2024
1 parent 4c067de commit 85ec8c6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 37 deletions.
13 changes: 4 additions & 9 deletions docs/src/components/Download/CardDownload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,12 @@ type SystemType = {

const systemsTemplate: SystemType[] = [
{
name: 'Mac M1, M2, M3',
label: 'Apple Silicon',
name: 'Mac ',
label: 'Universal',
logo: FaApple,
fileFormat: '{appname}-mac-arm64-{tag}.dmg',
},
{
name: 'Mac (Intel)',
label: 'Apple Intel',
logo: FaApple,
fileFormat: '{appname}-mac-x64-{tag}.dmg',
fileFormat: '{appname}-mac-universal-{tag}.dmg',
},

{
name: 'Windows',
label: 'Standard (64-bit)',
Expand Down
44 changes: 16 additions & 28 deletions docs/src/components/DropdownDownload/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,9 @@ type GpuInfo = {

const systemsTemplate: SystemType[] = [
{
name: 'Download for Mac (M1/M2/M3)',
name: 'Download for Mac',
logo: FaApple,
fileFormat: '{appname}-mac-arm64-{tag}.dmg',
},
{
name: 'Download for Mac (Intel)',
logo: FaApple,
fileFormat: '{appname}-mac-x64-{tag}.dmg',
fileFormat: '{appname}-mac-universal-{tag}.dmg',
},
{
name: 'Download for Windows',
Expand Down Expand Up @@ -66,27 +61,20 @@ const DropdownDownload = ({ lastRelease }: Props) => {
type: '',
})

const changeDefaultSystem = useCallback(
async (systems: SystemType[]) => {
const userAgent = navigator.userAgent
if (userAgent.includes('Windows')) {
// windows user
setDefaultSystem(systems[2])
} else if (userAgent.includes('Linux')) {
// linux user
setDefaultSystem(systems[3])
} else if (userAgent.includes('Mac OS')) {
if (gpuInfo.type === 'Apple Silicon') {
setDefaultSystem(systems[0])
} else {
setDefaultSystem(systems[1])
}
} else {
setDefaultSystem(systems[1])
}
},
[gpuInfo.type]
)
const changeDefaultSystem = useCallback(async (systems: SystemType[]) => {
const userAgent = navigator.userAgent
if (userAgent.includes('Windows')) {
// windows user
setDefaultSystem(systems[2])
} else if (userAgent.includes('Linux')) {
// linux user
setDefaultSystem(systems[3])
} else if (userAgent.includes('Mac OS')) {
setDefaultSystem(systems[0])
} else {
setDefaultSystem(systems[1])
}
}, [])

function getUnmaskedInfo(gl: WebGLRenderingContext): {
renderer: string
Expand Down

0 comments on commit 85ec8c6

Please sign in to comment.