Skip to content

Commit 0e11a40

Browse files
authored
Merge pull request #16 from SillyLittleTech/copilot/update-safari-extension-icons
Toolbar icon: use custom app icon; bump versions to 2.1.6/build 3; add AGENTS.md
2 parents aa3b637 + 7110071 commit 0e11a40

5 files changed

Lines changed: 175 additions & 36 deletions

File tree

AGENTS.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Flean — Agent Guide
2+
3+
## What this app is
4+
5+
Flean is a Safari Web Extension (with native host helpers) that redirects Fandom wiki URLs to independent community-hosted mirrors (e.g. Breezewiki). It ships as **two separate Xcode projects** — one for iOS and one for macOS — that share the same extension JavaScript resources.
6+
7+
---
8+
9+
## Repository layout
10+
11+
```
12+
/
13+
├── ios/ # iOS Xcode project
14+
│ ├── Flean.xcodeproj/ # iOS app project file
15+
│ ├── Flean/ # iOS native app source (SwiftUI/WKWebView host)
16+
│ │ ├── Assets.xcassets/ # App icons and image assets
17+
│ │ ├── Resources/ # Shared web UI (Main.html, Script.js)
18+
│ │ └── iOS/ # SwiftUI entry point + SettingsStore
19+
│ ├── extention/ # Safari Web Extension target (note: folder is misspelled)
20+
│ │ └── Resources/ # Extension JS, HTML, CSS, manifest.json, images/
21+
│ ├── FleanTests/
22+
│ └── FleanUITests/
23+
24+
├── mos/ # macOS Xcode project
25+
│ ├── Flean.xcodeproj/ # macOS app project file
26+
│ ├── Flean/ # macOS native app source (AppKit/WKWebView host)
27+
│ │ ├── Assets.xcassets/
28+
│ │ ├── Resources/ # Shared web UI (Main.html, Script.js)
29+
│ │ └── iOS/ # iOS SwiftUI host (reused here)
30+
│ ├── Flean Extension/ # Safari Web Extension target
31+
│ │ └── Resources/ # Extension JS, HTML, CSS, manifest.json, images/
32+
│ ├── FleanTests/
33+
│ └── FleanUITests/
34+
35+
├── docs/ # Additional documentation
36+
├── index.php # Local test harness (loads popup in iframe)
37+
├── redirect.php # Local test redirect endpoint
38+
├── README.md
39+
└── AGENTS.md # This file
40+
```
41+
42+
> **Important:** iOS lives in `/ios/` and macOS lives in `/mos/`. These are **completely separate Xcode projects** (`ios/Flean.xcodeproj` and `mos/Flean.xcodeproj`). Changes that need to apply to both platforms must be made in **both** directories.
43+
44+
---
45+
46+
## Key files — where things actually are
47+
48+
| What | iOS path | macOS path |
49+
|---|---|---|
50+
| Xcode project | `ios/Flean.xcodeproj/project.pbxproj` | `mos/Flean.xcodeproj/project.pbxproj` |
51+
| Extension manifest | `ios/extention/Resources/manifest.json` | `mos/Flean Extension/Resources/manifest.json` |
52+
| Extension images | `ios/extention/Resources/images/` | `mos/Flean Extension/Resources/images/` |
53+
| Extension JS | `ios/extention/Resources/{background,content,popup}.js` | `mos/Flean Extension/Resources/{background,content,popup}.js` |
54+
| App icon assets | `ios/Flean/Assets.xcassets/AppIcon.appiconset/` | `mos/Flean/Assets.xcassets/AppIcon.appiconset/` |
55+
| Native app Swift | `ios/Flean/iOS/` | `mos/Flean/AppDelegate.swift`, `mos/Flean/ViewController.swift` |
56+
57+
---
58+
59+
## Version numbers
60+
61+
Version numbers live in **two places** and must be kept in sync manually. Current values (as of release 2.1.6 / build 3) are shown below — replace them with your next release numbers in **both** projects:
62+
63+
### 1. Extension manifest (`manifest.json`) — `version` field
64+
Both `ios/extention/Resources/manifest.json` and `mos/Flean Extension/Resources/manifest.json` contain the extension version, for example:
65+
```json
66+
"version": "2.1.6"
67+
```
68+
Update this value in **both** files for every release.
69+
70+
### 2. Xcode project files (`project.pbxproj`) — `MARKETING_VERSION` and `CURRENT_PROJECT_VERSION`
71+
Both `ios/Flean.xcodeproj/project.pbxproj` and `mos/Flean.xcodeproj/project.pbxproj` contain multiple occurrences like:
72+
```
73+
MARKETING_VERSION = 2.1.6;
74+
CURRENT_PROJECT_VERSION = 3;
75+
```
76+
`MARKETING_VERSION` is the user-visible version string; `CURRENT_PROJECT_VERSION` is the build number. Update all occurrences in **both** files (use a global find-and-replace — there are ~8 occurrences of each per file).
77+
78+
---
79+
80+
## Extension toolbar icon
81+
82+
The icon displayed in the Safari toolbar comes from the `action.default_icon` field in **each extension's `manifest.json`**, not from the app's Asset Catalog. To change it, update:
83+
84+
```json
85+
"action": {
86+
"default_popup": "popup.html",
87+
"default_icon": {
88+
"48": "images/icon-48.png",
89+
"96": "images/icon-96.png",
90+
"128": "images/icon-128.png",
91+
"256": "images/icon-256.png",
92+
"512": "images/icon-512.png"
93+
}
94+
}
95+
```
96+
97+
in both `ios/extention/Resources/manifest.json` and `mos/Flean Extension/Resources/manifest.json`. The `images/` directory inside each extension Resources folder contains the icon files (`icon-48.png`, `icon-96.png`, `icon-128.png`, `icon-256.png`, `icon-512.png`, etc.).
98+
99+
---
100+
101+
## Building without Xcode (manual edits)
102+
103+
Because no `.xcscheme` files are committed to the repository, builds must be driven via `-project` / `-target` flags:
104+
105+
```bash
106+
# iOS
107+
cd ios
108+
xcodebuild build -project Flean.xcodeproj -target Flean \
109+
-sdk iphonesimulator SYMROOT=build
110+
111+
# macOS
112+
cd mos
113+
xcodebuild build -project Flean.xcodeproj -target Flean \
114+
-sdk macosx SYMROOT=build
115+
```
116+
117+
When editing project files manually (without Xcode open), use a plain text editor or `sed` to update `project.pbxproj`. The file is plain text despite the `.pbxproj` extension.
118+
119+
---
120+
121+
## Common gotchas
122+
123+
- **Two separate projects, not one workspace.** Don't assume a change in `ios/` applies to `mos/` — you must update both explicitly.
124+
- **The iOS extension folder is misspelled** as `extention` (missing an 's'). This is intentional/historical; do not rename it without updating all Xcode project references.
125+
- **No shared `.xcscheme` files are committed.** `xcodebuild -scheme` is unreliable in fresh clones/CI because no shared schemes exist; prefer `-project` / `-target` for reproducible builds.
126+
- **Toolbar icon ≠ app icon.** The app icon (in `Assets.xcassets/AppIcon.appiconset/`) controls what appears on the home screen / Launchpad. The toolbar icon in Safari is controlled by `action.default_icon` in `manifest.json`.
127+
- **Shared web resources** (`Main.html`, `Script.js`) are referenced by both the iOS and macOS native app targets, but they live inside each project's own `Resources/` folder — they are not a single shared source file.

ios/Flean.xcodeproj/project.pbxproj

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@
381381
isa = XCBuildConfiguration;
382382
buildSettings = {
383383
CODE_SIGN_STYLE = Automatic;
384-
CURRENT_PROJECT_VERSION = 2;
384+
CURRENT_PROJECT_VERSION = 3;
385385
DEVELOPMENT_ASSET_PATHS = extention;
386386
DEVELOPMENT_TEAM = PWL627GZ4Y;
387387
GENERATE_INFOPLIST_FILE = YES;
@@ -394,7 +394,7 @@
394394
"@executable_path/Frameworks",
395395
"@executable_path/../../Frameworks",
396396
);
397-
MARKETING_VERSION = 2.1.3;
397+
MARKETING_VERSION = 2.1.6;
398398
OTHER_LDFLAGS = (
399399
"-framework",
400400
SafariServices,
@@ -417,7 +417,7 @@
417417
isa = XCBuildConfiguration;
418418
buildSettings = {
419419
CODE_SIGN_STYLE = Automatic;
420-
CURRENT_PROJECT_VERSION = 2;
420+
CURRENT_PROJECT_VERSION = 3;
421421
DEVELOPMENT_ASSET_PATHS = extention;
422422
DEVELOPMENT_TEAM = PWL627GZ4Y;
423423
GENERATE_INFOPLIST_FILE = YES;
@@ -430,7 +430,7 @@
430430
"@executable_path/Frameworks",
431431
"@executable_path/../../Frameworks",
432432
);
433-
MARKETING_VERSION = 2.1.3;
433+
MARKETING_VERSION = 2.1.6;
434434
OTHER_LDFLAGS = (
435435
"-framework",
436436
SafariServices,
@@ -577,7 +577,7 @@
577577
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
578578
CODE_SIGN_ENTITLEMENTS = Flean/Flean.entitlements;
579579
CODE_SIGN_STYLE = Automatic;
580-
CURRENT_PROJECT_VERSION = 2;
580+
CURRENT_PROJECT_VERSION = 3;
581581
DEVELOPMENT_TEAM = PWL627GZ4Y;
582582
GENERATE_INFOPLIST_FILE = YES;
583583
INFOPLIST_KEY_CFBundleDisplayName = Flean;
@@ -588,7 +588,7 @@
588588
"$(inherited)",
589589
"@executable_path/Frameworks",
590590
);
591-
MARKETING_VERSION = 2.1.3;
591+
MARKETING_VERSION = 2.1.6;
592592
OTHER_LDFLAGS = (
593593
"-framework",
594594
SafariServices,
@@ -613,7 +613,7 @@
613613
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
614614
CODE_SIGN_ENTITLEMENTS = Flean/Flean.entitlements;
615615
CODE_SIGN_STYLE = Automatic;
616-
CURRENT_PROJECT_VERSION = 2;
616+
CURRENT_PROJECT_VERSION = 3;
617617
DEVELOPMENT_TEAM = PWL627GZ4Y;
618618
GENERATE_INFOPLIST_FILE = YES;
619619
INFOPLIST_KEY_CFBundleDisplayName = Flean;
@@ -624,7 +624,7 @@
624624
"$(inherited)",
625625
"@executable_path/Frameworks",
626626
);
627-
MARKETING_VERSION = 2.1.3;
627+
MARKETING_VERSION = 2.1.6;
628628
OTHER_LDFLAGS = (
629629
"-framework",
630630
SafariServices,
@@ -647,11 +647,11 @@
647647
buildSettings = {
648648
BUNDLE_LOADER = "$(TEST_HOST)";
649649
CODE_SIGN_STYLE = Automatic;
650-
CURRENT_PROJECT_VERSION = 2;
650+
CURRENT_PROJECT_VERSION = 3;
651651
DEVELOPMENT_TEAM = PWL627GZ4Y;
652652
GENERATE_INFOPLIST_FILE = YES;
653653
MACOSX_DEPLOYMENT_TARGET = 10.14;
654-
MARKETING_VERSION = 2.1.3;
654+
MARKETING_VERSION = 2.1.6;
655655
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanTests;
656656
PRODUCT_NAME = "$(TARGET_NAME)";
657657
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -665,11 +665,11 @@
665665
buildSettings = {
666666
BUNDLE_LOADER = "$(TEST_HOST)";
667667
CODE_SIGN_STYLE = Automatic;
668-
CURRENT_PROJECT_VERSION = 2;
668+
CURRENT_PROJECT_VERSION = 3;
669669
DEVELOPMENT_TEAM = PWL627GZ4Y;
670670
GENERATE_INFOPLIST_FILE = YES;
671671
MACOSX_DEPLOYMENT_TARGET = 10.14;
672-
MARKETING_VERSION = 2.1.3;
672+
MARKETING_VERSION = 2.1.6;
673673
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanTests;
674674
PRODUCT_NAME = "$(TARGET_NAME)";
675675
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -682,10 +682,10 @@
682682
isa = XCBuildConfiguration;
683683
buildSettings = {
684684
CODE_SIGN_STYLE = Automatic;
685-
CURRENT_PROJECT_VERSION = 2;
685+
CURRENT_PROJECT_VERSION = 3;
686686
DEVELOPMENT_TEAM = PWL627GZ4Y;
687687
GENERATE_INFOPLIST_FILE = YES;
688-
MARKETING_VERSION = 2.1.3;
688+
MARKETING_VERSION = 2.1.6;
689689
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanUITests;
690690
PRODUCT_NAME = "$(TARGET_NAME)";
691691
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -698,10 +698,10 @@
698698
isa = XCBuildConfiguration;
699699
buildSettings = {
700700
CODE_SIGN_STYLE = Automatic;
701-
CURRENT_PROJECT_VERSION = 2;
701+
CURRENT_PROJECT_VERSION = 3;
702702
DEVELOPMENT_TEAM = PWL627GZ4Y;
703703
GENERATE_INFOPLIST_FILE = YES;
704-
MARKETING_VERSION = 2.1.3;
704+
MARKETING_VERSION = 2.1.6;
705705
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanUITests;
706706
PRODUCT_NAME = "$(TARGET_NAME)";
707707
SWIFT_EMIT_LOC_STRINGS = NO;

ios/extention/Resources/manifest.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
"name": "Flean Extension",
66
"description": "Redirect Fandom wiki pages to independent mirrors.",
7-
"version": "2.1.5",
7+
"version": "2.1.6",
88

99
"icons": {
1010
"48": "images/icon-48.png",
@@ -31,7 +31,13 @@
3131

3232
"action": {
3333
"default_popup": "popup.html",
34-
"default_icon": "images/icon-48.png"
34+
"default_icon": {
35+
"48": "images/icon-48.png",
36+
"96": "images/icon-96.png",
37+
"128": "images/icon-128.png",
38+
"256": "images/icon-256.png",
39+
"512": "images/icon-512.png"
40+
}
3541
}
3642

3743
}

mos/Flean Extension/Resources/manifest.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
"name": "__MSG_extension_name__",
66
"description": "__MSG_extension_description__",
7-
"version": "2.1.5",
7+
"version": "2.1.6",
88

99
"icons": {
1010
"48": "images/icon-48.png",
@@ -31,7 +31,13 @@
3131

3232
"action": {
3333
"default_popup": "popup.html",
34-
"default_icon": "images/toolbar-icon.svg"
34+
"default_icon": {
35+
"48": "images/icon-48.png",
36+
"96": "images/icon-96.png",
37+
"128": "images/icon-128.png",
38+
"256": "images/icon-256.png",
39+
"512": "images/icon-512.png"
40+
}
3541
}
3642

3743
}

0 commit comments

Comments
 (0)