Skip to content

Commit f654093

Browse files
Copilotkiyarose
andauthored
fix: pre-warm wiki index on startup and fix iOS UI navigation delegate, bump to 2.3.0
Agent-Logs-Url: https://github.com/SillyLittleTech/Flean/sessions/85ef0bde-c484-413d-b06a-3f226ff8c228 Co-authored-by: kiyarose <75678535+kiyarose@users.noreply.github.com>
1 parent a70cbb7 commit f654093

9 files changed

Lines changed: 57 additions & 25 deletions

File tree

ios/Flean.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@
394394
"@executable_path/Frameworks",
395395
"@executable_path/../../Frameworks",
396396
);
397-
MARKETING_VERSION = 2.2.0;
397+
MARKETING_VERSION = 2.3.0;
398398
OTHER_LDFLAGS = (
399399
"-framework",
400400
SafariServices,
@@ -430,7 +430,7 @@
430430
"@executable_path/Frameworks",
431431
"@executable_path/../../Frameworks",
432432
);
433-
MARKETING_VERSION = 2.2.0;
433+
MARKETING_VERSION = 2.3.0;
434434
OTHER_LDFLAGS = (
435435
"-framework",
436436
SafariServices,
@@ -588,7 +588,7 @@
588588
"$(inherited)",
589589
"@executable_path/Frameworks",
590590
);
591-
MARKETING_VERSION = 2.2.0;
591+
MARKETING_VERSION = 2.3.0;
592592
OTHER_LDFLAGS = (
593593
"-framework",
594594
SafariServices,
@@ -624,7 +624,7 @@
624624
"$(inherited)",
625625
"@executable_path/Frameworks",
626626
);
627-
MARKETING_VERSION = 2.2.0;
627+
MARKETING_VERSION = 2.3.0;
628628
OTHER_LDFLAGS = (
629629
"-framework",
630630
SafariServices,
@@ -651,7 +651,7 @@
651651
DEVELOPMENT_TEAM = PWL627GZ4Y;
652652
GENERATE_INFOPLIST_FILE = YES;
653653
MACOSX_DEPLOYMENT_TARGET = 10.14;
654-
MARKETING_VERSION = 2.2.0;
654+
MARKETING_VERSION = 2.3.0;
655655
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanTests;
656656
PRODUCT_NAME = "$(TARGET_NAME)";
657657
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -669,7 +669,7 @@
669669
DEVELOPMENT_TEAM = PWL627GZ4Y;
670670
GENERATE_INFOPLIST_FILE = YES;
671671
MACOSX_DEPLOYMENT_TARGET = 10.14;
672-
MARKETING_VERSION = 2.2.0;
672+
MARKETING_VERSION = 2.3.0;
673673
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanTests;
674674
PRODUCT_NAME = "$(TARGET_NAME)";
675675
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -685,7 +685,7 @@
685685
CURRENT_PROJECT_VERSION = 4;
686686
DEVELOPMENT_TEAM = PWL627GZ4Y;
687687
GENERATE_INFOPLIST_FILE = YES;
688-
MARKETING_VERSION = 2.2.0;
688+
MARKETING_VERSION = 2.3.0;
689689
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanUITests;
690690
PRODUCT_NAME = "$(TARGET_NAME)";
691691
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -701,7 +701,7 @@
701701
CURRENT_PROJECT_VERSION = 4;
702702
DEVELOPMENT_TEAM = PWL627GZ4Y;
703703
GENERATE_INFOPLIST_FILE = YES;
704-
MARKETING_VERSION = 2.2.0;
704+
MARKETING_VERSION = 2.3.0;
705705
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanUITests;
706706
PRODUCT_NAME = "$(TARGET_NAME)";
707707
SWIFT_EMIT_LOC_STRINGS = NO;

ios/Flean/iOS/WebViewContainer.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ struct WebViewContainer: UIViewRepresentable {
1212

1313
// Add script message handler compatible with the macOS app's controller name
1414
web.configuration.userContentController.add(context.coordinator, name: "controller")
15+
web.navigationDelegate = context.coordinator
1516

1617
// Give the coordinator a reference to the web view so it can inject
1718
// settings back into the page when requested.
@@ -29,7 +30,7 @@ struct WebViewContainer: UIViewRepresentable {
2930

3031
func makeCoordinator() -> Coordinator { Coordinator() }
3132

32-
class Coordinator: NSObject, WKScriptMessageHandler {
33+
class Coordinator: NSObject, WKScriptMessageHandler, WKNavigationDelegate {
3334
// Weak reference to avoid retain cycles
3435
weak var webView: WKWebView?
3536

@@ -138,6 +139,15 @@ struct WebViewContainer: UIViewRepresentable {
138139
// Push updated settings into the web view when the SettingsStore saves.
139140
sendSettingsToPage()
140141
}
142+
143+
// MARK: - WKNavigationDelegate
144+
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
145+
// Update the UI to use iOS-appropriate text. Extension state cannot be
146+
// queried programmatically on iOS (no SFSafariExtensionManager equivalent),
147+
// so we pass null for the enabled state (shows "unknown") and true for
148+
// useSettingsInsteadOfPreferences so the correct iOS wording is displayed.
149+
webView.evaluateJavaScript("show(null, true)", completionHandler: nil)
150+
}
141151

142152
}
143153
}

ios/extention/Resources/background.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import { getWikiData, fetchWikiData, findMatchingWiki, invalidateIndex } from './scripts/wiki-data-manager.js'
1+
import { fetchWikiData, findMatchingWiki, invalidateIndex, warmIndex } from './scripts/wiki-data-manager.js'
22

3-
// Initialise wiki data on extension startup (loads from cache or fetches fresh)
3+
// Initialise wiki data on extension startup and pre-warm the lookup index so the
4+
// first findWiki message from content.js is answered without needing to build the
5+
// index inside the 500ms race window.
46
async function initWikiData () {
57
try {
6-
await getWikiData()
8+
await warmIndex()
79
} catch (err) {
810
if (err) return
911
}

ios/extention/Resources/manifest.json

Lines changed: 1 addition & 1 deletion
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.2.0",
7+
"version": "2.3.0",
88

99
"icons": {
1010
"48": "images/icon-48.png",

ios/extention/Resources/scripts/wiki-data-manager.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,15 @@ export function invalidateIndex () {
134134
_wikiIndex = null
135135
}
136136

137+
/**
138+
* Pre-build the in-memory wiki lookup index.
139+
* Call this during extension startup so the first findMatchingWiki request
140+
* does not stall waiting for index construction within the content-script timeout.
141+
*/
142+
export async function warmIndex () {
143+
return ensureIndex()
144+
}
145+
137146
/**
138147
* Given a URL string, find the best matching independent wiki destination.
139148
* Returns { destinationUrl: string, wikiName: string } or null if no match found.

mos/Flean Extension/Resources/background.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import { getWikiData, fetchWikiData, findMatchingWiki, invalidateIndex } from './scripts/wiki-data-manager.js'
1+
import { fetchWikiData, findMatchingWiki, invalidateIndex, warmIndex } from './scripts/wiki-data-manager.js'
22

3-
// Initialise wiki data on extension startup (loads from cache or fetches fresh)
3+
// Initialise wiki data on extension startup and pre-warm the lookup index so the
4+
// first findWiki message from content.js is answered without needing to build the
5+
// index inside the 500ms race window.
46
async function initWikiData () {
57
try {
6-
await getWikiData()
8+
await warmIndex()
79
} catch (err) {
810
if (err) return
911
}

mos/Flean Extension/Resources/manifest.json

Lines changed: 1 addition & 1 deletion
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.2.0",
7+
"version": "2.3.0",
88

99
"icons": {
1010
"48": "images/icon-48.png",

mos/Flean Extension/Resources/scripts/wiki-data-manager.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,15 @@ export function invalidateIndex () {
134134
_wikiIndex = null
135135
}
136136

137+
/**
138+
* Pre-build the in-memory wiki lookup index.
139+
* Call this during extension startup so the first findMatchingWiki request
140+
* does not stall waiting for index construction within the content-script timeout.
141+
*/
142+
export async function warmIndex () {
143+
return ensureIndex()
144+
}
145+
137146
/**
138147
* Given a URL string, find the best matching independent wiki destination.
139148
* Returns { destinationUrl: string, wikiName: string } or null if no match found.

mos/Flean.xcodeproj/project.pbxproj

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@
392392
"@executable_path/../../../../Frameworks",
393393
);
394394
MACOSX_DEPLOYMENT_TARGET = 10.14;
395-
MARKETING_VERSION = 2.2.0;
395+
MARKETING_VERSION = 2.3.0;
396396
OTHER_LDFLAGS = (
397397
"-framework",
398398
SafariServices,
@@ -423,7 +423,7 @@
423423
"@executable_path/../../../../Frameworks",
424424
);
425425
MACOSX_DEPLOYMENT_TARGET = 10.14;
426-
MARKETING_VERSION = 2.2.0;
426+
MARKETING_VERSION = 2.3.0;
427427
OTHER_LDFLAGS = (
428428
"-framework",
429429
SafariServices,
@@ -577,7 +577,7 @@
577577
"@executable_path/../Frameworks",
578578
);
579579
MACOSX_DEPLOYMENT_TARGET = 10.14;
580-
MARKETING_VERSION = 2.2.0;
580+
MARKETING_VERSION = 2.3.0;
581581
OTHER_LDFLAGS = (
582582
"-framework",
583583
SafariServices,
@@ -616,7 +616,7 @@
616616
"@executable_path/../Frameworks",
617617
);
618618
MACOSX_DEPLOYMENT_TARGET = 10.14;
619-
MARKETING_VERSION = 2.2.0;
619+
MARKETING_VERSION = 2.3.0;
620620
OTHER_LDFLAGS = (
621621
"-framework",
622622
SafariServices,
@@ -643,7 +643,7 @@
643643
DEVELOPMENT_TEAM = PWL627GZ4Y;
644644
GENERATE_INFOPLIST_FILE = YES;
645645
MACOSX_DEPLOYMENT_TARGET = 10.14;
646-
MARKETING_VERSION = 2.2.0;
646+
MARKETING_VERSION = 2.3.0;
647647
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanTests;
648648
PRODUCT_NAME = "$(TARGET_NAME)";
649649
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -661,7 +661,7 @@
661661
DEVELOPMENT_TEAM = PWL627GZ4Y;
662662
GENERATE_INFOPLIST_FILE = YES;
663663
MACOSX_DEPLOYMENT_TARGET = 10.14;
664-
MARKETING_VERSION = 2.2.0;
664+
MARKETING_VERSION = 2.3.0;
665665
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanTests;
666666
PRODUCT_NAME = "$(TARGET_NAME)";
667667
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -677,7 +677,7 @@
677677
CURRENT_PROJECT_VERSION = 4;
678678
DEVELOPMENT_TEAM = PWL627GZ4Y;
679679
GENERATE_INFOPLIST_FILE = YES;
680-
MARKETING_VERSION = 2.2.0;
680+
MARKETING_VERSION = 2.3.0;
681681
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanUITests;
682682
PRODUCT_NAME = "$(TARGET_NAME)";
683683
SWIFT_EMIT_LOC_STRINGS = NO;
@@ -693,7 +693,7 @@
693693
CURRENT_PROJECT_VERSION = 4;
694694
DEVELOPMENT_TEAM = PWL627GZ4Y;
695695
GENERATE_INFOPLIST_FILE = YES;
696-
MARKETING_VERSION = 2.2.0;
696+
MARKETING_VERSION = 2.3.0;
697697
PRODUCT_BUNDLE_IDENTIFIER = slf.FleanUITests;
698698
PRODUCT_NAME = "$(TARGET_NAME)";
699699
SWIFT_EMIT_LOC_STRINGS = NO;

0 commit comments

Comments
 (0)