Skip to content

Commit

Permalink
Merge pull request #196 from superwall-me/develop
Browse files Browse the repository at this point in the history
Release 3.5.0-rc.1
  • Loading branch information
anglinb committed Feb 4, 2024
2 parents 205c458 + 22bfdda commit d296269
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 13 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,15 @@

The changelog for `SuperwallKit`. Also see the [releases](https://github.com/superwall-me/Superwall-iOS/releases) on GitHub.

## 3.5.0-rc.1

This is our first visionOS pre-release, we'll test this on a few devices to
ensure everything works as expected!

### Enhancements

- Adds support for visionOS!

## 3.4.8

### Enhancements
Expand Down
2 changes: 2 additions & 0 deletions Sources/SuperwallKit/Debug/SWBounceButton.swift
Expand Up @@ -113,7 +113,9 @@ final class SWBounceButton: UIButton {

@objc func tappedBounceButton(sender: SWBounceButton) {
if isEnabled {
#if !os(visionOS)
UIImpactFeedbackGenerator(style: .light).impactOccurred()
#endif
// AudioServicesPlayAlertSound(1104)
}

Expand Down
Expand Up @@ -51,8 +51,9 @@ final class SWLocalizationViewController: UITableViewController {
reloadTableView()

navigationItem.titleView = searchBar

#if !os(visionOS)
tableView.keyboardDismissMode = .onDrag
#endif

navigationController?.navigationBar.tintColor = primaryColor
view.tintColor = primaryColor
Expand Down
2 changes: 1 addition & 1 deletion Sources/SuperwallKit/Misc/Constants.swift
Expand Up @@ -18,5 +18,5 @@ let sdkVersion = """
*/

let sdkVersion = """
3.4.8
3.5.0-rc.1
"""
4 changes: 4 additions & 0 deletions Sources/SuperwallKit/Models/SW Product/SWProduct.swift
Expand Up @@ -30,7 +30,11 @@ struct SWProduct: Codable {
productIdentifier = product.productIdentifier
isDownloadable = product.isDownloadable
downloadContentLengths = product.downloadContentLengths.map { $0.doubleValue }
#if os(visionOS)
contentVersion = ""
#else
contentVersion = product.contentVersion
#endif
downloadContentVersion = product.downloadContentVersion

if #available(iOS 14.0, *) {
Expand Down
26 changes: 16 additions & 10 deletions Sources/SuperwallKit/Network/Device Helper/DeviceHelper.swift
Expand Up @@ -8,7 +8,9 @@
import UIKit
import Foundation
import SystemConfiguration
#if canImport(CoreTelephony)
import CoreTelephony
#endif

class DeviceHelper {
var locale: String {
Expand Down Expand Up @@ -119,17 +121,21 @@ class DeviceHelper {
}

var interfaceStyle: String {
let style = UIScreen.main.traitCollection.userInterfaceStyle
switch style {
case .unspecified:
return "Unspecified"
case .light:
return "Light"
case .dark:
return "Dark"
default:
#if os(visionOS)

Check warning on line 124 in Sources/SuperwallKit/Network/Device Helper/DeviceHelper.swift

View workflow job for this annotation

GitHub Actions / Package-SwiftLint

Indentation Width Violation: Code should be indented using one tab or 2 spaces (indentation_width)
return "Unknown"
}
#else
let style = UIScreen.main.traitCollection.userInterfaceStyle
switch style {
case .unspecified:
return "Unspecified"
case .light:
return "Light"
case .dark:
return "Dark"
default:
return "Unknown"
}
#endif
}

var platformWrapper: String?
Expand Down
Expand Up @@ -188,7 +188,9 @@ public class PaywallViewController: UIViewController, LoadingDelegate {

private func configureUI() {
modalPresentationCapturesStatusBarAppearance = true
#if !os(visionOS)
setNeedsStatusBarAppearanceUpdate()
#endif
view.backgroundColor = paywall.backgroundColor

view.addSubview(webView)
Expand Down Expand Up @@ -517,6 +519,7 @@ public class PaywallViewController: UIViewController, LoadingDelegate {
modalPresentationStyle = .overFullScreen
case .drawer:
modalPresentationStyle = .pageSheet
#if !os(visionOS)
if #available(iOS 16.0, *),
UIDevice.current.userInterfaceIdiom == .phone {
sheetPresentationController?.detents = [
Expand All @@ -525,6 +528,7 @@ public class PaywallViewController: UIViewController, LoadingDelegate {
})
]
}
#endif
case .none:
break
}
Expand Down Expand Up @@ -610,7 +614,9 @@ extension PaywallViewController: PaywallMessageHandlerDelegate {
return
}
let safariVC = SFSafariViewController(url: url)
#if !os(visionOS)
safariVC.delegate = self
#endif
self.isSafariVCPresented = true
present(safariVC, animated: true)
}
Expand Down Expand Up @@ -881,12 +887,14 @@ extension PaywallViewController {
}
}

#if !os(visionOS)
// MARK: - SFSafariViewControllerDelegate
extension PaywallViewController: SFSafariViewControllerDelegate {
public func safariViewControllerDidFinish(_ controller: SFSafariViewController) {
isSafariVCPresented = false
}
}
#endif

// MARK: - GameControllerDelegate
extension PaywallViewController: GameControllerDelegate {
Expand Down
Expand Up @@ -300,6 +300,8 @@ final class PaywallMessageHandler: WebEventDelegate {
if Superwall.shared.options.isGameControllerEnabled {
return
}
#if !os(visionOS)
UIImpactFeedbackGenerator().impactOccurred(intensity: 0.7)
#endif
}
}
Expand Up @@ -15,6 +15,8 @@ import WatchKit
#elseif os(macOS)
import IOKit
import Cocoa
#else
import VisionKit
#endif

import CommonCrypto
Expand Down Expand Up @@ -273,7 +275,7 @@ private func guid() -> Data {
return data
}
return Data()
#elseif !targetEnvironment(macCatalyst) && (os(iOS) || os(tvOS))
#elseif !targetEnvironment(macCatalyst) && (os(iOS) || os(tvOS) || os(visionOS))
if let identifierForVendor = UIDevice.current.identifierForVendor {
var rawUUID = identifierForVendor.uuid
let count = MemoryLayout.size(ofValue: rawUUID)
Expand Down

0 comments on commit d296269

Please sign in to comment.