-
Notifications
You must be signed in to change notification settings - Fork 2
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 #20 from TrustlyInc/DEV-233807-choose_webview_inap…
…pbrowser [DEV-233807] Choose between webview and inappbrowser
- Loading branch information
Showing
24 changed files
with
770 additions
and
172 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
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
57 changes: 11 additions & 46 deletions
57
trustly-android-sdk/.idea/sonarlint/securityhotspotstore/index.pb
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
14 changes: 14 additions & 0 deletions
14
trustly-android-sdk/src/main/java/net/trustly/android/sdk/data/APIMethod.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 net.trustly.android.sdk.data | ||
|
||
import retrofit2.Call | ||
import retrofit2.http.GET | ||
import retrofit2.http.Query | ||
|
||
interface APIMethod { | ||
|
||
@GET("frontend/mobile/setup") | ||
fun getSettings( | ||
@Query("token") token: String | ||
): Call<Settings> | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
trustly-android-sdk/src/main/java/net/trustly/android/sdk/data/APIRequest.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,26 @@ | ||
package net.trustly.android.sdk.data | ||
|
||
import android.util.Log | ||
import retrofit2.Call | ||
import retrofit2.Callback | ||
import retrofit2.Response | ||
|
||
class APIRequest(private val apiInterface: APIMethod, private val settings: (Settings) -> Unit, private val error: (String) -> Unit) { | ||
|
||
fun getSettingsData(token: String) { | ||
apiInterface.getSettings(token).enqueue(object : Callback<Settings> { | ||
override fun onResponse(call: Call<Settings>, response: Response<Settings>) { | ||
if (response.isSuccessful && response.body() != null) { | ||
Log.d("APIRequestNew", response.body().toString()) | ||
settings.invoke(response.body() as Settings) | ||
} | ||
} | ||
|
||
override fun onFailure(call: Call<Settings>, t: Throwable) { | ||
Log.e("APIRequestNew", t.message.toString()) | ||
error.invoke(t.message.toString()) | ||
} | ||
}) | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
trustly-android-sdk/src/main/java/net/trustly/android/sdk/data/RetrofitInstance.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,22 @@ | ||
package net.trustly.android.sdk.data | ||
|
||
import net.trustly.android.sdk.BuildConfig | ||
import okhttp3.OkHttpClient | ||
import okhttp3.logging.HttpLoggingInterceptor | ||
import retrofit2.Retrofit | ||
import retrofit2.converter.gson.GsonConverterFactory | ||
|
||
|
||
object RetrofitInstance { | ||
|
||
fun getInstance(baseUrl: String): Retrofit { | ||
val interceptor = HttpLoggingInterceptor() | ||
if (BuildConfig.DEBUG) interceptor.setLevel(HttpLoggingInterceptor.Level.BODY) | ||
val okHttpClient = OkHttpClient.Builder().addInterceptor(interceptor).build() | ||
return Retrofit.Builder().baseUrl(baseUrl) | ||
.addConverterFactory(GsonConverterFactory.create()) | ||
.client(okHttpClient) | ||
.build() | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
trustly-android-sdk/src/main/java/net/trustly/android/sdk/data/Settings.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 net.trustly.android.sdk.data | ||
|
||
data class Settings( | ||
val settings: StrategySetting | ||
) | ||
|
||
data class StrategySetting( | ||
val integrationStrategy: String | ||
) |
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 |
---|---|---|
|
@@ -36,4 +36,4 @@ private static void showDisabledBrowserMessage(Context context) { | |
alertDialog.show(); | ||
} | ||
|
||
} | ||
} |
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.