• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rj76 / fcm-rust / 7614069314

22 Jan 2024 04:12PM UTC coverage: 5.2%. Remained the same
7614069314

Pull #4

github

web-flow
Merge 59c8a7a94 into a8babd228
Pull Request #4: feat: build new api

561 of 35893 branches covered (0.0%)

Branch coverage included in aggregate %.

116 of 239 new or added lines in 22 files covered. (48.54%)

1163 existing lines in 58 files now uncovered.

15495 of 272851 relevant lines covered (5.68%)

170.56 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/android/android_config.rs
1
use serde::Serialize;
2
use serde_json::Value;
3

4
use super::{
5
    android_fcm_options::{AndroidFcmOptions, AndroidFcmOptionsInternal},
6
    android_message_priority::AndroidMessagePriority,
7
    android_notification::{AndroidNotification, AndroidNotificationInternal},
8
};
9

NEW
10
#[derive(Serialize, Debug)]
×
11
//https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages?authuser=0#androidconfig
12
pub(crate) struct AndroidConfigInternal {
13
    // An identifier of a group of messages that can be collapsed, so that only the last message gets
14
    // sent when delivery can be resumed.
15
    #[serde(skip_serializing_if = "Option::is_none")]
16
    collapse_key: Option<String>,
17

18
    // Message priority.
19
    #[serde(skip_serializing_if = "Option::is_none")]
20
    priority: Option<AndroidMessagePriority>,
21

22
    // How long (in seconds) the message should be kept in FCM storage if the device is offline.
23
    // Duration format: https://developers.google.com/protocol-buffers/docs/reference/google.protobuf?authuser=0#google.protobuf.Duration
24
    #[serde(skip_serializing_if = "Option::is_none")]
25
    ttl: Option<String>,
26

27
    // Package name of the application where the registration token must match in order to receive the message.
28
    #[serde(skip_serializing_if = "Option::is_none")]
29
    restricted_package_name: Option<String>,
30

31
    // Arbitrary key/value payload.
32
    #[serde(skip_serializing_if = "Option::is_none")]
33
    data: Option<Value>,
34

35
    // Notification to send to android devices.
36
    #[serde(skip_serializing_if = "Option::is_none")]
37
    notification: Option<AndroidNotificationInternal>,
38

39
    // Options for features provided by the FCM SDK for Android.
40
    #[serde(skip_serializing_if = "Option::is_none")]
41
    fcm_options: Option<AndroidFcmOptionsInternal>,
42

43
    // If set to true, messages will be allowed to be delivered to the app while the device is in direct boot mode.
44
    #[serde(skip_serializing_if = "Option::is_none")]
45
    direct_boot_ok: Option<bool>,
46
}
47

NEW
48
#[derive(Debug, Default)]
×
49
pub struct AndroidConfig {
NEW
50
    pub collapse_key: Option<String>,
×
NEW
51
    pub priority: Option<AndroidMessagePriority>,
×
NEW
52
    pub ttl: Option<String>,
×
NEW
53
    pub restricted_package_name: Option<String>,
×
NEW
54
    pub data: Option<Value>,
×
NEW
55
    pub notification: Option<AndroidNotification>,
×
NEW
56
    pub fcm_options: Option<AndroidFcmOptions>,
×
NEW
57
    pub direct_boot_ok: Option<bool>,
×
58
}
59

60
impl AndroidConfig {
61
    pub(crate) fn finalize(self) -> AndroidConfigInternal {
62
        AndroidConfigInternal {
63
            collapse_key: self.collapse_key,
64
            priority: self.priority,
65
            ttl: self.ttl,
66
            restricted_package_name: self.restricted_package_name,
67
            data: self.data,
68
            notification: self.notification.map(|n| n.finalize()),
69
            fcm_options: self.fcm_options.map(|f| f.finalize()),
70
            direct_boot_ok: self.direct_boot_ok,
71
        }
72
    }
73
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc