Compare commits
No commits in common. "7bfbcc955c7c4b4e3bd210317277c5a2e4c1967b" and "a3414667490ce54295b46f4d3928eb8fcb9b3ac1" have entirely different histories.
7bfbcc955c
...
a341466749
|
@ -4,7 +4,7 @@
|
||||||
mod db;
|
mod db;
|
||||||
|
|
||||||
use grammers_client::types::{Dialog, LoginToken};
|
use grammers_client::types::{Dialog, LoginToken};
|
||||||
use grammers_client::{Client, Config, InitParams};
|
use grammers_client::{Client, Config};
|
||||||
use grammers_session::{PackedChat, Session, UpdateState};
|
use grammers_session::{PackedChat, Session, UpdateState};
|
||||||
use jni::objects::{JObject, JString};
|
use jni::objects::{JObject, JString};
|
||||||
use jni::sys::{jboolean, jint, jlong, jstring};
|
use jni::sys::{jboolean, jint, jlong, jstring};
|
||||||
|
@ -25,22 +25,8 @@ type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>;
|
||||||
|
|
||||||
const LOG_MIN_LEVEL: Level = Level::Trace;
|
const LOG_MIN_LEVEL: Level = Level::Trace;
|
||||||
const LOG_TAG: &str = ".native.talari";
|
const LOG_TAG: &str = ".native.talari";
|
||||||
const API_ID: i32 = {
|
const API_ID: i32 = 0;
|
||||||
let mut index = 0;
|
const API_HASH: &str = "";
|
||||||
let mut value = 0;
|
|
||||||
let api_id = env!("TALARIA_API_ID");
|
|
||||||
let bytes = api_id.as_bytes();
|
|
||||||
while index < bytes.len() {
|
|
||||||
match bytes[index] {
|
|
||||||
b @ b'0'..=b'9' => value = value * 10 + (b - b'0') as i32,
|
|
||||||
_ => panic!("non-digit character found in API ID"),
|
|
||||||
}
|
|
||||||
index += 1
|
|
||||||
}
|
|
||||||
value
|
|
||||||
};
|
|
||||||
const API_HASH: &str = env!("TALARIA_API_HASH");
|
|
||||||
const SERVER_ADDR: &str = env!("TALARIA_SERVER_ADDR");
|
|
||||||
|
|
||||||
static RUNTIME: OnceCell<Runtime> = OnceCell::new();
|
static RUNTIME: OnceCell<Runtime> = OnceCell::new();
|
||||||
static CLIENT: OnceCell<Client> = OnceCell::new();
|
static CLIENT: OnceCell<Client> = OnceCell::new();
|
||||||
|
@ -115,14 +101,7 @@ async fn init_client() -> Result<()> {
|
||||||
session,
|
session,
|
||||||
api_id: API_ID,
|
api_id: API_ID,
|
||||||
api_hash: API_HASH.to_string(),
|
api_hash: API_HASH.to_string(),
|
||||||
params: InitParams {
|
params: Default::default(),
|
||||||
server_addr: if SERVER_ADDR.is_empty() {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some(SERVER_ADDR.parse().unwrap())
|
|
||||||
},
|
|
||||||
..Default::default()
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue