matthiasemde / musikus-android

Your personal practice companion
Other
17 stars 2 forks source link

Revamp Permission handling #51

Open matthiasemde opened 6 months ago

matthiasemde commented 6 months ago

Add ui support for notification permissions. Figure out how the active session should react when notification permissions are not granted (probably display a dialog like the recorder does)

mipro98 commented 5 months ago

Apparently this leads to a crash on saving, if denied.

EDIT: crash does not happen on API 34, confirmed to happen on API 33:

FATAL EXCEPTION: main
    Process: app.musikus, PID: 4587
    java.lang.IllegalArgumentException: List has more than one element.
        at kotlin.collections.CollectionsKt___CollectionsKt.single(_Collections.kt:610)
        at app.musikus.usecase.library.GetLastPracticedDateUseCase$invoke$$inlined$map$1$2.emit(Emitters.kt:243)
        at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
        at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
        at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:87)
        at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:66)
        at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:37)
        at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
        at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Unknown Source:14)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
        at android.os.Handler.handleCallback(Handler.java:942)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7872)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
        Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@688602c, Dispatchers.Main.immediate]

EDIT2:

Does not seem to have something to do with permissions i think, more with an error in GetLastPracticedDateUseCase -> #67