Skip to content

Commit

Permalink
Fixes name conflict in swift generated code (#5181)
Browse files Browse the repository at this point in the history
* Fixes name conflict in swift generated code

* Adds changelog
  • Loading branch information
Tarik Eshaq authored Oct 15, 2022
1 parent 44d79cb commit 914ac9c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGES_UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Use the template below to make assigning a version number during the release cut
-->

## General
### What's fixed
- Fixed a bug released in 94.3.1. The bug broke firefox-ios builds due to a name conflict. ([#5181](https://github.com/mozilla/application-services/pull/5181))

## Nimbus ⛅️🔬🔭

### What's Changed
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

@file:Suppress("InvalidPackageDeclaration")
package mozilla.appservices.remotetabs

// We needed to rename the Rust `TabsGuid` struct to `Guid` in order to circumvent the naming conflict in
// iOS with the Guid exposed in `places.udl`. But that creates a breaking change for the Android code. So we are aliasing
// `TabsGuid` back to `Guid` to prevent a breaking change.
typealias Guid = TabsGuid
8 changes: 4 additions & 4 deletions components/tabs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ mod sync;
uniffi_macros::include_scaffolding!("tabs");

// Our UDL uses a `Guid` type.
use sync_guid::Guid;
impl UniffiCustomTypeConverter for Guid {
use sync_guid::Guid as TabsGuid;
impl UniffiCustomTypeConverter for TabsGuid {
type Builtin = String;

fn into_custom(val: Self::Builtin) -> uniffi::Result<Guid> {
Ok(Guid::new(val.as_str()))
fn into_custom(val: Self::Builtin) -> uniffi::Result<TabsGuid> {
Ok(TabsGuid::new(val.as_str()))
}

fn from_custom(obj: Self) -> Self::Builtin {
Expand Down
4 changes: 2 additions & 2 deletions components/tabs/src/tabs.udl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Custom]
typedef string Guid;
typedef string TabsGuid;

namespace tabs {

Expand Down Expand Up @@ -95,7 +95,7 @@ interface TabsBridgedEngine {
sequence<string> apply();

[Throws=TabsError]
void set_uploaded(i64 new_timestamp, sequence<Guid> uploaded_ids);
void set_uploaded(i64 new_timestamp, sequence<TabsGuid> uploaded_ids);

[Throws=TabsError]
void sync_finished();
Expand Down

0 comments on commit 914ac9c

Please sign in to comment.