Browse Source

APPLEMAIL-33 Add documentation to PEPNotificationXPCApiProtocol. Change name to UpdateDownloadStatus.

APPLEMAIL-33
David Alarcon 2 years ago
parent
commit
472538ce8f
5 changed files with 25 additions and 21 deletions
  1. +3
    -3
      Submodules/PEPUpdatesXPCService/PEPUpdatesXPCService/PEPNotificationXPCService/PEPNotificationXPCClient/XPCService/PEPNotificationXPCClientService.m
  2. +6
    -6
      Submodules/PEPUpdatesXPCService/PEPUpdatesXPCService/PEPNotificationXPCService/PEPNotificationXPCService/XPCService/PEPNotificationXPCApi.m
  3. +12
    -9
      Submodules/PEPUpdatesXPCService/PEPUpdatesXPCService/PEPNotificationXPCService/Shared/PEPNotificationXPCApiProtocol.h
  4. +3
    -3
      Submodules/PEPUpdatesXPCService/PEPUpdatesXPCService/PEPUpdateDownloadXPCService/PEPUpdateDownloadXPCService/UpdateDownloader/PEPUpdateDownloader.mm
  5. +1
    -0
      Submodules/pEpNotifications/PEPUpdatesApp/AppDelegate.swift

+ 3
- 3
Submodules/PEPUpdatesXPCService/PEPUpdatesXPCService/PEPNotificationXPCService/PEPNotificationXPCClient/XPCService/PEPNotificationXPCClientService.m View File

@ -70,14 +70,14 @@
self.updateDownloader.subscriber = self.pEpDownloadNotification;
if (self.pEpDownloadNotification) {
[self.pEpDownloadNotification notifyDownload:ready withName:@"" withFilename:@""];
[self.pEpDownloadNotification notifyDownload:UpdateDownloadStatusReady withName:@"" withFilename:@""];
}
}
// MARK: - PEPNotificationXPCApiProtocol
- (void)notifyDownload:(int)type withName:(NSString *)name withFilename:(NSString *)filename {
[self.pEpDownloadNotification notifyDownload:type withName:name withFilename:filename];
- (void)notifyDownload:(UpdateDownloadStatus)status withName:(NSString *)name withFilename:(NSString *)filename {
[self.pEpDownloadNotification notifyDownload:status withName:name withFilename:filename];
}
@end

+ 6
- 6
Submodules/PEPUpdatesXPCService/PEPUpdatesXPCService/PEPNotificationXPCService/PEPNotificationXPCService/XPCService/PEPNotificationXPCApi.m View File

@ -29,20 +29,20 @@
// MARK: - PEPNotificationXPCApiProtocol
- (void)notifyDownload:(int)type
- (void)notifyDownload:(UpdateDownloadStatus)status
withName:(nonnull NSString *)name
withFilename:(nonnull NSString *)filename {
switch (type) {
case downloading:
switch (status) {
case UpdateDownloadStatusDownloading:
[self.delegate pEpNotificationIsDownloadingWithName:name];
break;
case downloadArrived:
case UpdateDownloadStatusDownloadArrived:
[self.delegate pEpNotificationDownloadDidArriveWithName:name filename:filename];
break;
case noDownloadAvailable:
case UpdateDownloadStatusNoDownloadAvailable:
[self.delegate pEpNotificationNoDownloadAvailable];
break;
case ready:
case UpdateDownloadStatusReady:
[self.delegate pEpNotificationReady];
break;
default:


+ 12
- 9
Submodules/PEPUpdatesXPCService/PEPUpdatesXPCService/PEPNotificationXPCService/Shared/PEPNotificationXPCApiProtocol.h View File

@ -10,19 +10,22 @@
NS_ASSUME_NONNULL_BEGIN
/// Notification types
typedef NS_CLOSED_ENUM(int, DNType) {
ready = 0,
downloading,
downloadArrived,
noDownloadAvailable
/// Update download status
typedef NS_CLOSED_ENUM(int, UpdateDownloadStatus) {
UpdateDownloadStatusReady = 0,
UpdateDownloadStatusDownloading,
UpdateDownloadStatusDownloadArrived,
UpdateDownloadStatusNoDownloadAvailable
};
/// Callback protocol to notify about download events
/// Protocol to notify about update download status
@protocol PEPNotificationXPCApiProtocol <NSObject>
/// notification about download events
- (void)notifyDownload:(int)type withName:(NSString*)name withFilename:(NSString*)filename;
/// Notifiy about update download status
/// @param status The update notification status.
/// @param name The name of the pEp product being updated.
/// @param filename The filename name of the pEp product being updated.
- (void)notifyDownload:(UpdateDownloadStatus)status withName:(NSString*)name withFilename:(NSString*)filename;
@end


+ 3
- 3
Submodules/PEPUpdatesXPCService/PEPUpdatesXPCService/PEPUpdateDownloadXPCService/PEPUpdateDownloadXPCService/UpdateDownloader/PEPUpdateDownloader.mm View File

@ -124,7 +124,7 @@ NSString* CONFIG_PATH = @"/Library/Application Support/pEp/Updater";
pEp::notifyRead_t notifyRead = [=]()->void{
NSLog(@"downloading: %@", name);
if (_subscriber) {
[_subscriber notifyDownload:(int)downloading withName:name withFilename:@""];
[_subscriber notifyDownload:UpdateDownloadStatusDownloading withName:name withFilename:@""];
}
};
@ -138,13 +138,13 @@ NSString* CONFIG_PATH = @"/Library/Application Support/pEp/Updater";
NSLog(@"download arrived %@", download);
if (_subscriber) {
[_subscriber notifyDownload:(int)downloadArrived withName:name withFilename:download];
[_subscriber notifyDownload:UpdateDownloadStatusDownloadArrived withName:name withFilename:download];
}
}
else {
NSLog(@"no download available for %@", name);
if (_subscriber) {
[_subscriber notifyDownload:(int)noDownloadAvailable withName:name withFilename:@""];
[_subscriber notifyDownload:UpdateDownloadStatusNoDownloadAvailable withName:name withFilename:@""];
}
}
}


+ 1
- 0
Submodules/pEpNotifications/PEPUpdatesApp/AppDelegate.swift View File

@ -215,6 +215,7 @@ extension AppDelegate: PEPNotificationXPCServiceDelegate {
product.notification = un
}
NSLog("pEpUpdates: New update for '%@'", name)
downloadStateNotifier.notify(.NewVersionAvailable(String(name)), with: product)
}


Loading…
Cancel
Save