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 1 commit
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 @@
.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,8 +256,8 @@
.listRowBackground(Color(designSystemColor: .surface))

Section {
if #available(iOS 17.0, *) {
if #available(iOS 17.8, *) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this use iOS 18 instead?

Suggested change
if #available(iOS 17.8, *) {
if #available(iOS 18.0, *) {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is right, good eye.

I noticed had suggested a change after pushing the commit myself too... more coffeeeeee!

geoswitchingTipView()

Check failure on line 260 in DuckDuckGo/NetworkProtectionStatusView.swift

View workflow job for this annotation

GitHub Actions / Unit Tests

'geoswitchingTipView()' is only available in iOS 18.0 or newer

Check failure on line 260 in DuckDuckGo/NetworkProtectionStatusView.swift

View workflow job for this annotation

GitHub Actions / Make Release Build

'geoswitchingTipView()' is only available in iOS 18.0 or newer

Check failure on line 260 in DuckDuckGo/NetworkProtectionStatusView.swift

View workflow job for this annotation

GitHub Actions / Make Release Build

'geoswitchingTipView()' is only available in iOS 18.0 or newer
.tipImageSize(Self.defaultImageSize)
.padding(.horizontal, 3)
}
Expand Down Expand Up @@ -351,7 +351,7 @@

// 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 @@
}
}

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

@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