diff --git a/Pod/Classes/TSMessageView.m b/Pod/Classes/TSMessageView.m index 31b8619d..e547cbab 100755 --- a/Pod/Classes/TSMessageView.m +++ b/Pod/Classes/TSMessageView.m @@ -146,6 +146,9 @@ + (NSMutableDictionary *)notificationDesign if (!_notificationDesign) { NSString *path = [[NSBundle bundleForClass:self.class] pathForResource:TSDesignFileName ofType:@"json"]; + if (path == nil) { + path = [[NSBundle bundleForClass:[self class]] pathForResource:TSDesignFileName ofType:@"json"]; + } NSData *data = [NSData dataWithContentsOfFile:path]; NSAssert(data != nil, @"Could not read TSMessages config file from main bundle with name %@.json", TSDesignFileName); @@ -169,6 +172,13 @@ + (void)addNotificationDesignFromFile:(NSString *)filename [[TSMessageView notificationDesign] addEntriesFromDictionary:design]; } + else if ([[NSFileManager defaultManager] fileExistsAtPath:[[[NSBundle bundleForClass:[self class]] resourcePath] stringByAppendingPathComponent:filename]]) { + NSDictionary *design = [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfFile:path] + options:kNilOptions + error:nil]; + + [[TSMessageView notificationDesign] addEntriesFromDictionary:design]; + } else { NSAssert(NO, @"Error loading design file with name %@", filename); @@ -250,6 +260,10 @@ - (id)initWithTitle:(NSString *)title { image = [UIImage imageNamed:[current valueForKey:@"imageName"]]; } + if (!image && [[current valueForKey:@"imageName"] length]) + { + image = [UIImage imageNamed:[current valueForKey:@"imageName"] inBundle:[NSBundle bundleForClass:[self class]] compatibleWithTraitCollection:nil]; + } if (![TSMessage iOS7StyleEnabled]) {