Skip to content

Commit

Permalink
rename manifest entry to request_integration
Browse files Browse the repository at this point in the history
  • Loading branch information
r10s committed Jun 20, 2024
1 parent 185d8b5 commit 4ee66b4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion deltachat-jsonrpc/src/api/types/webxdc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl WebxdcMessageInfo {
document,
summary,
source_code_url,
integration: _,
request_integration: _,
internet_access,
} = message.get_webxdc_info(context).await?;

Expand Down
14 changes: 7 additions & 7 deletions src/webxdc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ pub struct WebxdcManifest {
/// Optional URL of webxdc source code.
pub source_code_url: Option<String>,

/// Set to "maps" if the webxdc is an integration.
pub integration: Option<String>,
/// Set to "map" to request integration.
pub request_integration: Option<String>,

/// If the webxdc requests network access.
pub request_internet_access: Option<bool>,
Expand Down Expand Up @@ -95,8 +95,8 @@ pub struct WebxdcInfo {
/// URL of webxdc source code or an empty string.
pub source_code_url: String,

/// Set to "maps" if the webxdc is an integration, otherwise an empty string.
pub integration: String,
/// Set to "map" to request integration, otherwise an empty string.
pub request_integration: String,

/// If the webxdc is allowed to access the network.
/// It should request access, be encrypted
Expand Down Expand Up @@ -824,7 +824,7 @@ impl Message {
}
}

let request_integration = manifest.integration.unwrap_or_default();
let request_integration = manifest.request_integration.unwrap_or_default();
let is_integrated = self.is_set_as_webxdc_integration(context).await?;

let internet_access = manifest.request_internet_access.unwrap_or_default()
Expand All @@ -851,7 +851,7 @@ impl Message {
.to_string(),
summary: if is_integrated {
"🌍 Used as map. Delete to use default. Do not enter sensitive data".to_string()
} else if request_integration == "maps" {
} else if request_integration == "map" {
"🌏 To use as map, forward to \"Saved Messages\" again. Do not enter sensitive data"
.to_string()
} else if internet_access {
Expand All @@ -867,7 +867,7 @@ impl Message {
} else {
"".to_string()
},
integration: request_integration,
request_integration,
internet_access,
})
}
Expand Down
4 changes: 2 additions & 2 deletions src/webxdc/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl Context {
true
} else if msg.chat_id.is_self_talk(context).await? {
let info = msg.get_webxdc_info(context).await?;
if info.integration == "maps" {
if info.request_integration == "map" {
msg.param.set_int(Param::WebxdcIntegration, 1);
msg.update_param(context).await?;
true
Expand Down Expand Up @@ -195,7 +195,7 @@ mod tests {
t.send_msg(self_chat.id, &mut msg).await;
assert_integration(&t, "with some icon").await?; // still the default integration

// send a maps.xdc with manifest including the line `integration = "maps"`
// send a maps.xdc with manifest including the line `request_integration = "map"`
let mut msg = Message::new(Viewtype::Webxdc);
msg.set_file_from_bytes(
&t,
Expand Down
Binary file modified test-data/webxdc/mapstest-integration-set.xdc
Binary file not shown.

0 comments on commit 4ee66b4

Please sign in to comment.