Simple email application for Android. Original source code: https://framagit.org/dystopia-project/simple-email
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.8 KiB

  1. package eu.faircode.email;
  2. /*
  3. This file is part of Safe email.
  4. Safe email is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. NetGuard is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with NetGuard. If not, see <http://www.gnu.org/licenses/>.
  14. Copyright 2018 by Marcel Bokhorst (M66B)
  15. */
  16. import android.arch.lifecycle.LiveData;
  17. import android.arch.persistence.room.Dao;
  18. import android.arch.persistence.room.Insert;
  19. import android.arch.persistence.room.OnConflictStrategy;
  20. import android.arch.persistence.room.Query;
  21. import android.arch.persistence.room.Update;
  22. import java.util.List;
  23. @Dao
  24. public interface DaoAttachment {
  25. @Query("SELECT id,message,sequence,name,type,size,progress" +
  26. ", (NOT content IS NULL) as content" +
  27. " FROM attachment WHERE message = :message")
  28. LiveData<List<TupleAttachment>> liveAttachments(long message);
  29. @Query("SELECT * FROM attachment WHERE message = :message AND sequence = :sequence")
  30. EntityAttachment getAttachment(long message, int sequence);
  31. @Query("UPDATE attachment SET progress = :progress WHERE id = :id")
  32. void setProgress(long id, int progress);
  33. @Query("SELECT content FROM attachment WHERE id = :id")
  34. byte[] getContent(long id);
  35. @Insert(onConflict = OnConflictStrategy.REPLACE)
  36. long insertAttachment(EntityAttachment attachment);
  37. @Update
  38. void updateAttachment(EntityAttachment attachment);
  39. }