Skip to content

Commit

Permalink
identity V3: public facing changes (#252)
Browse files Browse the repository at this point in the history
* added deprecation notices

* removed internal modifiers to make logIn and logOut public

* updated ReplaceWith declarations

* fixed missing closing bracket in replaceWith

* made logInWith and logOutWith public

* removed @Jvmsynthetic since they're not needed anymore for logIn and logOut
  • Loading branch information
aboedo authored Jul 15, 2021
1 parent eed77c4 commit f4ff618
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
19 changes: 15 additions & 4 deletions purchases/src/main/kotlin/com/revenuecat/purchases/Purchases.kt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ class Purchases @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) intern
* default. If true treats all purchases as restores, aliasing together appUserIDs that share a
* Play Store account.
*/

@Deprecated(
"Replaced with configuration in the RevenueCat dashboard",
ReplaceWith("configure through the RevenueCat dashboard")
)
var allowSharingPlayStoreAccount: Boolean
@Synchronized get() =
state.allowSharingPlayStoreAccount ?: identityManager.currentUserIsAnonymous()
Expand Down Expand Up @@ -700,6 +705,10 @@ class Purchases @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) intern
* @param newAppUserID The new appUserID that should be linked to the currently user
* @param [listener] An optional listener to listen for successes or errors.
*/
@Deprecated(
"Use logIn instead",
ReplaceWith("Purchases.sharedInstance.logIn(newAppUserID, LogInCallback?)")
)
@JvmOverloads
fun identify(
newAppUserID: String,
Expand Down Expand Up @@ -728,8 +737,7 @@ class Purchases @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) intern
* @param [callback] An optional listener to listen for successes or errors.
*/
@JvmOverloads
@JvmSynthetic
internal fun logIn(
fun logIn(
newAppUserID: String,
callback: LogInCallback? = null
) {
Expand Down Expand Up @@ -762,8 +770,7 @@ class Purchases @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) intern
* @param [listener] An optional listener to listen for successes or errors.
*/
@JvmOverloads
@JvmSynthetic
internal fun logOut(listener: ReceivePurchaserInfoListener? = null) {
fun logOut(listener: ReceivePurchaserInfoListener? = null) {
val error: PurchasesError? = identityManager.logOut()
if (error != null) {
listener?.onError(error)
Expand All @@ -781,6 +788,10 @@ class Purchases @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) intern
* id and save it in the cache.
* @param [listener] An optional listener to listen for successes or errors.
*/
@Deprecated(
"Use logOut instead",
ReplaceWith("Purchases.sharedInstance.logOut(ReceivePurchaserInfoListener?)")
)
@JvmOverloads
fun reset(
listener: ReceivePurchaserInfoListener? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ fun Purchases.identifyWith(
* @param [onError] Will be called after the call has completed with an error.
*/
@Suppress("unused")
internal fun Purchases.logInWith(
fun Purchases.logInWith(
appUserID: String,
onError: ErrorFunction = ON_ERROR_STUB,
onSuccess: ReceiveLogInSuccessFunction
Expand All @@ -348,7 +348,7 @@ internal fun Purchases.logInWith(
* @param [onError] Will be called after the call has completed with an error.
*/
@Suppress("unused")
internal fun Purchases.logOutWith(
fun Purchases.logOutWith(
onError: ErrorFunction = ON_ERROR_STUB,
onSuccess: ReceivePurchaserInfoSuccessFunction
) {
Expand Down

0 comments on commit f4ff618

Please sign in to comment.