Skip to content
This repository was archived by the owner on Oct 2, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Data/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ android {
versionName rootProject.ext.versionName


buildConfigField "String", "AWS_CREDENTIALS_URL_PROD", "\"https://eynmuj2g26.execute-api.eu-west-1.amazonaws.com/prod/iot/keys\""
// buildConfigField "String", "AWS_CREDENTIALS_URL_PROD", "\"https://eynmuj2g26.execute-api.eu-west-1.amazonaws.com/prod/iot/keys\""
buildConfigField "String", "AWS_CREDENTIALS_URL_PROD", "\"https://notifications.inplayer.com/iot/keys\""

buildConfigField "String", "AWS_CREDENTIALS_URL_STAGING", "\"https://o3871l8vj7.execute-api.eu-west-1.amazonaws.com/staging/iot/keys\""
// buildConfigField "String", "AWS_CREDENTIALS_URL_STAGING", "\"https://o3871l8vj7.execute-api.eu-west-1.amazonaws.com/staging/iot/keys\""
buildConfigField "String", "AWS_CREDENTIALS_URL_STAGING", "\"https://staging-notifications.inplayer.com/iot/keys\""
}

buildTypes {
Expand Down
51 changes: 25 additions & 26 deletions Data/src/main/java/com/sdk/data/remote/AccountRemoteImpl.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.sdk.data.remote

import com.sdk.data.model.ResponseModel
import com.sdk.data.model.account.InPlayerAccount
import com.sdk.data.model.account.InPlayerAuthorizationModel
import com.sdk.data.model.account.InPlayerRegisterFieldsModel
Expand All @@ -15,7 +14,7 @@ class AccountRemoteImpl constructor(
private val inPlayerRemoteProvider: InPlayerRemoteServiceAPI,
private val inPlayerRemotePublicServiceAPI: InPlayerRemotePublicServiceAPI
) : AccountRemote {

/**
* API's that are public and don't require Auth Token in their Header, should be calling the
* InPlayerRemotePublicProvider
Expand All @@ -31,14 +30,14 @@ class AccountRemoteImpl constructor(
grantType = grantType.toLowerCase(),
clientId = clientId
)

override fun refreshToken(refreshToken: String, grantType: String, clientId: String) =
inPlayerRemotePublicServiceAPI.authenticate(
refreshToken = refreshToken,
grantType = grantType,
clientId = clientId
)

override fun authenticateWithClientSecret(
clientSecret: String,
grantType: String,
Expand All @@ -62,11 +61,11 @@ class AccountRemoteImpl constructor(
brandingId: Int?
): Single<InPlayerAuthorizationModel> {
var updatedMetadataMap = hashMapOf<String, String>()

metadata?.forEach {
updatedMetadataMap["metadata[${it.key}]"] = it.value
}

return inPlayerRemotePublicServiceAPI.createAccount(
fullName,
email,
Expand All @@ -88,69 +87,69 @@ class AccountRemoteImpl constructor(
inPlayerRemotePublicServiceAPI.forgotPassword(merchantUUID, email, brandingId)

override fun getSocialUrls(state: String): Single<ArrayList<HashMap<String, String>>> {
return inPlayerRemoteProvider.getSocialUrls(state).map {
return inPlayerRemotePublicServiceAPI.getSocialUrls(state).map {
it.socialUrls
}
}

override fun sendPinCode(brandingId: Int?): Completable {
return inPlayerRemoteProvider.sendPinCode(brandingId)
}

override fun validatePinCode(pinCode: String): Completable {
return inPlayerRemoteProvider.validatePinCode(pinCode)
}

/**
* END
* */


/**
* API's that are NOT public and require Auth Token in their Header, should be calling the
* InPlayerRemoteProvider
* */

override fun accountDetails() = inPlayerRemoteProvider.getAccount()

override fun getRegisterFields(merchantUUID: String): Single<List<InPlayerRegisterFieldsModel>> {
return inPlayerRemotePublicServiceAPI.exportRegisterFields(merchantUUID).map {
it.collection
}
}

override fun exportUserData(password: String, brandingId: Int?) =
inPlayerRemoteProvider.exportAccountData(password, brandingId)


override fun updateAccount(
fullName: String,
metadata: HashMap<String, String>?
): Single<InPlayerAccount> {

var updatedMetadataMap = hashMapOf<String, String>()

metadata?.forEach {
updatedMetadataMap["metadata[${it.key}]"] = it.value
}

return inPlayerRemoteProvider.updateAccount(fullName, updatedMetadataMap)
}

override fun changePassword(
newPassword: String,
newPasswordConfirmation: String,
oldPassword: String,
brandingId: Int?
) = inPlayerRemoteProvider.changePassword(newPassword, newPasswordConfirmation, oldPassword, brandingId)

override fun logOut() = inPlayerRemoteProvider.logout()

override fun eraseUser(password: String, brandingId: Int?) = inPlayerRemoteProvider.eraseAccount(password, brandingId)

/**
* END
* */


}
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,7 @@ class InPlayerRemoteProvider(


override fun exportAccountData(password: String, brandingId: Int?) = retrofitAPI.exportAccountData(password, brandingId)

override fun getSocialUrls(socialUrlState: String) = retrofitAPI.getSocialUrls(socialUrlState)


override fun validatePinCode(pinCode: String) = retrofitAPI.validatePinCode(pinCode)

override fun sendPinCode(brandingId: Int?) = retrofitAPI.sendPinCode(brandingId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,7 @@ class InPlayerRemotePublicProvider(val baseUrl: String, val isDebug: Boolean) :

override fun exportRegisterFields(merchantUUID: String) =
retrofitAPI.exportRegisterFields(merchantUUID)


override fun getSocialUrls(socialUrlState: String) = retrofitAPI.getSocialUrls(socialUrlState)

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.sdk.data.model.CollectionModel
import com.sdk.data.model.ResponseModel
import com.sdk.data.model.account.InPlayerAuthorizationModel
import com.sdk.data.model.account.InPlayerRegisterFieldsModel
import com.sdk.data.model.account.InPlayerSocialUrlsReponse
import com.sdk.data.model.asset.AccessFeeModel
import com.sdk.data.model.asset.ItemDetailsModel
import io.reactivex.Completable
Expand Down Expand Up @@ -80,4 +81,7 @@ interface InPlayerRemotePublicServiceAPI {

@GET("/accounts/register-fields/{merchant_uuid}")
fun exportRegisterFields(@Path("merchant_uuid") merchantUUID: String): Single<CollectionModel<InPlayerRegisterFieldsModel>>

@GET("/accounts/social")
fun getSocialUrls(@Query("state") socialUrlState: String): Single<InPlayerSocialUrlsReponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ import com.sdk.data.model.CollectionModel
import com.sdk.data.model.ResponseListModel
import com.sdk.data.model.ResponseModel
import com.sdk.data.model.account.InPlayerAccount
import com.sdk.data.model.account.InPlayerSocialUrlsReponse
import com.sdk.data.model.asset.ItemAccessModel
import com.sdk.data.model.notification.AWSCredentialsModel
import com.sdk.data.model.payment.CustomerAccessItemModel
import com.sdk.data.model.subscription.SubscriptionModel
import io.reactivex.Completable
import io.reactivex.Single
import retrofit2.http.*
import java.util.*

interface InPlayerRemoteServiceAPI {

Expand Down Expand Up @@ -67,10 +65,6 @@ interface InPlayerRemoteServiceAPI {
@Query("type") type: String?
): Single<ResponseListModel<CustomerAccessItemModel>>


@GET("/accounts/social")
fun getSocialUrls(@Query("state") socialUrlState: String): Single<InPlayerSocialUrlsReponse>

@FormUrlEncoded
@POST("/v2/accounts/pin-codes/validate")
fun validatePinCode(@Field("pin_code") pinCode: String): Completable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class InPlayerAccountRepositoryImpl constructor(

val jsonObject = JSONObject()
jsonObject.put("client_id", clientId)
jsonObject.put("redirect", "viktor.inplayer://")
jsonObject.put("redirect", redirectUri)

val base64 = Base64.encodeToString(jsonObject.toString().toByteArray(), Base64.DEFAULT)

Expand Down
14 changes: 14 additions & 0 deletions Example/src/main/java/com/inplayersdk/ApiTestingActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ class ApiTestingActivity : AppCompatActivity() {
getSubscriptions()
}

btn_get_social_urls.setOnClickListener {
InPlayer.Account.getSocialLoginUrls(
"https://event.inplayer.com/v3/live?asset=3062620&asset_id=3062620&access_control_type=Paid",
InPlayerCallback { socialUrlsList, error ->
if (error == null) {

Log.v("SocialLoginUrls Call", "---Success-- $socialUrlsList")
} else {
//Handle Error
Log.w("SocialLoginUrls Call", error.toString())
}
})
}

btn_refresh_token.setOnClickListener {
InPlayer.Account.refreshToken(
"def502001db88c34f019e16044833a8898158cf59f520b80bbf81a43fa8fa1b2f7c83dcb0de90d59d0058a143fc1043d956e204558703cf8ca022e45c19f7f51e00c77d98a75d19be8c335c9fd40e176feb021b0e923a5216157d74b6f1c3a869cc7b695929dd5945d188e0b73d1b5329870e3b2d7c50011d7f0fcaa8ae81f9df48039a78188c3bd6acadbab9025a53e4d9fb18b3e3808f63a37c4b42cfd581b383b87852261e7fdf79b2697361b28adaeaf8bea34f0ef11b72c1d36f894c2368f0fedae1f69ceaa2484af39d6c6e17b021c4627104ee930e7c92989937b57142b67106f4b74be0d1f7a0e15c8785a272aa34307f7a95b922a87e88859cf8b011f4074fccf988f1de0110e239f657a5f8a5a3c490dc052f40b186da17017a96fec2670a21d887ce91165ed04c3aaad51a508843d58c70463e6c2b58f3919581eef9909b8013715d59fdf67c10b358681e45ac01ad855537a4a966c22a9b418e1ccc6107768b97dbddfb3427b18e3205111caf53eac530601141254f67bf245f9c3a15ba9010e0425c1f5e942b0a49e76e8d71511a79b7b9fb2e233075173daa0585be7bce89921601e"
Expand Down