Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
207f894
[tx-robot] updated from transifex
nextcloud-bot Nov 4, 2019
b0563b9
Theming: Fix date picker button text colour
dan0xii Nov 4, 2019
a3ae321
Bump gradle from 3.5.1 to 3.5.2
dependabot-preview[bot] Nov 5, 2019
7a8aee3
[tx-robot] updated from transifex
nextcloud-bot Nov 5, 2019
6b01382
Replace BaseActivity.sharedPreferences with app preferences
ezaquarii Nov 4, 2019
25aaf4b
Applied ability to set as wallpaper from properties of a picture
Nov 5, 2019
d208681
Merge pull request #4796 from nextcloud/datepicker
tobiasKaminsky Nov 5, 2019
9e15f5e
Merge pull request #4799 from nextcloud/dependabot/gradle/com.android…
AndyScherzinger Nov 5, 2019
7f4db3f
Make synced folder init/enable date persistent
ashpieboop Nov 2, 2019
c2ea4de
FileContentProvider: add dagger injection
ashpieboop Nov 6, 2019
2e13212
SyncedFolderProvider: pass Clock dependency via constructor instead o…
ashpieboop Nov 6, 2019
b59938d
daily dev 20191106
tobiasKaminsky Nov 6, 2019
039adc0
[tx-robot] updated from transifex
nextcloud-bot Nov 6, 2019
180bdee
Merge pull request #4801 from Infomaniak/feature/resolve-set-as-wallp…
tobiasKaminsky Nov 6, 2019
890789f
Merge pull request #4797 from nextcloud/ezaquarii/replace-shared-pref…
tobiasKaminsky Nov 6, 2019
142c79b
daily dev 20191107
tobiasKaminsky Nov 7, 2019
403fc87
[tx-robot] updated from transifex
nextcloud-bot Nov 7, 2019
ff646aa
daily dev 20191108
tobiasKaminsky Nov 8, 2019
4690042
[tx-robot] updated from transifex
nextcloud-bot Nov 10, 2019
86027dd
Bump annotations from 17.0.0 to 18.0.0
dependabot-preview[bot] Nov 11, 2019
4343c3d
Merge pull request #4814 from nextcloud/dependabot/gradle/org.jetbrai…
tobiasKaminsky Nov 11, 2019
df6d847
[tx-robot] updated from transifex
nextcloud-bot Nov 12, 2019
fb615ef
Remove out-of-band setAccount/onAccountSet calls
ezaquarii Oct 21, 2019
d30b574
Add changelog for 3.9.0
tobiasKaminsky Nov 12, 2019
f245b72
Merge pull request #4823 from nextcloud/changelog-master-stable-3.9.0
AndyScherzinger Nov 12, 2019
e43ef8e
daily dev 20191113
tobiasKaminsky Nov 13, 2019
f38900d
[tx-robot] updated from transifex
nextcloud-bot Nov 13, 2019
ed8b9cb
Merge pull request #4713 from nextcloud/ezaquarii/remove-set-account-…
tobiasKaminsky Nov 13, 2019
693f408
Improve menu file name pattern
AndyScherzinger Nov 3, 2019
75de7b8
daily dev 20191114
tobiasKaminsky Nov 14, 2019
3943e1c
[tx-robot] updated from transifex
nextcloud-bot Nov 14, 2019
20c9ce3
Bump kotlin_version from 1.3.50 to 1.3.60
dependabot-preview[bot] Nov 15, 2019
bd503a8
[tx-robot] updated from transifex
nextcloud-bot Nov 15, 2019
5273e1e
Merge pull request #4832 from nextcloud/dependabot/gradle/kotlin_vers…
AndyScherzinger Nov 15, 2019
65da616
FilesSyncHelper: use our own logging framework
ashpieboop Nov 15, 2019
c82c080
daily dev 20191116
tobiasKaminsky Nov 16, 2019
bfdaba8
[tx-robot] updated from transifex
nextcloud-bot Nov 16, 2019
9ae5507
[tx-robot] updated from transifex
nextcloud-bot Nov 17, 2019
b6d6826
Bump markwonVersion from 4.1.2 to 4.2.0
dependabot-preview[bot] Nov 18, 2019
b59d96a
[tx-robot] updated from transifex
nextcloud-bot Nov 18, 2019
b561f68
allow to switch off old login method
tobiasKaminsky Nov 18, 2019
77b6b17
Merge pull request #4841 from nextcloud/disableOldLoginMethod
tobiasKaminsky Nov 18, 2019
dbe12e6
Merge pull request #4789 from nextcloud/name_pattern_menus
tobiasKaminsky Nov 18, 2019
a00677c
daily dev 20191119
tobiasKaminsky Nov 19, 2019
f1a0ac5
[tx-robot] updated from transifex
nextcloud-bot Nov 19, 2019
2110937
Merge pull request #4839 from nextcloud/dependabot/gradle/markwonVers…
tobiasKaminsky Nov 19, 2019
94502f6
Merge pull request #4787 from ArisuOngaku/auto-upload-start-date-pers…
tobiasKaminsky Nov 19, 2019
8879179
Drone: update FindBugs results to reflect reduced error/warning count…
nextcloud-android-bot Nov 19, 2019
0223085
shorten text a bit
tobiasKaminsky Nov 19, 2019
21ef006
Merge pull request #4858 from nextcloud/changeScreenshot
AndyScherzinger Nov 19, 2019
26c5c5e
Use png for checker image to use it via bitmap
Unpublished Nov 18, 2019
0977c9d
daily dev 20191120
tobiasKaminsky Nov 20, 2019
b9ff6ce
Merge pull request #4843 from Unpublished/fix4842
tobiasKaminsky Nov 20, 2019
16c220e
Bump exifinterface from 1.0.0 to 1.1.0
dependabot-preview[bot] Nov 21, 2019
6e5d7a8
daily dev 20191121
tobiasKaminsky Nov 21, 2019
44220d7
Merge pull request #4867 from nextcloud/dependabot/gradle/androidx.ex…
tobiasKaminsky Nov 21, 2019
609b996
New user model
ezaquarii Nov 16, 2019
c8eba1d
Merge pull request #4835 from nextcloud/ezaquarii/new-user-model
tobiasKaminsky Nov 22, 2019
6249a06
daily dev 20191123
tobiasKaminsky Nov 23, 2019
0691786
Bump flexbox from 1.1.1 to 2.0.0
dependabot-preview[bot] Nov 25, 2019
4f26261
Bump detekt-gradle-plugin from 1.1.1 to 1.2.0
dependabot-preview[bot] Nov 25, 2019
a7eb714
Migrate simple cases of getCurrentAccount() to getUser()
ezaquarii Nov 18, 2019
b91136c
Disable android backup on the QA app
ashpieboop Nov 25, 2019
80fb800
Merge commit 'a7eb7148fa0ceb42981366eb2ddcf0ff921e6a55'
Nov 25, 2019
11687c6
Drone: update FindBugs results to reflect reduced error/warning count…
nextcloud-android-bot Nov 25, 2019
b7876c4
disable GoogleAppIndexingWarning lint check
tobiasKaminsky Nov 25, 2019
9f24b25
[tx-robot] updated from transifex
nextcloud-bot Nov 25, 2019
10960bf
[tx-robot] updated from transifex
nextcloud-bot Nov 26, 2019
99d9a69
Merge pull request #4885 from nextcloud/disable_android_backup_qa
AndyScherzinger Nov 26, 2019
e92daa2
Merge pull request #4853 from nextcloud/migrate-simple-cases-of-get-c…
tobiasKaminsky Nov 26, 2019
21c0de3
daily dev 20191127
tobiasKaminsky Nov 27, 2019
83e0ebc
[tx-robot] updated from transifex
nextcloud-bot Nov 27, 2019
48038d5
Merge pull request #4883 from nextcloud/dependabot/gradle/io.gitlab.a…
tobiasKaminsky Nov 27, 2019
f34ba2c
Bump kotlin_version from 1.3.60 to 1.3.61
dependabot-preview[bot] Nov 27, 2019
540c649
Merge pull request #4894 from nextcloud/dependabot/gradle/kotlin_vers…
AndyScherzinger Nov 27, 2019
23e4424
show/hide auto upload list items
AndyScherzinger Nov 1, 2019
ca6918f
show/hide improvements when list is completed hidden + nicer empty UI…
AndyScherzinger Nov 2, 2019
bedc2b4
housekeeping, removing unused resources
AndyScherzinger Nov 2, 2019
7c62ad6
unify use of boolean, make use of lombok getter/setters, remove unnee…
AndyScherzinger Nov 2, 2019
4e0b405
Drone: update FindBugs results to reflect reduced error/warning count…
nextcloud-android-bot Nov 2, 2019
3e872df
add more spotbug exclusions (for 3rd party libs)
AndyScherzinger Nov 2, 2019
74bfe47
remove action button, use checkable menu item for shown/hidden state …
AndyScherzinger Nov 5, 2019
d17c853
re-add button/action and improve upon code review
AndyScherzinger Nov 27, 2019
1f4e857
Drone: update FindBugs results to reflect reduced error/warning count…
nextcloud-android-bot Nov 27, 2019
aa43181
Merge pull request #4882 from nextcloud/dependabot/gradle/com.google.…
AndyScherzinger Nov 27, 2019
5257fb2
[tx-robot] updated from transifex
nextcloud-bot Nov 28, 2019
2c57e37
Merge pull request #4784 from nextcloud/hideAutoUploadEntries
tobiasKaminsky Nov 28, 2019
d262206
ADD: [instantupload] setting to also upload existing files
koying Aug 10, 2018
03d8246
Make newly created synced folders auto upload existing files by default
ashpieboop Nov 20, 2019
ea801eb
Make file uploads ask the user what to do when the file already exist…
ashpieboop Nov 25, 2019
01fe0ac
Drone: update FindBugs results to reflect reduced error/warning count…
nextcloud-android-bot Nov 28, 2019
2cdc3b1
FileUploader: require explicit NameCollisionPolicy
ashpieboop Dec 2, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
3.9.0 (November, 12, 2019)

- preview Markdown with syntax highlighting @AndyScherzinger
- improved DavX5 integration @bitfireAT
- AutoUpload: allow files to upload into subfolder
- new media player service @ezaquarii
- Remote wipe integration
- Print from within Collabora
- enhanced SingleSignOn
- outdated server warning set to NC14

For a full list, please see https://github.com/nextcloud/android/milestone/38

## 3.8.1 (October, 11, 2019)

- upload images into subfolder, if source folder also has subfolder
Expand Down
20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
1. Backport pull request
1. Pull requests that also need changes on library
1. Adding new files
1. File naming
1. Menu files
1. Translations
1. Releases
1. Types
Expand Down Expand Up @@ -236,6 +238,24 @@ Source code of app:
-->
```

## File naming

The file naming patterns are inspired and based on [Ribot's Android Project And Code Guidelines](https://github.com/ribot/android-guidelines/blob/c1d8c9c904eb31bf01fe24aadb963b74281fe79a/project_and_code_guidelines.md).

### Menu files

Similar to layout files, menu files should match the name of the component. For example, if we are defining a menu file that is going to be used in the `UserProfileActivity`, then the name of the file should be `activity_user_profile.xml`. Same pattern applies for menus used in adapter view items, dialogs, etc.

| Component | Class Name | Menu Name |
| ---------------- | ---------------------- | ----------------------------- |
| Activity | `UserProfileActivity` | `activity_user_profile.xml` |
| Fragment | `SignUpFragment` | `fragment_sign_up.xml` |
| Dialog | `ChangePasswordDialog` | `dialog_change_password.xml` |
| AdapterView item | --- | `item_person.xml` |
| Partial layout | --- | `partial_stats_bar.xml` |

A good practice is to not include the word `menu` as part of the name because these files are already located in the `menu` directory. In case a component uses several menus in different places (via popup menus) then the resource name would be extended. For example, if the user profile activity has two popup menus for configuring the users settings and one for the handling group assignments then the file names for the menus would be: `activity_user_profile_user_settings.xml` and `activity_user_profile_group_assignments.xml`.

## Translations
We manage translations via [Transifex](https://www.transifex.com/nextcloud/nextcloud/android/). So just request joining the translation team for Android on the site and start translating. All translations will then be automatically pushed to this repository, there is no need for any pull request for translations.

Expand Down
25 changes: 15 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.github.spotbugs.SpotBugsTask

buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()
Expand All @@ -20,13 +20,13 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.android.tools.build:gradle:3.5.2'
classpath('com.dicedmelon.gradle:jacoco-android:0.1.4') {
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
}
classpath 'gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:1.6.6'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.1.1"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.2.0"
}
}

Expand Down Expand Up @@ -58,7 +58,7 @@ configurations {
ext {
jacocoVersion = "0.8.2"
daggerVersion = "2.25.2"
markwonVersion = "4.1.2"
markwonVersion = "4.2.0"
prismVersion = "2.0.0"
androidLibraryVersion = "master-SNAPSHOT"

Expand Down Expand Up @@ -105,7 +105,12 @@ android {
abortOnError false
htmlReport true
htmlOutput file("$project.buildDir/reports/lint/lint.html")
disable 'MissingTranslation', 'GradleDependency', 'VectorPath', 'IconMissingDensityFolder', 'IconDensities'
disable 'MissingTranslation',
'GradleDependency',
'VectorPath',
'IconMissingDensityFolder',
'IconDensities',
'GoogleAppIndexingWarning'
}

dexOptions {
Expand Down Expand Up @@ -162,8 +167,8 @@ android {
versionDev {
applicationId "com.nextcloud.android.beta"
dimension "default"
versionCode 20191102
versionName "20191102"
versionCode 20191127
versionName "20191127"
}

qa {
Expand Down Expand Up @@ -273,7 +278,7 @@ dependencies {
implementation 'com.jakewharton:disklrucache:2.0.2'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.1.0'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0"
implementation "androidx.work:work-runtime:2.2.0"
implementation "androidx.work:work-runtime-ktx:2.2.0"
Expand All @@ -292,7 +297,7 @@ dependencies {
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
implementation 'com.github.tobiaskaminsky:qrcodescanner:0.1.2.2' // 'com.github.blikoon:QRCodeScanner:0.1.2'
implementation 'com.google.android:flexbox:1.1.1'
implementation 'com.google.android:flexbox:2.0.0'
implementation 'org.parceler:parceler-api:1.1.12'
kapt 'org.parceler:parceler:1.1.12'
implementation('com.github.bumptech.glide:glide:3.8.0') {
Expand All @@ -301,7 +306,7 @@ dependencies {
implementation 'com.caverock:androidsvg:1.4'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'org.jetbrains:annotations:17.0.0'
implementation 'org.jetbrains:annotations:18.0.0'

implementation 'com.github.cotechde.hwsecurity:hwsecurity-fido:2.5.1'

Expand Down
2 changes: 1 addition & 1 deletion scripts/analysis/findbugs-results.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
423
406
9 changes: 7 additions & 2 deletions spotbugs-filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
<Match>
<Or>
<Class name="~.*\.Dagger.*" />
<Class name="~com.nextcloud.client.di\..*_.*" />
<Class name="~com\.nextcloud\.client\.di\..*_.*" />
<Class name="~dagger\.android\..*" />
</Or>
</Match>
<!-- Dagger generated code uses internal APIs -->
Expand All @@ -30,7 +31,7 @@
<Match>
<Or>
<Class name="~.*BindingImpl"/>
<Class name="~.*\.DataBinderMapperImpl"/>
<Class name="~.*\.DataBinderMapperImpl"/>
</Or>
</Match>

Expand All @@ -39,6 +40,10 @@
<Or>
<Package name="~io\.noties\..*" />
<Package name="~third_parties\.ezvcard_android\..*" />
<Package name="~com\.afollestad\.sectionedrecyclerview\..*" />
<Package name="~butterknife\..*" />
<Package name="~de\.cotech\..*" />
<Package name="~pl\.droidsonroids\..*" />
</Or>
</Match>
<Match>
Expand Down
24 changes: 12 additions & 12 deletions src/androidTest/java/com/owncloud/android/UploadIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public RemoteOperationResult testUpload(OCUpload ocUpload) {
account,
null,
ocUpload,
false,
FileUploader.NameCollisionPolicy.DEFAULT,
FileUploader.LOCAL_BEHAVIOUR_COPY,
targetContext,
false,
Expand All @@ -140,17 +140,17 @@ public void testUploadInNonExistingFolder() {
OCUpload ocUpload = new OCUpload(FileStorageUtils.getSavePath(account.name) + "/empty.txt",
"/testUpload/2/3/4/1.txt", account.name);
UploadFileOperation newUpload = new UploadFileOperation(
storageManager,
connectivityServiceMock,
powerManagementServiceMock,
account,
null,
ocUpload,
false,
FileUploader.LOCAL_BEHAVIOUR_COPY,
targetContext,
false,
false
storageManager,
connectivityServiceMock,
powerManagementServiceMock,
account,
null,
ocUpload,
FileUploader.NameCollisionPolicy.DEFAULT,
FileUploader.LOCAL_BEHAVIOUR_COPY,
targetContext,
false,
false
);
newUpload.addRenameUploadListener(() -> {
// dummy
Expand Down
30 changes: 14 additions & 16 deletions src/generic/fastlane/metadata/android/cs-CZ/full_description.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
Svobodně licencovaná Nexcloud Android aplikace, dávající vám mobilní svobodu.

Software, který můžete nasadit na vlastní server a ten organizuje ukládání a synchronizaci souborů. Díky doplňkům jde o kompletní groupwarové řešení.
Funkce:
* Snadno použitelné moderní rozhraní, přizpůsobené vzhledu, používaném na vašem serveru
* Nahrávejte soubory na svůj Nextcloud server
* Sdílejte je s ostatními
* Udržujte své oblíbené soubory a složky synchronizované
* Hledejte napříč všemi složkami na svém serveru
* Automaticky nahrávejte své fotky a videa, pořízená zařízením
* Udržujte si přehled pomocí oznámení
* Podporuje vícero účtů
* Zabezpečený přístup k vašim datům pomocí otisku prstu nebo PIN kódu
* Napojení na DAVx5 (dříve známé pod názvem DAVdroid) pro snadné nastavení synchronizace kalendáře a kontaktů

Veškeré nalezené problémy hlaste na https://github.com/nextcloud/android/issues a diskutujte o aplikaci na https://help.nextcloud.com/c/clients/android
* Soubory nahrané do nexcloudu lze snadno sdílet s ostatními.
* Přístup odkudkoli přes webové a mobilní rozhraní.
* Synchronizace s počítačem umožňující offline práci.
* Vaše data jsou na vašem serveru a máte nad nimi plnou kontrolu.
* Jde o svobodný software, který snadno můžete sami hostovat a volně si ho přizplsobit. V případě potřeby je ale k dispozici komerční podpora.
* Vyhledávání napříč soubory.
* Synchronizace kontaktů a zpráv.
* Sdílení kalendářů do mobilu (DAVx5/DAVdroid)
* Neomezený počet uživatelů, autoupload fotek přímo z mobilu, oznámení,
* Klienti pro WIndows, MacOS, iOS, Android, web.
* Mnoho dalších doplňků s dalšími funkcemi.

Noví v Nextcloud? Nextcloud je soukromý server pro synchronizaci souborů a jejich sdílení, dále pro komunikaci. Jedná se o svobodný software a můžete ho hostovat svými silami nebo za to zaplatit nějaké společnosti. Tím máte pod kontrolou své fotky, kalendář a kontakty, dokumenty a vše ostatní.
Díky Nextcloudu budete mít kompletní privátní řešení pro všechy vaše soubory, fotky, kalendáře a kontakty.

Podívejte se na Nextcloud na https://nextcloud.com
Připomínky zasílejte na https://github.com/nextcloud/android/issues, diskutovat lze na https://help.nextcloud.com/c/clients a vše ostatní najdete na https://nextcloud.com 
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Produktivní platforma hostovaná u vás, kde vaše data jsou opravdu vaše
Platforma pro produktivitu hostovaná u vás, kde vaše data jsou opravdu vaše
58 changes: 58 additions & 0 deletions src/main/java/com/nextcloud/client/account/AnonymousUser.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz <hello@ezaquarii.com>
* Copyright (C) 2019 Chris Narkiewicz
* Copyright (C) 2019 Nextcloud GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.account

import android.accounts.Account
import android.content.Context
import android.net.Uri
import com.owncloud.android.MainApp
import com.owncloud.android.R
import com.owncloud.android.lib.common.OwnCloudAccount
import com.owncloud.android.lib.common.OwnCloudBasicCredentials
import java.net.URI

/**
* This object represents anonymous user, ie. user that did not log in the Nextcloud server.
* It serves as a semantically correct "empty value", allowing simplification of logic
* in various components requiring user data, such as DB queries.
*/
internal class AnonymousUser(private val accountType: String) : User {

companion object {
@JvmStatic
fun fromContext(context: Context): AnonymousUser {
val type = context.getString(R.string.account_type)
return AnonymousUser(type)
}
}

override val accountName: String = "anonymous"
override val server = Server(URI.create(""), MainApp.MINIMUM_SUPPORTED_SERVER_VERSION)
override val isAnonymous = true

override fun toPlatformAccount(): Account {
return Account(accountName, accountType)
}

override fun toOwnCloudAccount(): OwnCloudAccount {
return OwnCloudAccount(Uri.EMPTY, OwnCloudBasicCredentials("", ""))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,31 @@

import android.accounts.Account;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
* This interface provides access to currently selected user Account.
* This interface provides access to currently selected user.
*
* @see UserAccountManager
*/
@FunctionalInterface
public interface CurrentAccountProvider {
/**
* Get currently active account.
* Get currently active account.
*
* @return Currently selected {@link Account} or first valid {@link Account} registered in OS or null, if not available at all.
*/
@Deprecated
@Nullable
Account getCurrentAccount();

/**
* Get currently active user profile. If there is no actice user, anonymous user is returned.
*
* @return User profile. Profile is never null.
*/
@NonNull
default User getUser() {
return new AnonymousUser("dummy");
}
}
47 changes: 47 additions & 0 deletions src/main/java/com/nextcloud/client/account/RegisteredUser.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Nextcloud Android client application
*
* @author Chris Narkiewicz <hello@ezaquarii.com>
* Copyright (C) 2019 Chris Narkiewicz
* Copyright (C) 2019 Nextcloud GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.nextcloud.client.account

import android.accounts.Account
import com.owncloud.android.lib.common.OwnCloudAccount

/**
* This class represents normal user logged into the Nextcloud server.
*/
internal class RegisteredUser(
private val account: Account,
private val ownCloudAccount: OwnCloudAccount,
override val server: Server
) : User {
override val isAnonymous = false

override val accountName: String get() {
return account.name
}

override fun toPlatformAccount(): Account {
return account
}

override fun toOwnCloudAccount(): OwnCloudAccount {
return ownCloudAccount
}
}
Loading