[fractal] Backend: Remove sticker_widget field



commit 0ab93cd856c841b8e2e32596265e5c2a79b9dfc0
Author: Alejandro Domínguez <adomu net-c com>
Date:   Thu Dec 12 02:50:11 2019 +0100

    Backend: Remove sticker_widget field
    
    None of the commands related to stickers management
    are used from the app, and the functions are written
    in a way that makes decoupling the backend really
    difficult. It's best to remove everything altogether
    and rewrite all the functions in a nicer way.

 fractal-matrix-api/src/backend/mod.rs      |  20 --
 fractal-matrix-api/src/backend/stickers.rs | 284 -----------------------------
 fractal-matrix-api/src/backend/types.rs    |   7 -
 fractal-matrix-api/src/meson.build         |   2 -
 fractal-matrix-api/src/model/mod.rs        |   1 -
 fractal-matrix-api/src/model/stickers.rs   |  64 -------
 fractal-matrix-api/src/types.rs            |   2 -
 7 files changed, 380 deletions(-)
---
diff --git a/fractal-matrix-api/src/backend/mod.rs b/fractal-matrix-api/src/backend/mod.rs
index 4450bd79..0905398e 100644
--- a/fractal-matrix-api/src/backend/mod.rs
+++ b/fractal-matrix-api/src/backend/mod.rs
@@ -21,7 +21,6 @@ mod directory;
 mod media;
 pub mod register;
 mod room;
-mod stickers;
 mod sync;
 mod types;
 mod user;
@@ -37,10 +36,6 @@ pub use self::types::RoomType;
 impl Backend {
     pub fn new(tx: Sender<BKResponse>) -> Backend {
         let data = BackendData {
-            // scalar_token: None,
-            // scalar_url: Url::parse("https://scalar.vector.im";)
-            //     .expect("Wrong scalar_url value in BackendData"),
-            sticker_widget: None,
             rooms_since: String::new(),
             join_to_room: String::new(),
             m_direct: HashMap::new(),
@@ -398,21 +393,6 @@ impl Backend {
                 bkerror2!(r, tx, BKResponse::DirectorySearch);
             }
 
-            // Stickers module
-            Ok(BKCommand::ListStickers(access_token, uid, scalar_url, scalar_token)) => {
-                let r = stickers::list(self, access_token, uid, scalar_url, scalar_token);
-                bkerror2!(r, tx, BKResponse::Stickers);
-            }
-            Ok(BKCommand::SendSticker(server, access_token, room, sticker)) => {
-                let r = stickers::send(self, server, access_token, room, sticker);
-                bkerror2!(r, tx, BKResponse::Stickers);
-            }
-            Ok(BKCommand::PurchaseSticker(access_token, uid, group, scalar_url, scalar_token)) => {
-                let r =
-                    stickers::purchase(self, access_token, uid, group, scalar_url, scalar_token);
-                bkerror2!(r, tx, BKResponse::Stickers);
-            }
-
             // Internal commands
             Ok(BKCommand::ShutDown) => {
                 tx.send(BKResponse::ShutDown)
diff --git a/fractal-matrix-api/src/backend/types.rs b/fractal-matrix-api/src/backend/types.rs
index cd3a46ef..7cf4dfee 100644
--- a/fractal-matrix-api/src/backend/types.rs
+++ b/fractal-matrix-api/src/backend/types.rs
@@ -12,8 +12,6 @@ use crate::types::Event;
 use crate::types::Member;
 use crate::types::Message;
 use crate::types::Room;
-use crate::types::Sticker;
-use crate::types::StickerGroup;
 
 use crate::cache::CacheMap;
 use url::Url;
@@ -81,9 +79,6 @@ pub enum BKCommand {
     RejectInv(Url, AccessToken, String),
     UserSearch(Url, AccessToken, String),
     Invite(Url, AccessToken, String, String),
-    ListStickers(AccessToken, String, Url, Option<String>),
-    SendSticker(Url, AccessToken, String, Sticker),
-    PurchaseSticker(AccessToken, String, StickerGroup, Url, Option<String>),
     ChangeLanguage(AccessToken, Url, String, String, String),
 }
 
@@ -135,7 +130,6 @@ pub enum BKResponse {
     AddedToFav(Result<(String, bool), Error>),
     RoomNotifications(String, i32, i32),
     UserSearch(Result<Vec<Member>, Error>),
-    Stickers(Result<Vec<StickerGroup>, Error>),
 
     //errors
     LoginError(Error),
@@ -154,7 +148,6 @@ pub enum RoomType {
 }
 
 pub struct BackendData {
-    pub sticker_widget: Option<String>,
     pub rooms_since: String,
     pub join_to_room: String,
     pub m_direct: HashMap<String, Vec<String>>,
diff --git a/fractal-matrix-api/src/meson.build b/fractal-matrix-api/src/meson.build
index e867baff..9df5e735 100644
--- a/fractal-matrix-api/src/meson.build
+++ b/fractal-matrix-api/src/meson.build
@@ -4,7 +4,6 @@ api_sources = files(
   'backend/mod.rs',
   'backend/register.rs',
   'backend/room.rs',
-  'backend/stickers.rs',
   'backend/sync.rs',
   'backend/types.rs',
   'backend/user.rs',
@@ -18,7 +17,6 @@ api_sources = files(
   'model/message.rs',
   'model/mod.rs',
   'model/room.rs',
-  'model/stickers.rs',
   'r0/account/change_password.rs',
   'r0/account/deactivate.rs',
   'r0/account/login.rs',
diff --git a/fractal-matrix-api/src/model/mod.rs b/fractal-matrix-api/src/model/mod.rs
index 836fd935..0569a8c0 100644
--- a/fractal-matrix-api/src/model/mod.rs
+++ b/fractal-matrix-api/src/model/mod.rs
@@ -3,4 +3,3 @@ pub mod fileinfo;
 pub mod member;
 pub mod message;
 pub mod room;
-pub mod stickers;
diff --git a/fractal-matrix-api/src/types.rs b/fractal-matrix-api/src/types.rs
index 28cc3307..9287a8dc 100644
--- a/fractal-matrix-api/src/types.rs
+++ b/fractal-matrix-api/src/types.rs
@@ -9,5 +9,3 @@ pub use crate::model::room::Room;
 pub use crate::model::room::RoomList;
 pub use crate::model::room::RoomMembership;
 pub use crate::model::room::RoomTag;
-pub use crate::model::stickers::Sticker;
-pub use crate::model::stickers::StickerGroup;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]