AppPreferences.java 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. /*
  2. * Nextcloud Android client application
  3. *
  4. * @author Chris Narkiewicz
  5. * Copyright (C) 2019 Chris Narkiewicz, EZ Aquarii
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  19. */
  20. package com.nextcloud.client.preferences;
  21. import com.owncloud.android.datamodel.OCFile;
  22. import com.owncloud.android.utils.FileSortOrder;
  23. public interface AppPreferences {
  24. void setKeysReInitEnabled();
  25. boolean isKeysReInitEnabled();
  26. void setPushToken(String pushToken);
  27. String getPushToken();
  28. boolean instantPictureUploadEnabled();
  29. boolean instantVideoUploadEnabled();
  30. boolean isShowHiddenFilesEnabled();
  31. void setShowHiddenFilesEnabled(boolean enabled);
  32. /**
  33. * Gets the selected file extension position the user selected to do the
  34. * last upload of a url file shared from other app.
  35. *
  36. * @return selectedPos the selected file extension position.
  37. */
  38. int getUploadUrlFileExtensionUrlSelectedPos();
  39. /**
  40. * Saves the selected file extension position the user selected to do the
  41. * last upload of a url file shared from other app.
  42. *
  43. * @param selectedPos the selected file extension position.
  44. */
  45. void setUploadUrlFileExtensionUrlSelectedPos(int selectedPos);
  46. /**
  47. * Gets the selected map file extension position the user selected to
  48. * do the last upload of a url file shared from other app.
  49. *
  50. * @return selectedPos the selected file extension position.
  51. */
  52. int getUploadMapFileExtensionUrlSelectedPos();
  53. /**
  54. * Saves the selected map file extension position the user selected to
  55. * do the last upload of a url file shared from other app.
  56. *
  57. * @param selectedPos the selected file extension position.
  58. */
  59. void setUploadMapFileExtensionUrlSelectedPos(int selectedPos);
  60. /**
  61. * Gets the last local path where the user selected to do an upload from.
  62. *
  63. * @return path Absolute path to a folder, as previously stored by
  64. * {@link #setUploadFromLocalLastPath(String)}, or empty String if never saved before.
  65. */
  66. String getUploadFromLocalLastPath();
  67. /**
  68. * Saves the path where the user selected to do the last local upload of a file from.
  69. *
  70. * @param path Absolute path to a folder.
  71. */
  72. void setUploadFromLocalLastPath(String path);
  73. /**
  74. * Gets the path where the user selected to do the last upload of a file shared from other app.
  75. *
  76. * @return path Absolute path to a folder, as previously stored by {@link #setLastUploadPath(String)},
  77. * or empty String if never saved before.
  78. */
  79. String getLastUploadPath();
  80. /**
  81. * Get preferred folder display type.
  82. *
  83. * @param folder Folder
  84. * @return preference value, default is
  85. * {@link com.owncloud.android.ui.fragment.OCFileListFragment#FOLDER_LAYOUT_LIST}
  86. */
  87. String getFolderLayout(OCFile folder);
  88. /**
  89. * Set preferred folder display type.
  90. *
  91. * @param folder Folder
  92. * @param layout_name preference value
  93. */
  94. void setFolderLayout(OCFile folder, String layout_name);
  95. /**
  96. * Saves the path where the user selected to do the last upload of a file shared from other app.
  97. *
  98. * @param path Absolute path to a folder.
  99. */
  100. void setLastUploadPath(String path);
  101. String getLockPreference();
  102. void setLockPreference(String lockPreference);
  103. /**
  104. * Set pass code composed of 4 digits (as strings).
  105. *
  106. * @todo This must be refactored further to use a passcode stype
  107. * @param d1 1st digit
  108. * @param d2 2nd digit
  109. * @param d3 3rd digit
  110. * @param d4 4th digit
  111. */
  112. void setPassCode(String d1, String d2, String d3, String d4);
  113. /**
  114. * Get 4-digit passcode as array of strings. Strings may be null.
  115. *
  116. * @return 4 strings with digits or nulls
  117. */
  118. String[] getPassCode();
  119. /**
  120. * Gets the unlock via fingerprint preference configured by the user.
  121. *
  122. * @implNote this is always false
  123. * @return useFingerprint is unlock with fingerprint enabled
  124. */
  125. boolean isFingerprintUnlockEnabled();
  126. /**
  127. * Gets the auto upload paths flag last set.
  128. *
  129. * @return ascending order the legacy cleaning flag, default is false
  130. */
  131. boolean isAutoUploadPathsUpdateEnabled();
  132. /**
  133. * Saves the legacy cleaning flag which the user has set last.
  134. *
  135. * @param pathUpdate flag if it is a auto upload path update
  136. */
  137. void setAutoUploadPathsUpdateEnabled(boolean pathUpdate);
  138. /**
  139. * Gets the auto upload split out flag last set.
  140. *
  141. * @return ascending order the legacy cleaning flag, default is false
  142. */
  143. boolean isAutoUploadSplitEntriesEnabled();
  144. /**
  145. * Saves the flag for split entries magic
  146. *
  147. * @param splitOut flag if it is a auto upload path update
  148. */
  149. void setAutoUploadSplitEntriesEnabled(boolean splitOut);
  150. boolean isAutoUploadInitialized();
  151. void setAutoUploadInit(boolean autoUploadInit);
  152. /**
  153. * Get preferred folder sort order.
  154. *
  155. * @return sort order the sort order, default is {@link FileSortOrder#sort_a_to_z} (sort by name)
  156. */
  157. FileSortOrder getSortOrderByFolder(OCFile folder);
  158. /**
  159. * Set preferred folder sort order.
  160. *
  161. * @param sortOrder the sort order
  162. */
  163. void setSortOrder(OCFile folder, FileSortOrder sortOrder);
  164. /**
  165. * Set preferred folder sort order.
  166. *
  167. * @param sortOrder the sort order
  168. */
  169. void setSortOrder(FileSortOrder.Type type, FileSortOrder sortOrder);
  170. /**
  171. * Get preferred folder sort order.
  172. *
  173. * @return sort order the sort order, default is {@link FileSortOrder#sort_a_to_z} (sort by name)
  174. */
  175. FileSortOrder getSortOrderByType(FileSortOrder.Type type, FileSortOrder defaultOrder);
  176. FileSortOrder getSortOrderByType(FileSortOrder.Type type);
  177. boolean isShowDetailedTimestampEnabled();
  178. void setShowDetailedTimestampEnabled(boolean showDetailedTimestamp);
  179. boolean isShowMediaScanNotifications();
  180. void setShowMediaScanNotifications(boolean showMediaScanNotification);
  181. /**
  182. * Gets the uploader behavior which the user has set last.
  183. *
  184. * @return uploader behavior the uploader behavior
  185. */
  186. int getUploaderBehaviour();
  187. /**
  188. * Saves the uploader behavior which the user has set last.
  189. *
  190. * @param uploaderBehaviour the uploader behavior
  191. */
  192. void setUploaderBehaviour(int uploaderBehaviour);
  193. float getGridColumns();
  194. void setGridColumns(float gridColumns);
  195. long getLockTimestamp();
  196. void setLockTimestamp(long timestamp);
  197. /**
  198. * Gets the last seen version code right before updating.
  199. *
  200. * @return grid columns grid columns
  201. */
  202. int getLastSeenVersionCode();
  203. /**
  204. * Saves the version code as the last seen version code.
  205. *
  206. * @param versionCode the app's version code
  207. */
  208. void setLastSeenVersionCode(int versionCode);
  209. void removeLegacyPreferences();
  210. /**
  211. * Clears all user preferences.
  212. *
  213. * @implNote this clears only shared preferences, not preferences kept in account manager
  214. */
  215. void clear();
  216. }