Skip to content

Commit

Permalink
Merge branch 'master' into chore/action-release-trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
dhayab authored Jun 3, 2024
2 parents db216e8 + 27105ae commit ce9ead8
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ class NotificationController: WKUserNotificationHostingController<NotificationVi
return NotificationView()
}

override func willActivate() {
// This method is called when watch view controller is about to be visible to user
super.willActivate()
}

override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}

override func didReceive(_: UNNotification) {
// This method is called when a notification needs to be presented.
// Implement it if you use a dynamic notification interface.
Expand Down
40 changes: 23 additions & 17 deletions InstantSearch.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = 'InstantSearch'
s.version = '7.26.1'
s.platforms = { :ios => "9.0", :osx => "10.11", :watchos => "2.0", :tvos => "9.0" }
s.platforms = { :ios => "14.0", :osx => "11.0", :watchos => "7.0", :tvos => "14.0" }

s.license = { type: 'Apache 2.0', file: 'LICENSE.md' }
s.summary = 'A library of widgets and helpers to build instant-search applications on iOS.'
Expand All @@ -13,45 +13,51 @@ Pod::Spec.new do |s|

s.default_subspec = 'UI'

s.resource_bundles = { 'InstantSearch' => ['Sources/PrivacyInfo.xcprivacy'] }

s.subspec "Insights" do |ss|
ss.source_files = 'Sources/InstantSearchInsights/**/*.{swift}'
ss.dependency 'AlgoliaSearchClient', '~> 8.18'
ss.ios.deployment_target = '9.0'
ss.osx.deployment_target = '10.10'
ss.watchos.deployment_target = '2.0'
ss.tvos.deployment_target = '9.0'
ss.dependency 'Logging'
ss.ios.deployment_target = '14.0'
ss.osx.deployment_target = '11.0'
ss.watchos.deployment_target = '7.0'
ss.tvos.deployment_target = '14.0'
end

s.subspec "Core" do |ss|
ss.source_files = 'Sources/InstantSearchCore/**/*.{swift}'
ss.dependency 'AlgoliaSearchClient', '~> 8.18'
ss.dependency 'Logging'
ss.dependency 'InstantSearch/Insights'
ss.dependency 'InstantSearchTelemetry', '~> 0.1.3'
ss.ios.deployment_target = '9.0'
ss.osx.deployment_target = '10.11'
ss.watchos.deployment_target = '2.0'
ss.tvos.deployment_target = '9.0'
ss.ios.deployment_target = '14.0'
ss.osx.deployment_target = '11.0'
ss.watchos.deployment_target = '7.0'
ss.tvos.deployment_target = '14.0'
ss.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-DInstantSearchCocoaPods' }
end

s.subspec "UI" do |ss|
ss.source_files = 'Sources/InstantSearch/**/*.{swift}'
ss.dependency 'InstantSearch/Core'
ss.ios.deployment_target = '9.0'
ss.osx.deployment_target = '10.11'
ss.watchos.deployment_target = '2.0'
ss.tvos.deployment_target = '9.0'
ss.dependency 'Logging'
ss.ios.deployment_target = '14.0'
ss.osx.deployment_target = '11.0'
ss.watchos.deployment_target = '7.0'
ss.tvos.deployment_target = '14.0'
ss.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-DInstantSearchCocoaPods' }
end

s.subspec "SwiftUI" do |ss|
ss.source_files = 'Sources/InstantSearchSwiftUI/**/*.{swift}'
ss.dependency 'InstantSearch/Core'
ss.dependency 'Logging'
ss.dependency 'InstantSearchTelemetry', '~> 0.1.3'
ss.ios.deployment_target = '13.0'
ss.osx.deployment_target = '10.15'
ss.watchos.deployment_target = '6.0'
ss.tvos.deployment_target = '13.0'
ss.ios.deployment_target = '14.0'
ss.osx.deployment_target = '11.0'
ss.watchos.deployment_target = '7.0'
ss.tvos.deployment_target = '14.0'
ss.pod_target_xcconfig = { 'OTHER_SWIFT_FLAGS' => '-DInstantSearchCocoaPods' }
ss.weak_frameworks = 'SwiftUI', 'Combine'
end
Expand Down
22 changes: 14 additions & 8 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import PackageDescription
let package = Package(
name: "InstantSearch",
platforms: [
.iOS(.v9),
.macOS(.v10_11),
.watchOS(.v2),
.tvOS(.v9)
.iOS(.v14),
.macOS(.v11),
.watchOS(.v7),
.tvOS(.v14)
],
products: [
.library(
Expand All @@ -33,6 +33,8 @@ let package = Package(
.package(name: "AlgoliaSearchClient",
url: "https://github.com/algolia/algoliasearch-client-swift",
from: "8.18.2"),
.package(url: "https://github.com/apple/swift-log",
from: "1.5.4"),
.package(name: "InstantSearchTelemetry",
url: "https://github.com/algolia/instantsearch-telemetry-native",
from: "0.1.3")
Expand All @@ -41,15 +43,17 @@ let package = Package(
.target(
name: "InstantSearchInsights",
dependencies: ["AlgoliaSearchClient"],
exclude: ["Readme.md"]
exclude: ["Readme.md"],
resources: [.copy("../PrivacyInfo.xcprivacy")]
),
.testTarget(
name: "InstantSearchInsightsTests",
dependencies: ["InstantSearchInsights", "AlgoliaSearchClient"]
),
.target(
name: "InstantSearchCore",
dependencies: ["AlgoliaSearchClient", "InstantSearchInsights", .product(name: "InstantSearchTelemetry", package: "InstantSearchTelemetry")]
dependencies: ["AlgoliaSearchClient", "InstantSearchInsights", .product(name: "InstantSearchTelemetry", package: "InstantSearchTelemetry"), .product(name: "Logging", package: "swift-log")],
resources: [.copy("../PrivacyInfo.xcprivacy")]
),
.testTarget(
name: "InstantSearchCoreTests",
Expand All @@ -67,15 +71,17 @@ let package = Package(
),
.target(
name: "InstantSearch",
dependencies: ["InstantSearchCore"]
dependencies: ["InstantSearchCore"],
resources: [.copy("../PrivacyInfo.xcprivacy")]
),
.testTarget(
name: "InstantSearchTests",
dependencies: ["InstantSearch"]
),
.target(
name: "InstantSearchSwiftUI",
dependencies: ["InstantSearchCore", .product(name: "InstantSearchTelemetry", package: "InstantSearchTelemetry")]
dependencies: ["InstantSearchCore", .product(name: "InstantSearchTelemetry", package: "InstantSearchTelemetry")],
resources: [.copy("../PrivacyInfo.xcprivacy")]
),
.testTarget(
name: "InstantSearchSwiftUITests",
Expand Down
23 changes: 16 additions & 7 deletions Sources/InstantSearchCore/Searcher/Hits/HitsSearcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,17 @@ public final class HitsSearcher: IndexSearcher<AlgoliaSearchService> {
- apiKey: API Key
- indexName: Name of the index in which search will be performed
- query: Instance of Query. By default a new empty instant of Query will be created.
- isAutoSendingHitsViewEvents: flag defining whether the automatic hits view Insights events sending is enabled
- requestOptions: Custom request options. Default is `nil`.
*/
public convenience init(appID: ApplicationID,
apiKey: APIKey,
indexName: IndexName,
query: Query = .init(),
requestOptions: RequestOptions? = nil) {
requestOptions: RequestOptions? = nil,
isAutoSendingHitsViewEvents: Bool = false) {
let client = SearchClient(appID: appID, apiKey: apiKey)
self.init(client: client, indexName: indexName, query: query, requestOptions: requestOptions)
self.init(client: client, indexName: indexName, query: query, requestOptions: requestOptions, isAutoSendingHitsViewEvents: isAutoSendingHitsViewEvents)
Telemetry.shared.trace(type: .hitsSearcher,
parameters: [
.appID,
Expand All @@ -147,35 +149,42 @@ public final class HitsSearcher: IndexSearcher<AlgoliaSearchService> {
- Parameters:
- index: Index value in which search will be performed
- query: Instance of Query. By default a new empty instant of Query will be created.
- isAutoSendingHitsViewEvents: flag defining whether the automatic hits view Insights events sending is enabled
- requestOptions: Custom request options. Default is nil.
*/
public init(client: SearchClient,
indexName: IndexName,
query: Query = .init(),
requestOptions: RequestOptions? = nil) {
requestOptions: RequestOptions? = nil,
isAutoSendingHitsViewEvents: Bool = false) {
let service = AlgoliaSearchService(client: client)
let request = AlgoliaSearchService.Request(indexName: indexName, query: query, requestOptions: requestOptions)
super.init(service: service, initialRequest: request)
Telemetry.shared.trace(type: .hitsSearcher,
parameters: .client)
onResults.subscribe(with: self) { searcher, response in
searcher.eventTracker.trackView(for: response.hits,
eventName: "Hits Viewed")
if isAutoSendingHitsViewEvents {
searcher.eventTracker.trackView(for: response.hits, eventName: "Hits Viewed")
}
}
}

/**
- Parameters:
- indexQueryState: Instance of `IndexQueryState` encapsulating index value in which search will be performed and a `Query` instance.
- isAutoSendingHitsViewEvents: flag defining whether the automatic hits view Insights events sending is enabled
- requestOptions: Custom request options. Default is nil.
*/
public convenience init(client: SearchClient,
indexQueryState: IndexQueryState,
requestOptions: RequestOptions? = nil) {
requestOptions: RequestOptions? = nil,
isAutoSendingHitsViewEvents: Bool = false) {
self.init(client: client,
indexName: indexQueryState.indexName,
query: indexQueryState.query,
requestOptions: requestOptions)
requestOptions: requestOptions,
isAutoSendingHitsViewEvents: isAutoSendingHitsViewEvents
)
}

deinit {
Expand Down
61 changes: 61 additions & 0 deletions Sources/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
</dict>
</array>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyCollectedDataTypes</key>
<array>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeProductInteraction</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeProductPersonalization</string>
</array>
</dict>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeUserID</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
</array>
</dict>
<dict>
<key>NSPrivacyCollectedDataType</key>
<string>NSPrivacyCollectedDataTypeOtherDiagnosticData</string>
<key>NSPrivacyCollectedDataTypeLinked</key>
<false/>
<key>NSPrivacyCollectedDataTypeTracking</key>
<false/>
<key>NSPrivacyCollectedDataTypePurposes</key>
<array>
<string>NSPrivacyCollectedDataTypePurposeAnalytics</string>
</array>
</dict>
</array>
<key>NSPrivacyTracking</key>
<false/>
</dict>
</plist>

0 comments on commit ce9ead8

Please sign in to comment.