Skip to content
Merged
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
351 changes: 351 additions & 0 deletions src/bitdrift_public/protobuf/workflow/v1/workflow_command.proto
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ message DeviceCommandArgumentDefinition {
INT64 = 5;
// Data.bool_data.
BOOL = 6;
// Any data type;
ANY = 99;
}

// The name used as the key in the command invocation's arguments map.
Expand Down Expand Up @@ -202,6 +204,355 @@ enum WellKnownCommandType {
}
]
}];
// Remove a value from app settings, using `UserDefaults` on Apple platforms or `SharedPreferences`
// on Android.
//
// Specify a key to remove a corresponding value from settings. On Android, the `file_name` argument
// is required and equivalent to `Context.getSharedPreferences(file_name)`.
USER_SETTINGS_REMOVE = 4 [(well_known_command_options) = {
key: "user_settings_remove"
description: "Removes a value from UserDefaults (Apple platforms) or SharedPreferences (Android)"
availability: {
supported_platforms: [
{
platform: ANDROID
min_os_version: "8.0"
min_config_version: 50
},
{
platform: APPLE
min_os_version: "15.0"
min_config_version: 50
}
]
}
argument_definitions: [
{
name: "key"
type: STRING
description: "Settings key to remove"
},
{
name: "file_name"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this and the other NSUserDefaults/UserDefaults commands: wouldnt be also good to have this parameter (or a separate one with a more specific name) for the suiteName (more info)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kinda wondered something similar, though the semantics are weird, especially for mac apps, where you can use it to access other apps' settings

type: STRING
description: "Desired shared preferences file, equivalent to `Context.getSharedPreferences(file_name)`"
availability: {
supported_platforms: [
{
platform: ANDROID
min_os_version: "8.0"
min_config_version: 50
}
]
}
},
{
name: "suite_name"
type: STRING
description: "Name of the app group or suite to use, equivalent to `UserDefaults(suiteName: suite_name)`"
optional: true
availability: {
supported_platforms: [
{
platform: APPLE
min_os_version: "15.0"
min_config_version: 50
}
]
}
}
]
}];
// Set a value in app settings, using `UserDefaults` on Apple platforms or `SharedPreferences` on
// Android.
//
// Specify a key and value to set. On Android, the `file_name` argument is required and equivalent
// to `Context.getSharedPreferences(file_name)`.
USER_SETTINGS_SET = 5 [(well_known_command_options) = {
key: "user_settings_set"
description: "Updates a value in UserDefaults (Apple platforms) or SharedPreferences (Android)"
availability: {
supported_platforms: [
{
platform: ANDROID
min_os_version: "8.0"
min_config_version: 49
},
{
platform: APPLE
min_os_version: "15.0"
min_config_version: 49
}
]
}
argument_definitions: [
{
name: "key"
type: STRING
description: "Settings key to update"
},
{
name: "value"
type: ANY
description: "New settings value"
},
{
name: "file_name"
type: STRING
description: "Desired shared preferences file, equivalent to `Context.getSharedPreferences(file_name)`"
availability: {
supported_platforms: [
{
platform: ANDROID
min_os_version: "8.0"
min_config_version: 50
}
]
}
},
{
name: "suite_name"
type: STRING
description: "Name of the app group or suite to use, equivalent to `UserDefaults(suiteName: suite_name)`"
optional: true
availability: {
supported_platforms: [
{
platform: APPLE
min_os_version: "15.0"
min_config_version: 50
}
]
}
}
]
}];
// Get a value from app settings, using `UserDefaults` on Apple platforms or `SharedPreferences` on
// Android.
//
// Specify a key to fetch. On Android, the `file_name` argument is required and equivalent to
// `Context.getSharedPreferences(file_name)`.
USER_SETTINGS_GET = 6 [(well_known_command_options) = {
key: "user_settings_get"
description: "Reads a value from UserDefaults (Apple platforms) or SharedPreferences (Android)"
availability: {
supported_platforms: [
{
platform: ANDROID
min_os_version: "8.0"
min_config_version: 50
},
{
platform: APPLE
min_os_version: "15.0"
min_config_version: 50
}
]
}
argument_definitions: [
{
name: "key"
type: STRING
description: "Settings key to read"
},
{
name: "file_name"
type: STRING
description: "Desired shared preferences file, equivalent to `Context.getSharedPreferences(file_name)`"
availability: {
supported_platforms: [
{
platform: ANDROID
min_os_version: "8.0"
min_config_version: 49
}
]
}
},
{
name: "suite_name"
type: STRING
description: "Name of the app group or suite to use, equivalent to `UserDefaults(suiteName: suite_name)`"
optional: true
availability: {
supported_platforms: [
{
platform: APPLE
min_os_version: "15.0"
min_config_version: 50
}
]
}
}
]
}];
// Remove all values from app settings, using `UserDefaults` on Apple platforms or
// `SharedPreferences` on Android.
//
// On Android, the `file_name` argument is required and equivalent to
// `Context.getSharedPreferences(file_name)`.
USER_SETTINGS_CLEAR = 7 [(well_known_command_options) = {
key: "user_settings_clear"
description: "Removes all values from UserDefaults (Apple platforms) or SharedPreferences (Android)"
availability: {
supported_platforms: [
{
platform: ANDROID
min_os_version: "8.0"
min_config_version: 49
},
{
platform: APPLE
min_os_version: "15.0"
min_config_version: 49
}
]
}
argument_definitions: [
{
name: "file_name"
type: STRING
description: "Desired shared preferences file, equivalent to `Context.getSharedPreferences(file_name)`"
availability: {
supported_platforms: [
{
platform: ANDROID
min_os_version: "8.0"
min_config_version: 49
}
]
}
},
{
name: "suite_name"
type: STRING
description: "Name of the app group or suite to use, equivalent to `UserDefaults(suiteName: suite_name)`"
optional: true
availability: {
supported_platforms: [
{
platform: APPLE
min_os_version: "15.0"
min_config_version: 50
}
]
}
}
]
}];
// List files within the cache directory
//
// Lists the file names with the cache directory or a directory within the cache if the path
// argument is specified
FILE_LIST = 8 [(well_known_command_options) = {
key: "file_list"
Comment on lines +447 to +448

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file commands are named broadly to support later adding an optional argument to handle other file areas

description: "List file names relative to the cache directory"
availability: {
supported_platforms: [
{
platform: ANDROID
min_os_version: "8.0"
min_config_version: 50
},
{
platform: APPLE
min_os_version: "15.0"
min_config_version: 50
}
]
}
argument_definitions: [
{
name: "path"
type: STRING
description: "Directory path relative to the area or unspecified for the entire area"
optional: true
}
]
}];
// Read the size of a file or directory
//
// Returns the size of the cache directory or a directory within the cache if the path
// argument is specified
FILE_SIZE = 9 [(well_known_command_options) = {
key: "file_size"
description: "Get the size of a file or directory within the cache"
availability: {
supported_platforms: [
{
platform: ANDROID
min_os_version: "8.0"
min_config_version: 50
},
{
platform: APPLE
min_os_version: "15.0"
min_config_version: 50
}
]
}
argument_definitions: [
{
name: "path"
type: STRING
description: "Directory path relative to the area or unspecified for the entire area"
optional: true
}
]
}];
// Delete the contents of the cache directory
FILE_CLEAR = 10 [(well_known_command_options) = {
key: "file_clear"
description: "Delete the contents of the cache"
availability: {
supported_platforms: [
{
platform: ANDROID
min_os_version: "8.0"
min_config_version: 49
},
{
platform: APPLE
min_os_version: "15.0"
min_config_version: 49
}
]
}
}];
// Delete a file or directory within the cache directory
//
// Directories are only removed if the recursive argument is set
FILE_DELETE = 11 [(well_known_command_options) = {
key: "file_delete"
description: "Delete a file or directory within the cache"
availability: {
supported_platforms: [
{
platform: ANDROID
min_os_version: "8.0"
min_config_version: 50
},
{
platform: APPLE
min_os_version: "15.0"
min_config_version: 50
}
]
}
argument_definitions: [
{
name: "path"
type: STRING
description: "Directory path relative to the area"
},
{
name: "recursive"
type: BOOL
description: "Set true to remove a directory and all contents"
optional: true
}
]
}];
// Captures a snapshot of the application's memory.
//
// On Apple platforms the attachment is a `bitdrift_public.protobuf.memory.v1.MemoryDump` with MIME
Expand Down
Loading