mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 02:17:41 +00:00 
			
		
		
		
	add changes according to review
This commit is contained in:
		
							parent
							
								
									db478efedc
								
							
						
					
					
						commit
						76c55c9a9c
					
				| @ -16,12 +16,6 @@ dependencies { | ||||
|     kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshiVersion" | ||||
| 
 | ||||
|     testImplementation 'junit:junit:4.13' | ||||
|     testImplementation 'org.robolectric:robolectric:4.3' | ||||
|     androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' | ||||
|     androidTestImplementation 'androidx.test:runner:1.3.0' | ||||
|     androidTestImplementation 'androidx.test:core:1.3.0' | ||||
|     androidTestImplementation 'androidx.test.ext:junit:1.1.2' | ||||
|     androidTestImplementation 'androidx.test:rules:1.3.0' | ||||
| } | ||||
| 
 | ||||
| android { | ||||
| @ -48,10 +42,4 @@ android { | ||||
|         sourceCompatibility JavaVersion.VERSION_1_8 | ||||
|         targetCompatibility JavaVersion.VERSION_1_8 | ||||
|     } | ||||
| 
 | ||||
|     testOptions { | ||||
|         unitTests { | ||||
|             includeAndroidResources = true | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -121,18 +121,6 @@ class GetRemoteShareesOperation | ||||
|         return RemoteOperationResult(method) | ||||
|     } | ||||
| 
 | ||||
|     private fun flattenResultData(jsonResults: Array<JSONArray>):ArrayList<JSONObject> { | ||||
|         val data = ArrayList<JSONObject>() // For result data | ||||
|         for (i in 0..jsonResults.size) { | ||||
|             for (j in 0 until jsonResults[i].length()) { | ||||
|                 val jsonResult = jsonResults[i].getJSONObject(j) | ||||
|                 data.add(jsonResult) | ||||
|                 Timber.d("*** Added item: ${jsonResult.getString(PROPERTY_LABEL)}") | ||||
|             } | ||||
|         } | ||||
|         return data | ||||
|     } | ||||
| 
 | ||||
|     private fun onRequestSuccessful(response: String?): RemoteOperationResult<ShareeOcsResponse> { | ||||
|         val result = RemoteOperationResult<ShareeOcsResponse>(OK) | ||||
|         Timber.d("Successful response: $response") | ||||
|  | ||||
| @ -32,13 +32,9 @@ import com.squareup.moshi.JsonClass | ||||
|  */ | ||||
| @JsonClass(generateAdapter = true) | ||||
| data class ShareeOcsResponse( | ||||
|     @Json(name = "exact") | ||||
|     val exact: ExactSharees?, | ||||
|     @Json(name = "groups") | ||||
|     val groups: List<ShareeItem>, | ||||
|     @Json(name = "remotes") | ||||
|     val remotes: List<ShareeItem>, | ||||
|     @Json(name = "users") | ||||
|     val users: List<ShareeItem> | ||||
| ) { | ||||
|     fun getFlatRepresentationWithoutExact() = ArrayList<ShareeItem>().apply { | ||||
| @ -50,11 +46,8 @@ data class ShareeOcsResponse( | ||||
| 
 | ||||
| @JsonClass(generateAdapter = true) | ||||
| data class ExactSharees( | ||||
|     @Json(name = "groups") | ||||
|     val groups: List<ShareeItem>, | ||||
|     @Json(name = "remotes") | ||||
|     val remotes: List<ShareeItem>, | ||||
|     @Json(name = "users") | ||||
|     val users: List<ShareeItem> | ||||
| ) { | ||||
|     fun getFlatRepresentation() = ArrayList<ShareeItem>().apply { | ||||
| @ -66,17 +59,13 @@ data class ExactSharees( | ||||
| 
 | ||||
| @JsonClass(generateAdapter = true) | ||||
| data class ShareeItem( | ||||
|     @Json(name = "label") | ||||
|     val label: String, | ||||
|     @Json(name = "value") | ||||
|     val value: ShareeValue | ||||
| ) | ||||
| 
 | ||||
| @JsonClass(generateAdapter = true) | ||||
| data class ShareeValue( | ||||
|     @Json(name = "shareType") | ||||
|     val shareType: Int, | ||||
|     @Json(name = "shareWith") | ||||
|     val shareWith: String, | ||||
|     @Json(name = "shareWithAdditionalInfo") | ||||
|     val additionalInfo: String? | ||||
|  | ||||
| @ -1,12 +1,35 @@ | ||||
| package com.owncloud.android.lib | ||||
| /* ownCloud Android Library is available under MIT license | ||||
|  *   Copyright (C) 2020 ownCloud GmbH. | ||||
|  * | ||||
|  *   Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
|  *   of this software and associated documentation files (the "Software"), to deal | ||||
|  *   in the Software without restriction, including without limitation the rights | ||||
|  *   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||||
|  *   copies of the Software, and to permit persons to whom the Software is | ||||
|  *   furnished to do so, subject to the following conditions: | ||||
|  * | ||||
|  *   The above copyright notice and this permission notice shall be included in | ||||
|  *   all copies or substantial portions of the Software. | ||||
|  * | ||||
|  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||||
|  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||||
|  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||||
|  *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||||
|  *   BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||||
|  *   ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||||
|  *   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||||
|  *   THE SOFTWARE. | ||||
|  * | ||||
|  */ | ||||
| 
 | ||||
| package com.owncloud.android.lib.resources.shares.responses | ||||
| 
 | ||||
| import com.owncloud.android.lib.resources.CommonOcsResponse | ||||
| import com.owncloud.android.lib.resources.shares.responses.ShareeOcsResponse | ||||
| import com.squareup.moshi.JsonAdapter | ||||
| import com.squareup.moshi.Moshi | ||||
| import com.squareup.moshi.Types | ||||
| import junit.framework.Assert.assertEquals | ||||
| import junit.framework.Assert.assertTrue | ||||
| import org.junit.Assert.assertEquals | ||||
| import org.junit.Assert.assertTrue | ||||
| import org.junit.Assert.assertNotEquals | ||||
| import org.junit.Before | ||||
| import org.junit.Test | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user