-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from betterme-dev/develop
Develop
- Loading branch information
Showing
15 changed files
with
154 additions
and
63 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
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
36 changes: 0 additions & 36 deletions
36
rxbilling/src/main/java/com/gen/rxbilling/flow/FlowDelegate.kt
This file was deleted.
Oops, something went wrong.
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
13 changes: 13 additions & 0 deletions
13
rxbilling/src/main/java/com/gen/rxbilling/flow/delegate/ActivityFlowDelegate.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,13 @@ | ||
package com.gen.rxbilling.flow.delegate | ||
|
||
import android.app.Activity | ||
import android.app.PendingIntent | ||
import android.content.Intent | ||
|
||
class ActivityFlowDelegate(private val activity: Activity) : FlowDelegate { | ||
|
||
override fun startFlow(pendingIntent: PendingIntent, requestCode: Int) { | ||
activity.startIntentSenderForResult( | ||
pendingIntent.intentSender, requestCode, Intent(), 0, 0, 0) | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
rxbilling/src/main/java/com/gen/rxbilling/flow/delegate/ConductorFlowDelegate.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,13 @@ | ||
package com.gen.rxbilling.flow.delegate | ||
|
||
import android.app.PendingIntent | ||
import android.content.Intent | ||
import com.bluelinelabs.conductor.Controller | ||
|
||
class ConductorFlowDelegate(private val controller: Controller) : FlowDelegate { | ||
|
||
override fun startFlow(pendingIntent: PendingIntent, requestCode: Int) { | ||
controller.startIntentSenderForResult( | ||
pendingIntent.intentSender, requestCode, Intent(), 0, 0, 0, null) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
rxbilling/src/main/java/com/gen/rxbilling/flow/delegate/FlowDelegate.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,9 @@ | ||
package com.gen.rxbilling.flow.delegate | ||
|
||
import android.app.PendingIntent | ||
|
||
interface FlowDelegate { | ||
|
||
fun startFlow(pendingIntent: PendingIntent, requestCode: Int) | ||
} | ||
|
13 changes: 13 additions & 0 deletions
13
rxbilling/src/main/java/com/gen/rxbilling/flow/delegate/androidx/FragmentFlowDelegate.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,13 @@ | ||
package com.gen.rxbilling.flow.delegate.androidx | ||
|
||
import android.app.PendingIntent | ||
import android.content.Intent | ||
import com.gen.rxbilling.flow.delegate.FlowDelegate | ||
|
||
class FragmentFlowDelegate(private val fragment: androidx.fragment.app.Fragment) : FlowDelegate { | ||
|
||
override fun startFlow(pendingIntent: PendingIntent, requestCode: Int) { | ||
fragment.startIntentSenderForResult( | ||
pendingIntent.intentSender, requestCode, Intent(), 0, 0, 0, null) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
rxbilling/src/main/java/com/gen/rxbilling/flow/delegate/support/FragmentFlowDelegate.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,14 @@ | ||
package com.gen.rxbilling.flow.delegate.support | ||
|
||
import android.app.PendingIntent | ||
import android.content.Intent | ||
import android.support.v4.app.Fragment | ||
import com.gen.rxbilling.flow.delegate.FlowDelegate | ||
|
||
class FragmentFlowDelegate(private val fragment: Fragment) : FlowDelegate { | ||
|
||
override fun startFlow(pendingIntent: PendingIntent, requestCode: Int) { | ||
fragment.startIntentSenderForResult( | ||
pendingIntent.intentSender, requestCode, Intent(), 0, 0, 0, null) | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
rxbilling/src/main/java/com/gen/rxbilling/lifecycle/androidx/BillingConnectionManager.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,33 @@ | ||
package com.gen.rxbilling.lifecycle.androidx | ||
|
||
import androidx.lifecycle.Lifecycle | ||
import androidx.lifecycle.LifecycleObserver | ||
import androidx.lifecycle.OnLifecycleEvent | ||
import com.gen.rxbilling.lifecycle.Connectable | ||
import io.reactivex.disposables.Disposable | ||
import timber.log.Timber | ||
|
||
class BillingConnectionManager<T>( | ||
private val connectable: Connectable<T> | ||
) : LifecycleObserver { | ||
private var disposable: Disposable? = null | ||
|
||
@OnLifecycleEvent(Lifecycle.Event.ON_START) | ||
fun connect() { | ||
Timber.d("connect") | ||
disposable = connectable.connect() | ||
.subscribe({ | ||
Timber.d("$it") | ||
}, { | ||
Timber.e(it) | ||
}, { | ||
Timber.d("onComplete") | ||
}) | ||
} | ||
|
||
@OnLifecycleEvent(Lifecycle.Event.ON_STOP) | ||
fun disconnect() { | ||
Timber.d("disconnect") | ||
disposable?.dispose() | ||
} | ||
} |
8 changes: 5 additions & 3 deletions
8
...ing/lifecycle/BillingConnectionManager.kt → ...ifecycle/arch/BillingConnectionManager.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