forked from Blendman974/faceclaw
iOS porting: Config pull and push scripts; Terminal works; voice input with Siri works
This commit is contained in:
1 parent
b07ae0b479
commit
319d3dc44b
21 files changed
+339
-9
No files matched your search
@@ -0,0 +1,11 @@
|
||||
import { wrapText, type WrapFont } from '../../graphics/textwrap';
|
||||
|
||||
/** Keep short status on the title row; give long errors their full width. */
|
||||
export function layoutHubHeader(font: WrapFont, title: string, status: string, width: number, step: number) {
|
||||
const inlineX = 18 + font.measureText(title) + 16;
|
||||
const inline = !/[\r\n]/.test(status) && font.measureText(status) <= Math.max(0, width - inlineX - 12);
|
||||
const lines = inline ? [status] : wrapText(font, status, Math.max(1, width - 30));
|
||||
const x = inline ? inlineX : 18;
|
||||
const y = inline ? 10 : 10 + step;
|
||||
return { x, y, lines, listTop: inline ? 16 + step : 16 + step * (1 + lines.length) };
|
||||
}
|
||||
@@ -35,6 +35,7 @@ import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { flattenPlanesWithDraws, planesFingerprint, type Plane } from "../../graphics/plane";
|
||||
import { prepareFrameDraws } from "../../graphics/glyph-wire";
|
||||
import { getDefaultSmallFont, getTerminalFontConfig } from "../../graphics/ui-fonts";
|
||||
import { layoutHubHeader } from "./hub-header";
|
||||
import { truncateText } from "../../graphics/textwrap";
|
||||
import { TERMINAL_ICON_GLYPHS } from "../../graphics/icons";
|
||||
import * as frameTimings from "../../native/frame-timings";
|
||||
@@ -1497,13 +1498,13 @@ function paintHub(window: HubWindow): GrayImage {
|
||||
const font = chromeFont();
|
||||
const step = lineStep(font);
|
||||
// No border box: the shell chrome (top bar + sidebar) already frames the app.
|
||||
// Title and status share the top line.
|
||||
// Long statuses get a wrapped block and move the list below it.
|
||||
const title = window.mode === "connections" ? "Terminal - Connections" : "Terminal";
|
||||
image.drawText(font, 18, 10, title, 220);
|
||||
const statusX = 18 + font.measureText(title) + 16;
|
||||
image.drawText(font, statusX, 10, truncateText(font, hubStatusLine(window), Math.max(0, window.viewportWidth - statusX - 12)), 170);
|
||||
const header = layoutHubHeader(font, title, hubStatusLine(window), window.viewportWidth, step);
|
||||
header.lines.forEach((line, index) => image.drawText(font, header.x, header.y + index * step, line, 170));
|
||||
|
||||
let listTop = 16 + step;
|
||||
let listTop = header.listTop;
|
||||
if (window.mode === "sessions" && controls.size === 0) {
|
||||
image.drawText(font, 24, listTop, "Add a g2mirror:// connection to get started, see:", 150);
|
||||
image.drawText(font, 24, listTop + step, "https://github.com/jimrandomh/g2mirror", 190);
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { Application } from '@nativescript/core'
|
||||
import { createMainPage } from './phone-ui/main-page.ios'
|
||||
declare const FaceclawConfigPort: any
|
||||
|
||||
// Apply transferred preferences before settings getters or app workers load.
|
||||
FaceclawConfigPort.processPendingRequest()
|
||||
const { createMainPage } = require('./phone-ui/main-page.ios') as typeof import('./phone-ui/main-page.ios')
|
||||
|
||||
Application.run({ create: createMainPage })
|
||||
@@ -326,7 +326,9 @@ export class G2MirrorClient {
|
||||
*/
|
||||
submitInput(text: string): void {
|
||||
if (this.phase !== "attached") return;
|
||||
const textByteLength = new java.lang.String(text).getBytes("UTF-8").length;
|
||||
const textByteLength = global.isIOS
|
||||
? NSString.stringWithString(text).lengthOfBytesUsingEncoding(NSUTF8StringEncoding)
|
||||
: new java.lang.String(text).getBytes("UTF-8").length;
|
||||
this.send({
|
||||
type: "input",
|
||||
data: encodeBase64Utf8(`${text}\r`),
|
||||
|
||||
Reference in new issue
Block a user