Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
# `gjsify-lock.json` resolves, so bootstrap and locked toolchain are the
# same CLI.
- name: Install gjsify CLI
run: npm install -g @gjsify/cli@0.51.1
run: npm install -g @gjsify/cli@0.63.0

- name: Install dependencies
run: gjsify install --immutable
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
restore-keys: gjsify-tarballs-

- name: Install gjsify CLI
run: npm install -g @gjsify/cli@0.51.1
run: npm install -g @gjsify/cli@0.63.0

- name: Install dependencies
run: gjsify install --immutable
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
restore-keys: gjsify-tarballs-

- name: Install gjsify CLI
run: npm install -g @gjsify/cli@0.51.1
run: npm install -g @gjsify/cli@0.63.0

- name: Install dependencies
run: gjsify install --immutable
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue-to-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
# node_modules exists. Pinned exactly to what `gjsify-lock.json` resolves;
# the build steps below use the workspace-local CLI regardless.
- name: Install gjsify CLI
run: npm install -g @gjsify/cli@0.51.1
run: npm install -g @gjsify/cli@0.63.0

- name: Install dependencies
run: gjsify install --immutable
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/package-managers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
setup: "npm install -g pnpm"
install: "pnpm install"
- pm: gjsify
setup: "npm install -g @gjsify/cli@0.51.1"
setup: "npm install -g @gjsify/cli@0.63.0"
install: "gjsify install"

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ env:
# Bootstrap pin. Must equal the version `gjsify-lock.json` resolves — the
# assertion step below fails the run when the two drift, the same guard
# ci.yml uses.
GJSIFY_CLI_VERSION: "0.51.1"
GJSIFY_CLI_VERSION: "0.63.0"

jobs:
artifacts:
Expand Down
55 changes: 55 additions & 0 deletions packages/app-android/app/services/main-window.services.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { Application, ApplicationSettings, Utils } from "@nativescript/core";
import { localize as _ } from "@nativescript/localize";
import type { MainWindowServices } from "@learn6502/ui";
import { FileService } from "./file.service";
import { notificationService } from "./notification.service";

/** Learn6502 project repository — the "share your example" destination. */
const SHARE_URL = "https://github.com/JumpLink/Learn6502";

const fileService = new FileService();

function copyToClipboard(text: string): boolean {
if (!Application.android) return false;
const clipboardManager = Application.android.context.getSystemService(
android.content.Context.CLIPBOARD_SERVICE
) as android.content.ClipboardManager;
clipboardManager.setPrimaryClip(android.content.ClipData.newPlainText("6502 Code", text));
return true;
}

/** Hand the editor's code to the Android share sheet; GNOME opens its own share dialog instead. */
function shareCode(code: string): void {
const activity = Application.android?.foregroundActivity;
if (!activity || !code) return;
const intent = new android.content.Intent(android.content.Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(android.content.Intent.EXTRA_TEXT, code);
activity.startActivity(android.content.Intent.createChooser(intent, _("Share")));
}

/** What the shared main window asks of Android: SAF for files, the share sheet, app settings. */
export function createMainWindowServices(showHelp: () => void): MainWindowServices {
return {
files: {
openFile: () => fileService.openFile(),
saveFile: (content) => fileService.saveFile(content),
saveFileAs: (content, suggestedName) => fileService.saveFileAs(content, suggestedName),
getCurrentFileName: () => fileService.getCurrentFileName(),
hasCurrentFile: () => fileService.getCurrentFileUri() !== null,
hasUnsavedChanges: () => fileService.hasUnsavedChanges(),
setUnsavedChanges: (hasChanges) => fileService.setUnsavedChanges(hasChanges),
},
settings: {
getInt: (key) => ApplicationSettings.getNumber(key, 0),
setInt: (key, value) => ApplicationSettings.setNumber(key, value),
getBoolean: (key) => ApplicationSettings.getBoolean(key, false),
setBoolean: (key, value) => ApplicationSettings.setBoolean(key, value),
},
clipboard: { copy: copyToClipboard },
notifier: { show: (options) => notificationService.showNotification(options) },
showHelp,
showShareDialog: (code) => shareCode(code),
submitExample: () => Utils.openUrl(SHARE_URL),
};
}
Loading
Loading