Skip to main content

storekit/
message.rs

1use crate::error::StoreKitError;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
4pub enum MessageReason {
5    Generic,
6    PriceIncreaseConsent,
7    BillingIssue,
8    WinBackOffer,
9    Unknown(i64),
10}
11
12#[derive(Debug, Clone, PartialEq, Eq)]
13pub struct Message {
14    pub reason: MessageReason,
15    pub localized_reason: Option<String>,
16}
17
18#[derive(Debug, Clone, Copy, Default)]
19pub struct MessageStream;
20
21impl Message {
22    pub const fn is_supported() -> bool {
23        false
24    }
25
26    pub fn messages() -> Result<MessageStream, StoreKitError> {
27        Err(StoreKitError::NotSupported(
28            "StoreKit.Message is unavailable on macOS".to_owned(),
29        ))
30    }
31}
32
33impl MessageStream {
34    #[allow(clippy::should_implement_trait)]
35    pub fn next(&mut self) -> Result<Option<Message>, StoreKitError> {
36        Err(StoreKitError::NotSupported(
37            "StoreKit.Message is unavailable on macOS".to_owned(),
38        ))
39    }
40}