Skip to main content
Glama
DeviceInfoHandler.swift1.12 kB
import Foundation import FlyingFox import os import XCTest import Network @MainActor struct DeviceInfoHandler: HTTPHandler { private let logger = Logger( subsystem: Bundle.main.bundleIdentifier!, category: String(describing: Self.self) ) func handleRequest(_ request: HTTPRequest) async throws -> HTTPResponse { do { let (width, height, orientation) = try ScreenSizeHelper.actualScreenSize() NSLog("Device orientation is \(String(orientation.rawValue))") let deviceInfo = DeviceInfoResponse( widthPoints: Int(width), heightPoints: Int(height), widthPixels: Int(CGFloat(width) * UIScreen.main.scale), heightPixels: Int(CGFloat(height) * UIScreen.main.scale) ) let responseBody = try JSONEncoder().encode(deviceInfo) return HTTPResponse(statusCode: .ok, body: responseBody) } catch let error { return AppError(message: "Getting device info call failed. Error \(error.localizedDescription)").httpResponse } } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mobile-dev-inc/Maestro'

If you have feedback or need assistance with the MCP directory API, please join our Discord server