Skip to content

Commit

Permalink
Fixed backend webpack config for ios (iTwin#1122)
Browse files Browse the repository at this point in the history
* fix

* add mobile oidc config

* move authConfig to backend.

* Update App.ts

remove config from frontend

* reinstant authConfig for webcase

Co-authored-by: Affan Khan <[email protected]>
Co-authored-by: kabentley <[email protected]>
  • Loading branch information
3 people authored Apr 9, 2021
1 parent 4b90a47 commit 63ba3d6
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 12 deletions.
7 changes: 6 additions & 1 deletion test-apps/display-test-app/ios/backend.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ function getConfig(env) {
target: "node",
devtool: "source-map",
module: {
rules: []
rules: [
{
test: /AzCopyFileHandler\.js/g,
use: 'null-loader'
}
]
},
stats: {
warnings: false
Expand Down
11 changes: 5 additions & 6 deletions test-apps/display-test-app/src/backend/Backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
IModelReadRpcInterface, IModelTileRpcInterface, IModelWriteRpcInterface, RpcInterfaceDefinition, RpcManager,
SnapshotIModelRpcInterface,
} from "@bentley/imodeljs-common";
import { AndroidHost, IOSHost } from "@bentley/mobile-manager/lib/MobileBackend";
import { AndroidHost, IOSHost, MobileHostOpts } from "@bentley/mobile-manager/lib/MobileBackend";
import { DtaConfiguration } from "../common/DtaConfiguration";
import { DtaRpcInterface } from "../common/DtaRpcInterface";
import { FakeTileCacheService } from "./FakeTileCacheService";
Expand Down Expand Up @@ -224,7 +224,7 @@ const setupStandaloneConfiguration = () => {
return configuration;
};

export const initializeDtaBackend = async (electronHost?: ElectronHostOptions) => {
export const initializeDtaBackend = async (hostOpts?: ElectronHostOptions & MobileHostOpts) => {
const dtaConfig = setupStandaloneConfiguration();

const iModelHost = new IModelHostConfiguration();
Expand All @@ -245,15 +245,14 @@ export const initializeDtaBackend = async (electronHost?: ElectronHostOptions) =
if (undefined !== logLevelEnv)
logLevel = Logger.parseLogLevel(logLevelEnv);
}

const opts = {
iModelHost,
electronHost,
electronHost: hostOpts,
nativeHost: {
applicationName: "display-test-app",
},
mobileHost: {
rpcInterfaces: electronHost?.rpcInterfaces,
},
mobileHost: hostOpts!.mobileHost,
};

/** register the implementation of our RPCs. */
Expand Down
16 changes: 13 additions & 3 deletions test-apps/display-test-app/src/backend/MobileMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/

import { MobileRpcManager } from "@bentley/mobile-manager/lib/MobileFrontend";
import { MobileHostOpts } from "@bentley/mobile-manager/lib/MobileBackend";
import { getRpcInterfaces, initializeDtaBackend } from "./Backend";

const dtaMobileMain = (async () => {
const opts: MobileHostOpts = {
mobileHost: {
authConfig: {
clientId: "imodeljs-electron-test",
redirectUri: "imodeljs://app/signin-callback",
scope: "openid email profile organization imodelhub context-registry-service:read-only reality-data:read product-settings-service projectwise-share urlps-third-party imodel-extension-service-api imodeljs-router offline_access",
},
rpcInterfaces: getRpcInterfaces(),
},
};

// Initialize the backend
await initializeDtaBackend();
MobileRpcManager.initializeImpl(getRpcInterfaces());
await initializeDtaBackend(opts);
});

// eslint-disable-next-line @typescript-eslint/no-floating-promises
Expand Down
7 changes: 6 additions & 1 deletion test-apps/ui-test-app/ios/backend.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ function getConfig(env) {
target: "node",
devtool: "source-map",
module: {
rules: []
rules: [
{
test: /AzCopyFileHandler\.js/g,
use: 'null-loader'
}
]
},
stats: {
warnings: false
Expand Down
3 changes: 2 additions & 1 deletion test-apps/ui-test-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"typescript": "~4.1.0",
"fs-extra": "^8.1.0",
"webpack": "4.42.0",
"semver": "^5.5.0"
"semver": "^5.5.0",
"null-loader": "^0.1.1"
},
"dependencies": {
"@bentley/backend-application-insights-client": "2.16.0-dev.2",
Expand Down

0 comments on commit 63ba3d6

Please sign in to comment.