Skip to content

Commit d1b3935

Browse files
author
Firefox Sync Engineering
committed
Nightly auto-update (124.0.20240126050308)
1 parent 8ff87c7 commit d1b3935

File tree

11 files changed

+99
-57
lines changed

11 files changed

+99
-57
lines changed

Package.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// swift-tools-version:5.4
22
import PackageDescription
33

4-
let checksum = "224d759484e4d7e253023277626e02df38e6cefb85880ee08afa4c66b12a4d8c"
5-
let version = "124.0.20240125050305"
6-
let url = "https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/project.application-services.v2.swift.124.20240125050305/artifacts/public/build/MozillaRustComponents.xcframework.zip"
4+
let checksum = "1d7a8c947c32b549af4381477a7d77477fd58cc3fc825a41f1787c4924676905"
5+
let version = "124.0.20240126050308"
6+
let url = "https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/project.application-services.v2.swift.124.20240126050308/artifacts/public/build/MozillaRustComponents.xcframework.zip"
77

88
// Focus xcframework
9-
let focusChecksum = "3c77adeacc171f58ade4bd934df2bcc3419981483bd9a98559214eb46767f312"
10-
let focusUrl = "https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/project.application-services.v2.swift.124.20240125050305/artifacts/public/build/FocusRustComponents.xcframework.zip"
9+
let focusChecksum = "5af502b6a99da69b4c8cd247eff40d7ae6a18a92c13b51ff427a62446a87d19c"
10+
let focusUrl = "https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/project.application-services.v2.swift.124.20240126050308/artifacts/public/build/FocusRustComponents.xcframework.zip"
1111
let package = Package(
1212
name: "MozillaRustComponentsSwift",
1313
platforms: [.iOS(.v14)],

swift-source/all/Generated/Metrics/Metrics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extension GleanMetrics {
2525
// Intentionally left private, no external user can instantiate a new global object.
2626
}
2727

28-
public static let info = BuildInfo(buildDate: DateComponents(calendar: Calendar.current, timeZone: TimeZone(abbreviation: "UTC"), year: 2024, month: 1, day: 25, hour: 5, minute: 20, second: 8))
28+
public static let info = BuildInfo(buildDate: DateComponents(calendar: Calendar.current, timeZone: TimeZone(abbreviation: "UTC"), year: 2024, month: 1, day: 26, hour: 5, minute: 20, second: 13))
2929
}
3030

3131
enum NimbusEvents {

swift-source/all/Generated/remote_settings.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -539,53 +539,53 @@ public func FfiConverterTypeAttachment_lower(_ value: Attachment) -> RustBuffer
539539
}
540540

541541
public struct RemoteSettingsConfig {
542-
public var serverUrl: String?
543-
public var bucketName: String?
544542
public var collectionName: String
543+
public var bucketName: String?
544+
public var serverUrl: String?
545545

546546
// Default memberwise initializers are never public by default, so we
547547
// declare one manually.
548-
public init(serverUrl: String? = nil, bucketName: String? = nil, collectionName: String) {
549-
self.serverUrl = serverUrl
550-
self.bucketName = bucketName
548+
public init(collectionName: String, bucketName: String? = nil, serverUrl: String? = nil) {
551549
self.collectionName = collectionName
550+
self.bucketName = bucketName
551+
self.serverUrl = serverUrl
552552
}
553553
}
554554

555555
extension RemoteSettingsConfig: Equatable, Hashable {
556556
public static func == (lhs: RemoteSettingsConfig, rhs: RemoteSettingsConfig) -> Bool {
557-
if lhs.serverUrl != rhs.serverUrl {
557+
if lhs.collectionName != rhs.collectionName {
558558
return false
559559
}
560560
if lhs.bucketName != rhs.bucketName {
561561
return false
562562
}
563-
if lhs.collectionName != rhs.collectionName {
563+
if lhs.serverUrl != rhs.serverUrl {
564564
return false
565565
}
566566
return true
567567
}
568568

569569
public func hash(into hasher: inout Hasher) {
570-
hasher.combine(serverUrl)
571-
hasher.combine(bucketName)
572570
hasher.combine(collectionName)
571+
hasher.combine(bucketName)
572+
hasher.combine(serverUrl)
573573
}
574574
}
575575

576576
public struct FfiConverterTypeRemoteSettingsConfig: FfiConverterRustBuffer {
577577
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RemoteSettingsConfig {
578578
return try RemoteSettingsConfig(
579-
serverUrl: FfiConverterOptionString.read(from: &buf),
579+
collectionName: FfiConverterString.read(from: &buf),
580580
bucketName: FfiConverterOptionString.read(from: &buf),
581-
collectionName: FfiConverterString.read(from: &buf)
581+
serverUrl: FfiConverterOptionString.read(from: &buf)
582582
)
583583
}
584584

585585
public static func write(_ value: RemoteSettingsConfig, into buf: inout [UInt8]) {
586-
FfiConverterOptionString.write(value.serverUrl, into: &buf)
587-
FfiConverterOptionString.write(value.bucketName, into: &buf)
588586
FfiConverterString.write(value.collectionName, into: &buf)
587+
FfiConverterOptionString.write(value.bucketName, into: &buf)
588+
FfiConverterOptionString.write(value.serverUrl, into: &buf)
589589
}
590590
}
591591

swift-source/all/Nimbus/Nimbus.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ extension Nimbus: NimbusQueues {
7676
}
7777

7878
extension Nimbus: NimbusEventStore {
79-
public var events: NimbusEventStore {
80-
self
81-
}
82-
8379
public func recordEvent(_ eventId: String) {
8480
recordEvent(1, eventId)
8581
}
@@ -425,6 +421,10 @@ extension Nimbus: NimbusMessagingProtocol {
425421
let stringHelper = try nimbusClient.createStringHelper(additionalContext: string)
426422
return NimbusMessagingHelper(targetingHelper: targetingHelper, stringHelper: stringHelper)
427423
}
424+
425+
public var events: NimbusEventStore {
426+
self
427+
}
428428
}
429429

430430
public class NimbusDisabled: NimbusApi {
@@ -522,4 +522,6 @@ extension NimbusDisabled: NimbusMessagingProtocol {
522522
public func createMessageHelper<T: Encodable>(additionalContext _: T) throws -> NimbusMessagingHelperProtocol {
523523
try createMessageHelper()
524524
}
525+
526+
public var events: NimbusEventStore { self }
525527
}

swift-source/all/Nimbus/NimbusCreate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ public extension Nimbus {
9393
let context = Nimbus.buildExperimentContext(appSettings)
9494
let remoteSettings = server.map { server -> RemoteSettingsConfig in
9595
RemoteSettingsConfig(
96-
serverUrl: server.url.absoluteString,
97-
collectionName: server.collection
96+
collectionName: server.collection,
97+
serverUrl: server.url.absoluteString
9898
)
9999
}
100100
let nimbusClient = try NimbusClient(

swift-source/all/Nimbus/NimbusMessagingHelpers.swift

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,16 @@ public protocol NimbusMessagingProtocol {
2121
func createMessageHelper() throws -> NimbusMessagingHelperProtocol
2222
func createMessageHelper(additionalContext: [String: Any]) throws -> NimbusMessagingHelperProtocol
2323
func createMessageHelper<T: Encodable>(additionalContext: T) throws -> NimbusMessagingHelperProtocol
24+
25+
var events: NimbusEventStore { get }
2426
}
2527

26-
// Deprecated the name GleanPlumb.
27-
public typealias GleanPlumbProtocol = NimbusMessagingProtocol
28-
public typealias GleanPlumbMessageHelper = NimbusMessagingHelper
29-
public typealias NimbusMessagingHelperProtocol = NimbusStringHelperProtocol & NimbusTargetingHelperProtocol
28+
public protocol NimbusMessagingHelperProtocol: NimbusStringHelperProtocol, NimbusTargetingHelperProtocol {
29+
/**
30+
* Clear the JEXL cache
31+
*/
32+
func clearCache()
33+
}
3034

3135
/**
3236
* A helper object to make working with Strings uniform across multiple implementations of the messaging
@@ -40,14 +44,29 @@ public typealias NimbusMessagingHelperProtocol = NimbusStringHelperProtocol & Ni
4044
public class NimbusMessagingHelper: NimbusMessagingHelperProtocol {
4145
private let targetingHelper: NimbusTargetingHelperProtocol
4246
private let stringHelper: NimbusStringHelperProtocol
47+
private var cache: [String: Bool]
4348

44-
public init(targetingHelper: NimbusTargetingHelperProtocol, stringHelper: NimbusStringHelperProtocol) {
49+
public init(targetingHelper: NimbusTargetingHelperProtocol,
50+
stringHelper: NimbusStringHelperProtocol,
51+
cache: [String: Bool] = [:])
52+
{
4553
self.targetingHelper = targetingHelper
4654
self.stringHelper = stringHelper
55+
self.cache = cache
4756
}
4857

4958
public func evalJexl(expression: String) throws -> Bool {
50-
try targetingHelper.evalJexl(expression: expression)
59+
if let result = cache[expression] {
60+
return result
61+
} else {
62+
let result = try targetingHelper.evalJexl(expression: expression)
63+
cache[expression] = result
64+
return result
65+
}
66+
}
67+
68+
public func clearCache() {
69+
cache.removeAll()
5170
}
5271

5372
public func getUuid(template: String) -> String? {

swift-source/focus/Generated/Metrics/Metrics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extension GleanMetrics {
2525
// Intentionally left private, no external user can instantiate a new global object.
2626
}
2727

28-
public static let info = BuildInfo(buildDate: DateComponents(calendar: Calendar.current, timeZone: TimeZone(abbreviation: "UTC"), year: 2024, month: 1, day: 25, hour: 5, minute: 20, second: 11))
28+
public static let info = BuildInfo(buildDate: DateComponents(calendar: Calendar.current, timeZone: TimeZone(abbreviation: "UTC"), year: 2024, month: 1, day: 26, hour: 5, minute: 20, second: 16))
2929
}
3030

3131
enum NimbusEvents {

swift-source/focus/Generated/remote_settings.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -539,53 +539,53 @@ public func FfiConverterTypeAttachment_lower(_ value: Attachment) -> RustBuffer
539539
}
540540

541541
public struct RemoteSettingsConfig {
542-
public var serverUrl: String?
543-
public var bucketName: String?
544542
public var collectionName: String
543+
public var bucketName: String?
544+
public var serverUrl: String?
545545

546546
// Default memberwise initializers are never public by default, so we
547547
// declare one manually.
548-
public init(serverUrl: String? = nil, bucketName: String? = nil, collectionName: String) {
549-
self.serverUrl = serverUrl
550-
self.bucketName = bucketName
548+
public init(collectionName: String, bucketName: String? = nil, serverUrl: String? = nil) {
551549
self.collectionName = collectionName
550+
self.bucketName = bucketName
551+
self.serverUrl = serverUrl
552552
}
553553
}
554554

555555
extension RemoteSettingsConfig: Equatable, Hashable {
556556
public static func == (lhs: RemoteSettingsConfig, rhs: RemoteSettingsConfig) -> Bool {
557-
if lhs.serverUrl != rhs.serverUrl {
557+
if lhs.collectionName != rhs.collectionName {
558558
return false
559559
}
560560
if lhs.bucketName != rhs.bucketName {
561561
return false
562562
}
563-
if lhs.collectionName != rhs.collectionName {
563+
if lhs.serverUrl != rhs.serverUrl {
564564
return false
565565
}
566566
return true
567567
}
568568

569569
public func hash(into hasher: inout Hasher) {
570-
hasher.combine(serverUrl)
571-
hasher.combine(bucketName)
572570
hasher.combine(collectionName)
571+
hasher.combine(bucketName)
572+
hasher.combine(serverUrl)
573573
}
574574
}
575575

576576
public struct FfiConverterTypeRemoteSettingsConfig: FfiConverterRustBuffer {
577577
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> RemoteSettingsConfig {
578578
return try RemoteSettingsConfig(
579-
serverUrl: FfiConverterOptionString.read(from: &buf),
579+
collectionName: FfiConverterString.read(from: &buf),
580580
bucketName: FfiConverterOptionString.read(from: &buf),
581-
collectionName: FfiConverterString.read(from: &buf)
581+
serverUrl: FfiConverterOptionString.read(from: &buf)
582582
)
583583
}
584584

585585
public static func write(_ value: RemoteSettingsConfig, into buf: inout [UInt8]) {
586-
FfiConverterOptionString.write(value.serverUrl, into: &buf)
587-
FfiConverterOptionString.write(value.bucketName, into: &buf)
588586
FfiConverterString.write(value.collectionName, into: &buf)
587+
FfiConverterOptionString.write(value.bucketName, into: &buf)
588+
FfiConverterOptionString.write(value.serverUrl, into: &buf)
589589
}
590590
}
591591

swift-source/focus/Nimbus/Nimbus.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ extension Nimbus: NimbusQueues {
7676
}
7777

7878
extension Nimbus: NimbusEventStore {
79-
public var events: NimbusEventStore {
80-
self
81-
}
82-
8379
public func recordEvent(_ eventId: String) {
8480
recordEvent(1, eventId)
8581
}
@@ -425,6 +421,10 @@ extension Nimbus: NimbusMessagingProtocol {
425421
let stringHelper = try nimbusClient.createStringHelper(additionalContext: string)
426422
return NimbusMessagingHelper(targetingHelper: targetingHelper, stringHelper: stringHelper)
427423
}
424+
425+
public var events: NimbusEventStore {
426+
self
427+
}
428428
}
429429

430430
public class NimbusDisabled: NimbusApi {
@@ -522,4 +522,6 @@ extension NimbusDisabled: NimbusMessagingProtocol {
522522
public func createMessageHelper<T: Encodable>(additionalContext _: T) throws -> NimbusMessagingHelperProtocol {
523523
try createMessageHelper()
524524
}
525+
526+
public var events: NimbusEventStore { self }
525527
}

swift-source/focus/Nimbus/NimbusCreate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ public extension Nimbus {
9393
let context = Nimbus.buildExperimentContext(appSettings)
9494
let remoteSettings = server.map { server -> RemoteSettingsConfig in
9595
RemoteSettingsConfig(
96-
serverUrl: server.url.absoluteString,
97-
collectionName: server.collection
96+
collectionName: server.collection,
97+
serverUrl: server.url.absoluteString
9898
)
9999
}
100100
let nimbusClient = try NimbusClient(

0 commit comments

Comments
 (0)