Skip to content

Enable ScreenSet WebView debugging in Debug mode #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.app.Application
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.os.Build
import android.webkit.WebView
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.IntentSenderRequest
import com.gigya.android.sdk.*
Expand Down Expand Up @@ -723,6 +724,10 @@ class GigyaSDKWrapper<T : GigyaAccount>(application: Application, accountObj: Cl
arguments["parameters"] as MutableMap<String, Any>?
?: mutableMapOf()

(arguments["isDebug"] as? Boolean)?.let { isDebug ->
if (isDebug) WebView.setWebContentsDebuggingEnabled(true)
}

sdk.showScreenSet(screenSet, true, parameters, object : GigyaPluginCallback<T>() {
override fun onError(event: GigyaPluginEvent?) {
handler.addScreenSetEvent(
Expand Down
49 changes: 28 additions & 21 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,36 @@ PODS:
- AppAuth/ExternalUserAgent (1.7.5):
- AppAuth/Core
- Flutter (1.0.0)
- Gigya (1.6.2)
- Gigya (1.7.1)
- gigya_flutter_plugin (1.0.0):
- Flutter
- Gigya (>= 1.6.2)
- Gigya (>= 1.7.1)
- GigyaAuth (>= 1.1.2)
- GigyaAuth (1.1.2):
- Gigya (>= 1.6.0)
- google_sign_in_ios (0.0.1):
- AppAuth (>= 1.7.4)
- Flutter
- GoogleSignIn (~> 6.2)
- GoogleSignIn (6.2.4):
- AppAuth (~> 1.5)
- GTMAppAuth (~> 1.3)
- GTMSessionFetcher/Core (< 3.0, >= 1.1)
- GTMAppAuth (1.3.1):
- AppAuth/Core (~> 1.6)
- GTMSessionFetcher/Core (< 3.0, >= 1.5)
- GTMSessionFetcher/Core (2.3.0)
- FlutterMacOS
- GoogleSignIn (~> 7.1)
- GTMSessionFetcher (>= 3.4.0)
- GoogleSignIn (7.1.0):
- AppAuth (< 2.0, >= 1.7.3)
- GTMAppAuth (< 5.0, >= 4.1.1)
- GTMSessionFetcher/Core (~> 3.3)
- GTMAppAuth (4.1.1):
- AppAuth/Core (~> 1.7)
- GTMSessionFetcher/Core (< 4.0, >= 3.3)
- GTMSessionFetcher (3.5.0):
- GTMSessionFetcher/Full (= 3.5.0)
- GTMSessionFetcher/Core (3.5.0)
- GTMSessionFetcher/Full (3.5.0):
- GTMSessionFetcher/Core

DEPENDENCIES:
- Flutter (from `Flutter`)
- gigya_flutter_plugin (from `.symlinks/plugins/gigya_flutter_plugin/ios`)
- google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/ios`)
- google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`)

SPEC REPOS:
trunk:
Expand All @@ -45,19 +52,19 @@ EXTERNAL SOURCES:
gigya_flutter_plugin:
:path: ".symlinks/plugins/gigya_flutter_plugin/ios"
google_sign_in_ios:
:path: ".symlinks/plugins/google_sign_in_ios/ios"
:path: ".symlinks/plugins/google_sign_in_ios/darwin"

SPEC CHECKSUMS:
AppAuth: 501c04eda8a8d11f179dbe8637b7a91bb7e5d2fa
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
Gigya: 0e6fa3447def67739461c489305cd1a82278857d
gigya_flutter_plugin: d0b75ee89ad68a01978c349d96e238e6582579d3
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
Gigya: 69f7dbb2d2195930a5c3fc23c1a98f66595afa3f
gigya_flutter_plugin: 89ad5341d277cca4b6c3e637d8d3d72fb6892c80
GigyaAuth: 32cd49aa9eb380275ad10d85543a90ce326fe4fb
google_sign_in_ios: 1256ff9d941db546373826966720b0c24804bcdd
GoogleSignIn: 5651ce3a61e56ca864160e79b484cd9ed3f49b7a
GTMAppAuth: 0ff230db599948a9ad7470ca667337803b3fc4dd
GTMSessionFetcher: 3a63d75eecd6aa32c2fc79f578064e1214dfdec2
google_sign_in_ios: 07375bfbf2620bc93a602c0e27160d6afc6ead38
GoogleSignIn: d4281ab6cf21542b1cfaff85c191f230b399d2db
GTMAppAuth: f69bd07d68cd3b766125f7e072c45d7340dea0de
GTMSessionFetcher: 5aea5ba6bd522a239e236100971f10cb71b96ab6

PODFILE CHECKSUM: cc1f88378b4bfcf93a6ce00d2c587857c6008d3b

COCOAPODS: 1.13.0
COCOAPODS: 1.16.2
4 changes: 3 additions & 1 deletion example/lib/routes/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:gigya_flutter_plugin/gigya_flutter_plugin.dart';

Expand Down Expand Up @@ -244,7 +245,8 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
const String screenSet = 'Default-RegistrationLogin1';

try {
screenSetSubscription = widget.sdk.showScreenSet(screenSet).listen(
screenSetSubscription =
widget.sdk.showScreenSet(screenSet, isDebug: kDebugMode).listen(
(ScreensetEvent event) {
print('event type: ${event.type}');
print('event data: ${event.data}');
Expand Down
6 changes: 5 additions & 1 deletion ios/Classes/GigyaSdkWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,11 @@ public class GigyaSdkWrapper<T: GigyaAccountProtocol> :GigyaInstanceProtocol {
return
}

guard let screenSet = arguments["screenSet"] as? String
if let isDebug = arguments["isDebug"] as? Bool, isDebug {
GigyaLogger.setDebugMode(to: isDebug)
}

guard let screenSet = arguments["screenSet"] as? String
else {
result(FlutterError(code: PluginErrors.missingParameterError, message: PluginErrors.missingParameterMessage, details: nil))
return
Expand Down
2 changes: 2 additions & 0 deletions lib/gigya_flutter_plugin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,12 @@ class GigyaSdk {
Stream<ScreensetEvent> showScreenSet(
String name, {
Map<String, dynamic> parameters = const <String, dynamic>{},
bool isDebug = false,
}) {
return GigyaFlutterPluginPlatform.instance.showScreenSet(
name,
parameters: parameters,
isDebug: isDebug,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,15 @@ class MethodChannelGigyaFlutterPlugin extends GigyaFlutterPluginPlatform {
Stream<ScreensetEvent> showScreenSet(
String name, {
Map<String, dynamic> parameters = const <String, dynamic>{},
bool isDebug = false,
}) async* {
try {
await methodChannel.invokeMethod<void>(
Methods.showScreenSet.methodName,
<String, dynamic>{
'screenSet': name,
'parameters': parameters,
'isDebug': isDebug,
},
);
} on PlatformException catch (exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ abstract class GigyaFlutterPluginPlatform extends PlatformInterface {
Stream<ScreensetEvent> showScreenSet(
String name, {
Map<String, dynamic> parameters = const <String, dynamic>{},
bool isDebug = false,
}) {
throw UnimplementedError('showScreenSet() is not implemented.');
}
Expand Down