From 7c71910950d18868e1f419eed5234f113ee51776 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Thu, 15 Apr 2021 18:47:33 +0000 Subject: [PATCH] equality check for Profile --- .../net/ktnx/mobileledger/db/Profile.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/app/src/main/java/net/ktnx/mobileledger/db/Profile.java b/app/src/main/java/net/ktnx/mobileledger/db/Profile.java index 76d0e059..ebbf6dda 100644 --- a/app/src/main/java/net/ktnx/mobileledger/db/Profile.java +++ b/app/src/main/java/net/ktnx/mobileledger/db/Profile.java @@ -30,6 +30,7 @@ import net.ktnx.mobileledger.dao.AccountDAO; import net.ktnx.mobileledger.dao.DescriptionHistoryDAO; import net.ktnx.mobileledger.dao.OptionDAO; import net.ktnx.mobileledger.dao.TransactionDAO; +import net.ktnx.mobileledger.utils.Misc; @Entity(tableName = "profiles") public class Profile { @@ -195,6 +196,26 @@ public class Profile { public String toString() { return getName(); } + @Override + public boolean equals(@Nullable Object o) { + if (!(o instanceof Profile)) + return false; + Profile p = (Profile) o; + return id == p.id && Misc.equalStrings(name, p.name) && + Misc.equalStrings(deprecatedUUID, p.deprecatedUUID) && + Misc.equalStrings(url, p.url) && useAuthentication == p.useAuthentication && + Misc.equalStrings(authUser, p.authUser) && + Misc.equalStrings(authPassword, p.authPassword) && orderNo == p.orderNo && + permitPosting == p.permitPosting && theme == p.theme && + Misc.equalStrings(preferredAccountsFilter, p.preferredAccountsFilter) && + futureDates == p.futureDates && apiVersion == p.apiVersion && + showCommentsByDefault == p.showCommentsByDefault && + Misc.equalStrings(defaultCommodity, p.defaultCommodity) && + showCommentsByDefault == p.showCommentsByDefault && + detectedVersionPre_1_19 == p.detectedVersionPre_1_19 && + detectedVersionMajor == p.detectedVersionMajor && + detectedVersionMinor == p.detectedVersionMinor; + } @Transaction public void wipeAllDataSync() { OptionDAO optDao = DB.get() -- 2.39.5