Skip to content

Commit d2a7198

Browse files
mmermerkayaFeiyang1
authored andcommitted
Fix test-app (#117)
1 parent 8471e75 commit d2a7198

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

packages/installations/test-app/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
</style>
1313
</head>
1414
<body>
15+
<p>
16+
<label for="appName">App Name</label>
17+
<input id="appName" value="app-name" />
18+
</p>
1519
<p>
1620
<label for="projectId">Project Id</label>
1721
<input id="projectId" value="android-gcm-test-519bd" />

packages/installations/test-app/index.js

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,11 @@ function getInputValue(elementId) {
6363
}
6464

6565
function getFid() {
66-
const projectId = getInputValue('projectId');
67-
const apiKey = getInputValue('apiKey');
68-
const appId = getInputValue('appId');
69-
printRequest(
70-
'Get FID',
71-
FirebaseInstallations.getFid({ options: { projectId, apiKey, appId } })
72-
);
66+
printRequest('Get FID', FirebaseInstallations.getFid(getApp()));
7367
}
7468

7569
function getAuthToken() {
76-
const projectId = getInputValue('projectId');
77-
const apiKey = getInputValue('apiKey');
78-
const appId = getInputValue('appId');
79-
printRequest(
80-
'Get Auth Token',
81-
FirebaseInstallations.getAuthToken({
82-
options: { projectId, apiKey, appId }
83-
})
84-
);
70+
printRequest('Get Auth Token', FirebaseInstallations.getAuthToken(getApp()));
8571
}
8672

8773
async function printRequest(requestInfo, promise) {
@@ -103,6 +89,17 @@ function format(o) {
10389
return `<span class="formatted-content">${escapedString}</span>`;
10490
}
10591

92+
function getApp() {
93+
const appName = getInputValue('appName');
94+
const projectId = getInputValue('projectId');
95+
const apiKey = getInputValue('apiKey');
96+
const appId = getInputValue('appId');
97+
return {
98+
name: appName,
99+
options: { projectId, apiKey, appId }
100+
};
101+
}
102+
106103
getElement('getFid').onclick = getFid;
107104
getElement('getAuthToken').onclick = getAuthToken;
108105
getElement('clearDb').onclick = clearDb;

0 commit comments

Comments
 (0)