GithubHelp home page GithubHelp logo

ionic-team / ionic-portals Goto Github PK

View Code? Open in Web Editor NEW
50.0 10.0 7.0 13.86 MB

Portals Javascript Library and Docs

Home Page: https://ionic.io/docs/portals

License: Other

JavaScript 65.65% TypeScript 24.97% CSS 9.38%

ionic-portals's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ionic-portals's Issues

NullPointerException in PortalFragment; potential problems with Fragment-recreations

Dear ionic-team,

After using Portals successfully in production for multiple weeks, I noticed hundreds of NullPointerExceptions in my sentry.io crash-reports. Specifically, a NullPointerException happened in the following line:
https://github.com/ionic-team/ionic-portals/blob/main/android/IonicPortals/src/main/kotlin/io/ionic/portals/PortalFragment.kt#L99

Here is the stacktrace that was reported by sentry.io:

java.lang.NullPointerException: null
at io.ionic.portals.PortalFragment.load(PortalFragment.kt:99)
at io.ionic.portals.PortalFragment.onViewCreated(PortalFragment.kt:44)
at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:2987)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:546)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282)
at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128)
at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:3072)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:251)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:502)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:246)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1435)
at android.app.Activity.performStart(Activity.java:8231)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3853)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2317)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:246)
at android.app.ActivityThread.main(ActivityThread.java:8625)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)

I suspect that this happens when a PortalFragment gets instantiated without an instance of the Portal-class.
For example, such erroneous instantiations might happen when the following empty default-constructor of a PortalFragment gets invoked:
https://github.com/ionic-team/ionic-portals/blob/main/android/IonicPortals/src/main/kotlin/io/ionic/portals/PortalFragment.kt#L27

This makes me question whether there is a potential problem with Fragment-recreations.
The Android-OS might destroy and recreate Fragments at any time, and this might trigger the NullPointerException.

Perhaps I could "fix" the bug by adding more null-checks to the problematic code, but my goal would be to find a root-cause instead of only adding null-checks.

Crash when "startActivityForResult" and "Don't Keep Activity" setting is activated

I experienced this crash on a pet project I'm working on using ionic Portals. I have it when using a fragment that extends PortalFragment(but also happened in an activity that contains a portal in the layout). We use a library that internally does a call to startActivityForResult and the crash happens when the result is returned.

java.lang.NullPointerException
at io.ionic.portals.PortalFragment.load(PortalFragment.kt:99)
at io.ionic.portals.PortalFragment.onViewCreated(PortalFragment.kt:44)
at com.swisscom.myswisscom.activities.login.fragments.LoginFragment.onViewCreated(LoginFragment.kt:14)
at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:2987)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:546)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282)

In order to avoid the crash I used the following code but I think this might go into a place inside the PortalFragment implementation

class LoginFragment : PortalFragment {
    constructor() : super() {}
    constructor(portal: Portal?) : super(portal) {}

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        if (activity != null && portal!=null) {
            super.onViewCreated(view, savedInstanceState)
            setHasOptionsMenu(false)
        }
    }

I think the only check needed is the portal not being null

blink red when back navigation

스크린샷 2021-10-22 오전 1 15 31

스크린샷 2021-10-22 오전 1 15 45

스크린샷 2021-10-22 오전 1 15 52

스크린샷 2021-10-22 오전 1 15 57

I add portalview in my fragment.
And go Other fragment.
And go Back.
Always blink red light.
Only PortalView area hppened.

How can i fix it?

CAPWebView not found

I’ve been trying to build the Portals iOS framework from source (due to issues using Cocoapods with my ObjC project) but have come across this…

In ‘PortalWebView.swift on line 64:
‘class InternalCapWebView: CAPWebView {‘

This line fails as ‘CAPWebView’ cannot be found and I cannot see anywhere this is defined (in Portals or Capacitor). Am I missing something? (e.g. a specific Capacitor version).

I assume it must be something I'm doing wrong as you must be able to build it there. Any help would be greatly appreciated.

Wrong documentation for using capacitor plugin in ios

From this website
After adding a capacitor dependency in your Podfile,
the instruction says the plugin should be registered in viewDidload()

override func viewDidLoad() {
    // Inject the plugin into the native bridge
    apiPlugin = bridge?.plugin(withName: "MyPlugin") as? MyPlugin
    
    // now call super which will start the initial load
    super.viewDidLoad()
}

But in the example e-com app link here
The project use "CapacitorCamera"
but it wasn't registered any where in all of the view model files
the only plugin registered is a local plugin

   func handle(bridge: CAPBridgeProtocol?) {
        subRef = PortalsPlugin.subscribe("dismiss") { [weak self] result in
            if result.data as! String == "cancel" || result.data as! String == "success" {
                DispatchQueue.main.async {
                    
                    self?.shouldDisplayCheckout = false
                }
            }
        }
        
        apiPlugin = bridge?.plugin(withName: "ShopAPI") as? ShopAPIPlugin
        apiPlugin?.dataProvider = coordinator.dataStore
        apiPlugin?.actionDelegate = self
    }

I think the plugins are auto registered like the one from the community plugins,
the website also stated this for the community plugins

Plugins are automatically registered on iOS.

So i guess the plugins are auto registered if they are installed by pod ?

Hybrid Routing Management"

Hi, I want to integrate ionic into native app and when I am in the page of ionic, I want to go to native again or to another h5 page, is there any way to do that?
Checked the sample of ecommerce-app and didn't find anything about it. Any suggestions or approaches? Thanks for your help!

Missing cordova dependency in Android build

Im using this gradle dependency: implementation("io.ionic:portals:0.5.0")

Gradle can compile build files but warns it missing dependecy to Cordova. I can however reference code from your lib.

When building app project, it fails, its complains about missing Cordova dependency.

> Could not resolve all files for configuration ':app:demoDebugRuntimeClasspath'.
   > Could not find org.apache.cordova:framework:7.0.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/org/apache/cordova/framework/7.0.0/framework-7.0.0.pom
       - https://repo.maven.apache.org/maven2/org/apache/cordova/framework/7.0.0/framework-7.0.0.pom
       - https://maven.shortcut.io/org/apache/cordova/framework/7.0.0/framework-7.0.0.pom
     Required by:
         project :app > io.ionic:portals:0.5.0 > com.capacitorjs:core:3.4.1

Am i missing any other dependencies or?

Portals for ionic Angular

Hi ionic team,

Our project is using ionic 3, cordova, Angular. I would like to know if we can use Portals, Our company is very interested in this feature: Micro Frontends with Module Federation, but did not find documentation and Demo for ionic Angular.

thanks!

Test

Just testing an issue thing.

Unable to load web content

Following the QuickStart guides, it seems like in iOS the web content is expected to be a Capacitor app? The same built web app works for Android.

Here's the error in the Xcode console:

⚡️ ERROR: Unable to find application directory at: "file:///private/var/containers/Bundle/Application/6C3DFA39-02A0-4878-A78B-3C3D535AD9EE/PortalsDemo.app/public"!
Unable to find capacitor.config.json, make sure it exists and run npx cap copy.
Unable to find config.xml, make sure it exists and run npx cap copy.
2022-06-15 12:11:53.660581-0700 PortalsDemo[5584:383934] [ViewportSizing] maximumViewportInset cannot be larger than frame
2022-06-15 12:11:53.660622-0700 PortalsDemo[5584:383934] [ViewportSizing] minimumViewportInset cannot be larger than frame
⚡️ ERROR: Unable to load /private/var/containers/Bundle/Application/6C3DFA39-02A0-4878-A78B-3C3D535AD9EE/PortalsDemo.app/public
⚡️ This file is the root of your web app and must exist before
⚡️ Capacitor can run. Ensure you've run capacitor copy at least
⚡️ or, if embedding, that this directory exists as a resource directory.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.