Commits

José Manuel Sánchez Peñarroja  committed d549853

More changes to adapt to the new web services. Now we load sessions instead of workshops, added classes to some services

  • Participants
  • Parent commits 2dbece5

Comments (0)

Files changed (6)

File bmf/ios/subspecs/jbcharts/BMFJBAudioChartView.h

+//
+//  BMFJBAudioChartView.h
+//  Pods
+//
+//  Created by Jose Manuel Sánchez Peñarroja on 21/08/14.
+//
+//
+
+#import "BMFView.h"
+
+@interface BMFJBAudioChartView : BMFView
+
+@end

File bmf/ios/subspecs/jbcharts/BMFJBAudioChartView.m

+//
+//  BMFJBAudioChartView.m
+//  Pods
+//
+//  Created by Jose Manuel Sánchez Peñarroja on 21/08/14.
+//
+//
+
+#import "BMFJBAudioChartView.h"
+
+@implementation BMFJBAudioChartView
+
+- (id)initWithFrame:(CGRect)frame
+{
+    self = [super initWithFrame:frame];
+    if (self) {
+        // Initialization code
+    }
+    return self;
+}
+
+/*
+// Only override drawRect: if you perform custom drawing.
+// An empty implementation adversely affects performance during animation.
+- (void)drawRect:(CGRect)rect
+{
+    // Drawing code
+}
+*/
+
+@end

File bmf/ios/subspecs/jbcharts/BMFJBChartDataSource.h

+//
+//  BMFJBChartDataSource.h
+//  Pods
+//
+//  Created by Jose Manuel Sánchez Peñarroja on 21/08/14.
+//
+//
+
+#import "BMFDataSource.h"
+
+@class JBChartView;
+
+@interface BMFJBChartDataSource : BMFDataSource
+
+@property (nonatomic, weak) JBChartView *chartView;
+
+- (instancetype) initWithDataStore:(id<BMFDataReadProtocol>)dataStore;
+
+@end

File bmf/ios/subspecs/jbcharts/BMFJBChartDataSource.m

+//
+//  BMFJBChartDataSource.m
+//  Pods
+//
+//  Created by Jose Manuel Sánchez Peñarroja on 21/08/14.
+//
+//
+
+#import "BMFJBChartDataSource.h"
+
+#import <JBChartView/JBChartView.h>
+
+@implementation BMFJBChartDataSource <JBChartViewDataSource>
+
+@end

File bmf/ios/subspecs/jbcharts/BMFJBLineChartDataSource.h

+//
+//  BMFJBLineChartDataSource.h
+//  Pods
+//
+//  Created by Jose Manuel Sánchez Peñarroja on 21/08/14.
+//
+//
+
+#import "BMFJBChartDataSource.h"
+
+@interface BMFJBLineChartDataSource : BMFJBChartDataSource
+
+@end

File bmf/ios/subspecs/jbcharts/BMFJBLineChartDataSource.m

+//
+//  BMFJBLineChartDataSource.m
+//  Pods
+//
+//  Created by Jose Manuel Sánchez Peñarroja on 21/08/14.
+//
+//
+
+#import "BMFJBLineChartDataSource.h"
+
+#import <JBChartView/JBLineChartView.h>
+
+@interface BMFJBLineChartDataSource() <JBLineChartViewDataSource, JBLineChartViewDelegate>
+
+@property (nonatomic, strong) NSMutableArray *observationTokens;
+
+@end
+
+@implementation BMFJBLineChartDataSource
+
+
+
+- (instancetype) initWithDataStore:(id<BMFDataReadProtocol>)dataStore {
+    self = [super init];
+    if (self) {
+		_observationTokens = [NSMutableArray array];
+    }
+    return self;
+}
+
+- (instancetype)init {
+	BMFInvalidInit(initWithDataStore:);
+}
+
+- (void) observeDataChanges {
+	[self stopObserving];
+
+	[self.observationTokens addObject:[[[[NSNotificationCenter defaultCenter] rac_addObserverForName:BMFDataBatchChangeNotification object:self.dataStore] throttle:0.5] subscribeNext:^(id x) {
+		[self.chartView reloadData];
+	}]];
+}
+
+- (void) dealloc {
+	self.dataStore = nil;
+	
+	[self stopObserving];
+}
+
+- (void) stopObserving {
+	
+	for (id token in self.observationTokens) {
+		[token dispose];
+	}
+	
+	[self.observationTokens removeAllObjects];
+}
+
+- (void) setDataStore:(id<BMFDataReadProtocol>)dataStore {
+	[self stopObserving];
+	
+	[super setDataStore:dataStore];
+	
+	[self observeDataChanges];
+	
+	[self.chartView reloadData];
+}
+
+- (void) setChartView:(JBChartView *)chartView {
+ 	self.chartView = chartView;
+	
+	self.chartView.dataSource = self;
+ 		
+	[self.chartView reloadData];
+}
+
+#pragma mark JBLineChartViewDataSource
+
+- (NSUInteger)numberOfLinesInLineChartView:(JBLineChartView *)lineChartView {
+	return [self.dataStore numberOfSections];
+}
+
+- (NSUInteger)lineChartView:(JBLineChartView *)lineChartView numberOfVerticalValuesAtLineIndex:(NSUInteger)lineIndex {
+	return [self.dataStore numberOfRowsInSection:lineIndex];
+}
+
+- (CGFloat)lineChartView:(JBLineChartView *)lineChartView verticalValueForHorizontalIndex:(NSUInteger)horizontalIndex atLineIndex:(NSUInteger)lineIndex {
+	NSNumber *item = [self.dataStore itemAt:lineIndex row:horizontalIndex];
+	if (item) return item.floatValue;
+	return 0;
+}
+
+@end