Skip to content

Conversation

@mikehardy
Copy link
Member

The Google diff-match-patch library object we had copied has moved
on and been worked on since 2006 (!) - this externalizes the diff algorithm
only keeping the small part where we wrap it for HTML diff display

Also upgrade the ExifInterface to the current recommended androidx reference

Finally, de-lint a bit more since Base64 isn't used and others had easy fixes

This is a massive improvement in errors-detected-by-codacy and just in general a huge code deletion, which I like.

Worth noting this is the usual maven/gradle reference for this algorithm (and is better than we were doing at updating) but even it is out of date. I've raised an issue with them in case they want to update ever: https://bitbucket.org/cowwoc/google-diff-match-patch/issues/5/update-to-track-new-home-for-diff-match

The Google diff-match-patch library object we had copied has moved
on and been worked on since 2006 (!) - this externalizes the diff algorithm
only keeping the small part where we wrap it for HTML diff display

Also upgrade the ExifInterface to the current recommended androidx reference

Finally, de-lint a bit more since Base64 isn't used and others had easy fixes
StringBuilder prettyTyped = new StringBuilder();
StringBuilder prettyCorrect = new StringBuilder();
for (DiffAction aDiff : diff_main(typed, correct)) {
for (DiffMatchPatch.Diff aDiff : diffMatchPatch.diffMain(typed, correct)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This method (and it's supporting methods) are the only ones in the whole file that wasn't a copy, so I kept it and just replaced the underlying diff calls with calls to the external version of the implementation

@mikehardy
Copy link
Member Author

Just leaving this as a link - there's some hope the original author will (re-)mavenize so the official upstream can be a gradle dependency google/diff-match-patch#2

@timrae timrae merged commit b4361f4 into ankidroid:master Nov 24, 2018
@mikehardy mikehardy deleted the external-diff-match-patch branch November 24, 2018 04:22
@mikehardy
Copy link
Member Author

My upstream request on this dependency for a resync with the official source received action, so this will be a dependency update in a day or so, making this a win I think - less code that we are maintaining, and the external dependency has a responsive maintainer. 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants