diff --git a/website/docs/for-android/quick-start.md b/website/docs/for-android/quick-start.md index fac9fdf..4f79e10 100644 --- a/website/docs/for-android/quick-start.md +++ b/website/docs/for-android/quick-start.md @@ -15,9 +15,9 @@ This is a walkthrough on how to get a single Portal + web application setup. To First have your web application ready. We will add some configuration to it and then get it setup in Appflow. At the end of this walkthrough: -- the web application will be setup in Appflow -- each new Android application build will pull the latest version of the web application from Appflow -- the Android application will have a Portal setup pointing to the web application files. +- The web application will be setup in Appflow. +- Each new Android application build will pull the latest version of the web application from Appflow. +- The Android application will have a Portal setup pointing to the web application files. ## 1. Create a capacitor config @@ -33,9 +33,9 @@ Create a `capacitor.config.json` file to the root of your web project. We will n These configuration values are required for web applications added to Appflow. -- `appId`, a unique id that you provide to your web application -- `appName` -- `webDir`, the directory where your compiled web code will be placed +- `appId`: a unique id that you provide to your web application +- `appName`: the name of your web application +- `webDir`: the directory where your compiled web code will be placed :::note There are many options that you can provide to a Capacitor configuration file we will only need a few to get started. These options are defined in the [config schema](https://capacitorjs.com/docs/config#schema). @@ -45,7 +45,7 @@ There are many options that you can provide to a Capacitor configuration file we Now that we have the application source configured we will need to add it to Appflow. Appflow can be used for deploying the web application into the Portal later using Live Updates. -During the Native App build process the most recent build of the web application will be used to seed the Portal, and then after the Native App deployment every subsequent build can be deployed as an over the air Live update. +During the Native App build process the most recent build of the web application will be used to seed the Portal, and then after the Native App deployment every subsequent build can be deployed as an over the air Live Update. ### Connect the repo @@ -56,13 +56,13 @@ In the upper right hand corner you will be able to select `Import existing app`. -- Provide an `App Name`. Most likely using the same you provided in the `capacitor.config.json` file in the previous step. +- Provide an `App Name`. Most likely using the same you provided in the `capacitor.config.json` file in the previous step - `Capacitor`, as the mobile architecture - Choose your git host. In this example we have selected `Github` ### Web application builds -After the app has been created you will want to go to the `Builds` page. This is where you will create new builds and see previous builds. Anytime you want to deploy a new version of the web application you will need to create a build from this screen or by using the Ionic Cloud CLI (which we will cover later). +After the app has been created you will want to go to the `Builds` page. This is where you will create new builds and see previous builds. Anytime you want to deploy a new version of the web application you will need to create a build from this screen or by using the [Ionic Cloud CLI](https://ionic.io/docs/appflow/cli/overview). -The scripts are slightly different depending on if you are building on a Windows or *nix based system. - - + -```groovy title=build.gradle +```groovy title="build.gradle" +// Make the preBuild task depend on syncPortals so it runs every build +preBuild.dependsOn 'syncPortals' -// ... - -// Make the preBuild task depend on getLiveUpdate so it runs every build -preBuild.dependsOn 'getLiveUpdate' - -tasks.register('getLiveUpdate') { +tasks.register('syncPortals') { doLast { - String appId = "0ee57266" - String channel = "PRODUCTION" - String portalName = "MY_FIRST_PORTAL" - - String assetPath = rootDir.getPath() + '/app/src/main/assets/' + portalName - if (new File(assetPath).exists()) { - // If the web app already exists, replace with fresh download - project.exec { - commandLine 'rm', '-rf', assetPath - } - project.exec { - commandLine 'mkdir', '-p', assetPath - } - } else { - project.exec { - commandLine 'mkdir', '-p', assetPath - } - } - project.exec { - commandLine 'ionic-cloud', 'live-update', 'download', '--config=.ionic-cloud.yaml', '--app-id', appId, '--channel-name', channel, '--zip-name', portalName + '.zip' - } - project.exec { - commandLine 'unzip', portalName + '.zip', '-d', assetPath - } - project.exec { - commandLine 'rm', portalName + '.zip' + commandLine 'portals', 'sync' } } } ``` - - -```java title=build.gradle - -// ... + -// Make the preBuild task depend on getLiveUpdate so it runs every build -preBuild.dependsOn 'getLiveUpdate' +```kotlin title="build.gradle.kts" +// Make the preBuild task depend on syncPortals so it runs every build +tasks.named("preBuild") { + dependsOn("syncPortals") +} -tasks.register('getLiveUpdate') { +tasks.register("syncPortals") { doLast { - String appId = "0ee57266" - String channel = "PRODUCTION" - String portalName = "MY_FIRST_PORTAL" - - String assetPath = rootDir.getPath() + '\\app\\src\\main\\assets\\' + portalName - if (new File(assetPath).exists()) { - // If the web app already exists, replace with fresh download - project.exec { - commandLine 'cmd', '/c', 'rm', '-r', assetPath - } - project.exec { - commandLine 'cmd', '/c', 'mkdir', assetPath - } - } else { - project.exec { - commandLine 'cmd', '/c', 'mkdir', assetPath - } - } - - project.exec { - commandLine 'cmd', '/c', 'ionic-cloud', 'live-update', 'download', '--config=".ionic-cloud.yaml"', '--app-id', appId, '--channel-name', channel, '--zip-name', portalName + '.zip' - } - project.exec { - commandLine 'cmd', '/c', 'unzip', portalName + '.zip', '-d', assetPath - } - project.exec { - commandLine 'cmd', '/c', 'rm', portalName + '.zip' + exec { + commandLine("portals", "sync") } } } @@ -245,11 +183,9 @@ tasks.register('getLiveUpdate') { -There are a few variables that you will need to setup at the beginning of script. - -- `APP_ID` - Web application id from Appflow -- `CHANNEL` - Live update distribution channel. -- `PORTAL_NAME` - Choose a name for the portal, no spaces. +:::note +The Portals CLI must be registered as part of the `PATH` to run this command successfully. +::: ## 4. Setup Portals in your Android App diff --git a/website/docs/for-ios/quick-start.md b/website/docs/for-ios/quick-start.md index 9aaca36..6f65f66 100644 --- a/website/docs/for-ios/quick-start.md +++ b/website/docs/for-ios/quick-start.md @@ -5,6 +5,8 @@ sidebar_label: iOS Quick Start import useBaseUrl from '@docusaurus/useBaseUrl'; import CodeBlock from '@theme/CodeBlock'; +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; import { getCapacitorVersion, getPortalsVersion, getPortalsVersionIos, getPortalsVersionAndroid, getPortalsVersionRN, getiOSMinVersion, getAndroidMinSdk, getRnMinVersion } from '@site/src/util'; # iOS Quick Start @@ -13,11 +15,11 @@ This is a walkthrough on how to get a single Portal + web application setup. To First have your web application ready. We will add some configuration to it and then get it setup in Appflow. At the end of this walkthrough: -- the web application will be setup in Appflow -- each new Xcode iOS application build will pull the latest version of the web application from Appflow -- the iOS application will have a Portal setup pointing to the web application files. +- The web application will be setup in Appflow. +- Each new Xcode iOS application build will pull the latest version of the web application from Appflow. +- The iOS application will have a Portal setup pointing to the web application files. -## 1. Create a capacitor config +## 1. Create a Capacitor config Create a `capacitor.config.json` file to the root of your web project. We will not need to add Capacitor to the web project but this configuration file will help us configure some options for the Portals that are displaying this web application. @@ -31,9 +33,9 @@ Create a `capacitor.config.json` file to the root of your web project. We will n These configuration values are required for web applications added to Appflow. -- `appId`, a unique id that you provide to your web application -- `appName` -- `webDir`, the directory where your compiled web code will be placed +- `appId`: a unique id that you provide to your web application +- `appName`: the name of your web application +- `webDir`: the directory where your compiled web code will be placed :::note There are many options that you can provide to a Capacitor configuration file we will only need a few to get started. These options are defined in the [config schema](https://capacitorjs.com/docs/config#schema). @@ -43,7 +45,7 @@ There are many options that you can provide to a Capacitor configuration file we Now that we have the application source configured we will need to add it to Appflow. Appflow can be used for deploying the web application into the Portal later using Live Updates. -During the Native App build process the most recent build of the web application will be used to seed the Portal, and then after the Native App deployment every subsequent build can be deployed as an over the air Live update. +During the Native App build process the most recent build of the web application will be used to seed the Portal, and then after the Native App deployment every subsequent build can be deployed as an over the air Live Update. ### Connect the repo @@ -54,13 +56,13 @@ In the upper right hand corner you will be able to select `Import existing app`. -- Provide an `App Name`. Most likely using the same you provided in the `capacitor.config.json` file in the previous step. +- Provide an `App Name`. Most likely using the same you provided in the `capacitor.config.json` file in the previous step - `Capacitor`, as the mobile architecture - Choose your git host. In this example we have selected `Github` ### Web application builds -After the app has been created you will want to go to the `Builds` page. This is where you will create new builds and see previous builds. Anytime you want to deploy a new version of the web application you will need to create a build from this screen or by using the Ionic Cloud CLI (which we will cover later). +After the app has been created you will want to go to the `Builds` page. This is where you will create new builds and see previous builds. Anytime you want to deploy a new version of the web application you will need to create a build from this screen or by using the [Ionic Cloud CLI](https://ionic.io/docs/appflow/cli/overview). -The following bash code should be added to the build process. +The following bash code should be added to the build process: ```bash -APP_ID=11a0971f -CHANNEL=production -PORTAL_NAME=featured_products - -ionic-cloud live-update download \ - --config="${SOURCE_ROOT}/.ionic-cloud.yaml" \ - --app-id ${APP_ID} \ - --channel-name ${CHANNEL} \ - --zip-name ${PORTAL_NAME}.zip - - -unzip ${PORTAL_NAME}.zip -d \ - ${BUILT_PRODUCTS_DIR}/${TARGET_NAME}.app/${PORTAL_NAME} -rm ${PORTAL_NAME}.zip +export PATH=$PATH:/opt/homebrew/bin +portals sync ``` -There are a few variables that you will need to setup at the beginning of script. - -- `APP_ID` - Web application id from Appflow -- `CHANNEL` - Live update distribution channel. -- `PORTAL_NAME` - Choose a name for the portal, no spaces. +:::note +Adjust the script as needed based on your installation method or system configuration to ensure the CLI is accessible in the iOS build process. +::: ## 4. Setup Portals in your iOS App -### Install the Cocoapod file +### Install the Portals iOS Library -:::note -IonicPortals requires using Cocoapods 1.10 or greater. -::: + + + To add Portals to your iOS project, add `https://github.com/ionic-team/ionic-portals-ios` in the Xcode "Swift Package Dependencies" tab in the project configuration. + + The suggested version range is "Up to Next Minor Version" to prevent auto-updating to a breaking version before Ionic Portals iOS reaches version 1.0 + + + :::note + IonicPortals requires using Cocoapods 1.10 or greater. + ::: -To add Portals to your iOS project, put the following line to your `Podfile`: + To add Portals to your iOS project, put the following line to your `Podfile`: - -{`pod 'IonicPortals', '~> ${getPortalsVersionIos()}'`} - + + {`pod 'IonicPortals', '~> ${getPortalsVersionIos()}'`} + -And then run `pod install`. + And then run `pod install`. + + ### Add the Portals key diff --git a/website/static/img/android-run-script-thumbnail.webp b/website/static/img/android-run-script-thumbnail.webp index 148b767..d151738 100644 Binary files a/website/static/img/android-run-script-thumbnail.webp and b/website/static/img/android-run-script-thumbnail.webp differ diff --git a/website/static/img/android-run-script.webp b/website/static/img/android-run-script.webp index 1f13d44..85f98eb 100644 Binary files a/website/static/img/android-run-script.webp and b/website/static/img/android-run-script.webp differ diff --git a/website/static/img/xcode-run-script-thumbnail.webp b/website/static/img/xcode-run-script-thumbnail.webp index 8a8412a..82833d0 100644 Binary files a/website/static/img/xcode-run-script-thumbnail.webp and b/website/static/img/xcode-run-script-thumbnail.webp differ diff --git a/website/static/img/xcode-run-script.webp b/website/static/img/xcode-run-script.webp index da2c152..686a5fb 100644 Binary files a/website/static/img/xcode-run-script.webp and b/website/static/img/xcode-run-script.webp differ