Skip to content

Commit

Permalink
things
Browse files Browse the repository at this point in the history
  • Loading branch information
junepark678 committed Dec 24, 2024
1 parent 68c82b3 commit eb8cde6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions Sources/CAltSign/Model/Apple API/ALTAppID.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (copy, nonatomic, nullable) NSDate *expirationDate;

@property (copy, nonatomic) NSDictionary<ALTFeature, id> *features;
@property (copy, nonatomic) NSDictionary<ALTEntitlement, id> *entitlements;

- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithName:(NSString *)name identifier:(NSString *)identifier bundleIdentifier:(NSString *)bundleIdentifier expirationDate:(nullable NSDate *)expirationDate features:(NSDictionary<ALTFeature, id> *)features NS_DESIGNATED_INITIALIZER;
Expand Down
13 changes: 7 additions & 6 deletions Sources/CAltSign/Model/Apple API/ALTAppID.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ - (instancetype)initWithName:(NSString *)name
_bundleIdentifier = [bundleIdentifier copy];
_expirationDate = [expirationDate copy];
_features = [features copy];
_entitlements = @[];
}

return self;
}

Expand All @@ -34,22 +35,22 @@ - (nullable instancetype)initWithResponseDictionary:(NSDictionary *)responseDict
NSString *name = responseDictionary[@"name"];
NSString *identifier = responseDictionary[@"appIdId"];
NSString *bundleIdentifier = responseDictionary[@"identifier"];

if (name == nil || identifier == nil || bundleIdentifier == nil)
{
return nil;
}

NSDictionary *allFeatures = responseDictionary[@"features"] ?: @{};
NSArray *enabledFeatures = responseDictionary[@"enabledFeatures"] ?: @[];

NSMutableDictionary *features = [NSMutableDictionary dictionary];
for (ALTFeature feature in enabledFeatures)
{
id value = allFeatures[feature];
features[feature] = value;
}

NSDate *expirationDate = responseDictionary[@"expirationDate"];

self = [self initWithName:name identifier:identifier bundleIdentifier:bundleIdentifier expirationDate:expirationDate features:features];
Expand All @@ -70,7 +71,7 @@ - (BOOL)isEqual:(id)object
{
return NO;
}

BOOL isEqual = ([self.identifier isEqualToString:appID.identifier] && [self.bundleIdentifier isEqualToString:appID.bundleIdentifier]);
return isEqual;
}
Expand Down

0 comments on commit eb8cde6

Please sign in to comment.