introduce file storage for pcloud with access to all files. current implementation doesn't work in my tests.
This commit is contained in:
		| @@ -48,11 +48,19 @@ public class PCloudFileStorage extends JavaFileStorageBase | ||||
|  | ||||
|     private ApiClient apiClient; | ||||
|     private String clientId; | ||||
|     private String protocolId; | ||||
|  | ||||
|     public PCloudFileStorage(Context ctx, String clientId) { | ||||
|     ///prefix for SHARED_PREF keys so we can distinguish between different instances | ||||
|     private String sharedPrefPrefix; | ||||
|  | ||||
|     public PCloudFileStorage(Context ctx, String clientId, String protocolId, String sharedPrefPrefix) { | ||||
|         this.ctx = ctx; | ||||
|         this.clientId = clientId; | ||||
|         this.protocolId = protocolId; | ||||
|         this.sharedPrefPrefix = sharedPrefPrefix; | ||||
|  | ||||
|         this.apiClient = createApiClientFromSharedPrefs(); | ||||
|         android.util.Log.d("KP2A", "Init pcloud with protocol " + protocolId + ", prefix=" + sharedPrefPrefix + ", clientId=" + clientId); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -87,7 +95,8 @@ public class PCloudFileStorage extends JavaFileStorageBase | ||||
|  | ||||
|     @Override | ||||
|     public String getProtocolId() { | ||||
|         return "pcloud"; | ||||
|  | ||||
|         return protocolId; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -239,6 +248,7 @@ public class PCloudFileStorage extends JavaFileStorageBase | ||||
|             activity.getState().putBoolean("hasStartedAuth", true); | ||||
|         } | ||||
|  | ||||
|  | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -279,7 +289,7 @@ public class PCloudFileStorage extends JavaFileStorageBase | ||||
|     } | ||||
|  | ||||
|     private ApiClient createApiClientFromSharedPrefs() { | ||||
|         SharedPreferences prefs = this.ctx.getSharedPreferences(SHARED_PREF_NAME, Context.MODE_PRIVATE); | ||||
|         SharedPreferences prefs = this.ctx.getSharedPreferences(sharedPrefPrefix + SHARED_PREF_NAME, Context.MODE_PRIVATE); | ||||
|         String authToken = prefs.getString(SHARED_PREF_AUTH_TOKEN, null); | ||||
|         String apiHost = prefs.getString(SHARED_PREF_API_HOST, null); | ||||
|         return this.createApiClient(authToken, apiHost); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Philipp Crocoll
					Philipp Crocoll