mirror of
https://github.com/bulwarkmail/native.git
synced 2026-11-05 16:08:17 +00:00
The app now has two product flavors. `github` is the sideloaded APK as before, with the same package name and its in-app updater. `play` is a bundle for Google Play as `org.bulwarkmail.mobile`, without the updater or the installer permission, since Play forbids apps updating themselves. - `release-android.yml` builds the Play bundle in a second job, checks its signer, package name and permissions, and keeps it as an artifact. With `PLAY_SERVICE_ACCOUNT_JSON` set it uploads it to internal testing. - The Play flavor uses the new Firebase project; the GitHub flavor keeps the old one until the app re-registers its token when it changes. - Widget clicks and the device-sync account type follow the package name. - Photos come from the system picker without asking for media access, and the unused microphone permission from expo-camera is removed. - A manual workflow run without a tag no longer replaces the APK of the latest release.
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
|
|
async function load(os: string, nativeModules: Record<string, unknown>) {
|
|
vi.resetModules();
|
|
vi.doMock('react-native', () => ({ Platform: { OS: os }, NativeModules: nativeModules }));
|
|
return import('../platform-capabilities');
|
|
}
|
|
|
|
afterEach(() => {
|
|
vi.doUnmock('react-native');
|
|
});
|
|
|
|
describe('supportsSideloadUpdates', () => {
|
|
it('is on for the GitHub build', async () => {
|
|
const caps = await load('android', { BulwarkBuild: { distribution: 'github' } });
|
|
expect(caps.androidDistribution).toBe('github');
|
|
expect(caps.supportsSideloadUpdates).toBe(true);
|
|
});
|
|
|
|
it('is off for the Play build, which Play updates', async () => {
|
|
const caps = await load('android', { BulwarkBuild: { distribution: 'play' } });
|
|
expect(caps.androidDistribution).toBe('play');
|
|
expect(caps.supportsSideloadUpdates).toBe(false);
|
|
});
|
|
|
|
it('treats a build without the module as the GitHub build', async () => {
|
|
const caps = await load('android', {});
|
|
expect(caps.supportsSideloadUpdates).toBe(true);
|
|
});
|
|
|
|
it('is off on iOS', async () => {
|
|
const caps = await load('ios', {});
|
|
expect(caps.supportsSideloadUpdates).toBe(false);
|
|
});
|
|
});
|