Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Removing App Virality Share Onboarding from Educational Notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
soner-yuksel committed Dec 23, 2020
1 parent 71f3a6d commit cf6dfb6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 137 deletions.
20 changes: 0 additions & 20 deletions Client/Extensions/UIViewExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,26 +102,6 @@ extension UIView {
return spacer
}

/// Adding multiple subviews in one instruction.
@discardableResult
func addSubviews(_ listofViews: [UIView]) -> Self {
for view in listofViews {
self.addSubview(view)
}
return self
}

/// List of subviews owned by the the view
public func subviews(where predicate: (_ view: UIView) -> Bool) -> [UIView] {
return self.subviews.flatMap { subview -> [UIView] in
var result = subview.subviews(where: predicate)
if predicate(subview) {
result.append(subview)
}
return result
}
}

/// Returns a line with height of 1pt. Used to imitate a separator line in custom views.
static var separatorLine: UIView {
let view = UIView().then {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,6 @@ import Shared

extension BrowserViewController {

// MARK: BenchmarkTrackerCountTier

enum BenchmarkTrackerCountTier: Int, Equatable, CaseIterable {
case specialTier = 1000
case newbieExclusive = 5000
case casualExclusive = 10000
case regularExclusive = 25000
case expertExclusive = 75000
case professionalTier = 100000
case primeTier = 250000
case grandTier = 500000
case legendaryTier = 1000000

var title: String {
switch self {
case .specialTier:
return Strings.ShieldEducation.benchmarkSpecialTierTitle
case .newbieExclusive, .casualExclusive, .regularExclusive, .expertExclusive:
return Strings.ShieldEducation.benchmarkExclusiveTierTitle
case .professionalTier:
return Strings.ShieldEducation.benchmarkProfessionalTierTitle
case .primeTier:
return Strings.ShieldEducation.benchmarkPrimeTierTitle
case .grandTier:
return Strings.ShieldEducation.benchmarkGrandTierTitle
case .legendaryTier:
return Strings.ShieldEducation.benchmarkLegendaryTierTitle
}
}

var nextTier: BenchmarkTrackerCountTier? {
guard let indexOfSelf = Self.allCases.firstIndex(where: { self == $0 }) else {
return nil
}

return Self.allCases[safe: indexOfSelf + 1]
}
}

// MARK: Internal

@objc func presentEducationalProductNotifications() {
Expand Down Expand Up @@ -107,27 +68,6 @@ extension BrowserViewController {
notifyHttpsUpgrade(theme: Theme.of(selectedTab))
notificationShown = true
}

// Step 5: Share Brave Benchmark Tiers
guard !notificationShown else { return }

if !Preferences.ProductNotificationBenchmarks.allTiersShown.value {
let numOfTrackerAds = BraveGlobalShieldStats.shared.adblock + BraveGlobalShieldStats.shared.trackingProtection
let existingTierList = BenchmarkTrackerCountTier.allCases.filter({ numOfTrackerAds > $0.rawValue })

for tier in existingTierList {
if Preferences.ProductNotificationBenchmarks.trackerTierCount.value < numOfTrackerAds {
if let nextTier = tier.nextTier {
Preferences.ProductNotificationBenchmarks.trackerTierCount.value = nextTier.rawValue
} else {
Preferences.ProductNotificationBenchmarks.allTiersShown.value = true
}

notifyTrackerAdsCount(tier.rawValue, theme: Theme.of(selectedTab))
break
}
}
}
}

private func notifyFirstTimeBlock(theme: Theme) {
Expand Down Expand Up @@ -204,31 +144,6 @@ extension BrowserViewController {
showBenchmarkNotificationPopover(controller: shareTrackersViewController)
}

private func notifyTrackerAdsCount(_ count: Int, theme: Theme) {
let shareTrackersViewController = ShareTrackersController(theme: theme, trackingType: .trackerCountShare(count: count))

shareTrackersViewController.actionHandler = { [weak self] action in
guard let self = self else { return }

self.benchmarkNotificationPresented = false

switch action {
case .shareEmailTapped:
self.shareTrackersAndAdsWithEmail(count)
case .shareTwitterTapped:
self.shareTrackersAndAdsWithTwitter(count)
case .shareFacebookTapped:
self.shareTrackersAndAdsWithFacebook(count)
case .shareMoreTapped:
self.shareTrackersAndAdsWithDefault(count)
default:
break
}
}

showBenchmarkNotificationPopover(controller: shareTrackersViewController)
}

private func showBenchmarkNotificationPopover(controller: (UIViewController & PopoverContentComponent)) {
let popover = PopoverController(contentController: controller, contentSizeBehavior: .autoLayout)
popover.addsConvenientDismissalMargins = false
Expand Down Expand Up @@ -268,36 +183,4 @@ extension BrowserViewController {
}
}
}

func shareTrackersAndAdsWithEmail(_ count: Int) {
benchmarkNotificationPresented = false

dismiss(animated: true) {
// TODO: Share with Email
}
}

func shareTrackersAndAdsWithTwitter(_ count: Int) {
benchmarkNotificationPresented = false

dismiss(animated: true) {
// TODO: Share with Twitter
}
}

func shareTrackersAndAdsWithFacebook(_ count: Int) {
benchmarkNotificationPresented = false

dismiss(animated: true) {
// TODO: Share with Facebook
}
}

func shareTrackersAndAdsWithDefault(_ count: Int) {
benchmarkNotificationPresented = false

dismiss(animated: true) {
// TODO: Share with Default
}
}
}

0 comments on commit cf6dfb6

Please # to comment.