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

IOS-175: Remove CoreData status edit #1148

Merged
merged 4 commits into from
Nov 10, 2023
Merged

Conversation

kimar
Copy link
Contributor

@kimar kimar commented Nov 9, 2023

Rationale

This removes the persistence of StatusEdit, the history will be loaded ad-hoc now. This is part of the effort to improve performance and stability by removing CoreData usage.

@kimar kimar requested a review from zeitschlag November 9, 2023 12:28
@kimar kimar self-assigned this Nov 9, 2023
@kimar kimar changed the title IOS-175: Remove coredata status edit IOS-175: Remove CoreData status edit Nov 9, 2023
Copy link
Contributor

@zeitschlag zeitschlag left a comment

Choose a reason for hiding this comment

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

In general, it looks good and works like a charm. Good work! I was surprised that we spoke this morning and now you're already done with it 🚀


But when I was looking for an edited toot with an image to test, the app crashed. For text-toots, it works great!

Can you have a look at it, please? Is it me or is it reproducible? It seems to be connected to AutoLayout:

*** Assertion failure in -[NSLayoutConstraint _setSymbolicConstant:constant:symbolicConstantMultiplier:], NSLayoutConstraint.m:669
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSLayoutConstraint constant is not finite!  That's illegal.  constant:nan firstAnchor:<NSLayoutDimension:0x600001b5d740 "MastodonUI.MediaView:0x148952520.width"> secondAnchor:(null)'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001804658a8 __exceptionPreprocess + 172
	1   libobjc.A.dylib                     0x000000018005c09c objc_exception_throw + 56
	2   Foundation                          0x0000000180cf3a5c _userInfoForFileAndLine + 0
	3   CoreAutoLayout                      0x00000001ab198f90 -[NSLayoutConstraint _setSymbolicConstant:constant:symbolicConstantMultiplier:] + 524
	4   CoreAutoLayout                      0x00000001ab199220 -[NSLayoutConstraint setConstant:] + 92
	5   CoreAutoLayout                      0x00000001ab19ce98 +[NSLayoutConstraint constraintWithAnchor:relatedBy:toAnchor:multiplier:constant:] + 240
	6   MastodonSDKDynamic                  0x000000010596ad6c $s10MastodonUI22MediaGridContainerViewC14AdaptiveLayoutV6layout2in05mediaF0ySo6UIViewC_AA0cF0CtF + 1032
	7   MastodonSDKDynamic                  0x000000010596a734 $s10MastodonUI22MediaGridContainerViewC07dequeuecF014adaptiveLayoutAA0cF0CAC08AdaptiveI0V_tF + 196
	8   MastodonSDKDynamic                  0x0000000105a367f0 $s10MastodonUI10StatusViewC0D5ModelC9bindMedia33_9A0E1A4F330D94BF8B5B0F1C695DCBB9LL06statusD0yAC_tFySayAA0gD0C13ConfigurationCGcfU_ + 520
	9   Combine                             0x000000019dfecaa8 $s7Combine11SubscribersO4SinkC7receiveyAC6DemandVxF + 88
	10  Combine                             0x000000019dfed0c8 $s7Combine11SubscribersO4SinkCy_xq_GAA10SubscriberA2aGP7receiveyAC6DemandV5InputQzFTW + 20
	11  Combine                             0x000000019dff5e48 $s7Combine16PublishedSubjectC7ConduitC5offeryyxF + 416
	12  Combine                             0x000000019dff6a0c $s7Combine16PublishedSubjectC4sendyyxFyAA11ConduitBaseCyxs5NeverOGXEfU_TA + 40
	13  Combine                             0x000000019e02d87c $s7Combine11ConduitBaseCyxq_Gs5Error_pIggzo_ADsAE_pIegnzo_sAER_r0_lTRTA + 24
	14  libswiftCore.dylib                  0x000000018ca06044 $sSTsE7forEachyyy7ElementQzKXEKF + 440
	15  Combine                             0x000000019e02d2b0 $s7Combine11ConduitListO7forEachyyyAA0B4BaseCyxq_GKXEKF + 184
	16  Combine                             0x000000019dff59ac $s7Combine16PublishedSubjectC4sendyyxF + 224
	17  Combine                             0x000000019e014a3c $s7Combine9PublishedV18_enclosingInstance7wrapped7storagexqd___s24ReferenceWritableKeyPathCyqd__xGAHyqd__ACyxGGtcRld__CluisZ + 256
	18  MastodonSDKDynamic                  0x0000000105a1e048 $s10MastodonUI10StatusViewC0D5ModelC05mediaD14ConfigurationsSayAA05MediaD0C13ConfigurationCGvs + 136
	19  MastodonSDKDynamic                  0x0000000105a07bd4 $s10MastodonUI10StatusViewC14configureMedia33_17C84C4D4A5223A95C5264F9FCBF381ELL6statusy0A3SDK0A0O6EntityO0C4EditC_tF + 160
	20  MastodonSDKDynamic                  0x0000000105a032ac $s10MastodonUI10StatusViewC9configure6status0F4Edity13CoreDataStack0C0C_0A3SDK0A0O6EntityO0cG0CtF + 1644
	21  Mastodon                            0x000000010057c920 $s8Mastodon30StatusEditHistoryTableViewCellC9configure6status0iC08dateTexty13CoreDataStack0B0C_0A3SDKAAO6EntityO0bC0CSStF + 256
	22  Mastodon                            0x00000001006c18c0 $s8Mastodon31StatusEditHistoryViewControllerC9viewModelAcA0bcdeH0V_tcfcSo07UITableE4CellCSgSo0iE0C_10Foundation9IndexPathV0A3SDKAAO6EntityO0bC0CtcfU_ + 2312
	23  UIKitCore                           0x000000010855fe20 __swift_destroy_boxed_opaque_existential_1Tm + 21308
	24  UIKitCore                           0x00000001085658d8 block_destroy_helper + 1372
	25  UIKitCore                           0x0000000108562548 __swift_destroy_boxed_opaque_existential_1Tm + 31332
	26  UIKitCore                           0x00000001087bd53c -[__UIDiffableDataSource tableView:cellForRowAtIndexPath:] + 276
	27  UIKitCore                           0x000000010856091c __swift_destroy_boxed_opaque_existential_1Tm + 24120
	28  UIKitCore                           0x00000001085609c8 __swift_destroy_boxed_opaque_existential_1Tm + 24292
	29  UIKitCore                           0x00000001092c1fc4 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 1376
	30  UIKitCore                           0x0000000109295134 -[UITableView _updateVisibleCellsForRanges:createIfNecessary:] + 560
	31  UIKitCore                           0x000000010929574c -[UITableView _updateVisibleCellsNow:] + 1112
	32  UIKitCore                           0x00000001092af53c -[UITableView layoutSubviews] + 144
	33  UIKitCore                           0x00000001095aab1c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1492
	34  QuartzCore                          0x00000001884d3dd4 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 440
	35  UIKitCore                           0x000000010959a178 -[UIView(Hierarchy) layoutBelowIfNeeded] + 304
	36  UIKitCore                           0x00000001092a3440 -[UITableView reloadData] + 1332
	37  UIKitCore                           0x00000001092af4cc -[UITableView layoutSubviews] + 32
	38  UIKitCore                           0x00000001095aab1c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1492
	39  QuartzCore                          0x00000001884d3dd4 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 440
	40  UIKitCore                           0x000000010959a178 -[UIView(Hierarchy) layoutBelowIfNeeded] + 304
	41  UIKitCore                           0x00000001088dfd88 __66-[UINavigationController _updateBottomBarsForNavigationTransition]_block_invoke + 148
	42  UIKitCore                           0x000000010959fcf4 +[UIView(Animation) performWithoutAnimation:] + 68
	43  UIKitCore                           0x00000001088dfae4 -[UINavigationController _updateBottomBarsForNavigationTransition] + 212
	44  UIKitCore                           0x00000001088e003c -[UINavigationController _navigationBarWillBeginCoordinatedTransitionAnimations:] + 220
	45  UIKitCore                           0x0000000108689b80 -[UINavigationBar _sendNavigationBarAnimateTransition] + 68
	46  UIKitCore                           0x00000001086d95a0 __96-[_UINavigationBarVisualProviderModernIOS _performAnimationWithTransitionCompletion:transition:]_block_invoke_2 + 36
	47  UIKitCore                           0x00000001095a1138 +[UIView _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] + 500
	48  UIKitCore                           0x00000001086d93bc -[_UINavigationBarVisualProviderModernIOS _performAnimationWithTransitionCompletion:transition:] + 1660
	49  UIKitCore                           0x0000000108685f24 -[UINavigationBar _pushNavigationItem:transitionAssistant:] + 436
	50  UIKitCore                           0x00000001086858a4 -[UINavigationBar _pushNavigationItemUsingCurrentTransition:] + 140
	51  UIKitCore                           0x00000001086859ac -[UINavigationBar pushNavigationItem:animated:] + 160
	52  UIKitCore                           0x0000000108680dc0 -[UINavigationBar _performUpdatesIgnoringLock:] + 60
	53  UIKitCore                           0x0000000108685a78 -[UINavigationBar _pushNavigationItem:transition:] + 112
	54  UIKitCore                           0x00000001088db540 __71-[UINavigationController pushViewController:transition:forceImmediate:]_block_invoke_2 + 288
	55  UIKitCore                           0x00000001088db658 __71-[UINavigationController pushViewController:transition:forceImmediate:]_block_invoke_4 + 80
	56  UIKitCore                           0x00000001088d75e0 __98-[UINavigationController _shouldSkipHostedRefreshControlUpdateSchedulingDeferredUpdateIfNecessary]_block_invoke + 32
	57  UIKitCore                           0x00000001088d8a08 -[UINavigationController _startDeferredTransitionIfNeeded:] + 872
	58  UIKitCore                           0x00000001088d975c -[UINavigationController __viewWillLayoutSubviews] + 92
	59  UIKitCore                           0x00000001088c05c8 -[UILayoutContainerView la
libc++abi: terminating due to uncaught exception of type NSException

import Foundation
import MastodonSDK

extension Mastodon.Entity.StatusEdit: Hashable, Equatable {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason that you put this into an extension (and not in the same file as Mastodon.Entity.StatusEdit?

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 reason I did this is because it's aligned to other extensions of those entities, but I agree that this spreads code over different places and makes discoverability worse. I'll move it to the original file but leave it in a distinct extension to keep the model class simpler.

@kimar kimar requested a review from zeitschlag November 10, 2023 09:54
Copy link
Contributor

@zeitschlag zeitschlag left a comment

Choose a reason for hiding this comment

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

LGTM, doesn't crash anymore.

I'll open an issue for the cut-off images

Mastodon/Coordinator/SceneCoordinator.swift Show resolved Hide resolved
@kimar kimar merged commit 5c834c7 into develop Nov 10, 2023
1 check passed
@kimar kimar deleted the remove_coredata_statusEdit branch November 10, 2023 10:32
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