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

Release 3.5.0-rc.1 #196

Merged
merged 4 commits into from
Feb 4, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 @@
}

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
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@

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

view.addSubview(webView)
Expand Down Expand Up @@ -306,19 +308,19 @@

func loadingStateDidChange(from oldValue: PaywallLoadingState) {
switch loadingState {
case .unknown:

Check warning on line 311 in Sources/SuperwallKit/Paywall/View Controller/PaywallViewController.swift

View workflow job for this annotation

GitHub Actions / Package-SwiftLint

Switch and Case Statement Alignment Violation: Case statements should vertically aligned with their closing brace (switch_case_alignment)
break
case .loadingPurchase,

Check warning on line 313 in Sources/SuperwallKit/Paywall/View Controller/PaywallViewController.swift

View workflow job for this annotation

GitHub Actions / Package-SwiftLint

Switch and Case Statement Alignment Violation: Case statements should vertically aligned with their closing brace (switch_case_alignment)
.manualLoading:
addLoadingView()
case .loadingURL:

Check warning on line 316 in Sources/SuperwallKit/Paywall/View Controller/PaywallViewController.swift

View workflow job for this annotation

GitHub Actions / Package-SwiftLint

Switch and Case Statement Alignment Violation: Case statements should vertically aligned with their closing brace (switch_case_alignment)
addShimmerView()
showRefreshButtonAfterTimeout(true)
UIView.springAnimate {
self.webView.alpha = 0.0
self.webView.transform = CGAffineTransform.identity.translatedBy(x: 0, y: -10)
}
case .ready:

Check warning on line 323 in Sources/SuperwallKit/Paywall/View Controller/PaywallViewController.swift

View workflow job for this annotation

GitHub Actions / Package-SwiftLint

Switch and Case Statement Alignment Violation: Case statements should vertically aligned with their closing brace (switch_case_alignment)
let translation = CGAffineTransform.identity.translatedBy(x: 0, y: 10)
let spinnerDidShow = oldValue == .loadingPurchase || oldValue == .manualLoading
webView.transform = spinnerDidShow ? .identity : translation
Expand Down Expand Up @@ -517,6 +519,7 @@
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 @@
})
]
}
#endif
case .none:
break
}
Expand Down Expand Up @@ -610,7 +614,9 @@
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 @@
}
}

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

// MARK: - GameControllerDelegate
extension PaywallViewController: GameControllerDelegate {
Expand Down
Original file line number Diff line number Diff line change
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
}
}
Original file line number Diff line number Diff line change
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