From e333fc2ba43e049f7fe31fbd489d6189966ac2ea Mon Sep 17 00:00:00 2001 From: Andrew Hahn Date: Wed, 12 Jun 2024 11:51:54 -0700 Subject: [PATCH 1/6] feat: added docs for getCurrentDevice API --- .../manage-users/manage-devices/index.mdx | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx b/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx index 7c2451af61e..37a4d8544b4 100644 --- a/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx @@ -270,7 +270,7 @@ func forgetDevice() async { print("Forget device failed with error \(error)") } catch { print("Unexpected error: \(error)") - } + } } ``` @@ -326,6 +326,35 @@ Future fetchAllDevices() async { ``` + +## Get the current device + +You can fetch the current device by using the following: + + + +```ts +import { getCurrentDevice } from 'aws-amplify/auth'; + +const output = await getCurrentDevice(); +``` + + + + +```dart +Future getCurrentUserDevice() async { + try { + final device = await Amplify.Auth.getCurrentDevice(); + safePrint('Device: $device'); + } on AuthException catch (e) { + safePrint('Get current device failed with error: $e'); + } +} +``` + + + From 825fb1372167863b46ca01906349b3b98ae42852 Mon Sep 17 00:00:00 2001 From: Andrew Hahn Date: Fri, 14 Jun 2024 13:15:57 -0700 Subject: [PATCH 2/6] feat: removed web docs for getCurrentDevice --- .../auth/manage-users/manage-devices/index.mdx | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx b/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx index 37a4d8544b4..aa68d1a2925 100644 --- a/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx @@ -331,15 +331,6 @@ Future fetchAllDevices() async { You can fetch the current device by using the following: - - -```ts -import { getCurrentDevice } from 'aws-amplify/auth'; - -const output = await getCurrentDevice(); -``` - - ```dart From 59cc44dee075d4a0d051c1f870125d0a474664fe Mon Sep 17 00:00:00 2001 From: Andrew Hahn Date: Mon, 24 Jun 2024 12:38:09 -0700 Subject: [PATCH 3/6] feat: changed docs to reflect api name change --- .../auth/manage-users/manage-devices/index.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx b/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx index aa68d1a2925..9e742aaadf9 100644 --- a/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx @@ -334,9 +334,9 @@ You can fetch the current device by using the following: ```dart -Future getCurrentUserDevice() async { +Future fetchCurrentUserDevice() async { try { - final device = await Amplify.Auth.getCurrentDevice(); + final device = await Amplify.Auth.fetchCurrentDevice(); safePrint('Device: $device'); } on AuthException catch (e) { safePrint('Get current device failed with error: $e'); From d2309f2d7c42e3b8487eb231bed224c7d23f73fd Mon Sep 17 00:00:00 2001 From: Andrew Hahn Date: Fri, 28 Jun 2024 14:43:50 -0700 Subject: [PATCH 4/6] fix: reworded title for clarity --- .../build-a-backend/auth/manage-users/manage-devices/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx b/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx index 9e742aaadf9..84c60885459 100644 --- a/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx @@ -327,7 +327,7 @@ Future fetchAllDevices() async { -## Get the current device +## Fetch the current device You can fetch the current device by using the following: From 88297c83f75801957e53f37d97e9f00e297d0a75 Mon Sep 17 00:00:00 2001 From: Andrew Hahn <58017052+hahnandrew@users.noreply.github.com> Date: Mon, 29 Jul 2024 16:25:08 -0700 Subject: [PATCH 5/6] Update index.mdx --- .../auth/manage-users/manage-devices/index.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx b/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx index 84c60885459..2438192d5ed 100644 --- a/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx @@ -327,12 +327,12 @@ Future fetchAllDevices() async { + + ## Fetch the current device You can fetch the current device by using the following: - - ```dart Future fetchCurrentUserDevice() async { try { From e5fca5890d2278c0e596aa2a62245a5f84ef1fb8 Mon Sep 17 00:00:00 2001 From: Andrew Hahn Date: Wed, 31 Jul 2024 19:59:49 -0700 Subject: [PATCH 6/6] Adjust filter block --- .../manage-users/manage-devices/index.mdx | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx b/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx index 2438192d5ed..f0e6cf54310 100644 --- a/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx +++ b/src/pages/[platform]/build-a-backend/auth/manage-users/manage-devices/index.mdx @@ -327,24 +327,6 @@ Future fetchAllDevices() async { - - -## Fetch the current device - -You can fetch the current device by using the following: - -```dart -Future fetchCurrentUserDevice() async { - try { - final device = await Amplify.Auth.fetchCurrentDevice(); - safePrint('Device: $device'); - } on AuthException catch (e) { - safePrint('Get current device failed with error: $e'); - } -} -``` - - @@ -446,6 +428,25 @@ func fetchDevices() -> AnyCancellable { + + +## Fetch the current device + +You can fetch the current device by using the following: + +```dart +Future fetchCurrentUserDevice() async { + try { + final device = await Amplify.Auth.fetchCurrentDevice(); + safePrint('Device: $device'); + } on AuthException catch (e) { + safePrint('Get current device failed with error: $e'); + } +} +``` + + + You can now set up devices to be remembered, forgotten, and fetched. {/* user agents */}