Skip to content

Commit c9538ef

Browse files
refactor(app-distribution): migrate to TypeScript (#8967)
1 parent 483c143 commit c9538ef

14 files changed

Lines changed: 355 additions & 291 deletions

File tree

packages/app-distribution/lib/index.d.ts

Lines changed: 0 additions & 165 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) 2016-present Invertase Limited & Contributors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this library except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
export type { AppDistribution, AppDistributionRelease } from './types/app-distribution';
19+
export type { FirebaseAppDistributionTypes } from './types/namespaced';
20+
21+
export * from './modular';
22+
export * from './namespaced';
23+
export { default } from './namespaced';
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright (c) 2016-present Invertase Limited & Contributors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this library except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
import { getApp } from '@react-native-firebase/app';
19+
import type { ReactNativeFirebase } from '@react-native-firebase/app';
20+
import { MODULAR_DEPRECATION_ARG } from '@react-native-firebase/app/dist/module/common';
21+
import type { AppDistribution, AppDistributionRelease } from './types/app-distribution';
22+
import type { AppDistributionWithDeprecationArg } from './types/internal';
23+
24+
export type FirebaseAppDistribution = AppDistribution;
25+
26+
function ap(appDistribution: FirebaseAppDistribution): AppDistributionWithDeprecationArg {
27+
return appDistribution as AppDistributionWithDeprecationArg;
28+
}
29+
30+
export function getAppDistribution(app?: ReactNativeFirebase.FirebaseApp): FirebaseAppDistribution {
31+
if (app) {
32+
return getApp(app.name).appDistribution();
33+
}
34+
35+
return getApp().appDistribution();
36+
}
37+
38+
export function isTesterSignedIn(appDistribution: FirebaseAppDistribution): Promise<boolean> {
39+
return ap(appDistribution).isTesterSignedIn.call(appDistribution, MODULAR_DEPRECATION_ARG);
40+
}
41+
42+
export function signInTester(appDistribution: FirebaseAppDistribution): Promise<void> {
43+
return ap(appDistribution).signInTester.call(appDistribution, MODULAR_DEPRECATION_ARG);
44+
}
45+
46+
export function checkForUpdate(
47+
appDistribution: FirebaseAppDistribution,
48+
): Promise<AppDistributionRelease> {
49+
return ap(appDistribution).checkForUpdate.call(appDistribution, MODULAR_DEPRECATION_ARG);
50+
}
51+
52+
export function signOutTester(appDistribution: FirebaseAppDistribution): Promise<void> {
53+
return ap(appDistribution).signOutTester.call(appDistribution, MODULAR_DEPRECATION_ARG);
54+
}

packages/app-distribution/lib/modular/index.d.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

packages/app-distribution/lib/modular/index.js

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)