From b022800098a1d0e4a451cb142cee3574f92f8455 Mon Sep 17 00:00:00 2001 From: Maximilien LEDOUX Date: Fri, 11 Mar 2022 17:01:57 +0100 Subject: [PATCH] =?UTF-8?q?Modification=20de=20repository=20pour=20permett?= =?UTF-8?q?re=20l'ajout=20de=20donn=C3=A9es=20et=20la=20sauvegarde=20en=20?= =?UTF-8?q?un=20seul=20appel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lightcontainer/storage/Repository.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/app/src/main/java/lightcontainer/storage/Repository.java b/app/src/main/java/lightcontainer/storage/Repository.java index 324b125..6f2d6f2 100644 --- a/app/src/main/java/lightcontainer/storage/Repository.java +++ b/app/src/main/java/lightcontainer/storage/Repository.java @@ -39,6 +39,38 @@ public class Repository { } } + public boolean addUser(String login, String password, String key) { + if (appData.addUser(login, password, key)) { + save(); + return true; + } + return false; + } + + public boolean addFileFor(File file, String userName) { + if (appData.addFileFor(file, userName)) { + save(); + return true; + } + return false; + } + + public boolean deleteFileOf(String fileName, String userName) { + if (appData.deleteFileOf(fileName, userName)) { + save(); + return true; + } + return false; + } + + public boolean addStorage(String userName, File file, String storage) { + if (appData.addStorage(userName, file, storage)) { + save(); + return true; + } + return false; + } + /** * Loads configuration file