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

sat change to get value from intent #235

Merged
merged 15 commits into from
Nov 26, 2024
26 changes: 15 additions & 11 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License
Eswar2103 marked this conversation as resolved.
Show resolved Hide resolved
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -103,15 +103,13 @@ export default class App extends Base {
const standalone = new URLSearchParams(appUrl.search).get('standalone');
const standalonePrefix = new URLSearchParams(appUrl.search).get('standalonePrefix');
this.systemui = new URLSearchParams(window.location.search).get('systemui');
this.testToken = new URLSearchParams(window.location.search).get('testtoken');
this.pubSubUuidPresent = false;
this.appContinue = false;
process.env.LIFECYCLE_VALIDATION = lifecycle;
process.env.MOCKOS = false;
process.env.MF_VALUE = false;
testContext ? (process.env.TESTCONTEXT = JSON.parse(testContext)) : (process.env.TESTCONTEXT = false);
process.env.TESTCONTEXT = true; // Making TESTCONTEXT = true by default. This line will be removed in later stages when required
process.env.TEST_TOKEN = this.testToken;
process.env.REPORTINGID = reportingId;
process.env.STANDALONE = standalone;
process.env.STANDALONE_PREFIX = standalonePrefix;
Expand All @@ -120,7 +118,8 @@ export default class App extends Base {
process.env.SDKS_AVAILABLE = [...CONSTANTS.defaultSDKs, ...CONSTANTS.additionalSDKs];

// Set the pubSub URL if present
process.env.PUB_SUB_URL = new URLSearchParams(window.location.search).get('pubSubUrl');
process.env.PUB_SUB_URL = new URLSearchParams(appUrl.search).get('pubSubUrl');
process.env.PUB_SUB_TOKEN = new URLSearchParams(appUrl.search).get('pubSubToken');
process.env.MACADDRESS = new URLSearchParams(appUrl.search).get('macaddress');
process.env.CURRENT_APPID = new URLSearchParams(appUrl.search).get('appId');
process.env.APP_TYPE = new URLSearchParams(appUrl.search).get('appType');
Expand Down Expand Up @@ -417,12 +416,6 @@ export default class App extends Base {
console.log('Error getting App Id :: ', err);
}

if (query.params.testtoken) {
process.env.TEST_TOKEN = query.params.testtoken;
} else {
logger.error('No Test Token Found in Parameter Initialization response...', 'getParameterInitializationValues');
}

if (query.params.macaddress) {
process.env.MACADDRESS = query.params.macaddress;
} else {
Expand All @@ -434,10 +427,21 @@ export default class App extends Base {
}

// Set the pubSub URL if present
console.log('2507 test log - query params', query.params);
Eswar2103 marked this conversation as resolved.
Show resolved Hide resolved
if (query.params.pubSubUrl) {
process.env.PUB_SUB_URL = query.params.pubSubUrl;
console.log('2507 test log - query params pubsuburl', process.env.PUB_SUB_URL);
Eswar2103 marked this conversation as resolved.
Show resolved Hide resolved
}
// Set the pubSub token if present
if (query.params.pubSubToken) {
Eswar2103 marked this conversation as resolved.
Show resolved Hide resolved
process.env.PUB_SUB_TOKEN = query.params.pubSubToken;
console.log('2507 test log - query params pubsubtoken', process.env.PUB_SUB_TOKEN);
Eswar2103 marked this conversation as resolved.
Show resolved Hide resolved
}
// Set the region if present
if (query.params.region) {
process.env.REGION = query.params.region;
console.log('2507 test log - query params region', process.env.REGION);
}

if (query.task) {
neeradanelxsi marked this conversation as resolved.
Show resolved Hide resolved
setTimeout(() => {
const intentReader = new IntentReader();
Expand Down
5 changes: 3 additions & 2 deletions src/LifeCycleHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,14 @@ export default class LifecycleHistory {
const query = JSON.parse(event.data.query);

// Establishing a pubSub connection if FCA receives an intent in the navigateTo event with the following parameters.
if (query.params && query.params.appId && query.params.testtoken && query.params.macaddress) {
if (query.params && query.params.appId && query.params.macaddress) {
// PUBSUB_CONNECTION environment variable has a pubsub client instance and calls the isConnected function to check the Websocket status.
if (!process.env.PUBSUB_CONNECTION || (process.env.PUBSUB_CONNECTION && !process.env.PUBSUB_CONNECTION.isConnected())) {
process.env.APP_TYPE = query.params.appType ? query.params.appType.toLowerCase() : CONSTANTS.FIREBOLT_CONST;
process.env.CURRENT_APPID = query.params.appId;
process.env.MACADDRESS = query.params.macaddress;
process.env.TEST_TOKEN = query.params.testtoken;
process.env.PUB_SUB_TOKEN = query.params.pubSubToken;
console.log('2507 test log - query params pubsubtoken discovery navigateTo', process.env.PUB_SUB_TOKEN);
const pubSubListenerCreation = new PubSubCommunication();
const webSocketConnection = await pubSubListenerCreation.startWebSocket();
}
Expand Down