Skip to main content

Extra: Data sources

Show a connections page for other data sources inside the app.

Introduction

This feature included in rook_sdk_apple_health allows developers to retrieve a list of available API data sources to build a custom connections page.

Xcode

Go to the main Xcode section to see the IDE configuration.

Getting started

Ios configuration

Go to the main Ios configuration section to see the basic configuration.

Logging

Go to the main Logging section to configure logs.

Usage

Initialize

Go to the main Initialize and Update userID sections to initialize.

Get available data sources

To get the available data sources for the current user call getAvailableDataSources:

  • redirectUrl (Optional) - After the user successfully connects to a data source, the user will be redirected to this URL.
void loadConnectionsPage() async {
try {
final dataSources = await AHRookDataSources.getAvailableDataSources();

// Success
} catch (exception) {
// Handle error
}
}

To unlink (revoke authorization) from a data source call revokeDataSource:

  • dataSourceType - The type of the data source to revoke.
void revoke() async {
try {
await AHRookDataSources.revokeDataSource(DataSourceType.oura);

// Success
} catch (exception) {
// Handle error
}
}

Pre-built connections page

If you don't want to create your own connections page, you can use our pre-built screen by calling presentDataSourceView:

  • redirectUrl (Optional) - After the user successfully connects to a data source, the user will be redirected to this URL.
void showDataSources() {
AHRookDataSources.presentDataSourceView();
}