-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of github_p2p:p2p-org/key-app-android into fea…
…ture/PWN-8969-striga-sms-errors-handling � Conflicts: � app/src/main/java/org/p2p/wallet/smsinput/SmsInputFactory.kt
- Loading branch information
Showing
56 changed files
with
922 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
app/src/main/java/org/p2p/wallet/common/NavigationStrategy.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package org.p2p.wallet.common | ||
|
||
import androidx.fragment.app.Fragment | ||
import android.os.Bundle | ||
import android.os.Parcelable | ||
import kotlinx.parcelize.Parcelize | ||
import org.p2p.wallet.utils.popAndReplaceFragment | ||
import org.p2p.wallet.utils.popBackStackTo | ||
import org.p2p.wallet.utils.replaceFragment | ||
|
||
@Parcelize | ||
sealed class NavigationStrategy : Parcelable { | ||
|
||
companion object { | ||
const val ARG_NEXT_DESTINATION_CLASS = "ARG_NEXT_DESTINATION_CLASS" | ||
const val ARG_NEXT_DESTINATION_ARGS = "ARG_NEXT_DESTINATION_ARGS" | ||
const val ARG_NAVIGATION_STRATEGY = "ARG_NAVIGATION_STRATEGY" | ||
|
||
fun createNextDestination( | ||
nextDestinationClass: Class<Fragment>, | ||
nextDestinationArgs: Bundle? = null | ||
): Fragment { | ||
return nextDestinationClass.newInstance().apply { | ||
arguments = nextDestinationArgs | ||
} | ||
} | ||
} | ||
|
||
object Replace : NavigationStrategy() { | ||
override fun execute(sourceFragment: Fragment, destinationFragment: Fragment) { | ||
sourceFragment.replaceFragment(destinationFragment) | ||
} | ||
} | ||
|
||
@Parcelize | ||
data class PopAndReplace( | ||
val popTo: Class<out Fragment>? = null, | ||
val inclusive: Boolean = false | ||
) : Parcelable, NavigationStrategy() { | ||
override fun execute(sourceFragment: Fragment, destinationFragment: Fragment) { | ||
sourceFragment.popAndReplaceFragment( | ||
target = destinationFragment, | ||
popTo = popTo?.kotlin, | ||
inclusive = inclusive | ||
) | ||
} | ||
} | ||
|
||
@Parcelize | ||
data class PopBackStackTo( | ||
val popTo: Class<out Fragment>, | ||
val inclusive: Boolean = false | ||
) : Parcelable, NavigationStrategy() { | ||
override fun execute(sourceFragment: Fragment, destinationFragment: Fragment) { | ||
sourceFragment.popBackStackTo( | ||
target = popTo.kotlin, | ||
inclusive = inclusive | ||
) | ||
} | ||
} | ||
|
||
abstract fun execute(sourceFragment: Fragment, destinationFragment: Fragment) | ||
|
||
fun navigateNext( | ||
sourceFragment: Fragment, | ||
nextDestinationClass: Class<Fragment>, | ||
nextDestinationArgs: Bundle? = null | ||
) { | ||
val destination = createNextDestination(nextDestinationClass, nextDestinationArgs) | ||
execute(sourceFragment, destination) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...va/org/p2p/wallet/common/feature_toggles/toggles/remote/SwapRoutesRefreshFeatureToggle.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.p2p.wallet.common.feature_toggles.toggles.remote | ||
|
||
import java.util.concurrent.TimeUnit | ||
import org.p2p.wallet.common.feature_toggles.remote_config.RemoteConfigValuesProvider | ||
|
||
private const val DEFAULT_INTERVAL_IN_SECONDS = 20L | ||
|
||
class SwapRoutesRefreshFeatureToggle( | ||
valuesProvider: RemoteConfigValuesProvider | ||
) : LongFeatureToggle(valuesProvider) { | ||
override val featureKey: String = "swap_route_refresh" | ||
override val featureDescription: String = "The interval for refreshing routes" | ||
override val defaultValue: Long = DEFAULT_INTERVAL_IN_SECONDS | ||
|
||
val durationInMilliseconds: Long = TimeUnit.SECONDS.toMillis(value) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.