Skip to content

Commit

Permalink
Merge pull request #530 from gini/PP-689_Atruvia-Accessibility---Land…
Browse files Browse the repository at this point in the history
…scape_Problem

Pp 689 atruvia accessibility   landscape problem
  • Loading branch information
GeraltRiv authored Aug 14, 2024
2 parents 2bc2f35 + 25fcef6 commit 8e8aedf
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.gini.android.bank.sdk.capture

import android.content.pm.ActivityInfo
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
Expand Down Expand Up @@ -29,6 +30,7 @@ import net.gini.android.capture.GiniCaptureFragmentDirections
import net.gini.android.capture.GiniCaptureFragmentListener
import net.gini.android.capture.camera.CameraFragmentListener
import net.gini.android.capture.internal.util.CancelListener
import net.gini.android.capture.internal.util.ContextHelper
import net.gini.android.capture.network.model.GiniCaptureCompoundExtraction
import net.gini.android.capture.network.model.GiniCaptureSpecificExtraction
import net.gini.android.capture.tracking.useranalytics.UserAnalytics
Expand Down Expand Up @@ -110,7 +112,7 @@ class CaptureFlowFragment(private val openWithDocument: Document? = null) :
override fun onDestroy() {
super.onDestroy()
if (!didFinishWithResult && !willBeRestored) {
captureFlowFragmentListener.onFinishedWithResult(CaptureResult.Cancel)
finishWithResult(CaptureResult.Cancel)
}
}

Expand Down Expand Up @@ -159,14 +161,13 @@ class CaptureFlowFragment(private val openWithDocument: Document? = null) :
}

else -> {
finishWithResult(result)
finishWithResult(interceptSuccessResult(result).toCaptureResult())
}
}
}

else -> {
didFinishWithResult = true
captureFlowFragmentListener.onFinishedWithResult(result.toCaptureResult())
finishWithResult(result.toCaptureResult())
}
}
}
Expand Down Expand Up @@ -195,16 +196,17 @@ class CaptureFlowFragment(private val openWithDocument: Document? = null) :
GiniCaptureFragmentDirections.toSkontoFragment(data = skontoData)
)
} catch (e: Exception) {
finishWithResult(result)
finishWithResult(interceptSuccessResult(result).toCaptureResult())
}
} else {
finishWithResult(result)
}
}

private fun finishWithResult(result: CaptureSDKResult.Success) {
private fun finishWithResult(result: CaptureResult) {
if (!ContextHelper.isTablet(requireContext())) {
requireActivity().requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
}
didFinishWithResult = true
captureFlowFragmentListener.onFinishedWithResult(interceptSuccessResult(result).toCaptureResult())
captureFlowFragmentListener.onFinishedWithResult(result)
trackSdkClosedEvent(UserAnalyticsScreen.Analysis)
}

Expand Down Expand Up @@ -237,37 +239,30 @@ class CaptureFlowFragment(private val openWithDocument: Document? = null) :
specificExtractions: Map<String, GiniCaptureSpecificExtraction>,
compoundExtractions: Map<String, GiniCaptureCompoundExtraction>
) {
didFinishWithResult = true
captureFlowFragmentListener.onFinishedWithResult(
CaptureResult.Success(
specificExtractions,
compoundExtractions,
emptyList()
)
)
finishWithResult(CaptureResult.Success(
specificExtractions,
compoundExtractions,
emptyList()
))
}


override fun onPayInvoiceWithSkonto(
specificExtractions: Map<String, GiniCaptureSpecificExtraction>,
compoundExtractions: Map<String, GiniCaptureCompoundExtraction>
) {
didFinishWithResult = true
captureFlowFragmentListener.onFinishedWithResult(
CaptureResult.Success(
specificExtractions,
compoundExtractions,
emptyList()
)
)
finishWithResult(CaptureResult.Success(
specificExtractions,
compoundExtractions,
emptyList()
))
}


override fun onCancelFlow() {
val popBackStack = navController.popBackStack()
if (!popBackStack) {
didFinishWithResult = true
captureFlowFragmentListener.onFinishedWithResult(CaptureResult.Cancel)
finishWithResult(CaptureResult.Cancel)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal class BufferedUserAnalyticsEventTracker(
private val userProperties: Queue<Set<UserAnalyticsUserProperty>> = LinkedList()
private val events: Queue<Pair<UserAnalyticsEvent, Set<UserAnalyticsEventProperty>>> =
LinkedList()
private lateinit var amplitude: AmplitudeUserAnalyticsEventTracker
private var amplitude: AmplitudeUserAnalyticsEventTracker? = null

fun setPlatformTokens(
vararg tokens: UserAnalytics.AnalyticsApiKey,
Expand All @@ -46,8 +46,8 @@ internal class BufferedUserAnalyticsEventTracker(
networkRequestsManager = networkRequestsManager,
uniqueIdProvider = uniqueIdProvider
)
amplitude.startRepeatingJob()
eventTrackers.add(amplitude)
amplitude?.startRepeatingJob()
amplitude?.let { eventTrackers.add(it) }

LOG.debug("Amplitude Initialized")
}
Expand Down Expand Up @@ -90,7 +90,7 @@ internal class BufferedUserAnalyticsEventTracker(
}

override fun flushEvents() {
amplitude.flushEvents()
amplitude?.flushEvents()
}

private fun trySendEvents() {
Expand Down

0 comments on commit 8e8aedf

Please sign in to comment.