Skip to content

Commit

Permalink
Try basic auth & release builds
Browse files Browse the repository at this point in the history
* Fix 401 with basic auth
* Fix release build
  • Loading branch information
martinfrouin authored Oct 26, 2023
1 parent e27b7fe commit 14516a8
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
3 changes: 2 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,17 @@ repositories {
maven {
url "${reactNativePath}/android"
}
maven { url 'https://jitpack.io' }
mavenCentral()
google()
}

dependencies {
api project(':gigya-sdk')
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.facebook.react:react-native:+'
implementation "org.jetbrains.kotlin:kotlin-stdlib:${safeExtGet('kotlinVersion')}"
implementation "androidx.webkit:webkit:${safeExtGet('webkitVersion')}"
implementation 'com.github.SAP.gigya-android-sdk:sdk-core:core-v7.0.5'
}

configurations.maybeCreate("default")
Expand Down
2 changes: 0 additions & 2 deletions android/gigya-sdk/build.gradle

This file was deleted.

1 change: 0 additions & 1 deletion android/settings.gradle

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ import com.gigya.android.sdk.account.models.GigyaAccount
import com.gigya.android.sdk.session.SessionInfo
import com.gigya.android.sdk.ui.plugin.IGigyaWebBridge

class RNCGigya(context: Application, apiKey: String, apiDomain: String) {
private var gigya: Gigya<GigyaAccount>
class RNCGigya(context: Application) {
private lateinit var gigya: Gigya<GigyaAccount>

init {
Gigya.setApplication(context)
}

fun prepare(apiKey: String, apiDomain: String) {
gigya = Gigya.getInstance(GigyaAccount::class.java)
gigya.init(apiKey, apiDomain)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ public class RNCWebView extends WebView implements LifecycleEventListener {
protected boolean hasScrollEvent = false;
protected boolean nestedScrollEnabled = false;
protected ProgressChangedFilter progressChangedFilter;
protected RNCGigya gigya = new RNCGigya(this.getThemedReactContext().getCurrentActivity().getApplication());

/**
/**
* WebView must be created with an context of the current activity
* <p>
* Activity Context is required for creation of dialogs internally by WebView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public void onPageStarted(WebView webView, String url, Bitmap favicon) {

RNCWebView reactWebView = (RNCWebView) webView;
reactWebView.callInjectedJavaScriptBeforeContentLoaded();
if (gigyaCredentials.sessionToken != null && gigyaCredentials.sessionSecret != null) {
reactWebView.gigya.initialize(gigyaCredentials.sessionToken, gigyaCredentials.sessionSecret, reactWebView);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,8 @@ class RNCWebViewManagerImpl {

gigyaCredentials = RNCGigyaCredentials(sessionToken, sessionSecret, apiKey, apiDomain)

if (sessionToken != null && sessionSecret != null && apiKey != null && apiDomain != null) {
val application = viewWrapper.webView.themedReactContext.currentActivity?.application as Application
val gigya = RNCGigya(application, apiKey, apiDomain)

gigya.initialize(sessionToken, sessionSecret, viewWrapper.webView)
if (apiKey != null && apiDomain != null) {
viewWrapper.webView.gigya.prepare(apiKey, apiDomain)
}
}
}
Expand Down

0 comments on commit 14516a8

Please sign in to comment.