Merge remote-tracking branch 'nextcloud/master' into share-target-page-layout-fix

This commit is contained in:
SunboX 2017-06-06 20:19:41 +02:00
Родитель e6afca67db 9dae167f9f
Коммит 3f264fe76b
6 изменённых файлов: 61 добавлений и 14 удалений

Просмотреть файл

@ -38,5 +38,19 @@
public static string ThemeDark = "ThemeDark";
public static string ThemeLight = "ThemeLight";
#region SyncService
public static string SyncService_Error_CannotCreateClient = "SyncService_Error_CannotCreateClient";
public static string SyncService_Error_DeleteFolderRemotely = "SyncService_Error_DeleteFolderRemotely";
public static string SyncService_Error_CreateFolderRemotely = "SyncService_Error_CreateFolderRemotely";
public static string SyncService_Error_UploadFile = "SyncService_Error_UploadFile";
public static string SyncService_Error_DownloadFile = "SyncService_Error_DownloadFile";
#endregion SyncService
}
}

Просмотреть файл

@ -12,6 +12,8 @@ using System.Threading;
using System.Diagnostics;
using DecaTec.WebDav;
using Windows.Storage;
using NextcloudApp.Constants;
using Prism.Windows.AppModel;
namespace NextcloudApp.Services
{
@ -22,12 +24,14 @@ namespace NextcloudApp.Services
private ResourceInfo resourceInfo;
private NextcloudClient.NextcloudClient client;
private List<SyncInfoDetail> sidList;
private readonly IResourceLoader resourceLoader;
public SyncService(StorageFolder startFolder, ResourceInfo resourceInfo, FolderSyncInfo syncInfo)
public SyncService(StorageFolder startFolder, ResourceInfo resourceInfo, FolderSyncInfo syncInfo, IResourceLoader resourceLoader)
{
this.baseFolder = startFolder;
this.folderSyncInfo = syncInfo;
this.resourceInfo = resourceInfo;
this.resourceLoader = resourceLoader;
sidList = new List<SyncInfoDetail>();
}
@ -45,7 +49,7 @@ namespace NextcloudApp.Services
if (client == null)
{
// ERROR
throw new Exception("Error creating webdav client");
throw new NullReferenceException(this.resourceLoader.GetString(ResourceConstants.SyncService_Error_CannotCreateClient));
}
int changedCount = 0;
@ -140,8 +144,9 @@ namespace NextcloudApp.Services
{
ResponseErrorHandlerService.HandleException(e);
}
//List<Task> syncTasks = new List<Task>();
List<IStorageItem> synced = new List<IStorageItem>();
if (list != null && list.Count > 0)
{
foreach (ResourceInfo subInfo in list)
@ -163,7 +168,7 @@ namespace NextcloudApp.Services
}
else
{
sid.Error = "Deletion of " + subInfo.Path + " on nextcloud failed.";
sid.Error = String.Format(this.resourceLoader.GetString(ResourceConstants.SyncService_Error_DeleteFolderRemotely), subInfo.Path);
// Error could be overridden by other errors
}
}
@ -261,7 +266,7 @@ namespace NextcloudApp.Services
}
else
{
sid.Error = "Could not create directory on nextcloud: " + newPath;
sid.Error = String.Format(this.resourceLoader.GetString(ResourceConstants.SyncService_Error_CreateFolderRemotely), newPath);
}
}
}
@ -332,7 +337,7 @@ namespace NextcloudApp.Services
}
else
{
sid.Error = "Error while uploading File to nextcloud.";
sid.Error = String.Format(this.resourceLoader.GetString(ResourceConstants.SyncService_Error_UploadFile), file.Name);
}
}
else if (info != null)
@ -352,7 +357,7 @@ namespace NextcloudApp.Services
}
else
{
sid.Error = "Error while downloading file from nextcloud";
sid.Error = String.Format(this.resourceLoader.GetString(ResourceConstants.SyncService_Error_DownloadFile), info.Name);
}
}
}
@ -388,7 +393,7 @@ namespace NextcloudApp.Services
}
else
{
sid.Error = "Error while uploading File to nextcloud.";
sid.Error = String.Format(this.resourceLoader.GetString(ResourceConstants.SyncService_Error_UploadFile), file.Name);
}
break;
case ConflictSolution.PREFER_REMOTE:
@ -444,7 +449,7 @@ namespace NextcloudApp.Services
}
else
{
sid.Error = "Error while downloading file from nextcloud";
sid.Error = String.Format(this.resourceLoader.GetString(ResourceConstants.SyncService_Error_DownloadFile), info.Name);
}
break;
default:
@ -471,7 +476,7 @@ namespace NextcloudApp.Services
}
else
{
sid.Error = "Error while downloading file from nextcloud";
sid.Error = String.Format(this.resourceLoader.GetString(ResourceConstants.SyncService_Error_DownloadFile), info.Name);
}
}
}
@ -489,7 +494,7 @@ namespace NextcloudApp.Services
}
else
{
sid.Error = "Error while uploading file to nextcloud";
sid.Error = String.Format(this.resourceLoader.GetString(ResourceConstants.SyncService_Error_UploadFile), info.Name);
}
}
else
@ -510,7 +515,7 @@ namespace NextcloudApp.Services
}
else
{
sid.Error = "Error while uploading file to nextcloud";
sid.Error = String.Format(this.resourceLoader.GetString(ResourceConstants.SyncService_Error_UploadFile), info.Name);
}
break;
case ConflictSolution.PREFER_REMOTE:
@ -525,7 +530,7 @@ namespace NextcloudApp.Services
}
else
{
sid.Error = "Error while downloading file from nextcloud";
sid.Error = String.Format(this.resourceLoader.GetString(ResourceConstants.SyncService_Error_DownloadFile), info.Name);
}
break;
default:

Просмотреть файл

@ -608,4 +608,26 @@ Please try again later.</value>
<data name="PrepareForSharing" xml:space="preserve">
<value>Prepare for sharing...</value>
</data>
<data name="AppBarCreateFolder.Label" xml:space="preserve">
<value>Create folder</value>
</data>
<data name="SyncService_Error_CannotCreateClient" xml:space="preserve">
<value>Error while creating client for WebDAV communication</value>
</data>
<data name="SyncService_Error_CreateFolderRemotely" xml:space="preserve">
<value>Could not create directory '{0}' on Nextcloud.</value>
<comment>{0} = the path to be created</comment>
</data>
<data name="SyncService_Error_DeleteFolderRemotely" xml:space="preserve">
<value>Deletion of '{0}' on Nextcloud failed.</value>
<comment>{0} = the path to be deleted</comment>
</data>
<data name="SyncService_Error_DownloadFile" xml:space="preserve">
<value>Error while downloading file '{0}' from Nextcloud.</value>
<comment>{0} = file name</comment>
</data>
<data name="SyncService_Error_UploadFile" xml:space="preserve">
<value>Error while uploading file '{0}' to Nextcloud.</value>
<comment>{0} = file name</comment>
</data>
</root>

Просмотреть файл

@ -371,7 +371,7 @@ namespace NextcloudApp.ViewModels
// TODO catch exceptions
}
SyncService service = new SyncService(folder, resourceInfo, syncInfo);
SyncService service = new SyncService(folder, resourceInfo, syncInfo, _resourceLoader);
await service.StartSync();
if (firstRunDialog != null)

Просмотреть файл

@ -170,6 +170,7 @@ namespace NextcloudApp.ViewModels
HideProgressIndicator();
if (success)
{
SelectedFileOrFolder = null;
return;
}

Просмотреть файл

@ -288,6 +288,11 @@
Label="Refresh"
x:Uid="AppBarRefresh"
Command="{Binding RefreshCommand}"/>
<AppBarButton
Icon="NewFolder"
Label="Create folder"
x:Uid="AppBarAddCreateFolder"
Command="{Binding CreateDirectoryCommand}"/>
</CommandBar.SecondaryCommands>
<AppBarButton Icon="Accept" Label="Done" x:Uid="AppBarDone" Command="{Binding StartUploadCommand}"/>
<AppBarButton Icon="Clear" Label="Cancel" x:Uid="AppBarCancel" Command="{Binding CancelFolderSelectionCommand}"/>