Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions lib/src/app/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -904,4 +904,41 @@ class AppClient {
..data = data.toStruct();
await _client.updateRobotPartMetadata(request);
}

/// Upload a device push token for the user.
///
/// Associates a device token with the user's email and app bundle ID so that
/// push notifications can be sent to this device when triggers fire.
Future<void> uploadDevicePushToken(String email, String bundleId, String deviceUuid, String deviceToken) async {
final request = UploadDevicePushTokenRequest()
..email = email
..bundleId = bundleId
..deviceUuid = deviceUuid
..deviceToken = deviceToken;
await _client.uploadDevicePushToken(request);
}

/// Delete a device push token for the user.
///
/// Removes a previously registered device token, stopping push notifications
/// for this device.
Future<void> deleteDevicePushToken(String email, String bundleId, String deviceUuid) async {
final request = DeleteDevicePushTokenRequest()
..email = email
..bundleId = bundleId
..deviceUuid = deviceUuid;
await _client.deleteDevicePushToken(request);
}

/// Get all device push tokens for the user.
///
/// Returns a list of device tokens registered for the given user email and
/// app bundle ID.
Future<List<String>> getDevicePushTokens(String email, String bundleId) async {
final request = GetDevicePushTokensRequest()
..email = email
..bundleId = bundleId;
final GetDevicePushTokensResponse response = await _client.getDevicePushTokens(request);
return response.deviceTokens;
}
}
Loading