mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 18:37:17 +00:00 
			
		
		
		
	GetRemoteStatusOperation saves server version in result instance, instead of in a field
This commit is contained in:
		
							parent
							
								
									25c53f3bf9
								
							
						
					
					
						commit
						a3683116ae
					
				| @ -24,6 +24,8 @@ | |||||||
| 
 | 
 | ||||||
| package com.owncloud.android.lib.resources.status; | package com.owncloud.android.lib.resources.status; | ||||||
| 
 | 
 | ||||||
|  | import java.util.ArrayList; | ||||||
|  | 
 | ||||||
| import org.apache.commons.httpclient.HttpStatus; | import org.apache.commons.httpclient.HttpStatus; | ||||||
| import org.apache.commons.httpclient.methods.GetMethod; | import org.apache.commons.httpclient.methods.GetMethod; | ||||||
| import org.json.JSONException; | import org.json.JSONException; | ||||||
| @ -61,16 +63,10 @@ public class GetRemoteStatusOperation extends RemoteOperation { | |||||||
|     private String mUrl; |     private String mUrl; | ||||||
|     private RemoteOperationResult mLatestResult; |     private RemoteOperationResult mLatestResult; | ||||||
|     private Context mContext; |     private Context mContext; | ||||||
|     private OwnCloudVersion mOCVersion; |  | ||||||
| 
 | 
 | ||||||
|     public GetRemoteStatusOperation(String url, Context context) { |     public GetRemoteStatusOperation(String url, Context context) { | ||||||
|         mUrl = url; |         mUrl = url; | ||||||
|         mContext = context; |         mContext = context; | ||||||
|         mOCVersion = null; |  | ||||||
|     } |  | ||||||
|      |  | ||||||
|     public OwnCloudVersion getDiscoveredVersion() { |  | ||||||
|         return mOCVersion; |  | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     private boolean tryConnection(OwnCloudClient wc, String urlSt) { |     private boolean tryConnection(OwnCloudClient wc, String urlSt) { | ||||||
| @ -87,8 +83,8 @@ public class GetRemoteStatusOperation extends RemoteOperation { | |||||||
|                 } else { |                 } else { | ||||||
|                     String version = json.getString(NODE_VERSION); |                     String version = json.getString(NODE_VERSION); | ||||||
|                     String versionString = json.getString(NODE_VERSIONSTRING); |                     String versionString = json.getString(NODE_VERSIONSTRING); | ||||||
|                     mOCVersion = new OwnCloudVersion(version, versionString); |                     OwnCloudVersion ocVersion = new OwnCloudVersion(version, versionString); | ||||||
|                     if (!mOCVersion.isVersionValid()) { |                     if (!ocVersion.isVersionValid()) { | ||||||
|                         mLatestResult = new RemoteOperationResult(RemoteOperationResult.ResultCode.BAD_OC_VERSION); |                         mLatestResult = new RemoteOperationResult(RemoteOperationResult.ResultCode.BAD_OC_VERSION); | ||||||
|                          |                          | ||||||
|                     } else { |                     } else { | ||||||
| @ -97,6 +93,9 @@ public class GetRemoteStatusOperation extends RemoteOperation { | |||||||
|                                                                     RemoteOperationResult.ResultCode.OK_NO_SSL |                                                                     RemoteOperationResult.ResultCode.OK_NO_SSL | ||||||
|                             ); |                             ); | ||||||
| 
 | 
 | ||||||
|  |                         ArrayList<Object> data = new ArrayList<Object>(); | ||||||
|  |                         data.add(ocVersion); | ||||||
|  |                         mLatestResult.setData(data); | ||||||
|                         retval = true; |                         retval = true; | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user