Skip to content

Commit

Permalink
remove commented out error cases; update bookmarks Readme.md and add …
Browse files Browse the repository at this point in the history
…to pbxproj
  • Loading branch information
mallexxx committed Dec 21, 2023
1 parent f1c4dc3 commit 27db74c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
11 changes: 2 additions & 9 deletions DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2738,7 +2738,6 @@
B662D3DE275613BB0035D4D6 /* EncryptionKeyStoreMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = B662D3DD275613BB0035D4D6 /* EncryptionKeyStoreMock.swift */; };
B662D3DF275616FF0035D4D6 /* EncryptionKeyStoreMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = B662D3DD275613BB0035D4D6 /* EncryptionKeyStoreMock.swift */; };
B6656E122B29E3BE008798A1 /* DownloadListStoreMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = B693956026F1C1BC0015B914 /* DownloadListStoreMock.swift */; };
B6656E5B2B2ADB1C008798A1 /* RequestFilePermissionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6B5F5832B03580A008DB58A /* RequestFilePermissionView.swift */; };
B6676BE12AA986A700525A21 /* AddressBarTextEditor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6676BE02AA986A700525A21 /* AddressBarTextEditor.swift */; };
B6676BE22AA986A700525A21 /* AddressBarTextEditor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6676BE02AA986A700525A21 /* AddressBarTextEditor.swift */; };
B6685E3D29A602D90043D2EE /* ExternalAppSchemeHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = B687B7CB2947A1E9001DEA6F /* ExternalAppSchemeHandler.swift */; };
Expand Down Expand Up @@ -3042,13 +3041,6 @@
remoteGlobalIDString = AA585D7D248FD31100E9A3E2;
remoteInfo = "DuckDuckGo Privacy Browser";
};
565E46E32B2725DD0013AC2A /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = AA585D76248FD31100E9A3E2 /* Project object */;
proxyType = 1;
remoteGlobalIDString = AA585D7D248FD31100E9A3E2;
remoteInfo = "DuckDuckGo Privacy Browser";
};
7B4CE8DF26F02108009134B1 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = AA585D76248FD31100E9A3E2 /* Project object */;
Expand Down Expand Up @@ -4070,6 +4062,7 @@
B657841925FA484B00D8DB33 /* NSException+Catch.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSException+Catch.m"; sourceTree = "<group>"; };
B657841E25FA497600D8DB33 /* NSException+Catch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSException+Catch.swift"; sourceTree = "<group>"; };
B65CD8D42B316FCA00A595BB /* __Snapshots__ */ = {isa = PBXFileReference; lastKnownFileType = folder; path = __Snapshots__; sourceTree = "<group>"; };
B65CD8D72B341FD300A595BB /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
B65E6B9D26D9EC0800095F96 /* CircularProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircularProgressView.swift; sourceTree = "<group>"; };
B65E6B9F26D9F10600095F96 /* NSBezierPathExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSBezierPathExtension.swift; sourceTree = "<group>"; };
B66260DC29AC5D4300E9E3EE /* NavigationProtectionTabExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationProtectionTabExtension.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -4722,6 +4715,7 @@
373A1AA6283ECC8000586521 /* HTML */ = {
isa = PBXGroup;
children = (
B65CD8D72B341FD300A595BB /* README.md */,
373A1AA7283ED1B900586521 /* BookmarkHTMLReader.swift */,
373A1AAF2842C4EA00586521 /* BookmarkHTMLImporter.swift */,
);
Expand Down Expand Up @@ -8287,7 +8281,6 @@
buildRules = (
);
dependencies = (
565E46E42B2725DD0013AC2A /* PBXTargetDependency */,
);
name = SyncE2EUITests;
productName = DuckDuckGoSyncUITests;
Expand Down
5 changes: 2 additions & 3 deletions DuckDuckGo/DataImport/Bookmarks/HTML/BookmarkHTMLReader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ struct HTMLImportedBookmarks {
final class BookmarkHTMLReader {

struct ImportError: DataImportError {
// !! do not change the order
// cases 2,3 and 6 are reserved for removed errors
enum OperationType: Int {
case parseXml = 0
case validationBody = 1
// case validationH1
// case findTopLevelFolder
case proceedToTopLevelFolder = 4
case readFolder = 5
// case bookmarkRead
case unknown = 7
}

Expand Down
17 changes: 13 additions & 4 deletions DuckDuckGo/DataImport/Bookmarks/HTML/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,24 @@

```mermaid
graph TD
A[cursor = document root node] -->|validateHTMLBookmarksDocument| B[cursor = h1 tag]
A[cursor = document root node] -->|validateHTMLBookmarksDocument| B[cursor = first body child]
B --> C[determineImportSource<br>findTopLevelFolderNameNode]
C --> D[cursor => nextSibling]
C --> D{cursor.htmlTag}
D -->|`dl` tag| E[proceedToTopLevel<br>FolderNameNode]
E --> F[store cursor<br>cursor => firstChild]
F -->|`dd` tag| G[cursor => firstChild]
E --> E1[store cursor<br>cursor => firstChild]
E1 --> F{cursor.htmlTag}
F -->|`dd` tag| F1[cursor => firstChild]
F1 --> G{cursor.htmlTag}
G -->|`h3` tag| H[cursor = top level folder name<br>source = other]
G -->|other tag| G1[cursor => nextSibling]
G -->|`nil`| RET
G1 --> F
F -->|`dt` tag| I[restore cursor<br>no top level folder]
F -->|other tag| ERR
D -->|`h3` tag| J{isDDGBookmarks?}
D -->|other tag| NXT[cursor => nextSibling]
NXT --> D
D -->|`nil`| RET
I --> K{isDDGBookmarks?}
K -->|no| L[cursor = first item in folder<br>source = Safari]
K -->|yes| M[cursor = first item in folder<br>source = DDG WebKit]
Expand Down

0 comments on commit 27db74c

Please sign in to comment.