-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated tabs component for iOS integration
- Loading branch information
1 parent
491ca4c
commit fd913d9
Showing
11 changed files
with
138 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
components/tabs/android/src/main/java/mozilla/appservices/tabs/DeviceType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
// We needed to rename the tabs `DeviceType` as it conflicts with the `DeviceType` we are exposing for FxA | ||
// in iOS. However renaming `DeviceType` to `TabsDeviceType` creates a breaking change for the Android code. | ||
// So we are aliasing `TabsDeviceType` back to `DeviceType` in order to prevent the breaking change. | ||
typealias DeviceType = TabsDeviceType |
10 changes: 10 additions & 0 deletions
10
components/tabs/android/src/main/java/mozilla/appservices/tabs/RemoteTab.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
// We needed to rename the Rust `RemoteTab` struct to `RemoteTabRecord` in order to circumvent the naming conflict in | ||
// iOS with the native `RemoteTab` struct. But that creates a breaking change for the Android code. So we are aliasing | ||
// `RemoteTabRecord` back to `RemoteTab` to prevent a breaking change. | ||
typealias RemoteTab = RemoteTabRecord |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* 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/. */ | ||
|
||
import Foundation | ||
|
||
open class TabsStorage { | ||
private var store: TabsStore | ||
private let queue = DispatchQueue(label: "com.mozilla.tabs-storage") | ||
|
||
public init(databasePath: String) { | ||
store = TabsStore(path: databasePath) | ||
} | ||
|
||
/// Get all tabs by client. | ||
open func getAll() -> [ClientRemoteTabs] { | ||
return queue.sync { | ||
return self.store.getAll() | ||
} | ||
} | ||
|
||
/// Set the local tabs. | ||
open func setLocalTabs(remoteTabs: [RemoteTabRecord]) { | ||
queue.sync { | ||
self.store.setLocalTabs(remoteTabs: remoteTabs) | ||
} | ||
} | ||
|
||
open func reset() throws { | ||
try queue.sync { | ||
try self.store.reset() | ||
} | ||
} | ||
|
||
open func sync(unlockInfo: SyncUnlockInfo) throws -> String { | ||
return try queue.sync { | ||
return try self.store | ||
.sync( | ||
keyId: unlockInfo.kid, | ||
accessToken: unlockInfo.fxaAccessToken, | ||
syncKey: unlockInfo.syncKey, | ||
tokenserverUrl: unlockInfo.tokenserverURL, | ||
localId: unlockInfo.tabsLocalId | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters