Skip to content

Commit 14516a8

Browse files
author
Martin Frouin
authored
Try basic auth & release builds
* Fix 401 with basic auth * Fix release build
1 parent e27b7fe commit 14516a8

File tree

8 files changed

+14
-12
lines changed

8 files changed

+14
-12
lines changed

android/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,17 @@ repositories {
9696
maven {
9797
url "${reactNativePath}/android"
9898
}
99+
maven { url 'https://jitpack.io' }
99100
mavenCentral()
100101
google()
101102
}
102103

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

111112
configurations.maybeCreate("default")

android/gigya-sdk/build.gradle

Lines changed: 0 additions & 2 deletions
This file was deleted.
File renamed without changes.

android/settings.gradle

Lines changed: 0 additions & 1 deletion
This file was deleted.

android/src/main/java/com/reactnativecommunity/webview/RNCGigya.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ import com.gigya.android.sdk.account.models.GigyaAccount
1010
import com.gigya.android.sdk.session.SessionInfo
1111
import com.gigya.android.sdk.ui.plugin.IGigyaWebBridge
1212

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

1616
init {
1717
Gigya.setApplication(context)
18+
}
19+
20+
fun prepare(apiKey: String, apiDomain: String) {
1821
gigya = Gigya.getInstance(GigyaAccount::class.java)
1922
gigya.init(apiKey, apiDomain)
2023
}

android/src/main/java/com/reactnativecommunity/webview/RNCWebView.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ public class RNCWebView extends WebView implements LifecycleEventListener {
6767
protected boolean hasScrollEvent = false;
6868
protected boolean nestedScrollEnabled = false;
6969
protected ProgressChangedFilter progressChangedFilter;
70+
protected RNCGigya gigya = new RNCGigya(this.getThemedReactContext().getCurrentActivity().getApplication());
7071

71-
/**
72+
/**
7273
* WebView must be created with an context of the current activity
7374
* <p>
7475
* Activity Context is required for creation of dialogs internally by WebView

android/src/main/java/com/reactnativecommunity/webview/RNCWebViewClient.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ public void onPageStarted(WebView webView, String url, Bitmap favicon) {
8787

8888
RNCWebView reactWebView = (RNCWebView) webView;
8989
reactWebView.callInjectedJavaScriptBeforeContentLoaded();
90+
if (gigyaCredentials.sessionToken != null && gigyaCredentials.sessionSecret != null) {
91+
reactWebView.gigya.initialize(gigyaCredentials.sessionToken, gigyaCredentials.sessionSecret, reactWebView);
92+
}
9093
}
9194

9295
@Override

android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManagerImpl.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,8 @@ class RNCWebViewManagerImpl {
281281

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

284-
if (sessionToken != null && sessionSecret != null && apiKey != null && apiDomain != null) {
285-
val application = viewWrapper.webView.themedReactContext.currentActivity?.application as Application
286-
val gigya = RNCGigya(application, apiKey, apiDomain)
287-
288-
gigya.initialize(sessionToken, sessionSecret, viewWrapper.webView)
284+
if (apiKey != null && apiDomain != null) {
285+
viewWrapper.webView.gigya.prepare(apiKey, apiDomain)
289286
}
290287
}
291288
}

0 commit comments

Comments
 (0)