//
// LCLicenceObserver.h
// LicenceCore - https://indie.miln.eu
//
// Copyright © Graham Miln. All rights reserved. https://miln.eu
//
// This package is subject to the terms of the Artistic License 2.0.
// If a copy of the Artistic-2.0 was not distributed with this file, you can
// obtain one at https://indie.miln.eu/licence
@import Foundation;
#import "LCLicenceCore.h"
@class LCLicenceObserver;
// WARNING: This protocol will change. The method names and conventions are blunt but workable for now.
@protocol LCLicenceObserverProtocol
@optional
/** Called when the combined licensed state changes. */
- (void)licenceObserver:(LCLicenceObserver*)anObserver licensed:(BOOL)isLicensed;
/** Called each time the licences change, including individual trusted states; aLicence can be nil. */
- (void)licenceObserver:(LCLicenceObserver*)anObserver didChange:(LCLicence*)aLicence;
@end
/** LCLicenceObserver observes a LicenceCore and calls the delegate when specific changes occur. Avoids duplicate KVO code. */
@interface LCLicenceObserver : NSObject
+ (instancetype)observerWithCore:(LCLicenceCore*)aCore delegate:(NSObject<LCLicenceObserverProtocol>*)aDelegate;
- (instancetype)initWithCore:(LCLicenceCore*)aCore delegate:(NSObject<LCLicenceObserverProtocol>*)aDelegate;
@end
LCLicenceObserver.h
This file can be downloaded as part of milnlicence.tbz.