Skip to content

Commit

Permalink
Revert "feat: build new api"
Browse files Browse the repository at this point in the history
This reverts commit 069246e.
  • Loading branch information
adnanjpg committed Jan 22, 2024
1 parent 069246e commit 38c3b28
Show file tree
Hide file tree
Showing 25 changed files with 498 additions and 838 deletions.
1 change: 0 additions & 1 deletion a.sh

This file was deleted.

37 changes: 12 additions & 25 deletions examples/simple_sender.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// cargo run --example simple_sender -- -t <device_token>

use argparse::{ArgumentParser, Store};
use fcm::{fcm_options::FcmOptions, target::Target, Client, Message, Notification};
use serde_json::json;
use fcm::{Client, MessageBuilder, Target};
use serde::Serialize;

#[derive(Serialize)]
struct CustomData {
message: &'static str,
}

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
Expand All @@ -19,28 +22,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
}

let client = Client::new();
let data = CustomData { message: "howdy" };

let mut builder = MessageBuilder::new(Target::Token(device_token));
builder.data(&data)?;

let data = json!({
"key": "value",
});

let builder = Message {
data: Some(data),
notification: Some(Notification {
title: Some("Hello".to_string()),
body: Some(format!("it's {}", chrono::Utc::now())),
image: None,
}),
target: Target::Token(device_token),
android: None,
webpush: None,
apns: None,
fcm_options: Some(FcmOptions {
analytics_label: "analytics_label".to_string(),
}),
};

let response = client.send(builder).await?;
let response = client.send(builder.finalize()).await?;
println!("Sent: {:?}", response);

Ok(())
Expand Down
73 changes: 0 additions & 73 deletions src/android/android_config.rs

This file was deleted.

21 changes: 0 additions & 21 deletions src/android/android_fcm_options.rs

This file was deleted.

10 changes: 0 additions & 10 deletions src/android/android_message_priority.rs

This file was deleted.

234 changes: 0 additions & 234 deletions src/android/android_notification.rs

This file was deleted.

Loading

0 comments on commit 38c3b28

Please sign in to comment.