Last active
September 28, 2021 16:43
-
-
Save jthoms1/07d948e28dbdfba5bda76ad6472e36bc to your computer and use it in GitHub Desktop.
Revisions
-
jthoms1 revised this gist
Sep 28, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,10 +6,10 @@ const App: React.FC<InitialContext> = () => { const [startingRoute, setInitialRoute] = useState(null); useEffect(() => { const [context, sessionInfo] = await Promise.all([ Portals.getInitialContext(), ShopAPI.getSessionInfo() ]); setInitialRoute(context.startingRoute); setSessionInfo(sessionInfo); }, []); -
jthoms1 revised this gist
Sep 28, 2021 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,9 +6,9 @@ const App: React.FC<InitialContext> = () => { const [startingRoute, setInitialRoute] = useState(null); useEffect(() => { const [context, sessionInfo] = await Promise.all( Portals.getInitialContext(), ShopAPI.getSessionInfo() ); setInitialRoute(context.startingRoute); setSessionInfo(sessionInfo); -
jthoms1 revised this gist
Sep 2, 2021 . 1 changed file with 14 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,19 @@ import ShopAPI from './ShopAPIPlugin'; import Portals from '@ionic/portals'; const App: React.FC<InitialContext> = () => { const [sessionInfo, setSession] = useState(null); const [startingRoute, setInitialRoute] = useState(null); useEffect(() => { const { context, sessionInfo } = await Promise.all( Portals.getInitialContext()); ShopAPI.getSessionInfo()); ); setInitialRoute(context.startingRoute); setSessionInfo(sessionInfo); }, []); // ... } }; -
jthoms1 revised this gist
Sep 2, 2021 . 1 changed file with 21 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,24 @@ import ShopAPI from './ShopAPIPlugin'; import Portals from '@ionic/portals'; interface InitialContext { startingRoute: string; } Portals.getInitialContext<InitialContext>().then(({ value }) => { ReactDOM.render(<App />, document.getElementById('root') ); }); const App: React.FC<InitialContext> = ({ startingRoute }) => { <IonApp> <IonReactRouter> <IonRouterOutlet> <Redirect path="/" exact to={context.startingRoute} /> <Route path="/address/:id" exact component={AddressPage} /> <Route path="/checkout" exact component={CheckoutPage} /> // ... </IonRouterOutlet> </IonReactRouter> </IonApp> }; -
jthoms1 revised this gist
Sep 2, 2021 . 3 changed files with 30 additions and 12 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,8 @@ import ShopAPI from './ShopAPIPlugin'; import Portals from '@ionic/portals'; // ... const portalInitialContext = await Portals.getInitialContext<{ startingRoute: string >(); const sessionInfo = await ShopAPI.getSession(); console.log(portalInitialContext.startingRoute, sessionInfo); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,17 @@ import io.ionic.portals.Portal; import io.ionic.portals.PortalFragment; class ProfileFragment : PortalFragment { override fun onViewCreated(@NotNull View view, Bundle savedInstanceState) { val portal: Portal = PortalBuilder("myPortal") .addPlugin(ShopAPIPlugin::class.java) .setInitialContext(mapOf("startingRoute" to "/home")) .setStartDir("web_app") .create() var portalView = PortalWebView(); super.onViewCreated(portalView, savedInstanceState); } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,15 @@ import IonicPortals class HomeViewController: AppParticipantViewController { override func viewDidLoad() { let portal = PortalBuilder("myPortal") .setInitialContext(["startingRoute", "/home"]) .setStartDir("web_app") .create() self.view = PortalWebView(frame: view.frame, portal: portal) super.viewDidLoad() } } -
jthoms1 revised this gist
Sep 1, 2021 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ import ShopAPI from './ShopAPIPlugin'; import Portals from '@ionic/portals'; // ... const portalInitialContext = await Portals.getInitialContext<{ startingRoute: string >(); const sessionInfo = await ShopAPI.getSession(); console.log(portalInitialContext.startingRoute, sessionInfo); -
jthoms1 revised this gist
Sep 1, 2021 . 2 changed files with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,6 @@ import io.ionic.portals.Portal; val portal: Portal = PortalBuilder("myPortal") .addPlugin(ShopAPIPlugin::class.java) .setInitialContext(mapOf("startingRoute" to "/home")) .setStartDir("web_app") .create() This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,6 @@ import IonicPortals // ... let portal = PortalBuilder("myPortal") .setInitialContext(["startingRoute", "/home"]) .setStartDir("web_app") .create() -
jthoms1 revised this gist
Sep 1, 2021 . 1 changed file with 4 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,7 @@ import IonicPortals // ... let portal = PortalBuilder("myPortal") .setInitialContext(["myVariable", 42]) .setStartDir("web_app") .create() -
jthoms1 revised this gist
Aug 31, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,4 +5,4 @@ import Portals from '@ionic/portals'; const portalInitialContext = await Portals.getInitialContext<{ sessionInfo: SessionDetails >(); const cartContents = await ShopAPI.getCart(); console.log(portalInitialContext.sessionInfo, cartContents); -
jthoms1 revised this gist
Aug 31, 2021 . 3 changed files with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ import ShopAPI, { SessionDetails } from './ShopAPIPlugin'; import Portals from '@ionic/portals'; // ... const portalInitialContext = await Portals.getInitialContext<{ sessionInfo: SessionDetails >(); const cartContents = await ShopAPI.getCart(); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ import io.ionic.portals.Portal; // ... val portal: Portal = PortalBuilder("myPortal") .addPlugin(ShopAPIPlugin::class.java) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ import IonicPortals // ... let checkoutPortal = Portal("myPortal", "web_app") portal.initialContext = ["myVariable", 42] -
jthoms1 revised this gist
Aug 31, 2021 . 3 changed files with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@ import ShopAPI, { SessionDetails } from './ShopAPIPlugin'; import Portals from '@ionic/portals'; ... const portalInitialContext = await Portals.getInitialContext<{ sessionInfo: SessionDetails >(); const cartContents = await ShopAPI.getCart(); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ import io.ionic.portals.Portal; ... val portal: Portal = PortalBuilder("myPortal") .addPlugin(ShopAPIPlugin::class.java) .setInitialContext(mapOf("answer" to 42)) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ import IonicPortals ... let checkoutPortal = Portal("myPortal", "web_app") portal.initialContext = ["myVariable", 42] -
jthoms1 created this gist
Aug 31, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ import ShopAPI, { SessionDetails } from './ShopAPIPlugin'; import Portals from '@ionic/portals'; const portalInitialContext = await Portals.getInitialContext<{ sessionInfo: SessionDetails >(); const cartContents = await ShopAPI.getCart(); console.log(portalInitialContext, cartContents); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ val portal: Portal = PortalBuilder("myPortal") .addPlugin(ShopAPIPlugin::class.java) .setInitialContext(mapOf("answer" to 42)) .setStartDir("web_app") .create() This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ let checkoutPortal = Portal("myPortal", "web_app") portal.initialContext = ["myVariable", 42] let portalWebView = PortalWebView(frame: view.frame, portal: portal) self.view = portalWebView self.bridge = portalWebView.bridge self.bridge.plugin(withName: "ShopAPI") as? ShopAPIPlugin super.viewDidLoad()