Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limits TipKit availability to iOS 18+ #3589

Merged
merged 2 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions DuckDuckGo/NetworkProtectionStatusView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ struct NetworkProtectionStatusView: View {
.listRowBackground(Color(designSystemColor: .surface))

Section {
if #available(iOS 17.0, *) {
if #available(iOS 18.0, *) {
widgetTipView()
.tipImageSize(Self.defaultImageSize)
.padding(.horizontal, 3)
}

if #available(iOS 17.0, *) {
if #available(iOS 18.0, *) {
snoozeTipView()
.tipImageSize(Self.defaultImageSize)
.padding(.horizontal, 3)
Expand Down Expand Up @@ -256,7 +256,7 @@ struct NetworkProtectionStatusView: View {
.listRowBackground(Color(designSystemColor: .surface))

Section {
if #available(iOS 17.0, *) {
if #available(iOS 18.0, *) {
geoswitchingTipView()
.tipImageSize(Self.defaultImageSize)
.padding(.horizontal, 3)
Expand Down Expand Up @@ -351,7 +351,7 @@ struct NetworkProtectionStatusView: View {

// MARK: - Tips

@available(iOS 17.0, *)
@available(iOS 18.0, *)
@ViewBuilder
private func geoswitchingTipView() -> some View {
if statusModel.canShowTips {
Expand All @@ -363,7 +363,7 @@ struct NetworkProtectionStatusView: View {
}
}

@available(iOS 17.0, *)
@available(iOS 18.0, *)
@ViewBuilder
private func snoozeTipView() -> some View {
if statusModel.canShowTips,
Expand All @@ -376,7 +376,7 @@ struct NetworkProtectionStatusView: View {
}
}

@available(iOS 17.0, *)
@available(iOS 18.0, *)
@ViewBuilder
private func widgetTipView() -> some View {
if statusModel.canShowTips,
Expand Down
24 changes: 14 additions & 10 deletions DuckDuckGo/TipKit/TipKitAppEventHandling.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//

import Core
import BrowserServicesKit
import Foundation
import os.log

Expand All @@ -28,26 +29,29 @@ protocol TipKitAppEventHandling {
struct TipKitAppEventHandler: TipKitAppEventHandling {

private let controller: TipKitController
private let featureFlagger: FeatureFlagger
private let logger: Logger

init(controller: TipKitController = .make(),
featureFlagger: FeatureFlagger = AppDependencyProvider.shared.featureFlagger,
logger: Logger = .tipKit) {

self.controller = controller
self.featureFlagger = featureFlagger
self.logger = logger
}

func appDidFinishLaunching() {
if #available(iOS 17.0, *) {
// TipKit is temporarily disabled.
// See https://app.asana.com/0/inbox/1203108348814444/1208724397684354/1208739407931826
// for more information
logger.log("TipKit is temporarily disabled.")

// controller.configureTipKit([
// .displayFrequency(.immediate),
// .datastoreLocation(.applicationDefault)
// ])
guard featureFlagger.isFeatureOn(.networkProtectionUserTips) else {
logger.log("TipKit disabled by remote feature flag.")
return
}

if #available(iOS 18.0, *) {
controller.configureTipKit([
.displayFrequency(.immediate),
.datastoreLocation(.applicationDefault)
])
} else {
logger.log("TipKit initialization skipped: iOS 17.0 or later is required.")
}
Expand Down
Loading