Skip to content

Commit

Permalink
Rename RemoteTabs to circumvent naming conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
lougeniaC64 committed Apr 26, 2022
1 parent df1f316 commit 4c21029
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* 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/. */

package mozilla.appservices.remotetabs

// In order to circumvent the breaking change that has been introduced with `RemoteTab` being renamed
// to `RemoteTabRecord` to prevent a conflict with the native iOS `RemoteTab`, we are aliasing `RemoteTabRecord`
// back to `RemoteTab` for android.
typealias RemoteTab = RemoteTabRecord
2 changes: 1 addition & 1 deletion components/tabs/ios/Tabs/Tabs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ open class TabsStorage {
}

/// Set the local tabs.
open func setLocalTabs(remoteTabs: [RemoteTab]) throws {
open func setLocalTabs(remoteTabs: [RemoteTabRecord]) throws {
try queue.sync {
self.store.setLocalTabs(remoteTabs: remoteTabs)
}
Expand Down
2 changes: 1 addition & 1 deletion components/tabs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mod sync;

uniffi_macros::include_scaffolding!("tabs");

pub use crate::storage::{ClientRemoteTabs, RemoteTab, TabsDeviceType};
pub use crate::storage::{ClientRemoteTabs, RemoteTabRecord, TabsDeviceType};
pub use crate::sync::engine::TabsEngine;
pub use crate::sync::store::TabsStore;
use error::TabsError;
Expand Down
1 change: 1 addition & 0 deletions components/tabs/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use std::cell::RefCell;
use std::path::{Path, PathBuf};

pub type TabsDeviceType = crate::DeviceType;
pub type RemoteTabRecord = RemoteTab;

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RemoteTab {
Expand Down
6 changes: 3 additions & 3 deletions components/tabs/src/tabs.udl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface TabsStore {

sequence<ClientRemoteTabs> get_all();

void set_local_tabs(sequence<RemoteTab> remote_tabs);
void set_local_tabs(sequence<RemoteTabRecord> remote_tabs);

[Self=ByArc]
void register_with_sync_manager();
Expand All @@ -36,7 +36,7 @@ interface TabsStore {
// reference it via an `[Extern=...]typedef`
enum TabsDeviceType { "Desktop", "Mobile", "Tablet", "VR", "TV", "Unknown" };

dictionary RemoteTab {
dictionary RemoteTabRecord {
string title;
sequence<string> url_history;
string? icon;
Expand All @@ -47,5 +47,5 @@ dictionary ClientRemoteTabs {
string client_id;
string client_name;
TabsDeviceType device_type;
sequence<RemoteTab> remote_tabs;
sequence<RemoteTabRecord> remote_tabs;
};
6 changes: 3 additions & 3 deletions examples/tabs-sync/src/tabs-sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use cli_support::prompt::prompt_char;
use std::path::Path;
use std::sync::Arc;
use structopt::StructOpt;
use tabs::{RemoteTab, TabsStore};
use tabs::{RemoteTabRecord, TabsStore};

use anyhow::Result;

Expand Down Expand Up @@ -123,7 +123,7 @@ fn main() -> Result<()> {
}

#[cfg(feature = "with-clipboard")]
fn read_local_state() -> Vec<RemoteTab> {
fn read_local_state() -> Vec<RemoteTabRecord> {
use clipboard::{ClipboardContext, ClipboardProvider};
println!("Please run the following command in the Firefox Browser Toolbox and copy it.");
println!(
Expand Down Expand Up @@ -156,7 +156,7 @@ fn read_local_state() -> Vec<RemoteTab> {
.iter()
.map(|u| u.as_str().unwrap().to_owned())
.collect();
local_state.push(RemoteTab {
local_state.push(RemoteTabRecord {
title,
url_history,
icon,
Expand Down

0 comments on commit 4c21029

Please sign in to comment.