Skip to content

Commit

Permalink
Auto update with latest AS Release v87.0.0 (#22)
Browse files Browse the repository at this point in the history
* Updates Package.swift with v87.0.0 release

* Version 87.0.0
  • Loading branch information
github-actions[bot] authored Nov 23, 2021
1 parent e8d9b43 commit 89f530f
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 82 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ let package = Package(
// For release artifacts, reference the MozillaRustComponents as a URL with checksum.
// IMPORTANT: The checksum has to be on the line directly after the `url`
// this is important for our release script so that all values are updated correctly
url: "https://119127-129966583-gh.circle-artifacts.com/0/dist/MozillaRustComponents.xcframework.zip",
checksum: "2cf6f6e5db8e995773560ad3074722b7ec3ed05a6c2d33c6f90bbffce866ed03"
url: "https://github.com/mozilla/application-services/releases/download/v87.0.0/MozillaRustComponents.xcframework.zip",
checksum: "f69d5c7bcde788d709944bacdeb72888beed1ec6b0a1ad32a092becdc156854b"

// For local testing, you can point at an (unzipped) XCFramework that's part of the repo.
// Note that you have to actually check it in and make a tag for it to work correctly.
Expand Down
108 changes: 64 additions & 44 deletions generated/places/Generated/places_msg_types.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -561,24 +561,28 @@ extension MsgTypes_HistoryVisitInfo: SwiftProtobuf.Message, SwiftProtobuf._Messa
}

func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if let v = self._url {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every if/case branch local when no optimizations
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
// https://github.com/apple/swift-protobuf/issues/1182
try { if let v = self._url {
try visitor.visitSingularStringField(value: v, fieldNumber: 1)
}
if let v = self._title {
} }()
try { if let v = self._title {
try visitor.visitSingularStringField(value: v, fieldNumber: 2)
}
if let v = self._timestamp {
} }()
try { if let v = self._timestamp {
try visitor.visitSingularInt64Field(value: v, fieldNumber: 3)
}
if let v = self._visitType {
} }()
try { if let v = self._visitType {
try visitor.visitSingularInt32Field(value: v, fieldNumber: 4)
}
if let v = self._isHidden {
} }()
try { if let v = self._isHidden {
try visitor.visitSingularBoolField(value: v, fieldNumber: 5)
}
if let v = self._previewImageURL {
} }()
try { if let v = self._previewImageURL {
try visitor.visitSingularStringField(value: v, fieldNumber: 6)
}
} }()
try unknownFields.traverse(visitor: &visitor)
}

Expand Down Expand Up @@ -661,15 +665,19 @@ extension MsgTypes_HistoryVisitInfosWithBound: SwiftProtobuf.Message, SwiftProto
}

func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every if/case branch local when no optimizations
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
// https://github.com/apple/swift-protobuf/issues/1182
if !self.infos.isEmpty {
try visitor.visitRepeatedMessageField(value: self.infos, fieldNumber: 1)
}
if let v = self._bound {
try { if let v = self._bound {
try visitor.visitSingularInt64Field(value: v, fieldNumber: 2)
}
if let v = self._offset {
} }()
try { if let v = self._offset {
try visitor.visitSingularInt64Field(value: v, fieldNumber: 3)
}
} }()
try unknownFields.traverse(visitor: &visitor)
}

Expand Down Expand Up @@ -721,39 +729,43 @@ extension MsgTypes_BookmarkNode: SwiftProtobuf.Message, SwiftProtobuf._MessageIm
}

func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if let v = self._nodeType {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every if/case branch local when no optimizations
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
// https://github.com/apple/swift-protobuf/issues/1182
try { if let v = self._nodeType {
try visitor.visitSingularInt32Field(value: v, fieldNumber: 1)
}
if let v = self._guid {
} }()
try { if let v = self._guid {
try visitor.visitSingularStringField(value: v, fieldNumber: 2)
}
if let v = self._dateAdded {
} }()
try { if let v = self._dateAdded {
try visitor.visitSingularInt64Field(value: v, fieldNumber: 3)
}
if let v = self._lastModified {
} }()
try { if let v = self._lastModified {
try visitor.visitSingularInt64Field(value: v, fieldNumber: 4)
}
if let v = self._parentGuid {
} }()
try { if let v = self._parentGuid {
try visitor.visitSingularStringField(value: v, fieldNumber: 5)
}
if let v = self._position {
} }()
try { if let v = self._position {
try visitor.visitSingularUInt32Field(value: v, fieldNumber: 6)
}
if let v = self._title {
} }()
try { if let v = self._title {
try visitor.visitSingularStringField(value: v, fieldNumber: 7)
}
if let v = self._url {
} }()
try { if let v = self._url {
try visitor.visitSingularStringField(value: v, fieldNumber: 8)
}
} }()
if !self.childGuids.isEmpty {
try visitor.visitRepeatedStringField(value: self.childGuids, fieldNumber: 9)
}
if !self.childNodes.isEmpty {
try visitor.visitRepeatedMessageField(value: self.childNodes, fieldNumber: 10)
}
if let v = self._haveChildNodes {
try { if let v = self._haveChildNodes {
try visitor.visitSingularBoolField(value: v, fieldNumber: 11)
}
} }()
try unknownFields.traverse(visitor: &visitor)
}

Expand Down Expand Up @@ -838,15 +850,19 @@ extension MsgTypes_SearchResultMessage: SwiftProtobuf.Message, SwiftProtobuf._Me
}

func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if let v = self._url {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every if/case branch local when no optimizations
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
// https://github.com/apple/swift-protobuf/issues/1182
try { if let v = self._url {
try visitor.visitSingularStringField(value: v, fieldNumber: 1)
}
if let v = self._title {
} }()
try { if let v = self._title {
try visitor.visitSingularStringField(value: v, fieldNumber: 2)
}
if let v = self._frecency {
} }()
try { if let v = self._frecency {
try visitor.visitSingularInt64Field(value: v, fieldNumber: 3)
}
} }()
if !self.reasons.isEmpty {
try visitor.visitPackedEnumField(value: self.reasons, fieldNumber: 4)
}
Expand Down Expand Up @@ -926,12 +942,16 @@ extension MsgTypes_TopFrecentSiteInfo: SwiftProtobuf.Message, SwiftProtobuf._Mes
}

func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
if let v = self._url {
// The use of inline closures is to circumvent an issue where the compiler
// allocates stack space for every if/case branch local when no optimizations
// are enabled. https://github.com/apple/swift-protobuf/issues/1034 and
// https://github.com/apple/swift-protobuf/issues/1182
try { if let v = self._url {
try visitor.visitSingularStringField(value: v, fieldNumber: 1)
}
if let v = self._title {
} }()
try { if let v = self._title {
try visitor.visitSingularStringField(value: v, fieldNumber: 2)
}
} }()
try unknownFields.traverse(visitor: &visitor)
}

Expand Down
38 changes: 15 additions & 23 deletions generated/push/Generated/push.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ private extension RustBuffer {
// Allocate a new buffer, copying the contents of a `UInt8` array.
init(bytes: [UInt8]) {
let rbuf = bytes.withUnsafeBufferPointer { ptr in
try! rustCall { ffi_push_b1b4_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) }
try! rustCall { ffi_push_6d2f_rustbuffer_from_bytes(ForeignBytes(bufferPointer: ptr), $0) }
}
self.init(capacity: rbuf.capacity, len: rbuf.len, data: rbuf.data)
}

// Frees the buffer in place.
// The buffer must not be used after this is called.
func deallocate() {
try! rustCall { ffi_push_b1b4_rustbuffer_free(self, $0) }
try! rustCall { ffi_push_6d2f_rustbuffer_free(self, $0) }
}
}

Expand Down Expand Up @@ -273,7 +273,7 @@ extension String: ViaFfi {

fileprivate static func lift(_ v: FfiType) throws -> Self {
defer {
try! rustCall { ffi_push_b1b4_rustbuffer_free(v, $0) }
try! rustCall { ffi_push_6d2f_rustbuffer_free(v, $0) }
}
if v.data == nil {
return String()
Expand All @@ -289,7 +289,7 @@ extension String: ViaFfi {
// The swift string gives us a trailing null byte, we don't want it.
let buf = UnsafeBufferPointer(rebasing: ptr.prefix(upTo: ptr.count - 1))
let bytes = ForeignBytes(bufferPointer: buf)
return try! rustCall { ffi_push_b1b4_rustbuffer_from_bytes(bytes, $0) }
return try! rustCall { ffi_push_6d2f_rustbuffer_from_bytes(bytes, $0) }
}
}
}
Expand Down Expand Up @@ -598,15 +598,13 @@ private func makeRustCall<T>(_ callback: (UnsafeMutablePointer<RustCallStatus>)
}

public struct DispatchInfo {
public var uaid: String
public var scope: String
public var endpoint: String
public var appServerKey: String?

// Default memberwise initializers are never public by default, so we
// declare one manually.
public init(uaid: String, scope: String, endpoint: String, appServerKey: String?) {
self.uaid = uaid
public init(scope: String, endpoint: String, appServerKey: String?) {
self.scope = scope
self.endpoint = endpoint
self.appServerKey = appServerKey
Expand All @@ -615,9 +613,6 @@ public struct DispatchInfo {

extension DispatchInfo: Equatable, Hashable {
public static func == (lhs: DispatchInfo, rhs: DispatchInfo) -> Bool {
if lhs.uaid != rhs.uaid {
return false
}
if lhs.scope != rhs.scope {
return false
}
Expand All @@ -631,7 +626,6 @@ extension DispatchInfo: Equatable, Hashable {
}

public func hash(into hasher: inout Hasher) {
hasher.combine(uaid)
hasher.combine(scope)
hasher.combine(endpoint)
hasher.combine(appServerKey)
Expand All @@ -641,15 +635,13 @@ extension DispatchInfo: Equatable, Hashable {
private extension DispatchInfo {
static func read(from buf: Reader) throws -> DispatchInfo {
return try DispatchInfo(
uaid: String.read(from: buf),
scope: String.read(from: buf),
endpoint: String.read(from: buf),
appServerKey: String?.read(from: buf)
)
}

func write(into buf: Writer) {
uaid.write(into: buf)
scope.write(into: buf)
endpoint.write(into: buf)
appServerKey.write(into: buf)
Expand Down Expand Up @@ -858,69 +850,69 @@ public class PushManager: PushManagerProtocol {
self.pointer = pointer
}

public convenience init(senderId: String, serverHost: String = "updates.push.services.mozilla.com", httpProtocol: String = "https", bridgeType: BridgeType, registrationId: String, databasePath: String = "push.sqlite") throws {
public convenience init(senderId: String, serverHost: String = "updates.push.services.mozilla.com", httpProtocol: String = "https", bridgeType: BridgeType, registrationId: String = "", databasePath: String = "push.sqlite") throws {
self.init(unsafeFromRawPointer: try

rustCallWithError(PushError.self) {
push_b1b4_PushManager_new(senderId.lower(), serverHost.lower(), httpProtocol.lower(), bridgeType.lower(), registrationId.lower(), databasePath.lower(), $0)
push_6d2f_PushManager_new(senderId.lower(), serverHost.lower(), httpProtocol.lower(), bridgeType.lower(), registrationId.lower(), databasePath.lower(), $0)
})
}

deinit {
try! rustCall { ffi_push_b1b4_PushManager_object_free(pointer, $0) }
try! rustCall { ffi_push_6d2f_PushManager_object_free(pointer, $0) }
}

public func subscribe(channelId: String = "", scope: String = "", appServerSey: String? = nil) throws -> SubscriptionResponse {
let _retval = try
rustCallWithError(PushError.self) {
push_b1b4_PushManager_subscribe(self.pointer, channelId.lower(), scope.lower(), appServerSey.lower(), $0)
push_6d2f_PushManager_subscribe(self.pointer, channelId.lower(), scope.lower(), appServerSey.lower(), $0)
}
return try SubscriptionResponse.lift(_retval)
}

public func unsubscribe(channelId: String) throws -> Bool {
let _retval = try
rustCallWithError(PushError.self) {
push_b1b4_PushManager_unsubscribe(self.pointer, channelId.lower(), $0)
push_6d2f_PushManager_unsubscribe(self.pointer, channelId.lower(), $0)
}
return try Bool.lift(_retval)
}

public func unsubscribeAll() throws {
try
rustCallWithError(PushError.self) {
push_b1b4_PushManager_unsubscribe_all(self.pointer, $0)
push_6d2f_PushManager_unsubscribe_all(self.pointer, $0)
}
}

public func update(registrationToken: String) throws -> Bool {
let _retval = try
rustCallWithError(PushError.self) {
push_b1b4_PushManager_update(self.pointer, registrationToken.lower(), $0)
push_6d2f_PushManager_update(self.pointer, registrationToken.lower(), $0)
}
return try Bool.lift(_retval)
}

public func verifyConnection() throws -> [PushSubscriptionChanged] {
let _retval = try
rustCallWithError(PushError.self) {
push_b1b4_PushManager_verify_connection(self.pointer, $0)
push_6d2f_PushManager_verify_connection(self.pointer, $0)
}
return try [PushSubscriptionChanged].lift(_retval)
}

public func decrypt(channelId: String, body: String, encoding: String = "aes128gcm", salt: String = "", dh: String = "") throws -> [Int8] {
let _retval = try
rustCallWithError(PushError.self) {
push_b1b4_PushManager_decrypt(self.pointer, channelId.lower(), body.lower(), encoding.lower(), salt.lower(), dh.lower(), $0)
push_6d2f_PushManager_decrypt(self.pointer, channelId.lower(), body.lower(), encoding.lower(), salt.lower(), dh.lower(), $0)
}
return try [Int8].lift(_retval)
}

public func dispatchInfoForChid(channelId: String) throws -> DispatchInfo? {
let _retval = try
rustCallWithError(PushError.self) {
push_b1b4_PushManager_dispatch_info_for_chid(self.pointer, channelId.lower(), $0)
push_6d2f_PushManager_dispatch_info_for_chid(self.pointer, channelId.lower(), $0)
}
return try DispatchInfo?.lift(_retval)
}
Expand Down
Loading

0 comments on commit 89f530f

Please sign in to comment.