Skip to content
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

core/v1.5.6 + showScreesent no modal #70

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions GigyaSwift/Gigya/GigyaCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -444,11 +444,11 @@ public final class GigyaCore<T: GigyaAccountProtocol>: GigyaInstanceProtocol {
- Parameter completion: Plugin completion `GigyaPluginEvent<T>`.
*/

public func showScreenSet(with name: String, viewController: UIViewController, params: [String: Any] = [:], completion: @escaping (GigyaPluginEvent<T>) -> Void) {
public func showScreenSet(with name: String, viewController: UIViewController, params: [String: Any] = [:], isModal: Bool = true, completion: @escaping (GigyaPluginEvent<T>) -> Void) {
let webBridge = createWebBridge()

pluginViewWrapper = PluginViewWrapper(config: config, persistenceService: persistenceService, sessionService: sessionService, businessApiService: businessApiService, webBridge: webBridge, plugin: "accounts.screenSet", params: params, completion: completion)
pluginViewWrapper?.presentPluginController(viewController: viewController, dataType: T.self, screenSet: name)
pluginViewWrapper?.presentPluginController(viewController: viewController, dataType: T.self, screenSet: name, isModal: isModal)
}

// MARK: - Interruptions
Expand Down
23 changes: 18 additions & 5 deletions GigyaSwift/Global/Plugins/PluginViewWrapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit

protocol PluginViewWrapperProtocol {
func presentPluginController<T: GigyaAccountProtocol>(viewController: UIViewController, dataType: T.Type, screenSet: String?)
func presentPluginController<T: GigyaAccountProtocol>(viewController: UIViewController, dataType: T.Type, screenSet: String?, isModal: Bool)
}

class PluginViewWrapper<T: GigyaAccountProtocol>: PluginViewWrapperProtocol {
Expand Down Expand Up @@ -51,7 +51,7 @@ class PluginViewWrapper<T: GigyaAccountProtocol>: PluginViewWrapperProtocol {
- Parameter dataType: Account schema.
- Parameter screenSet: Requested screen set.
*/
func presentPluginController<C: GigyaAccountProtocol>(viewController: UIViewController, dataType: C.Type, screenSet: String? = nil) {
func presentPluginController<C: GigyaAccountProtocol>(viewController: UIViewController, dataType: C.Type, screenSet: String? = nil, isModal: Bool) {
if let screenSet = screenSet {
params["screenSet"] = screenSet
}
Expand Down Expand Up @@ -79,9 +79,22 @@ class PluginViewWrapper<T: GigyaAccountProtocol>: PluginViewWrapperProtocol {

pluginViewController = PluginViewController(webBridge: webBridge, pluginEvent: eventHandler!)

let navigationController = UINavigationController(rootViewController: pluginViewController!)

viewController.present(navigationController, animated: true) {
if(isModal) {
let navigationController = UINavigationController(rootViewController: pluginViewController!)
viewController.present(navigationController, animated: true) {
self.webBridge?.load(html: html)
}
}
else {
viewController.addChild(pluginViewController!);
viewController.view.addSubview(pluginViewController!.view);

pluginViewController!.view.translatesAutoresizingMaskIntoConstraints = false;
pluginViewController!.view.topAnchor.constraint(equalTo:viewController.view.topAnchor, constant: 0).isActive = true
pluginViewController!.view.bottomAnchor.constraint(equalTo:viewController.view.bottomAnchor, constant: 0).isActive = true
pluginViewController!.view.leadingAnchor.constraint(equalTo:viewController.view.leadingAnchor, constant: 0).isActive = true
pluginViewController!.view.trailingAnchor.constraint(equalTo:viewController.view.trailingAnchor, constant: 0).isActive = true

self.webBridge?.load(html: html)
}
}
Expand Down