fyi that there seems to be issue with latest code ...
# confetti
j
fyi that there seems to be issue with latest code when running as "My Mac Designed for iPad")....it starts up but is stuck on spinner. Will try to investigate later.
👍 2
@Arkadii Ivanov I've narrowed it down to changes where Decompose was added to iOS code....I'll try to dig deeper tomorrow but just in case you might spot what could be cause
this is what I see in Xcode btw
Copy code
LSPrefs: could not find untranslocated node for <FSNode 0x600003edc160> { isDir = ?, path = '/private/var/folders/km/nnzy6qg173nf385_d4v23j780000gn/X/58C08EF1-887C-5E43-A821-C3CCF2FAB48E/d/Wrapper/Confetti.app' }, proceeding on the assumption it is not translocated: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"
a
First time I see this error. Let me know how it goes or if you need any help.
j
No luck so far.....is there basic decompose sample I can try to reproduce this with?
could be those errors above are unrelated....
j
getting similar logs in console for that but seems to be working fine...
a
The error "stuck on spinner" looks more like a runtime issue. Maybe some logging could help? Let me know if you need any help.
j
I put more logging in.....I don't seem to be getting response back from server for some reason in this case (wouldn't seem like something use of Decompose would affect so strange that it started happening with those changes). @mbonnin is there way to enable more detailed logging on apolllo side of things?
m
We don't have logs in Apollo Kotlin because of https://publicobject.com/2022/05/01/eventlisteners-are-good/
What I do to debug those issues is add an OkHttpLoggingInterceptor
Or run through a proxy (but most of the times OkHttpLoggingInterceptor is easier)
j
Never seems to go in this block for some reason (in
SessionsCompont
)
Copy code
// get initial data 
coroutineScope {
    val bookmarksResponse = async {
        repository.bookmarks(conference, user?.uid, user, fetchPolicy).first()
    }

    val sessionsResponse = async {
        repository.conferenceData(conference, fetchPolicy)
    }
     ResponseData(bookmarksResponse.await(), sessionsResponse.await())
}.also {
    emit(it)
}
that
coroutineScope
is coming from DecomposeUtils btw
hmm, or actually not in that particular code.....had seen
private val coroutineScope = coroutineScope()
in the class earlier
a
Maybe something wrong with lifecycle?
j
hmm, I see
didBecomeActiveNotification
when running in ios simulator but not when running on "My Mac"
if I force call to
LifecycleRegistryExtKt.resume(appDelegate.lifecycle)
then I see data
a
Thanks for confirming! This looks like the issue.
Interesting!
j
The other thing with latest code is that we're not showing the list/detail views we previously did on iPad/My Mac.....think this was due to way NavigationView was used before....anyway, I'll take a look at that separately
🤔 1
this is what it looked like before
@Arkadii Ivanov I haven't had chance to look any more in to this.....just in case you spotted anything or might know some things to look out for?
I guess we could hook in to some other lifecycle callback to trigger that call....
a
Sorry, haven't looked into this yet. I would try googling, this should be a known issue! But I'm AFK currently.
Somehow that documentation showcases another way of plumbing the lifecycle. I.e. the Decompose sample uses the same approach as Confetti.
I found the Confetti's way much cleaner, e.g. lifecycle.destory is called in the same place, not in the holder's deinit section. And then I reused this approach in the Decompose sample. But the docs have been staying unchanged.
j
cool, will try that
👍 1
a
Let me know how it goes
j
tried what's in the docs but not helping so far....
LifecycleRegistryExtKt.create
is called in
RootHolder
but
LifecycleRegistryExtKt.resume
isn't getting invoked then in App class
if I also call
resume
in
RootHolder
then it works
That's mac catalyst issue, seems like
j
so that requires separate
SceneDelegate
class?
a
I'm not sure 🫣
As a workaround, you can just call resume (instead of create), and then destroy (not onDestroy) in deinit .
👍 1
Maybe there is a way to check for mac catalyst at runtime, and either use the workaround or properly call lifecycle events on signals.
j
btw also looking at using
TabView
again....seems like something like following is working....but might be other issues
Copy code
VStack {
    let child = stack.active.instance
    
    TabView(selection: $selectedTab) {
        ChildView(child: child).tabItem {
            Label("Schedule", systemImage: "calendar")
        }.tag(1)
        ChildView(child: child).tabItem {
            Label("Speakers", systemImage: "person")
        }.tag(2)
    }
    .onChange(of: selectedTab) { selectedTab in
        switch selectedTab {
        case 1: component.onSessionsTabClicked()
        case 2: component.onSpeakersTabClicked()
        default: print("unhandled selection")
        }
    }
}
a
Why do you need TabView? I remember there are tabs implemented already, aren't they?
The thing is that TabView manages navigation on its own. Ideally, Decompose should be source of truth for navigation. You can mirror the navigation state via TabView's
selection
Binding argument, seems like this is what you are doing in the snippet above. But I'm not sure how is it better than the current approach. It should look and feel the same.
j
I think you get more native look and feel with TabView rather than what we have right now.....though that could be fixed probably. Just generally prefer using native UI components like this if possible.....and seems like we can still hook in to same decompose component apis for navigation etc taking this approach
👍 1
a
Please double check that you are not rendering a tab multiple times simultaneously. I suspect that both views are initialized eagerly. The same issue was with SwiftUI stack navigation, before NavigationStack was introduced.
The default navigation approaches in SwiftUI are far from ideal, as per my perception. So personally, I tend to use passive components as much as I can.
j
I was also seeing if I could still use
NavigationStack
etc so would get automatic list/detail split on MyMac/iiPad layout but no luck so far