UserAccount
@objc(GSUserAccount)
public protocol UserAccount : Facility
Facility that allows the application to register some user account identifier.
The application may register a user account in order to allow GroundSdk to upload data that may disclose user-personal information to the configured remote server. This includes:
- flight blackboxes,
- flight logs,
- flight camera records,
- full crash reports.
All HTTP requests that upload such data will include the registered user account identifier.
In the absence of such a user account, then by default GroundSdk is not allowed to upload any data to the configured remote server.
However, the application may authorize GroundSdk to upload anonymous data (which do not disclose any user-personal information) to the configured remote server. This includes:
- anonymous crash reports.
The application can opt-in anonymous data upload upon clearing any registered user account, by specifying the desired data upload policy to observe.
Note that GroundSdk may always collect both anonymous and personal data from connected devices and will store them on the user’s device, regardless of the presence of any user account. When the application eventually registers a user account, it may at that point indicate what to do with personal data that were collected beforehand, by specifying the desired old data policy to observe.
User account identifiers, or absence thereof, as well as whether anonymous data upload is allowed (when no user account is registered), are persisted by GroundSdk across application restarts.
By default, there is no registered user account (so personal data upload is denied), anonymous data upload is also denied, and private mode is disabled.
-
Registers a user account.
Only one user account may be registered, calling this method with a different account provider or account id will erase any previously set user account.
In case no user account was set beforehand, or data upload becomes allowed, the specified old data policy informs GroundSdk about what to do with user data that have already been collected on the user’s device.
Calling this method doesn’t change private mode, and upload policy is always set to
.deny
if it is enabled.Declaration
Swift
@objc(setAccountProvider:accountId:dataUploadPolicy:oldDataPolicy:token:droneList:) func set(accountProvider: String, accountId: String, dataUploadPolicy: DataUploadPolicy, oldDataPolicy: OldDataPolicy, token: String, droneList: String)
Parameters
accountProvider
accountProvider identifies the account provider
accountId
accountId identifies the account
dataUploadPolicy
data upload policy.
oldDataPolicy
true: Already collected data without account may be uploaded. false: Already collected data without account must not be uploaded and should be deleted.
token
token.
droneList
user drone list, APC JSON format
-
Sets data policies.
In case a user account is present and data upload becomes allowed at any anonymization level, the specified old data policy informs GroundSdk about what to do with user data that have already been collected on the user’s device while data upload was denied.
In case no user account is present, only
deny
andanonymous
upload policies are allowed and old data policy is ignored.This method has no effect if private mode is enabled.
Declaration
Swift
func set(dataUploadPolicy: DataUploadPolicy, oldDataPolicy: OldDataPolicy)
Parameters
dataUploadPolicy
policy to observe with regard to data upload from now on
oldDataPolicy
policy to observe with regard to data that were collected so far
-
Sets private mode.
Private mode ensures that no data is uploaded, and that no new data is collected on the user’s device.
If private mode is enabled, any collected user data are cleared, and data upload policy is ignored. Otherwise, the given policy is applied.
Declaration
Swift
func set(privateMode: Bool, dataUploadPolicy: DataUploadPolicy)
Parameters
privateMode
true
to enable private mode and clear user data,false
to disable itdataUploadPolicy
policy to observe with regard to data upload from now on
-
Sets the authentication token.
The token can be set even if no user account is registered, e.g. for cellular pairing purpose.
Declaration
Swift
func set(token: String)
Parameters
token
the token to set
-
Sets drone list for current user account.
Note
drone list is updated only if user account exists.
Declaration
Swift
func set(droneList: String)
Parameters
droneList
user drone list, APC JSON format
-
Clears any registered user account.
In the absence of any registered user account, the application may nevertheless specify a policy to observe with regard to anonymous data. Only
.deny
and.anonymous
upload policy values are meaningful here, any other value will be treated in the same way as.anonymous
.Calling this method doesn’t change private mode, and upload policy is always set to
.deny
if it is enabled.Declaration
Swift
func clear(dataUploadPolicy: DataUploadPolicy)
Parameters
dataUploadPolicy
data upload policy