@@ -274,26 +274,33 @@ class SiteStatsInsightsDetailsViewModel: Observable {
274274
275275 // Views Visitors
276276 let weekEnd = futureEndOfWeekDate ( for: periodSummary)
277- rows. append ( contentsOf: SiteStatsImmuTableRows . viewVisitorsImmuTableRows ( periodSummary,
278- selectedSegment: selectedViewsVisitorsSegment,
279- periodDate: selectedDate!,
280- periodEndDate: weekEnd,
281- siteStatsInsightsDelegate: nil ,
282- viewsAndVisitorsDelegate: viewsAndVisitorsDelegate) )
277+ rows. append (
278+ contentsOf: SiteStatsImmuTableRows . viewVisitorsImmuTableRows (
279+ periodSummary,
280+ selectedSegment: selectedViewsVisitorsSegment,
281+ periodDate: selectedDate!,
282+ periodEndDate: weekEnd,
283+ siteStatsInsightsDelegate: nil ,
284+ viewsAndVisitorsDelegate: viewsAndVisitorsDelegate
285+ )
286+ )
283287
284288 // Referrers
285289 if let referrers = viewsAndVisitorsData. topReferrers {
286290 let referrersData = referrersRowData ( topReferrers: referrers)
287291 let chartViewModel = StatsReferrersChartViewModel ( referrers: referrers)
288292 let chartView : UIView ? = referrers. totalReferrerViewsCount > 0 ? chartViewModel. makeReferrersChartView ( ) : nil
289293
290- var referrersRow = TopTotalsPeriodStatsRow ( itemSubtitle: StatSection . periodReferrers. itemSubtitle,
291- dataSubtitle: StatSection . periodReferrers. dataSubtitle,
292- dataRows: referrersData,
293- statSection: StatSection . periodReferrers,
294- siteStatsPeriodDelegate: nil , //TODO - look at if I need to be not null
295- siteStatsReferrerDelegate: nil ,
296- siteStatsInsightsDetailsDelegate: insightsDetailsDelegate)
294+ var referrersRow = TopTotalsPeriodStatsRow (
295+ itemSubtitle: StatSection . periodReferrers. itemSubtitle,
296+ dataSubtitle: StatSection . periodReferrers. dataSubtitle,
297+ dataRows: referrersData,
298+ statSection: StatSection . periodReferrers,
299+ siteStatsPeriodDelegate: nil ,
300+ //TODO - look at if I need to be not null
301+ siteStatsReferrerDelegate: nil ,
302+ siteStatsInsightsDetailsDelegate: insightsDetailsDelegate
303+ )
297304 referrersRow. topAccessoryView = chartView
298305 rows. append ( referrersRow)
299306 }
@@ -304,12 +311,18 @@ class SiteStatsInsightsDetailsViewModel: Observable {
304311 if isMapShown {
305312 rows. append ( CountriesMapRow ( countriesMap: map, statSection: . periodCountries) )
306313 }
307- rows. append ( CountriesStatsRow ( itemSubtitle: StatSection . periodCountries. itemSubtitle,
308- dataSubtitle: StatSection . periodCountries. dataSubtitle,
309- statSection: isMapShown ? nil : . periodCountries,
310- dataRows: countriesRowData ( topCountries: viewsAndVisitorsData. topCountries) ,
311- siteStatsPeriodDelegate: nil ,
312- siteStatsInsightsDetailsDelegate: insightsDetailsDelegate) )
314+ rows. append (
315+ CountriesStatsRow (
316+ itemSubtitle: StatSection . periodCountries. itemSubtitle,
317+ dataSubtitle: StatSection . periodCountries. dataSubtitle,
318+ statSection: isMapShown ? nil : . periodCountries,
319+ dataRows: countriesRowData (
320+ topCountries: viewsAndVisitorsData. topCountries
321+ ) ,
322+ siteStatsPeriodDelegate: nil ,
323+ siteStatsInsightsDetailsDelegate: insightsDetailsDelegate
324+ )
325+ )
313326 return rows
314327 }
315328
@@ -326,29 +339,42 @@ class SiteStatsInsightsDetailsViewModel: Observable {
326339 let emailFollowersCount = insightsStore. getEmailFollowers ( ) ? . emailFollowersCount ?? 0
327340
328341 if dotComFollowersCount > 0 || emailFollowersCount > 0 {
329- let chartViewModel = StatsFollowersChartViewModel ( dotComFollowersCount: dotComFollowersCount,
330- emailFollowersCount: emailFollowersCount)
342+ let chartViewModel = StatsFollowersChartViewModel (
343+ dotComFollowersCount: dotComFollowersCount,
344+ emailFollowersCount: emailFollowersCount
345+ )
331346
332347 let chartView : UIView = chartViewModel. makeFollowersChartView ( )
333348
334- var chartRow = TopTotalsPeriodStatsRow ( itemSubtitle: " " ,
335- dataSubtitle: " " ,
336- dataRows: followersRowData ( dotComFollowersCount: dotComFollowersCount,
337- emailFollowersCount: emailFollowersCount,
338- totalCount: dotComFollowersCount + emailFollowersCount) ,
339- statSection: StatSection . insightsFollowersWordPress,
340- siteStatsPeriodDelegate: nil , //TODO - look at if I need to be not null
341- siteStatsReferrerDelegate: nil )
349+ var chartRow = TopTotalsPeriodStatsRow (
350+ itemSubtitle: " " ,
351+ dataSubtitle: " " ,
352+ dataRows: followersRowData (
353+ dotComFollowersCount: dotComFollowersCount,
354+ emailFollowersCount: emailFollowersCount,
355+ totalCount: dotComFollowersCount + emailFollowersCount
356+ ) ,
357+ statSection: StatSection . insightsFollowersWordPress,
358+ siteStatsPeriodDelegate: nil ,
359+ //TODO - look at if I need to be not null
360+ siteStatsReferrerDelegate: nil
361+ )
342362 chartRow. topAccessoryView = chartView
343363 rows. append ( chartRow)
344364 }
345365
346- rows. append ( TabbedTotalsStatsRow ( tabsData: [ tabDataForFollowerType ( . insightsFollowersWordPress) ,
347- tabDataForFollowerType ( . insightsFollowersEmail) ] ,
366+ rows. append (
367+ TabbedTotalsStatsRow (
368+ tabsData: [
369+ tabDataForFollowerType ( . insightsFollowersWordPress) ,
370+ tabDataForFollowerType ( . insightsFollowersEmail)
371+ ] ,
348372 statSection: . insightsFollowersWordPress,
349373 siteStatsInsightsDelegate: insightsDetailsDelegate,
350374 siteStatsDetailsDelegate: detailsDelegate,
351- showTotalCount: false ) )
375+ showTotalCount: false
376+ )
377+ )
352378 return rows
353379 }
354380 case . insightsLikesTotals:
@@ -358,21 +384,32 @@ class SiteStatsInsightsDetailsViewModel: Observable {
358384 let likesTotalsData = revampStore. getLikesTotalsData ( )
359385
360386 if let summary = likesTotalsData. summary {
361- rows. append ( TotalInsightStatsRow ( dataRow: createLikesTotalInsightsRow ( periodSummary: summary) ,
362- statSection: statSection,
363- siteStatsInsightsDelegate: nil )
387+ rows. append (
388+ TotalInsightStatsRow (
389+ dataRow: createLikesTotalInsightsRow (
390+ periodSummary: summary
391+ ) ,
392+ statSection: statSection,
393+ siteStatsInsightsDelegate: nil
394+ )
364395 )
365396 }
366397
367398 if let topPostsAndPages = likesTotalsData. topPostsAndPages {
368- rows. append ( TopTotalsPeriodStatsRow ( itemSubtitle: StatSection . periodPostsAndPages. itemSubtitle,
369- dataSubtitle: StatSection . periodPostsAndPages. dataSubtitle,
370- dataRows: postsAndPagesRowData ( topPostsAndPages: topPostsAndPages) ,
371- statSection: StatSection . periodPostsAndPages,
372- siteStatsPeriodDelegate: nil ,
373- siteStatsReferrerDelegate: nil ,
374- siteStatsInsightsDetailsDelegate: insightsDetailsDelegate,
375- siteStatsDetailsDelegate: detailsDelegate) )
399+ rows. append (
400+ TopTotalsPeriodStatsRow (
401+ itemSubtitle: StatSection . periodPostsAndPages. itemSubtitle,
402+ dataSubtitle: StatSection . periodPostsAndPages. dataSubtitle,
403+ dataRows: postsAndPagesRowData (
404+ topPostsAndPages: topPostsAndPages
405+ ) ,
406+ statSection: StatSection . periodPostsAndPages,
407+ siteStatsPeriodDelegate: nil ,
408+ siteStatsReferrerDelegate: nil ,
409+ siteStatsInsightsDetailsDelegate: insightsDetailsDelegate,
410+ siteStatsDetailsDelegate: detailsDelegate
411+ )
412+ )
376413 }
377414
378415 return rows
0 commit comments