Skip to content

Commit

Permalink
Move autofill into a package (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanKingston authored May 18, 2022
1 parent 17b2950 commit 4be0dae
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 28 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "Sources/BrowserServicesKit/Resources/duckduckgo-autofill"]
path = Sources/BrowserServicesKit/Resources/duckduckgo-autofill
url = https://github.com/duckduckgo/duckduckgo-autofill
[submodule "Sources/BrowserServicesKit/Resources/content-scope-scripts"]
path = Sources/BrowserServicesKit/Resources/content-scope-scripts
url = https://github.com/duckduckgo/content-scope-scripts
Expand Down
26 changes: 3 additions & 23 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ let package = Package(
.library(name: "BrowserServicesKit", targets: ["BrowserServicesKit"])
],
dependencies: [
.package(name: "Autofill", url: "https://github.com/duckduckgo/duckduckgo-autofill.git", .exact("4.4.0")),
.package(name: "GRDB", url: "https://github.com/duckduckgo/GRDB.swift.git", .exact("1.1.0")),
.package(url: "https://github.com/duckduckgo/TrackerRadarKit", .exact("1.0.3")),
.package(name: "Punycode", url: "https://github.com/gumob/PunycodeSwift.git", .exact("2.1.0"))
Expand All @@ -23,6 +24,7 @@ let package = Package(
.target(
name: "BrowserServicesKit",
dependencies: [
"Autofill",
"GRDB",
"TrackerRadarKit",
.product(name: "Punnycode", package: "Punycode"),
Expand All @@ -41,31 +43,9 @@ let package = Package(
"Resources/content-scope-scripts/lib/",
"Resources/content-scope-scripts/build/chrome/",
"Resources/content-scope-scripts/build/firefox/",
"Resources/content-scope-scripts/build/integration/",
"Resources/duckduckgo-autofill/Gruntfile.js",
"Resources/duckduckgo-autofill/package.json",
"Resources/duckduckgo-autofill/package-lock.json",
"Resources/duckduckgo-autofill/packages/",
"Resources/duckduckgo-autofill/integration-test/",
"Resources/duckduckgo-autofill/LICENSE.md",
"Resources/duckduckgo-autofill/README.md",
"Resources/duckduckgo-autofill/src",
"Resources/duckduckgo-autofill/dist/autofill-host-styles_firefox.css",
"Resources/duckduckgo-autofill/dist/autofill.css",
"Resources/duckduckgo-autofill/jest.setup.js",
"Resources/duckduckgo-autofill/dist/autofill-host-styles_chrome.css",
"Resources/duckduckgo-autofill/jest.config.js",
"Resources/duckduckgo-autofill/jest-test-environment.js",
"Resources/duckduckgo-autofill/scripts/",
"Resources/duckduckgo-autofill/jesthtmlreporter.config.json",
"Resources/duckduckgo-autofill/types.d.ts",
"Resources/duckduckgo-autofill/tsconfig.json",
"Resources/duckduckgo-autofill/docs/real-world-html-tests.md",
"Resources/duckduckgo-autofill/docs/matcher-configuration.md"
"Resources/content-scope-scripts/build/integration/"
],
resources: [
.process("Resources/duckduckgo-autofill/dist/autofill.js"),
.process("Resources/duckduckgo-autofill/dist/TopAutofill.html"),
.process("ContentBlocking/UserScripts/contentblockerrules.js"),
.process("ContentBlocking/UserScripts/surrogates.js"),
.process("Resources/content-scope-scripts/build/apple/contentScope.js")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//

import Foundation
import Autofill

public protocol AutofillUserScriptSourceProvider {
var source: String { get }
Expand Down Expand Up @@ -58,6 +59,6 @@ public class DefaultAutofillSourceProvider: AutofillUserScriptSourceProvider {
replacements["// INJECT userUnprotectedDomains HERE"] = "userUnprotectedDomains = " + userUnprotectedDomainsString + ";"
replacements["// INJECT userPreferences HERE"] = "userPreferences = " + jsonPropertiesString + ";"

sourceStr = AutofillUserScript.loadJS("autofill", from: Bundle.module, withReplacements: replacements)
sourceStr = AutofillUserScript.loadJS("assets/autofill", from: Autofill.bundle, withReplacements: replacements)
}
}
1 change: 0 additions & 1 deletion Sources/BrowserServicesKit/Resources/duckduckgo-autofill
Submodule duckduckgo-autofill deleted from dd9165

0 comments on commit 4be0dae

Please sign in to comment.