Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support iOS Syncing & Bookmarks #6722

Merged
merged 91 commits into from
Dec 1, 2020
Merged

Support iOS Syncing & Bookmarks #6722

merged 91 commits into from
Dec 1, 2020

Conversation

Brandon-T
Copy link
Contributor

@Brandon-T Brandon-T commented Sep 29, 2020

fix brave/brave-browser#12971

  • Adds support for iOS Sync chain with Brave Desktop.
  • Adds support for iOS Chromium bookmarks so we can sync them with Desktop.
  • Adds better compatibility with iOS and Chromium core in general.
  • All interfaces that are native to iOS must be explicitly exported with OBJC_EXPORT

Submitter Checklist:

Test Plan:

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

After-merge Checklist:

  • The associated issue milestone is set to the smallest version that the
    changes has landed on.
  • All relevant documentation has been updated.

Copy link
Collaborator

@kylehickinson kylehickinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super basic first pass, let me know if any of the nits I had conflict with Chromium guidelines

@@ -38,6 +38,7 @@ struct Interface: Hashable, Comparable {
/// The generated output of a this @interface
var generatedPublicInterface: String {
return """
OBJC_EXPORT
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file isn't even used anymore :) So this change can be removed. In fact, if you want you can completely delete objc-gen since its done by mojom now

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that should probably be a separate PR

@bsclifton bsclifton requested a review from jumde September 29, 2020 17:17
@Brandon-T Brandon-T force-pushed the ios-sync-brandon-bj branch 2 times, most recently from e733c17 to 839ff25 Compare October 2, 2020 16:42
@Brandon-T Brandon-T force-pushed the ios-sync-brandon-bj branch from 839ff25 to e5b94d0 Compare October 4, 2020 23:07
@@ -19,6 +20,7 @@ config("internal_config") {
"-Wno-objc-property-synthesis",
"-Wno-sign-compare",
]
ldflags = [ "-Wl,-no_compact_unwind" ]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is needed for rust, correct? If so, we should add a rust config and do configs += so we can better track what these are used for

@Brandon-T Brandon-T requested a review from a team as a code owner October 13, 2020 16:09
@Brandon-T Brandon-T force-pushed the ios-sync-brandon-bj branch from fc100ef to 5de403d Compare October 13, 2020 20:52
@Brandon-T Brandon-T mentioned this pull request Oct 15, 2020
33 tasks
@bsclifton bsclifton force-pushed the ios-sync-brandon-bj branch 3 times, most recently from c39a612 to be4340f Compare October 21, 2020 17:38
@bsclifton bsclifton force-pushed the ios-sync-brandon-bj branch from be4340f to 2123454 Compare October 22, 2020 17:46
@Brandon-T Brandon-T force-pushed the ios-sync-brandon-bj branch from 25eddb4 to b88668d Compare October 27, 2020 20:13
int64_t internal_value;
base::StringToInt64(time_string, &internal_value);
return Write(base::NumberToString(
base::Time::FromInternalValue(internal_value).ToTimeT()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diracdeltas this is code copied from upstream, I recommend we keep it as-is to avoid compatibility issues

BookmarkEncoder::~BookmarkEncoder() = default;

void BookmarkEncoder::UpdateChecksum(const std::string& str) {
base::MD5Update(&md5_context_, str);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

md5 is not secure against an attacker who can modify the input to it. it should be ok if it's only used here to check if some data has changed, not for a security-related check.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diracdeltas as with the other code I commented on, this is copied from upstream. In this case we should actually be using the original BookmarkCodec class as I mentioned above

GetApplicationContext()->GetChromeBrowserStateManager();
DCHECK(browserStateManager);

ChromeBrowserState* chromeBrowserState =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be passed in to the constructor

@@ -73,6 +73,8 @@ OBJC_EXPORT
@property(nonatomic, readonly) NSUInteger childCount;

- (nullable IOSBookmarkNode*)childAtIndex:(NSUInteger)index;
- (NSArray<BookmarkFolder*>*)nestedChildFoldersFiltered:(BOOL(^)(BookmarkFolder*))included
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not following what this is supposed to do. Filtered for what? Is there a similar method for android? I definitely think this method needs some comments or a name change because it's not intuitive what is going on here or why this is needed to prevent users from moving parent folders into child folders

@Brandon-T Brandon-T force-pushed the ios-sync-brandon-bj branch from 69353a2 to 46a8534 Compare December 1, 2020 18:17
Comment on lines +88 to +91
- (void)moveToParent:(nonnull IOSBookmarkNode*)parent;
- (void)moveToParent:(nonnull IOSBookmarkNode*)parent index:(NSUInteger)index;
- (NSInteger)indexOfChild:(nonnull IOSBookmarkNode*)child;
- (bool)hasAncestor:(nonnull IOSBookmarkNode*)parent;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant nonnull additions

args.enable_stripping = args.enable_dsyms
args.use_xcode_clang = this.isOfficialBuild()
args.enable_stripping = !this.isDebug()
args.use_xcode_clang = false
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an intentional change, right? Does the 1.15/1.16 forks have this change? Just want to make sure we don't end up having issues submitting to Apple

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is intentional. This is what Chromium does for Xcode 12.0+. I explicitly changed this to false for use_xcode_clang. I have not tested submitting to Apple's servers but it did pass verification locally.

@bridiver
Copy link
Collaborator

bridiver commented Dec 1, 2020

win had an unrelated intermittent failure

@bridiver bridiver merged commit f3ce528 into master Dec 1, 2020
@bridiver bridiver deleted the ios-sync-brandon-bj branch December 1, 2020 20:29
@bridiver bridiver added this to the 1.20.x - Nightly milestone Dec 1, 2020
@soner-yuksel soner-yuksel added CI/skip-android Do not run CI builds for Android CI/skip-linux CI/skip-macos-x64 Do not run CI builds for macOS x64 and removed CI/skip-android Do not run CI builds for Android CI/skip-linux CI/skip-macos-x64 Do not run CI builds for macOS x64 labels May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable brave sync on ios
9 participants