-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
67 additions
and
0 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
5 changes: 5 additions & 0 deletions
5
core/navigator/src/main/java/team/ppac/navigator/RegisterNavigator.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,5 @@ | ||
package team.ppac.navigator | ||
|
||
import team.ppac.navigator.base.Navigator | ||
|
||
interface RegisterNavigator : Navigator |
17 changes: 17 additions & 0 deletions
17
feature/register/src/main/java/team/ppac/register/di/RegisterNavigatorModule.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,17 @@ | ||
package team.ppac.register.di | ||
|
||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.components.ActivityComponent | ||
import dagger.hilt.android.scopes.ActivityScoped | ||
import team.ppac.navigator.RegisterNavigator | ||
import team.ppac.register.navigator.RegisterNavigatorImpl | ||
|
||
@Module | ||
@InstallIn(ActivityComponent::class) | ||
internal abstract class RegisterNavigatorModule { | ||
@Binds | ||
@ActivityScoped | ||
abstract fun bindRegisterNavigator(impl: RegisterNavigatorImpl): RegisterNavigator | ||
} |
37 changes: 37 additions & 0 deletions
37
feature/register/src/main/java/team/ppac/register/navigator/RegisterNavigatorImpl.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,37 @@ | ||
package team.ppac.register.navigator | ||
|
||
import android.app.Activity | ||
import android.content.Context | ||
import android.content.Intent | ||
import androidx.activity.result.ActivityResultLauncher | ||
import team.ppac.common.android.extension.getIntent | ||
import team.ppac.navigator.RegisterNavigator | ||
import team.ppac.register.RegisterActivity | ||
import javax.inject.Inject | ||
|
||
class RegisterNavigatorImpl @Inject constructor() : RegisterNavigator { | ||
override fun navigateFrom( | ||
activity: Activity, | ||
intentBuilder: Intent.() -> Intent, | ||
withFinish: Boolean | ||
) { | ||
activity.startActivity(activity.getIntent<RegisterActivity>(intentBuilder)) | ||
if (withFinish) activity.finish() | ||
} | ||
|
||
override fun navigateResultLauncher( | ||
launcher: ActivityResultLauncher<Intent>, | ||
activity: Activity, | ||
intentBuilder: Intent.() -> Intent | ||
) { | ||
launcher.launch(activity.getIntent<RegisterActivity>(intentBuilder)) | ||
} | ||
|
||
override fun navigateResultLauncher( | ||
launcher: ActivityResultLauncher<Intent>, | ||
context: Context, | ||
intentBuilder: Intent.() -> Intent | ||
) { | ||
launcher.launch(context.getIntent<RegisterActivity>(intentBuilder)) | ||
} | ||
} |