Skip to content

Commit

Permalink
Fix #5299 - Send Tab is missing the tablet icon (#5773)
Browse files Browse the repository at this point in the history
  • Loading branch information
q2r5 authored and garvankeeley committed Nov 21, 2019
1 parent 761a672 commit ff96a7f
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Account/FxADeviceRegistration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import Foundation
import Shared
import UIKit
import SwiftyJSON

private let log = Logger.syncLogger
Expand Down Expand Up @@ -105,7 +106,7 @@ open class FxADeviceRegistrator {
device = FxADevice.forUpdate(account.deviceName, id: registration.id, availableCommands: availableCommands, push: pushParams)
registrationResult = .updated
} else {
device = FxADevice.forRegister(account.deviceName, type: "mobile", availableCommands: availableCommands, push: pushParams)
device = FxADevice.forRegister(account.deviceName, type: UIDevice.current.model.lowercased().contains("ipad") ? "tablet" : "mobile", availableCommands: availableCommands, push: pushParams)
registrationResult = .registered
}

Expand Down
26 changes: 23 additions & 3 deletions Client/Frontend/Extensions/DevicePickerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ class DevicePickerViewController: UITableViewController {
switch item {
case .client(let client):
clientCell.nameLabel.text = client.name
clientCell.clientType = client.type == "mobile" ? .Mobile : .Desktop
clientCell.clientType = ClientType.fromFxAType(client.type)
case .device(let device):
clientCell.nameLabel.text = device.name
clientCell.clientType = device.type == "mobile" ? .Mobile : .Desktop
clientCell.clientType = ClientType.fromFxAType(device.type)
}

if let id = item.identifier {
Expand Down Expand Up @@ -378,8 +378,28 @@ class DevicePickerTableViewHeaderCell: UITableViewCell {
}

public enum ClientType: String {
case Mobile = "deviceTypeMobile"
case Desktop = "deviceTypeDesktop"
case Mobile = "deviceTypeMobile"
case Tablet = "deviceTypeTablet"
case VR = "deviceTypeVR"
case TV = "deviceTypeTV"

static func fromFxAType(_ type: String?) -> ClientType {
switch type {
case "desktop":
return ClientType.Desktop
case "mobile":
return ClientType.Mobile
case "tablet":
return ClientType.Tablet
case "vr":
return ClientType.VR
case "tv":
return ClientType.TV
default:
return ClientType.Mobile
}
}
}

class DevicePickerTableViewCell: UITableViewCell {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "deviceTypeTablet.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ff96a7f

Please sign in to comment.