-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
45 changed files
with
431 additions
and
410 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,12 +3,13 @@ | |
// Copyright: 2023, Marc Bauer <[email protected]> | ||
// License: Mozilla Public License v2.0 (MPL v2.0) | ||
|
||
use crate::client::WasmError; | ||
use anyhow::anyhow; | ||
use core::str::FromStr; | ||
use js_sys::Array; | ||
use wasm_bindgen::prelude::*; | ||
|
||
use prose_core_client::dtos::UserId; | ||
|
||
use crate::client::WasmError; | ||
use crate::types::Message; | ||
|
||
#[wasm_bindgen] | ||
|
@@ -97,15 +98,15 @@ impl TryFrom<&StringArray> for Vec<String> { | |
} | ||
} | ||
|
||
pub fn try_jid_vec_from_string_array(arr: Array) -> Result<Vec<jid::BareJid>, WasmError> { | ||
pub fn try_user_id_vec_from_string_array(arr: Array) -> Result<Vec<UserId>, WasmError> { | ||
arr.into_iter() | ||
.map(|value| { | ||
value | ||
.as_string() | ||
.ok_or(anyhow::format_err!( | ||
"Could not read String from supposed String Array" | ||
)) | ||
.and_then(|str| jid::BareJid::from_str(&str).map_err(Into::into)) | ||
.and_then(|str| str.parse::<UserId>().map_err(Into::into)) | ||
}) | ||
.collect::<Result<Vec<_>, _>>() | ||
.map_err(WasmError::from) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.