@ovok/native 1.6.50 → 1.6.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/lib/commonjs/index.js +18 -7
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modules/auth/default-translation.js +6 -1
- package/lib/commonjs/modules/auth/default-translation.js.map +1 -1
- package/lib/commonjs/modules/auth/delete-account-button/components/delete-account-button.js +9 -14
- package/lib/commonjs/modules/auth/delete-account-button/components/delete-account-button.js.map +1 -1
- package/lib/commonjs/modules/auth/hooks/use-auth-action.js +41 -0
- package/lib/commonjs/modules/auth/hooks/use-auth-action.js.map +1 -0
- package/lib/commonjs/modules/auth/hooks/use-delete-account.js +27 -0
- package/lib/commonjs/modules/auth/hooks/use-delete-account.js.map +1 -0
- package/lib/commonjs/modules/auth/hooks/use-session.js +14 -86
- package/lib/commonjs/modules/auth/hooks/use-session.js.map +1 -1
- package/lib/commonjs/modules/auth/hooks/use-sign-in.js +66 -0
- package/lib/commonjs/modules/auth/hooks/use-sign-in.js.map +1 -0
- package/lib/commonjs/modules/auth/hooks/use-sign-out.js +15 -0
- package/lib/commonjs/modules/auth/hooks/use-sign-out.js.map +1 -0
- package/lib/commonjs/modules/auth/hooks/use-social-sign-in.js +92 -0
- package/lib/commonjs/modules/auth/hooks/use-social-sign-in.js.map +1 -0
- package/lib/commonjs/modules/auth/index.js +55 -0
- package/lib/commonjs/modules/auth/index.js.map +1 -1
- package/lib/commonjs/modules/auth/logout-button/components/logout-button.js +11 -16
- package/lib/commonjs/modules/auth/logout-button/components/logout-button.js.map +1 -1
- package/lib/commonjs/modules/auth/profile/components/profile-form-provider.js +5 -3
- package/lib/commonjs/modules/auth/profile/components/profile-form-provider.js.map +1 -1
- package/lib/commonjs/modules/auth/profile/contexts/profile-form-context.js +1 -1
- package/lib/commonjs/modules/auth/profile/contexts/profile-form-context.js.map +1 -1
- package/lib/commonjs/modules/auth/profile/hooks/use-profile-form.js +1 -1
- package/lib/commonjs/modules/auth/profile/hooks/use-profile-form.js.map +1 -1
- package/lib/commonjs/modules/auth/register/components/form/register-form-provider.js +6 -4
- package/lib/commonjs/modules/auth/register/components/form/register-form-provider.js.map +1 -1
- package/lib/commonjs/modules/auth/reset-password/components/form/inputs.js +2 -4
- package/lib/commonjs/modules/auth/reset-password/components/form/inputs.js.map +1 -1
- package/lib/commonjs/modules/auth/reset-password/components/form/reset-password-form-provider.js +6 -4
- package/lib/commonjs/modules/auth/reset-password/components/form/reset-password-form-provider.js.map +1 -1
- package/lib/commonjs/modules/auth/reset-password/contexts/reset-password-form-context.js +1 -1
- package/lib/commonjs/modules/auth/reset-password/contexts/reset-password-form-context.js.map +1 -1
- package/lib/commonjs/modules/auth/reset-password/hooks/use-reset-password-form.js +1 -1
- package/lib/commonjs/modules/auth/reset-password/hooks/use-reset-password-form.js.map +1 -1
- package/lib/commonjs/modules/auth/session/logout-session.js +29 -0
- package/lib/commonjs/modules/auth/session/logout-session.js.map +1 -0
- package/lib/commonjs/modules/auth/session/session-store.js +152 -0
- package/lib/commonjs/modules/auth/session/session-store.js.map +1 -0
- package/lib/commonjs/modules/auth/sign-in/components/form/login-form-provider.js +25 -41
- package/lib/commonjs/modules/auth/sign-in/components/form/login-form-provider.js.map +1 -1
- package/lib/commonjs/modules/auth/sign-in/components/social-logins/apple-login-button.js +13 -12
- package/lib/commonjs/modules/auth/sign-in/components/social-logins/apple-login-button.js.map +1 -1
- package/lib/commonjs/modules/auth/sign-in/components/social-logins/google-login-button.js +4 -4
- package/lib/commonjs/modules/auth/sign-in/components/social-logins/google-login-button.js.map +1 -1
- package/lib/commonjs/modules/auth/sign-in/contexts/login-form-context.js +1 -1
- package/lib/commonjs/modules/auth/sign-in/contexts/login-form-context.js.map +1 -1
- package/lib/commonjs/modules/auth/sign-in/hooks/use-login-form.js +1 -1
- package/lib/commonjs/modules/auth/sign-in/hooks/use-login-form.js.map +1 -1
- package/lib/commonjs/modules/bt-device/components/device-list-provider.js +5 -4
- package/lib/commonjs/modules/bt-device/components/device-list-provider.js.map +1 -1
- package/lib/commonjs/modules/bt-device/components/hooks/use-device-list.js +1 -1
- package/lib/commonjs/modules/bt-device/components/hooks/use-device-list.js.map +1 -1
- package/lib/commonjs/modules/bt-device/contexts/device-list-context.js +1 -4
- package/lib/commonjs/modules/bt-device/contexts/device-list-context.js.map +1 -1
- package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js +176 -84
- package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
- package/lib/commonjs/modules/bt-management/components/bt-provider.js +3 -2
- package/lib/commonjs/modules/bt-management/components/bt-provider.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/runtime-context.js +146 -14
- package/lib/commonjs/modules/bt-management/hooks/runtime-context.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-background-sync.js +17 -11
- package/lib/commonjs/modules/bt-management/hooks/use-background-sync.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-bluetooth-permission.js +100 -0
- package/lib/commonjs/modules/bt-management/hooks/use-bluetooth-permission.js.map +1 -0
- package/lib/commonjs/modules/bt-management/hooks/use-bluetooth-state.js +13 -26
- package/lib/commonjs/modules/bt-management/hooks/use-bluetooth-state.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-bt-device.js +148 -0
- package/lib/commonjs/modules/bt-management/hooks/use-bt-device.js.map +1 -0
- package/lib/commonjs/modules/bt-management/hooks/use-device-connection.js +10 -26
- package/lib/commonjs/modules/bt-management/hooks/use-device-connection.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-health-import.js +7 -76
- package/lib/commonjs/modules/bt-management/hooks/use-health-import.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-measurements.js +43 -57
- package/lib/commonjs/modules/bt-management/hooks/use-measurements.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-nearby-devices.js +12 -16
- package/lib/commonjs/modules/bt-management/hooks/use-nearby-devices.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-paired-devices.js +31 -12
- package/lib/commonjs/modules/bt-management/hooks/use-paired-devices.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-request-permissions.js +12 -55
- package/lib/commonjs/modules/bt-management/hooks/use-request-permissions.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-scan-control.js +6 -4
- package/lib/commonjs/modules/bt-management/hooks/use-scan-control.js.map +1 -1
- package/lib/commonjs/modules/bt-management/index.js +133 -11
- package/lib/commonjs/modules/bt-management/index.js.map +1 -1
- package/lib/commonjs/modules/cms/hooks/use-cms-content.js +50 -0
- package/lib/commonjs/modules/cms/hooks/use-cms-content.js.map +1 -0
- package/lib/commonjs/modules/cms/hooks/use-cms-locale.js +20 -0
- package/lib/commonjs/modules/cms/hooks/use-cms-locale.js.map +1 -0
- package/lib/commonjs/modules/cms/hooks/use-cms-translations.js +50 -0
- package/lib/commonjs/modules/cms/hooks/use-cms-translations.js.map +1 -0
- package/lib/commonjs/modules/cms/index.js +39 -0
- package/lib/commonjs/modules/cms/index.js.map +1 -0
- package/lib/commonjs/modules/cms/merge-cms-translations.js +49 -0
- package/lib/commonjs/modules/cms/merge-cms-translations.js.map +1 -0
- package/lib/commonjs/modules/data-sync/components/android/android-health-connect-authorization-provider.js +23 -18
- package/lib/commonjs/modules/data-sync/components/android/android-health-connect-authorization-provider.js.map +1 -1
- package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-provider.js +19 -18
- package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-provider.js.map +1 -1
- package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-utils.js +20 -0
- package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-utils.js.map +1 -0
- package/lib/commonjs/modules/data-sync/contexts/health-authorization-context.js +18 -0
- package/lib/commonjs/modules/data-sync/contexts/health-authorization-context.js.map +1 -0
- package/lib/commonjs/modules/data-sync/hooks/use-health-import.js +81 -0
- package/lib/commonjs/modules/data-sync/hooks/use-health-import.js.map +1 -0
- package/lib/commonjs/modules/data-sync/index.js +37 -0
- package/lib/commonjs/modules/data-sync/index.js.map +1 -1
- package/lib/commonjs/modules/helpers/hooks/use-shallow-stable-value.js +20 -0
- package/lib/commonjs/modules/helpers/hooks/use-shallow-stable-value.js.map +1 -0
- package/lib/commonjs/modules/language-switcher/components/language-switcher.js +12 -4
- package/lib/commonjs/modules/language-switcher/components/language-switcher.js.map +1 -1
- package/lib/commonjs/modules/language-switcher/components/option/context/language-option-context.js +1 -1
- package/lib/commonjs/modules/language-switcher/components/option/context/language-option-context.js.map +1 -1
- package/lib/commonjs/modules/language-switcher/components/option/language-switcher-option.js +5 -4
- package/lib/commonjs/modules/language-switcher/components/option/language-switcher-option.js.map +1 -1
- package/lib/commonjs/modules/socket/components/socket-provider.js +78 -73
- package/lib/commonjs/modules/socket/components/socket-provider.js.map +1 -1
- package/lib/commonjs/modules/tab/components/tab-provider.js +12 -1
- package/lib/commonjs/modules/tab/components/tab-provider.js.map +1 -1
- package/lib/commonjs/modules/tab/contexts/tab-context.js +1 -1
- package/lib/commonjs/modules/tab/contexts/tab-context.js.map +1 -1
- package/lib/commonjs/modules/tab/hooks/use-tab.js +1 -1
- package/lib/commonjs/modules/tab/hooks/use-tab.js.map +1 -1
- package/lib/commonjs/modules/ui/components/health-import-card.js +2 -3
- package/lib/commonjs/modules/ui/components/health-import-card.js.map +1 -1
- package/lib/commonjs/modules/ui/components/pairing-flow.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/auth/default-translation.js +3 -1
- package/lib/module/modules/auth/default-translation.js.map +1 -1
- package/lib/module/modules/auth/delete-account-button/components/delete-account-button.js +9 -14
- package/lib/module/modules/auth/delete-account-button/components/delete-account-button.js.map +1 -1
- package/lib/module/modules/auth/hooks/use-auth-action.js +36 -0
- package/lib/module/modules/auth/hooks/use-auth-action.js.map +1 -0
- package/lib/module/modules/auth/hooks/use-delete-account.js +22 -0
- package/lib/module/modules/auth/hooks/use-delete-account.js.map +1 -0
- package/lib/module/modules/auth/hooks/use-session.js +17 -88
- package/lib/module/modules/auth/hooks/use-session.js.map +1 -1
- package/lib/module/modules/auth/hooks/use-sign-in.js +61 -0
- package/lib/module/modules/auth/hooks/use-sign-in.js.map +1 -0
- package/lib/module/modules/auth/hooks/use-sign-out.js +10 -0
- package/lib/module/modules/auth/hooks/use-sign-out.js.map +1 -0
- package/lib/module/modules/auth/hooks/use-social-sign-in.js +86 -0
- package/lib/module/modules/auth/hooks/use-social-sign-in.js.map +1 -0
- package/lib/module/modules/auth/index.js +5 -0
- package/lib/module/modules/auth/index.js.map +1 -1
- package/lib/module/modules/auth/logout-button/components/logout-button.js +11 -16
- package/lib/module/modules/auth/logout-button/components/logout-button.js.map +1 -1
- package/lib/module/modules/auth/profile/components/profile-form-provider.js +5 -3
- package/lib/module/modules/auth/profile/components/profile-form-provider.js.map +1 -1
- package/lib/module/modules/auth/profile/contexts/profile-form-context.js +1 -1
- package/lib/module/modules/auth/profile/contexts/profile-form-context.js.map +1 -1
- package/lib/module/modules/auth/profile/hooks/use-profile-form.js +1 -1
- package/lib/module/modules/auth/profile/hooks/use-profile-form.js.map +1 -1
- package/lib/module/modules/auth/register/components/form/register-form-provider.js +6 -4
- package/lib/module/modules/auth/register/components/form/register-form-provider.js.map +1 -1
- package/lib/module/modules/auth/reset-password/components/form/inputs.js +2 -4
- package/lib/module/modules/auth/reset-password/components/form/inputs.js.map +1 -1
- package/lib/module/modules/auth/reset-password/components/form/reset-password-form-provider.js +6 -4
- package/lib/module/modules/auth/reset-password/components/form/reset-password-form-provider.js.map +1 -1
- package/lib/module/modules/auth/reset-password/contexts/reset-password-form-context.js +1 -1
- package/lib/module/modules/auth/reset-password/contexts/reset-password-form-context.js.map +1 -1
- package/lib/module/modules/auth/reset-password/hooks/use-reset-password-form.js +1 -1
- package/lib/module/modules/auth/reset-password/hooks/use-reset-password-form.js.map +1 -1
- package/lib/module/modules/auth/session/logout-session.js +24 -0
- package/lib/module/modules/auth/session/logout-session.js.map +1 -0
- package/lib/module/modules/auth/session/session-store.js +148 -0
- package/lib/module/modules/auth/session/session-store.js.map +1 -0
- package/lib/module/modules/auth/sign-in/components/form/login-form-provider.js +25 -41
- package/lib/module/modules/auth/sign-in/components/form/login-form-provider.js.map +1 -1
- package/lib/module/modules/auth/sign-in/components/social-logins/apple-login-button.js +13 -12
- package/lib/module/modules/auth/sign-in/components/social-logins/apple-login-button.js.map +1 -1
- package/lib/module/modules/auth/sign-in/components/social-logins/google-login-button.js +4 -4
- package/lib/module/modules/auth/sign-in/components/social-logins/google-login-button.js.map +1 -1
- package/lib/module/modules/auth/sign-in/contexts/login-form-context.js +1 -1
- package/lib/module/modules/auth/sign-in/contexts/login-form-context.js.map +1 -1
- package/lib/module/modules/auth/sign-in/hooks/use-login-form.js +1 -1
- package/lib/module/modules/auth/sign-in/hooks/use-login-form.js.map +1 -1
- package/lib/module/modules/bt-device/components/device-list-provider.js +5 -4
- package/lib/module/modules/bt-device/components/device-list-provider.js.map +1 -1
- package/lib/module/modules/bt-device/components/hooks/use-device-list.js +1 -1
- package/lib/module/modules/bt-device/components/hooks/use-device-list.js.map +1 -1
- package/lib/module/modules/bt-device/contexts/device-list-context.js +1 -4
- package/lib/module/modules/bt-device/contexts/device-list-context.js.map +1 -1
- package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js +175 -84
- package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
- package/lib/module/modules/bt-management/components/bt-provider.js +3 -2
- package/lib/module/modules/bt-management/components/bt-provider.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/runtime-context.js +144 -13
- package/lib/module/modules/bt-management/hooks/runtime-context.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-background-sync.js +17 -11
- package/lib/module/modules/bt-management/hooks/use-background-sync.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-bluetooth-permission.js +94 -0
- package/lib/module/modules/bt-management/hooks/use-bluetooth-permission.js.map +1 -0
- package/lib/module/modules/bt-management/hooks/use-bluetooth-state.js +13 -26
- package/lib/module/modules/bt-management/hooks/use-bluetooth-state.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-bt-device.js +142 -0
- package/lib/module/modules/bt-management/hooks/use-bt-device.js.map +1 -0
- package/lib/module/modules/bt-management/hooks/use-device-connection.js +11 -26
- package/lib/module/modules/bt-management/hooks/use-device-connection.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-health-import.js +2 -73
- package/lib/module/modules/bt-management/hooks/use-health-import.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-measurements.js +44 -58
- package/lib/module/modules/bt-management/hooks/use-measurements.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-nearby-devices.js +13 -17
- package/lib/module/modules/bt-management/hooks/use-nearby-devices.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-paired-devices.js +31 -12
- package/lib/module/modules/bt-management/hooks/use-paired-devices.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-request-permissions.js +12 -54
- package/lib/module/modules/bt-management/hooks/use-request-permissions.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-scan-control.js +6 -4
- package/lib/module/modules/bt-management/hooks/use-scan-control.js.map +1 -1
- package/lib/module/modules/bt-management/index.js +8 -1
- package/lib/module/modules/bt-management/index.js.map +1 -1
- package/lib/module/modules/cms/hooks/use-cms-content.js +44 -0
- package/lib/module/modules/cms/hooks/use-cms-content.js.map +1 -0
- package/lib/module/modules/cms/hooks/use-cms-locale.js +16 -0
- package/lib/module/modules/cms/hooks/use-cms-locale.js.map +1 -0
- package/lib/module/modules/cms/hooks/use-cms-translations.js +45 -0
- package/lib/module/modules/cms/hooks/use-cms-translations.js.map +1 -0
- package/lib/module/modules/cms/index.js +6 -0
- package/lib/module/modules/cms/index.js.map +1 -0
- package/lib/module/modules/cms/merge-cms-translations.js +46 -0
- package/lib/module/modules/cms/merge-cms-translations.js.map +1 -0
- package/lib/module/modules/data-sync/components/android/android-health-connect-authorization-provider.js +23 -18
- package/lib/module/modules/data-sync/components/android/android-health-connect-authorization-provider.js.map +1 -1
- package/lib/module/modules/data-sync/components/apple/apple-health-authorization-provider.js +18 -17
- package/lib/module/modules/data-sync/components/apple/apple-health-authorization-provider.js.map +1 -1
- package/lib/module/modules/data-sync/components/apple/apple-health-authorization-utils.js +16 -0
- package/lib/module/modules/data-sync/components/apple/apple-health-authorization-utils.js.map +1 -0
- package/lib/module/modules/data-sync/contexts/health-authorization-context.js +13 -0
- package/lib/module/modules/data-sync/contexts/health-authorization-context.js.map +1 -0
- package/lib/module/modules/data-sync/hooks/use-health-import.js +76 -0
- package/lib/module/modules/data-sync/hooks/use-health-import.js.map +1 -0
- package/lib/module/modules/data-sync/index.js +2 -0
- package/lib/module/modules/data-sync/index.js.map +1 -1
- package/lib/module/modules/helpers/hooks/use-shallow-stable-value.js +14 -0
- package/lib/module/modules/helpers/hooks/use-shallow-stable-value.js.map +1 -0
- package/lib/module/modules/language-switcher/components/language-switcher.js +11 -4
- package/lib/module/modules/language-switcher/components/language-switcher.js.map +1 -1
- package/lib/module/modules/language-switcher/components/option/context/language-option-context.js +1 -1
- package/lib/module/modules/language-switcher/components/option/context/language-option-context.js.map +1 -1
- package/lib/module/modules/language-switcher/components/option/language-switcher-option.js +5 -4
- package/lib/module/modules/language-switcher/components/option/language-switcher-option.js.map +1 -1
- package/lib/module/modules/socket/components/socket-provider.js +78 -73
- package/lib/module/modules/socket/components/socket-provider.js.map +1 -1
- package/lib/module/modules/tab/components/tab-provider.js +11 -1
- package/lib/module/modules/tab/components/tab-provider.js.map +1 -1
- package/lib/module/modules/tab/contexts/tab-context.js +1 -1
- package/lib/module/modules/tab/contexts/tab-context.js.map +1 -1
- package/lib/module/modules/tab/hooks/use-tab.js +1 -1
- package/lib/module/modules/tab/hooks/use-tab.js.map +1 -1
- package/lib/module/modules/ui/components/health-import-card.js +1 -2
- package/lib/module/modules/ui/components/health-import-card.js.map +1 -1
- package/lib/module/modules/ui/components/pairing-flow.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/default-translation.d.ts +53 -1
- package/lib/typescript/commonjs/src/modules/auth/default-translation.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/delete-account-button/components/delete-account-button.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-auth-action.d.ts +13 -0
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-auth-action.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-delete-account.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-delete-account.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-session.d.ts +6 -4
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-session.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-sign-in.d.ts +24 -0
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-sign-in.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-sign-out.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-sign-out.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-social-sign-in.d.ts +14 -0
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-social-sign-in.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/auth/index.d.ts +5 -0
- package/lib/typescript/commonjs/src/modules/auth/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/logout-button/components/logout-button.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/profile/components/profile-form-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/profile/contexts/profile-form-context.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/auth/profile/contexts/profile-form-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/profile/hooks/use-profile-form.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/register/components/form/register-form-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/reset-password/components/form/inputs.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/reset-password/components/form/reset-password-form-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/reset-password/contexts/reset-password-form-context.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/auth/reset-password/contexts/reset-password-form-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/session/logout-session.d.ts +6 -0
- package/lib/typescript/commonjs/src/modules/auth/session/logout-session.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/auth/session/session-store.d.ts +21 -0
- package/lib/typescript/commonjs/src/modules/auth/session/session-store.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/login-form-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/apple-login-button.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/google-login-button.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/sign-in/contexts/login-form-context.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/auth/sign-in/contexts/login-form-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/components/device-list-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/components/hooks/use-device-list.d.ts +1 -5
- package/lib/typescript/commonjs/src/modules/bt-device/components/hooks/use-device-list.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/contexts/device-list-context.d.ts +3 -2
- package/lib/typescript/commonjs/src/modules/bt-device/contexts/device-list-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts +40 -9
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-background-sync.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-bluetooth-permission.d.ts +17 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-bluetooth-permission.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-bluetooth-state.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-bt-device.d.ts +31 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-bt-device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-device-connection.d.ts +2 -2
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-device-connection.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-health-import.d.ts +2 -15
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-health-import.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-measurements.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-nearby-devices.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-paired-devices.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-request-permissions.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-request-permissions.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-scan-control.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +6 -1
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/btprovider-props.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/btprovider-props.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/cms/hooks/use-cms-content.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/cms/hooks/use-cms-content.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/cms/hooks/use-cms-locale.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/cms/hooks/use-cms-locale.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/cms/hooks/use-cms-translations.d.ts +10 -0
- package/lib/typescript/commonjs/src/modules/cms/hooks/use-cms-translations.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/cms/index.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/cms/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/cms/merge-cms-translations.d.ts +13 -0
- package/lib/typescript/commonjs/src/modules/cms/merge-cms-translations.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/data-sync/components/android/android-health-connect-authorization-provider.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/components/android/android-health-connect-authorization-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/data-sync/components/data-sync.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/contexts/health-authorization-context.d.ts +17 -0
- package/lib/typescript/commonjs/src/modules/data-sync/contexts/health-authorization-context.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/data-sync/hooks/use-health-import.d.ts +17 -0
- package/lib/typescript/commonjs/src/modules/data-sync/hooks/use-health-import.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/data-sync/index.d.ts +3 -0
- package/lib/typescript/commonjs/src/modules/data-sync/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/helpers/hooks/use-shallow-stable-value.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/helpers/hooks/use-shallow-stable-value.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/language-switcher/components/language-switcher.d.ts +6 -5
- package/lib/typescript/commonjs/src/modules/language-switcher/components/language-switcher.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/language-switcher/components/option/context/language-option-context.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/language-switcher/components/option/context/language-option-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/socket/components/socket-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/tab/components/tab-provider.d.ts +2 -1
- package/lib/typescript/commonjs/src/modules/tab/components/tab-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/tab/contexts/tab-context.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/tab/contexts/tab-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/ui/components/health-import-card.d.ts +1 -2
- package/lib/typescript/commonjs/src/modules/ui/components/health-import-card.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/ui/components/pairing-flow.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +1 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/default-translation.d.ts +53 -1
- package/lib/typescript/module/src/modules/auth/default-translation.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/delete-account-button/components/delete-account-button.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/hooks/use-auth-action.d.ts +13 -0
- package/lib/typescript/module/src/modules/auth/hooks/use-auth-action.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/auth/hooks/use-delete-account.d.ts +8 -0
- package/lib/typescript/module/src/modules/auth/hooks/use-delete-account.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/auth/hooks/use-session.d.ts +6 -4
- package/lib/typescript/module/src/modules/auth/hooks/use-session.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/hooks/use-sign-in.d.ts +24 -0
- package/lib/typescript/module/src/modules/auth/hooks/use-sign-in.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/auth/hooks/use-sign-out.d.ts +4 -0
- package/lib/typescript/module/src/modules/auth/hooks/use-sign-out.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/auth/hooks/use-social-sign-in.d.ts +14 -0
- package/lib/typescript/module/src/modules/auth/hooks/use-social-sign-in.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/auth/index.d.ts +5 -0
- package/lib/typescript/module/src/modules/auth/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/logout-button/components/logout-button.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/profile/components/profile-form-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/profile/contexts/profile-form-context.d.ts +1 -1
- package/lib/typescript/module/src/modules/auth/profile/contexts/profile-form-context.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/profile/hooks/use-profile-form.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/register/components/form/register-form-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/reset-password/components/form/inputs.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/reset-password/components/form/reset-password-form-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/reset-password/contexts/reset-password-form-context.d.ts +1 -1
- package/lib/typescript/module/src/modules/auth/reset-password/contexts/reset-password-form-context.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/session/logout-session.d.ts +6 -0
- package/lib/typescript/module/src/modules/auth/session/logout-session.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/auth/session/session-store.d.ts +21 -0
- package/lib/typescript/module/src/modules/auth/session/session-store.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/auth/sign-in/components/form/login-form-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/apple-login-button.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/google-login-button.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/sign-in/contexts/login-form-context.d.ts +1 -1
- package/lib/typescript/module/src/modules/auth/sign-in/contexts/login-form-context.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device/components/device-list-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device/components/hooks/use-device-list.d.ts +1 -5
- package/lib/typescript/module/src/modules/bt-device/components/hooks/use-device-list.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device/contexts/device-list-context.d.ts +3 -2
- package/lib/typescript/module/src/modules/bt-device/contexts/device-list-context.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/components/bt-provider.d.ts +1 -1
- package/lib/typescript/module/src/modules/bt-management/components/bt-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts +40 -9
- package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-background-sync.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-bluetooth-permission.d.ts +17 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-bluetooth-permission.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-bluetooth-state.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-bt-device.d.ts +31 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-bt-device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-device-connection.d.ts +2 -2
- package/lib/typescript/module/src/modules/bt-management/hooks/use-device-connection.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-health-import.d.ts +2 -15
- package/lib/typescript/module/src/modules/bt-management/hooks/use-health-import.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-measurements.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-nearby-devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-paired-devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-request-permissions.d.ts +1 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-request-permissions.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-scan-control.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/index.d.ts +6 -1
- package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/btprovider-props.d.ts +2 -0
- package/lib/typescript/module/src/modules/bt-management/types/btprovider-props.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/cms/hooks/use-cms-content.d.ts +9 -0
- package/lib/typescript/module/src/modules/cms/hooks/use-cms-content.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/cms/hooks/use-cms-locale.d.ts +7 -0
- package/lib/typescript/module/src/modules/cms/hooks/use-cms-locale.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/cms/hooks/use-cms-translations.d.ts +10 -0
- package/lib/typescript/module/src/modules/cms/hooks/use-cms-translations.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/cms/index.d.ts +4 -0
- package/lib/typescript/module/src/modules/cms/index.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/cms/merge-cms-translations.d.ts +13 -0
- package/lib/typescript/module/src/modules/cms/merge-cms-translations.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/data-sync/components/android/android-health-connect-authorization-provider.d.ts +1 -1
- package/lib/typescript/module/src/modules/data-sync/components/android/android-health-connect-authorization-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts +4 -0
- package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/data-sync/components/data-sync.d.ts +1 -1
- package/lib/typescript/module/src/modules/data-sync/contexts/health-authorization-context.d.ts +17 -0
- package/lib/typescript/module/src/modules/data-sync/contexts/health-authorization-context.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/data-sync/hooks/use-health-import.d.ts +17 -0
- package/lib/typescript/module/src/modules/data-sync/hooks/use-health-import.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/data-sync/index.d.ts +3 -0
- package/lib/typescript/module/src/modules/data-sync/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts +1 -0
- package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/helpers/hooks/use-shallow-stable-value.d.ts +2 -0
- package/lib/typescript/module/src/modules/helpers/hooks/use-shallow-stable-value.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/language-switcher/components/language-switcher.d.ts +6 -5
- package/lib/typescript/module/src/modules/language-switcher/components/language-switcher.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/language-switcher/components/option/context/language-option-context.d.ts +1 -1
- package/lib/typescript/module/src/modules/language-switcher/components/option/context/language-option-context.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/socket/components/socket-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/tab/components/tab-provider.d.ts +2 -1
- package/lib/typescript/module/src/modules/tab/components/tab-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/tab/contexts/tab-context.d.ts +1 -1
- package/lib/typescript/module/src/modules/tab/contexts/tab-context.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/ui/components/health-import-card.d.ts +1 -2
- package/lib/typescript/module/src/modules/ui/components/health-import-card.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/ui/components/pairing-flow.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useBluetoothRuntime","useBluetoothSelector","DeviceSelectionRequiredError","Error","constructor","model","ids","join","name","EMPTY_RESULTS","EMPTY_EVENTS","deviceQueues","WeakMap","serializeForDevice","runtime","deviceId","operation","queues","get","Map","set","previous","Promise","resolve","current","catch","undefined","then","finally","delete","getRawDevice","device","useBTDevice","id","autoConnect","allowRawAccess","selectedId","setSelectedId","useState","matches","snapshot","devices","filter","deviceData","next","length","every","item","index","candidate","selected","find","selectedIdRef","useRef","matchesRef","modelRef","autoConnectedRef","Set","useEffect","has","add","connect","select","useCallback","some","currentMatches","map","disconnect","raw","useMemo","resolveDevice","rawDevice","read","serviceUUID","characteristicUUID","readCharacteristicForService","write","base64Value","withResponse","writeCharacteristicWithResponseForService","writeCharacteristicWithoutResponseForService","requiresSelection","status","latestResult","results","events"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/hooks/use-bt-device.ts"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAK9B,SAIEC,mBAAmB,EACnBC,oBAAoB,QACf,sBAAmB;AAkB1B,MAAMC,4BAA4B,SAASC,KAAK,CAAC;EAC/CC,WAAWA,CAACC,KAAgB,EAAEC,GAAsB,EAAE;IACpD,KAAK,CAAC,0BAA0BD,KAAK,W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C,EAAE,CAAC1C,cAAc,EAAErB,OAAO,CAAC,CAAC;EAE7B,OAAO;IACLT,KAAK;IACLoC,OAAO,EAAEF,OAAO;IAChBR,MAAM,EAAEmB,QAAQ;IAChB+B,iBAAiB,EAAE1C,OAAO,CAACM,MAAM,GAAG,CAAC,IAAIK,QAAQ,KAAKxB,SAAS;IAC/DwD,MAAM,EAAEhC,QAAQ,EAAEgC,MAAM;IACxBC,YAAY,EAAEjC,QAAQ,EAAEiC,YAAY;IACpCC,OAAO,EAAElC,QAAQ,EAAEkC,OAAO,IAAI3E,aAAa;IAC3C4E,MAAM,EAAEnC,QAAQ,EAAEmC,MAAM,IAAI3E,YAAY;IACxCoD,MAAM;IACND,OAAO;IACPM,UAAU;IACVC;EACF,CAAC;AACH,CAAC;AAED,SACElE,4BAA4B,EAG5B8B,WAAW","ignoreList":[]}
|
|
@@ -1,34 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import { useBluetoothSelector } from "./runtime-context.js";
|
|
4
|
+
const EMPTY_EVENTS = [];
|
|
5
5
|
export const useDeviceConnection = id => {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}, [id, runtime]);
|
|
13
|
-
React.useEffect(() => {
|
|
14
|
-
const unsubStatus = runtime.subscribe("status", value => {
|
|
15
|
-
if (value.deviceData.id === id) {
|
|
16
|
-
setStatus(value.status);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const unsubEvent = runtime.subscribe("connection", event => {
|
|
20
|
-
if (event.deviceData.id === id) {
|
|
21
|
-
setEvents(current => [...current, event].slice(-100));
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
return () => {
|
|
25
|
-
unsubStatus();
|
|
26
|
-
unsubEvent();
|
|
6
|
+
const connection = useBluetoothSelector(snapshot => {
|
|
7
|
+
const device = id ? snapshot.devices.find(candidate => candidate.id === id) : undefined;
|
|
8
|
+
const events = device?.events;
|
|
9
|
+
return {
|
|
10
|
+
status: device?.status,
|
|
11
|
+
events: events?.length ? events : EMPTY_EVENTS
|
|
27
12
|
};
|
|
28
|
-
},
|
|
13
|
+
}, (previous, next) => previous.status === next.status && previous.events === next.events);
|
|
29
14
|
return {
|
|
30
|
-
status,
|
|
31
|
-
events
|
|
15
|
+
status: connection.status,
|
|
16
|
+
events: connection.events
|
|
32
17
|
};
|
|
33
18
|
};
|
|
34
19
|
//# sourceMappingURL=use-device-connection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useBluetoothSelector","EMPTY_EVENTS","useDeviceConnection","id","connection","snapshot","device","devices","find","candidate","undefined","events","status","length","previous","next"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/hooks/use-device-connection.ts"],"mappings":";;AAEA,SAEEA,oBAAoB,QACf,sBAAmB;AAE1B,MAAMC,YAA+C,GAAG,EAAE;AAE1D,OAAO,MAAMC,mBAAmB,GAC9BC,EAAW,IAC8D;EACzE,MAAMC,UAAU,GAAGJ,oBAAoB,CACpCK,QAAQ,IAAK;IACZ,MAAMC,MAAM,GAAGH,EAAE,GACbE,QAAQ,CAACE,OAAO,CAACC,IAAI,CAAEC,SAAS,IAAKA,SAAS,CAACN,EAAE,KAAKA,EAAE,CAAC,GACzDO,SAAS;IAEb,MAAMC,MAAM,GAAGL,MAAM,EAAEK,MAAM;IAE7B,OAAO;MACLC,MAAM,EAAEN,MAAM,EAAEM,MAAM;MACtBD,MAAM,EAAEA,MAAM,EAAEE,MAAM,GAAGF,MAAM,GAAGV;IACpC,CAAC;EACH,CAAC,EACD,CAACa,QAAQ,EAAEC,IAAI,KACbD,QAAQ,CAACF,MAAM,KAAKG,IAAI,CAACH,MAAM,IAAIE,QAAQ,CAACH,MAAM,KAAKI,IAAI,CAACJ,MAChE,CAAC;EAED,OAAO;IACLC,MAAM,EAAER,UAAU,CAACQ,MAAM;IACzBD,MAAM,EAAEP,UAAU,CAACO;EACrB,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,76 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
types,
|
|
6
|
-
background = false,
|
|
7
|
-
adapter
|
|
8
|
-
}) => {
|
|
9
|
-
const [enabled, setEnabled] = React.useState(false);
|
|
10
|
-
const [statusByType, setStatusByType] = React.useState({});
|
|
11
|
-
const [error, setError] = React.useState();
|
|
12
|
-
const typesKey = React.useMemo(() => types.join("\u0000"), [types]);
|
|
13
|
-
const configRef = React.useRef({
|
|
14
|
-
adapter,
|
|
15
|
-
types,
|
|
16
|
-
background
|
|
17
|
-
});
|
|
18
|
-
configRef.current = {
|
|
19
|
-
adapter,
|
|
20
|
-
types,
|
|
21
|
-
background
|
|
22
|
-
};
|
|
23
|
-
const refresh = React.useCallback(async () => {
|
|
24
|
-
void typesKey;
|
|
25
|
-
const {
|
|
26
|
-
adapter: currentAdapter,
|
|
27
|
-
types: currentTypes
|
|
28
|
-
} = configRef.current;
|
|
29
|
-
const entries = await Promise.allSettled(currentTypes.map(async type => [type, await currentAdapter.getStatus(type)]));
|
|
30
|
-
const rejected = entries.find(entry => entry.status === "rejected");
|
|
31
|
-
setStatusByType(current => {
|
|
32
|
-
const next = {
|
|
33
|
-
...current
|
|
34
|
-
};
|
|
35
|
-
entries.forEach(entry => {
|
|
36
|
-
if (entry.status === "fulfilled") {
|
|
37
|
-
next[entry.value[0]] = entry.value[1];
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
return next;
|
|
41
|
-
});
|
|
42
|
-
setEnabled(currentTypes.length > 0 && entries.every(entry => entry.status === "fulfilled" && entry.value[1] === "authorized"));
|
|
43
|
-
setError(rejected ? rejected.reason instanceof Error ? rejected.reason : new Error(String(rejected.reason)) : undefined);
|
|
44
|
-
}, [typesKey]);
|
|
45
|
-
React.useEffect(() => {
|
|
46
|
-
void refresh();
|
|
47
|
-
}, [refresh]);
|
|
48
|
-
const setEnabledForTypes = React.useCallback(async next => {
|
|
49
|
-
const {
|
|
50
|
-
adapter: currentAdapter,
|
|
51
|
-
types: currentTypes,
|
|
52
|
-
background: currentBackground
|
|
53
|
-
} = configRef.current;
|
|
54
|
-
setError(undefined);
|
|
55
|
-
try {
|
|
56
|
-
if (next) {
|
|
57
|
-
await currentAdapter.request(currentTypes, currentBackground);
|
|
58
|
-
await refresh();
|
|
59
|
-
}
|
|
60
|
-
setEnabled(next);
|
|
61
|
-
} catch (cause) {
|
|
62
|
-
const nextError = cause instanceof Error ? cause : new Error(String(cause));
|
|
63
|
-
setError(nextError);
|
|
64
|
-
throw nextError;
|
|
65
|
-
}
|
|
66
|
-
}, [refresh]);
|
|
67
|
-
const notShared = types.filter(type => statusByType[type] === "refused");
|
|
68
|
-
return {
|
|
69
|
-
enabled,
|
|
70
|
-
setEnabled: setEnabledForTypes,
|
|
71
|
-
statusByType: statusByType,
|
|
72
|
-
notShared,
|
|
73
|
-
error
|
|
74
|
-
};
|
|
75
|
-
};
|
|
3
|
+
/** @deprecated Import useHealthImport from the data-sync module instead. */
|
|
4
|
+
export { useHealthImport } from "../../data-sync/hooks/use-health-import.js";
|
|
76
5
|
//# sourceMappingURL=use-health-import.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["useHealthImport"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/hooks/use-health-import.ts"],"mappings":";;AAAA;AACA,SACEA,eAAe,QAEV,4CAAyC","ignoreList":[]}
|
|
@@ -1,73 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { useBluetoothRuntime } from "./runtime-context.js";
|
|
4
|
+
import { useBluetoothRuntime, useBluetoothSelector } from "./runtime-context.js";
|
|
5
|
+
const sameResults = (previous, next) => previous.length === next.length && previous.every((result, index) => result === next[index]);
|
|
6
|
+
const getMeasurementType = result => String(result.data.measurementTypeKey);
|
|
7
|
+
const applyResultPolicy = (results, policy, getConnectionId) => {
|
|
8
|
+
if (policy === "all") {
|
|
9
|
+
return [...results];
|
|
10
|
+
}
|
|
11
|
+
const seen = new Set();
|
|
12
|
+
return results.filter(result => {
|
|
13
|
+
const type = getMeasurementType(result);
|
|
14
|
+
const connectionId = getConnectionId(result);
|
|
15
|
+
if (policy === "first-reading-per-kind-per-connection") {
|
|
16
|
+
const key = `${result.deviceData.id}:${connectionId}:${type}`;
|
|
17
|
+
if (seen.has(key)) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
seen.add(key);
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
const temporal = result.data;
|
|
24
|
+
const end = temporal.end instanceof Date ? temporal.end : undefined;
|
|
25
|
+
if (end && end.getTime() > Date.now()) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
const day = temporal.end ?? temporal.start ?? temporal.recordedAt;
|
|
29
|
+
if (!(day instanceof Date)) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
const key = `${result.deviceData.id}:${connectionId}:${type}:${day.toISOString().slice(0, 10)}`;
|
|
33
|
+
if (seen.has(key)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
seen.add(key);
|
|
37
|
+
return true;
|
|
38
|
+
});
|
|
39
|
+
};
|
|
5
40
|
export const useMeasurements = (onResult, {
|
|
6
41
|
policy = "all",
|
|
7
42
|
maxResults = 100
|
|
8
43
|
} = {}) => {
|
|
9
44
|
const runtime = useBluetoothRuntime();
|
|
10
|
-
const
|
|
11
|
-
const seen = React.useRef(new Set());
|
|
12
|
-
const seenMeasurementKinds = React.useRef(new Set());
|
|
13
|
-
const seenDailyTotals = React.useRef(new Set());
|
|
45
|
+
const results = useBluetoothSelector(snapshot => snapshot.devices.flatMap(device => device.results ?? []), sameResults);
|
|
14
46
|
const onResultRef = React.useRef(onResult);
|
|
15
47
|
onResultRef.current = onResult;
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
seenMeasurementKinds.current.add(measurementTypeKey);
|
|
23
|
-
}
|
|
24
|
-
if (policy === "daily-totals-only") {
|
|
25
|
-
const temporal = result.data;
|
|
26
|
-
const end = temporal.end instanceof Date ? temporal.end : undefined;
|
|
27
|
-
if (end && end.getTime() > Date.now()) {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
const day = temporal.end ?? temporal.start ?? temporal.recordedAt;
|
|
31
|
-
if (day instanceof Date) {
|
|
32
|
-
const key = `${measurementTypeKey}:${day.toISOString().slice(0, 10)}`;
|
|
33
|
-
if (seenDailyTotals.current.has(key)) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
seenDailyTotals.current.add(key);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return true;
|
|
40
|
-
}, [policy]);
|
|
41
|
-
React.useEffect(() => {
|
|
42
|
-
return runtime.subscribe("result", result => {
|
|
43
|
-
if (!acceptsResult(result)) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (seen.current.has(result.id)) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
seen.current.add(result.id);
|
|
50
|
-
setMeasurements(current => [...current, result].slice(-maxResults));
|
|
51
|
-
onResultRef.current?.(result);
|
|
52
|
-
});
|
|
53
|
-
}, [acceptsResult, maxResults, runtime]);
|
|
54
|
-
React.useEffect(() => {
|
|
55
|
-
const unsubscribe = runtime.subscribe("connection", event => {
|
|
56
|
-
if (event.kind === "connected" || event.kind === "bonded") {
|
|
57
|
-
seenMeasurementKinds.current.clear();
|
|
58
|
-
seenDailyTotals.current.clear();
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
return unsubscribe;
|
|
62
|
-
}, [runtime]);
|
|
48
|
+
const measurements = React.useMemo(() => {
|
|
49
|
+
const accepted = applyResultPolicy(results, policy, runtime.getResultConnectionId);
|
|
50
|
+
return maxResults > 0 ? accepted.slice(-maxResults) : [];
|
|
51
|
+
}, [maxResults, policy, results, runtime]);
|
|
52
|
+
React.useEffect(() => runtime.subscribe("result", result => onResultRef.current?.(result)), [runtime]);
|
|
53
|
+
const clear = React.useCallback(() => runtime.clearResults(), [runtime]);
|
|
63
54
|
return {
|
|
64
55
|
measurements,
|
|
65
|
-
clear
|
|
66
|
-
seen.current.clear();
|
|
67
|
-
seenMeasurementKinds.current.clear();
|
|
68
|
-
seenDailyTotals.current.clear();
|
|
69
|
-
setMeasurements([]);
|
|
70
|
-
}
|
|
56
|
+
clear
|
|
71
57
|
};
|
|
72
58
|
};
|
|
73
59
|
//# sourceMappingURL=use-measurements.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useBluetoothRuntime","
|
|
1
|
+
{"version":3,"names":["React","useBluetoothRuntime","useBluetoothSelector","sameResults","previous","next","length","every","result","index","getMeasurementType","String","data","measurementTypeKey","applyResultPolicy","results","policy","getConnectionId","seen","Set","filter","type","connectionId","key","deviceData","id","has","add","temporal","end","Date","undefined","getTime","now","day","start","recordedAt","toISOString","slice","useMeasurements","onResult","maxResults","runtime","snapshot","devices","flatMap","device","onResultRef","useRef","current","measurements","useMemo","accepted","getResultConnectionId","useEffect","subscribe","clear","useCallback","clearResults"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/hooks/use-measurements.ts"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAI9B,SAEEC,mBAAmB,EACnBC,oBAAoB,QACf,sBAAmB;AAO1B,MAAMC,WAAW,GAAGA,CAClBC,QAAkC,EAClCC,IAA8B,KAE9BD,QAAQ,CAACE,MAAM,KAAKD,IAAI,CAACC,MAAM,IAC/BF,QAAQ,CAACG,KAAK,CAAC,CAACC,MAAM,EAAEC,KAAK,KAAKD,MAAM,KAAKH,IAAI,CAAC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,GAAGzC,MAAM,CAAC,CAAC,EAC5E,CAACkC,OAAO,CACV,CAAC;EAED,MAAMc,KAAK,GAAGxD,KAAK,CAACyD,WAAW,CAAC,MAAMf,OAAO,CAACgB,YAAY,CAAC,CAAC,EAAE,CAAChB,OAAO,CAAC,CAAC;EAExE,OAAO;IAAEQ,YAAY;IAAEM;EAAM,CAAC;AAChC,CAAC","ignoreList":[]}
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { useBluetoothRuntime } from "./runtime-context.js";
|
|
4
|
+
import { useBluetoothRuntime, useBluetoothSelector } from "./runtime-context.js";
|
|
5
5
|
export const useNearbyDevices = () => {
|
|
6
6
|
const runtime = useBluetoothRuntime();
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
const devices = useBluetoothSelector(snapshot => snapshot.devices, (previous, next) => previous.length === next.length && previous.every((item, index) => {
|
|
8
|
+
const candidate = next[index];
|
|
9
|
+
return candidate?.id === item.id && candidate.deviceData === item.deviceData && candidate.status === item.status && candidate.device === item.device;
|
|
10
|
+
}));
|
|
11
|
+
const pair = React.useCallback(async id => {
|
|
12
|
+
const device = runtime.devices.find(item => item.id === id);
|
|
13
|
+
if (device) {
|
|
14
|
+
await device.device.connect();
|
|
15
|
+
}
|
|
16
|
+
return device;
|
|
15
17
|
}, [runtime]);
|
|
16
18
|
return {
|
|
17
|
-
devices
|
|
18
|
-
pair
|
|
19
|
-
const device = runtime.devices.find(item => item.id === id);
|
|
20
|
-
if (device) {
|
|
21
|
-
await device.device.connect();
|
|
22
|
-
}
|
|
23
|
-
return device;
|
|
24
|
-
}
|
|
19
|
+
devices,
|
|
20
|
+
pair
|
|
25
21
|
};
|
|
26
22
|
};
|
|
27
23
|
//# sourceMappingURL=use-nearby-devices.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useBluetoothRuntime","useNearbyDevices","runtime","
|
|
1
|
+
{"version":3,"names":["React","useBluetoothRuntime","useBluetoothSelector","useNearbyDevices","runtime","devices","snapshot","previous","next","length","every","item","index","candidate","id","deviceData","status","device","pair","useCallback","find","connect"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/hooks/use-nearby-devices.ts"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAI9B,SAEEC,mBAAmB,EACnBC,oBAAoB,QACf,sBAAmB;AAE1B,OAAO,MAAMC,gBAAgB,GAAGA,CAAA,KAG3B;EACH,MAAMC,OAAO,GAAGH,mBAAmB,CAAC,CAAC;EAErC,MAAMI,OAAO,GAAGH,oBAAoB,CACjCI,QAAQ,IAAKA,QAAQ,CAACD,OAAO,EAC9B,CAACE,QAAQ,EAAEC,IAAI,KAAKD,QAAQ,CAACE,MAAM,KAAKD,IAAI,CAACC,MAAM,IAAIF,QAAQ,CAACG,KAAK,CAAC,CAACC,IAAI,EAAEC,KAAK,KAAK;IACrF,MAAMC,SAAS,GAAGL,IAAI,CAACI,KAAK,CAAC;IAE7B,OAAOC,SAAS,EAAEC,EAAE,KAAKH,IAAI,CAACG,EAAE,IAC9BD,SAAS,CAACE,UAAU,KAAKJ,IAAI,CAACI,UAAU,IACxCF,SAAS,CAACG,MAAM,KAAKL,IAAI,CAACK,MAAM,IAChCH,SAAS,CAACI,MAAM,KAAKN,IAAI,CAACM,MAAM;EACpC,CAAC,CACH,CAAC;EAED,MAAMC,IAAI,GAAGlB,KAAK,CAACmB,WAAW,CAAC,MAAOL,EAAU,IAAK;IACnD,MAAMG,MAAM,GAAGb,OAAO,CAACC,OAAO,CAACe,IAAI,CAAET,IAAI,IAAKA,IAAI,CAACG,EAAE,KAAKA,EAAE,CAAC;IAE7D,IAAIG,MAAM,EAAE;MACV,MAAMA,MAAM,CAACA,MAAM,CAACI,OAAO,CAAC,CAAC;IAC/B;IAEA,OAAOJ,MAAM;EACf,CAAC,EAAE,CAACb,OAAO,CAAC,CAAC;EAEb,OAAO;IACLC,OAAO;IACPa;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -12,12 +12,17 @@ export const usePairedDevices = ({
|
|
|
12
12
|
const runtime = useBluetoothRuntime();
|
|
13
13
|
const [paired, setPaired] = React.useState(() => runtime.getPairedDeviceIds(storageKey) ?? []);
|
|
14
14
|
const pairedRef = React.useRef(paired);
|
|
15
|
+
const autoConnectedRef = React.useRef(new Set());
|
|
16
|
+
const storageRef = React.useRef(storage);
|
|
17
|
+
const autoPairRef = React.useRef(autoPair);
|
|
18
|
+
storageRef.current = storage;
|
|
19
|
+
autoPairRef.current = autoPair;
|
|
15
20
|
const save = React.useCallback(async next => {
|
|
16
21
|
pairedRef.current = next;
|
|
17
22
|
setPaired(next);
|
|
18
23
|
runtime.setPairedDeviceIds(storageKey, next);
|
|
19
|
-
await
|
|
20
|
-
}, [runtime,
|
|
24
|
+
await storageRef.current.setItem(storageKey, JSON.stringify(next));
|
|
25
|
+
}, [runtime, storageKey]);
|
|
21
26
|
React.useEffect(() => runtime.subscribe("pairedDevices", event => {
|
|
22
27
|
if (event.storageKey !== storageKey) {
|
|
23
28
|
return;
|
|
@@ -40,22 +45,36 @@ export const usePairedDevices = ({
|
|
|
40
45
|
setPaired(next);
|
|
41
46
|
});
|
|
42
47
|
}, [runtime, storage, storageKey]);
|
|
48
|
+
const connectIfPaired = React.useCallback(device => {
|
|
49
|
+
if (!autoPairRef.current || !pairedRef.current.includes(device.id) || autoConnectedRef.current.has(device.id)) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
autoConnectedRef.current.add(device.id);
|
|
53
|
+
void device.device.connect().catch(() => {
|
|
54
|
+
autoConnectedRef.current.delete(device.id);
|
|
55
|
+
});
|
|
56
|
+
}, []);
|
|
43
57
|
React.useEffect(() => {
|
|
44
58
|
if (!autoPair) {
|
|
59
|
+
autoConnectedRef.current.clear();
|
|
45
60
|
return;
|
|
46
61
|
}
|
|
47
|
-
runtime.devices.
|
|
48
|
-
|
|
62
|
+
runtime.devices.forEach(connectIfPaired);
|
|
63
|
+
return runtime.subscribe("deviceFound", connectIfPaired);
|
|
64
|
+
}, [autoPair, connectIfPaired, paired, runtime]);
|
|
65
|
+
const pair = React.useCallback(device => save([...new Set([...pairedRef.current, device.id])]), [save]);
|
|
66
|
+
const forget = React.useCallback(async id => {
|
|
67
|
+
if (!runtime.manager) {
|
|
68
|
+
throw new Error("Bluetooth manager is not ready; try forgetting the device again.");
|
|
69
|
+
}
|
|
70
|
+
await runtime.manager.forget(id);
|
|
71
|
+
autoConnectedRef.current.delete(id);
|
|
72
|
+
await save(pairedRef.current.filter(candidate => candidate !== id));
|
|
73
|
+
}, [runtime, save]);
|
|
49
74
|
return {
|
|
50
75
|
paired,
|
|
51
|
-
pair
|
|
52
|
-
forget
|
|
53
|
-
if (!runtime.manager) {
|
|
54
|
-
throw new Error("Bluetooth manager is not ready; try forgetting the device again.");
|
|
55
|
-
}
|
|
56
|
-
await runtime.manager.forget(id);
|
|
57
|
-
await save(pairedRef.current.filter(candidate => candidate !== id));
|
|
58
|
-
}
|
|
76
|
+
pair,
|
|
77
|
+
forget
|
|
59
78
|
};
|
|
60
79
|
};
|
|
61
80
|
//# sourceMappingURL=use-paired-devices.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useBluetoothRuntime","usePairedDevices","storage","storageKey","autoPair","runtime","paired","setPaired","useState","getPairedDeviceIds","pairedRef","useRef","
|
|
1
|
+
{"version":3,"names":["React","useBluetoothRuntime","usePairedDevices","storage","storageKey","autoPair","runtime","paired","setPaired","useState","getPairedDeviceIds","pairedRef","useRef","autoConnectedRef","Set","storageRef","autoPairRef","current","save","useCallback","next","setPairedDeviceIds","setItem","JSON","stringify","useEffect","subscribe","event","loadPairedDeviceIds","value","getItem","parsed","parse","Array","isArray","filter","id","then","connectIfPaired","device","includes","has","add","connect","catch","delete","clear","devices","forEach","pair","forget","manager","Error","candidate"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/hooks/use-paired-devices.ts"],"mappings":";;AAAA;;AAEA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,SAAwBC,mBAAmB,QAAQ,sBAAmB;AAatE,OAAO,MAAMC,gBAAgB,GAAGA,CAAC;EAC/BC,OAAO;EACPC,UAAU,GAAG,6BAA6B;EAC1CC,QAAQ,GAAG;AACY,CAAC,KAIrB;EACH,MAAMC,OAAO,GAAGL,mBAAmB,CAAC,CAAC;EAErC,MAAM,CAACM,MAAM,EAAEC,SAAS,CAAC,GAAGR,KAAK,CAACS,QAAQ,CACxC,MAAMH,OAAO,CAACI,kBAAkB,CAACN,UAAU,CAAC,IAAI,EAClD,CAAC;EAED,MAAMO,SAAS,GAAGX,KAAK,CAACY,MAAM,CAAoBL,MAAM,CAAC;EACzD,MAAMM,gBAAgB,GAAGb,KAAK,CAACY,MAAM,CAAC,IAAIE,GAAG,CAAS,CAAC,CAAC;EACxD,MAAMC,UAAU,GAAGf,KAAK,CAACY,MAAM,CAACT,OAAO,CAAC;EACxC,MAAMa,WAAW,GAAGhB,KAAK,CAACY,MAAM,CAACP,QAAQ,CAAC;EAE1CU,UAAU,CAACE,OAAO,GAAGd,OAAO;EAC5Ba,WAAW,CAACC,OAAO,GAAGZ,QAAQ;EAE9B,MAAMa,IAAI,GAAGlB,KAAK,CAACmB,WAAW,CAAC,MAAOC,IAAuB,IAAK;IAChET,SAAS,CAACM,OAAO,GAAGG,IAAI;IACxBZ,SAAS,CAACY,IAAI,CAAC;IACfd,OAAO,CAACe,kBAAkB,CAACjB,UAAU,EAAEgB,IAAI,CAAC;IAC5C,MAAML,UAAU,CAACE,OAAO,CAACK,OAAO,CAAClB,UAAU,EAAEmB,IAAI,CAACC,SAAS,CAACJ,IAAI,CAAC,CAAC;EACpE,CAAC,EAAE,CAACd,OAAO,EAAEF,UAAU,CAAC,CAAC;EAEzBJ,KAAK,CAACyB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S,CAACM,OAAO,CAACkB,MAAM,CAAEkB,SAAS,IAAKA,SAAS,KAAKjB,EAAE,CAAC,CAAC;EACvE,CAAC,EAAE,CAAC9B,OAAO,EAAEY,IAAI,CAAC,CAAC;EAEnB,OAAO;IACLX,MAAM;IACN0C,IAAI;IACJC;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -1,67 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { AppState, Linking, Platform } from "react-native";
|
|
5
|
-
import { PERMISSIONS, requestMultiple } from "react-native-permissions";
|
|
6
3
|
import { slog } from "../../helpers/index.js";
|
|
7
|
-
import {
|
|
4
|
+
import { useBluetoothPermission } from "./use-bluetooth-permission.js";
|
|
8
5
|
export const useRequestPermissions = ({
|
|
9
6
|
onAccessPermissionChanged
|
|
10
7
|
}) => {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const requestPermissions = React.useCallback(async () => {
|
|
20
|
-
if (requestInFlightRef.current) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
requestInFlightRef.current = true;
|
|
24
|
-
const requestedPermissions = Platform.OS === "android" ? Number(Platform.Version) >= 31 ? [PERMISSIONS.ANDROID.BLUETOOTH_CONNECT, PERMISSIONS.ANDROID.BLUETOOTH_SCAN] : [PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION] : [PERMISSIONS.IOS.BLUETOOTH];
|
|
25
|
-
sentryLogger("info", "BT_PROVIDER: Permissions requesting", {
|
|
26
|
-
permissions: requestedPermissions
|
|
27
|
-
});
|
|
28
|
-
try {
|
|
29
|
-
const grantedPermissions = await requestMultiple(requestedPermissions);
|
|
30
|
-
const allGranted = requestedPermissions.every(permission => grantedPermissions[permission] === "granted");
|
|
31
|
-
sentryLogger("info", "BT_PROVIDER: Permissions requested", {
|
|
32
|
-
permissions: grantedPermissions,
|
|
33
|
-
allGranted
|
|
34
|
-
});
|
|
35
|
-
onChangeRef.current?.(allGranted);
|
|
36
|
-
setAccessPermission(allGranted);
|
|
37
|
-
} catch (error) {
|
|
8
|
+
const {
|
|
9
|
+
accessPermission,
|
|
10
|
+
openSettings,
|
|
11
|
+
requestPermission
|
|
12
|
+
} = useBluetoothPermission({
|
|
13
|
+
requestOnMount: true,
|
|
14
|
+
onPermissionChanged: onAccessPermissionChanged,
|
|
15
|
+
onRequestError: error => {
|
|
38
16
|
slog(error, "bt permission request error");
|
|
39
|
-
} finally {
|
|
40
|
-
requestInFlightRef.current = false;
|
|
41
17
|
}
|
|
42
|
-
}
|
|
43
|
-
React.useEffect(() => {
|
|
44
|
-
let wasActive = AppState.currentState === "active";
|
|
45
|
-
const listener = AppState.addEventListener("change", state => {
|
|
46
|
-
const becameActive = state === "active" && !wasActive;
|
|
47
|
-
wasActive = state === "active";
|
|
48
|
-
if (!becameActive || !requestOnResumeRef.current) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
requestOnResumeRef.current = false;
|
|
52
|
-
void requestPermissions();
|
|
53
|
-
});
|
|
54
|
-
void requestPermissions();
|
|
55
|
-
return () => {
|
|
56
|
-
listener.remove();
|
|
57
|
-
};
|
|
58
|
-
}, [requestPermissions]);
|
|
59
|
-
React.useEffect(() => {
|
|
60
|
-
onChangeRef.current = onAccessPermissionChanged;
|
|
61
|
-
}, [onAccessPermissionChanged]);
|
|
18
|
+
});
|
|
62
19
|
return {
|
|
63
20
|
accessPermission,
|
|
64
|
-
openBleSetting
|
|
21
|
+
openBleSetting: openSettings,
|
|
22
|
+
requestPermission
|
|
65
23
|
};
|
|
66
24
|
};
|
|
67
25
|
//# sourceMappingURL=use-request-permissions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["slog","useBluetoothPermission","useRequestPermissions","onAccessPermissionChanged","accessPermission","openSettings","requestPermission","requestOnMount","onPermissionChanged","onRequestError","error","openBleSetting"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/hooks/use-request-permissions.ts"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,wBAAe;AAIpC,SAASC,sBAAsB,QAAQ,+BAA4B;AAEnE,OAAO,MAAMC,qBAAqB,GAAGA,CAAC;EACpCC;AACuE,CAAC,KAAK;EAC7E,MAAM;IAAEC,gBAAgB;IAAEC,YAAY;IAAEC;EAAkB,CAAC,GACzDL,sBAAsB,CAAC;IACrBM,cAAc,EAAE,IAAI;IACpBC,mBAAmB,EAAEL,yBAAyB;IAC9CM,cAAc,EAAGC,KAAK,IAAK;MACzBV,IAAI,CAACU,KAAK,EAAE,6BAA6B,CAAC;IAC5C;EACF,CAAC,CAAC;EAEJ,OAAO;IACLN,gBAAgB;IAChBO,cAAc,EAAEN,YAAY;IAC5BC;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -6,11 +6,13 @@ import { useBluetoothRuntime } from "./runtime-context.js";
|
|
|
6
6
|
/** Exposes scan pause/resume to apps using BTProvider. */
|
|
7
7
|
export const useScanControl = () => {
|
|
8
8
|
const runtime = useBluetoothRuntime();
|
|
9
|
-
React.useSyncExternalStore(runtime.subscribeState, () => runtime.manager, () => undefined);
|
|
9
|
+
const manager = React.useSyncExternalStore(runtime.subscribeState, () => runtime.manager, () => undefined);
|
|
10
|
+
const pauseScan = React.useCallback(() => manager?.pauseScan(), [manager]);
|
|
11
|
+
const resumeScan = React.useCallback(() => manager?.resumeScan(), [manager]);
|
|
10
12
|
return {
|
|
11
|
-
canControl: Boolean(
|
|
12
|
-
pauseScan
|
|
13
|
-
resumeScan
|
|
13
|
+
canControl: Boolean(manager),
|
|
14
|
+
pauseScan,
|
|
15
|
+
resumeScan
|
|
14
16
|
};
|
|
15
17
|
};
|
|
16
18
|
//# sourceMappingURL=use-scan-control.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useBluetoothRuntime","useScanControl","runtime","useSyncExternalStore","subscribeState","
|
|
1
|
+
{"version":3,"names":["React","useBluetoothRuntime","useScanControl","runtime","manager","useSyncExternalStore","subscribeState","undefined","pauseScan","useCallback","resumeScan","canControl","Boolean"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/hooks/use-scan-control.ts"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,SAASC,mBAAmB,QAAQ,sBAAmB;;AAEvD;AACA,OAAO,MAAMC,cAAc,GAAGA,CAAA,KAIzB;EACH,MAAMC,OAAO,GAAGF,mBAAmB,CAAC,CAAC;EAErC,MAAMG,OAAO,GAAGJ,KAAK,CAACK,oBAAoB,CACxCF,OAAO,CAACG,cAAc,EACtB,MAAMH,OAAO,CAACC,OAAO,EACrB,MAAMG,SACR,CAAC;EAED,MAAMC,SAAS,GAAGR,KAAK,CAACS,WAAW,CAAC,MAAML,OAAO,EAAEI,SAAS,CAAC,CAAC,EAAE,CAACJ,OAAO,CAAC,CAAC;EAC1E,MAAMM,UAAU,GAAGV,KAAK,CAACS,WAAW,CAAC,MAAML,OAAO,EAAEM,UAAU,CAAC,CAAC,EAAE,CAACN,OAAO,CAAC,CAAC;EAE5E,OAAO;IACLO,UAAU,EAAEC,OAAO,CAACR,OAAO,CAAC;IAC5BI,SAAS;IACTE;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -92,13 +92,20 @@ export * from "./components/bt-provider.js";
|
|
|
92
92
|
export * from "./components/bluetooth-device-picker.js";
|
|
93
93
|
export * from "./components/default-permission-fallback.js";
|
|
94
94
|
export * from "./hooks/use-request-permissions.js";
|
|
95
|
+
export * from "./hooks/use-bluetooth-permission.js";
|
|
95
96
|
export * from "./hooks/runtime-context.js";
|
|
96
97
|
export * from "./hooks/use-bluetooth-state.js";
|
|
97
98
|
export * from "./hooks/use-nearby-devices.js";
|
|
98
99
|
export * from "./hooks/use-paired-devices.js";
|
|
99
100
|
export * from "./hooks/use-device-connection.js";
|
|
101
|
+
export * from "./hooks/use-bt-device.js";
|
|
100
102
|
export * from "./hooks/use-measurements.js";
|
|
101
103
|
export * from "./hooks/use-background-sync.js";
|
|
102
|
-
|
|
104
|
+
|
|
105
|
+
/** @deprecated Import useHealthImport from @ovok/native/data-sync instead. */
|
|
106
|
+
export { useHealthImport } from "../data-sync/hooks/use-health-import.js";
|
|
107
|
+
|
|
108
|
+
/** @deprecated Import HealthImportAdapter from @ovok/native/data-sync instead. */
|
|
109
|
+
|
|
103
110
|
export * from "./hooks/use-scan-control.js";
|
|
104
111
|
//# sourceMappingURL=index.js.map
|