Skip to content

Commit

Permalink
fix(util-defaults-mode-browser): import bowser by default export (#3203)
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanZhengYP committed Jan 19, 2022
1 parent 4ae5af5 commit 5187be2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { memoize } from "@aws-sdk/property-provider";
import type { DefaultsMode, ResolvedDefaultsMode } from "@aws-sdk/smithy-client";
import type { Provider } from "@aws-sdk/types";
import { parse } from "bowser";
import bowser from "bowser";

import { DEFAULTS_MODE_OPTIONS } from "./constants";

Expand Down Expand Up @@ -45,7 +45,9 @@ export const resolveDefaultsModeConfig = ({

const isMobileBrowser = (): boolean => {
const parsedUA =
typeof window !== "undefined" && window?.navigator?.userAgent ? parse(window.navigator.userAgent) : undefined;
typeof window !== "undefined" && window?.navigator?.userAgent
? bowser.parse(window.navigator.userAgent)
: undefined;
const platform = parsedUA?.platform?.type;
// Reference: https://github.com/lancedikson/bowser/blob/master/src/constants.js#L86
return platform === "tablet" || platform === "mobile";
Expand Down

0 comments on commit 5187be2

Please sign in to comment.