<commit_before>// Copyright eeGeo Ltd (2012-2015), All Rights Reserved

#include <string>
#include <algorithm>
#include "SearchResultPoiView.h"
#include "MathFunc.h"
#include "UIColors.h"
#include "ImageHelpers.h"
#include "IconResources.h"
#include "StringHelpers.h"
#import "UIView+TouchExclusivity.h"
#include "SearchResultPoiViewContainer.h"
#include "SearchResultPoiViewInterop.h"
#include "App.h"
#include "SearchResultModel.h"
#include "SearchVendorNames.h"
#include "YelpSearchResultPoiView.h"
#include "GeoNamesSearchResultPoiView.h"
#include "EegeoSearchResultPoiView.h"

@interface SearchResultPoiViewContainer()<UIGestureRecognizerDelegate>
{
}
@end

@implementation SearchResultPoiViewContainer

- (id)initWithoutParams
{
    self = [super init];
    
    if(self)
    {
        m_pInterop = Eegeo_NEW(ExampleApp::SearchResultPoi::View::SearchResultPoiViewInterop)(self);
    }

    return self;
}

- (void)dealloc
{
    Eegeo_DELETE m_pInterop;
    [self removeFromSuperview];
    [super dealloc];
}

- (void) open:(const ExampleApp::Search::SdkModel::SearchResultModel*)pModel :(bool)isPinned
{
    Eegeo_ASSERT(m_pCurrentActiveVendorView == NULL);

    self->m_pCurrentActiveVendorView = [self createSearchResultPoiViewForVendor:pModel->GetVendor()];
    [[self superview] addSubview: self->m_pCurrentActiveVendorView];
    [self->m_pCurrentActiveVendorView layoutSubviews];
    [self->m_pCurrentActiveVendorView setContent:pModel :isPinned];
    [self->m_pCurrentActiveVendorView setFullyActive];
}

- (void) close
{
    Eegeo_ASSERT(m_pCurrentActiveVendorView != NULL);
    
    [self->m_pCurrentActiveVendorView setFullyInactive];
    [self->m_pCurrentActiveVendorView removeFromSuperview];
    [self->m_pCurrentActiveVendorView release];
    
    m_pCurrentActiveVendorView = NULL;
}

- (void) updateImage:(const std::string&)url :(bool)success bytes:(const std::vector<Byte>*)bytes;
{
    Eegeo_ASSERT(m_pCurrentActiveVendorView != NULL);
    
    [self->m_pCurrentActiveVendorView updateImage:url :success bytes:bytes];
}

- (ExampleApp::SearchResultPoi::View::SearchResultPoiViewInterop*)getInterop
{
    return m_pInterop;
}<commit_msg>Avoid calling layout twice, the OS already calls it since it calls it on the base and the derived overrides it. Buddy: Blair<commit_after>// Copyright eeGeo Ltd (2012-2015), All Rights Reserved

#include <string>
#include <algorithm>
#include "SearchResultPoiView.h"
#include "MathFunc.h"
#include "UIColors.h"
#include "ImageHelpers.h"
#include "IconResources.h"
#include "StringHelpers.h"
#import "UIView+TouchExclusivity.h"
#include "SearchResultPoiViewContainer.h"
#include "SearchResultPoiViewInterop.h"
#include "App.h"
#include "SearchResultModel.h"
#include "SearchVendorNames.h"
#include "YelpSearchResultPoiView.h"
#include "GeoNamesSearchResultPoiView.h"
#include "EegeoSearchResultPoiView.h"

@interface SearchResultPoiViewContainer()<UIGestureRecognizerDelegate>
{
}
@end

@implementation SearchResultPoiViewContainer

- (id)initWithoutParams
{
    self = [super init];
    
    if(self)
    {
        m_pInterop = Eegeo_NEW(ExampleApp::SearchResultPoi::View::SearchResultPoiViewInterop)(self);
    }

    return self;
}

- (void)dealloc
{
    Eegeo_DELETE m_pInterop;
    [self removeFromSuperview];
    [super dealloc];
}

- (void) open:(const ExampleApp::Search::SdkModel::SearchResultModel*)pModel :(bool)isPinned
{
    Eegeo_ASSERT(m_pCurrentActiveVendorView == NULL);

    self->m_pCurrentActiveVendorView = [self createSearchResultPoiViewForVendor:pModel->GetVendor()];
    [[self superview] addSubview: self->m_pCurrentActiveVendorView];
    [self->m_pCurrentActiveVendorView setContent:pModel :isPinned];
    [self->m_pCurrentActiveVendorView setFullyActive];
}

- (void) close
{
    Eegeo_ASSERT(m_pCurrentActiveVendorView != NULL);
    
    [self->m_pCurrentActiveVendorView setFullyInactive];
    [self->m_pCurrentActiveVendorView removeFromSuperview];
    [self->m_pCurrentActiveVendorView release];
    
    m_pCurrentActiveVendorView = NULL;
}

- (void) updateImage:(const std::string&)url :(bool)success bytes:(const std::vector<Byte>*)bytes;
{
    Eegeo_ASSERT(m_pCurrentActiveVendorView != NULL);
    
    [self->m_pCurrentActiveVendorView updateImage:url :success bytes:bytes];
}

- (ExampleApp::SearchResultPoi::View::SearchResultPoiViewInterop*)getInterop
{
    return m_pInterop;
}
{'fraction_non_alphanumeric': 0.11745886654478976, 'fraction_numerical': 0.003656307129798903, 'mean_word_length': 6.117073170731707, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5935707', 'n_tokens_mistral': 1531, 'n_tokens_neox': 1500, 'n_words': 240}