diff --git a/.github/workflows/release-android.yml b/.github/workflows/release-android.yml index 881ee215..2a8116b8 100644 --- a/.github/workflows/release-android.yml +++ b/.github/workflows/release-android.yml @@ -59,7 +59,7 @@ jobs: - name: Rename APK with version id: artifact run: | - VERSION=$(node -p "require('./app.json').expo.version") + VERSION=$(cat VERSION | tr -d '[:space:]') SRC=android/app/build/outputs/apk/release/app-release.apk DEST="bulwark-mobile-${VERSION}-${GITHUB_SHA::7}.apk" cp "$SRC" "$DEST" diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..6e8bf73a --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/android/app/build.gradle b/android/app/build.gradle index a81980d3..65ecd40d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -5,6 +5,8 @@ apply plugin: "com.google.gms.google-services" def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath() +def appVersionName = file("${projectRoot}/VERSION").text.trim() + /** * This is the configuration block to customize your React Native Android app. * By default you don't need to apply any configuration, just uncomment the lines you need. @@ -94,7 +96,7 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 - versionName "1.0.0" + versionName appVersionName buildConfigField "String", "REACT_NATIVE_RELEASE_LEVEL", "\"${findProperty('reactNativeReleaseLevel') ?: 'stable'}\"" } diff --git a/app.config.js b/app.config.js new file mode 100644 index 00000000..49fc5068 --- /dev/null +++ b/app.config.js @@ -0,0 +1,53 @@ +const fs = require('node:fs'); +const path = require('node:path'); +const { execSync } = require('node:child_process'); + +const VERSION = fs.readFileSync(path.join(__dirname, 'VERSION'), 'utf8').trim(); + +let COMMIT = process.env.GITHUB_SHA || ''; +if (!COMMIT) { + try { + COMMIT = execSync('git rev-parse --short HEAD', { cwd: __dirname, stdio: ['ignore', 'pipe', 'ignore'] }) + .toString() + .trim(); + } catch { + COMMIT = 'dev'; + } +} +COMMIT = COMMIT.slice(0, 7); + +module.exports = { + expo: { + name: 'Bulwark Mobile', + slug: 'bulwark-mobile', + version: VERSION, + orientation: 'portrait', + icon: './assets/icon.png', + userInterfaceStyle: 'dark', + newArchEnabled: true, + splash: { + image: './assets/splash-icon.png', + resizeMode: 'contain', + backgroundColor: '#09090b', + }, + ios: { + supportsTablet: true, + }, + android: { + adaptiveIcon: { + foregroundImage: './assets/adaptive-icon.png', + backgroundColor: '#09090b', + }, + edgeToEdgeEnabled: true, + predictiveBackGestureEnabled: false, + package: 'com.anonymous.bulwarkmobile', + }, + web: { + favicon: './assets/favicon.png', + }, + plugins: ['expo-secure-store', '@react-native-community/datetimepicker'], + extra: { + commit: COMMIT, + }, + }, +}; diff --git a/app.json b/app.json deleted file mode 100644 index 3e4e28b0..00000000 --- a/app.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "expo": { - "name": "Bulwark Mobile", - "slug": "bulwark-mobile", - "version": "1.0.0", - "orientation": "portrait", - "icon": "./assets/icon.png", - "userInterfaceStyle": "dark", - "newArchEnabled": true, - "splash": { - "image": "./assets/splash-icon.png", - "resizeMode": "contain", - "backgroundColor": "#09090b" - }, - "ios": { - "supportsTablet": true - }, - "android": { - "adaptiveIcon": { - "foregroundImage": "./assets/adaptive-icon.png", - "backgroundColor": "#09090b" - }, - "edgeToEdgeEnabled": true, - "predictiveBackGestureEnabled": false, - "package": "com.anonymous.bulwarkmobile" - }, - "web": { - "favicon": "./assets/favicon.png" - }, - "plugins": [ - "expo-secure-store", - "@react-native-community/datetimepicker" - ] - } -} diff --git a/package.json b/package.json index 74df7a5e..ee763600 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bulwark-mobile", - "version": "1.0.0", + "version": "0.1.0", "license": "AGPL-3.0-only", "main": "index.ts", "scripts": { diff --git a/src/components/settings/AdvancedSettings.tsx b/src/components/settings/AdvancedSettings.tsx index 07163823..cee60ed7 100644 --- a/src/components/settings/AdvancedSettings.tsx +++ b/src/components/settings/AdvancedSettings.tsx @@ -1,13 +1,14 @@ import React, { useEffect, useState } from 'react'; import { View, Text, StyleSheet, Pressable, Linking, Alert } from 'react-native'; +import Constants from 'expo-constants'; import { ExternalLink } from 'lucide-react-native'; import { SettingsSection, SettingItem, ToggleSwitch } from './settings-section'; import Button from '../Button'; import { colors, spacing, radius, typography } from '../../theme/tokens'; import { useSettingsStore } from '../../stores/settings-store'; -const APP_VERSION = '0.0.0'; -const GIT_COMMIT = 'unknown'; +const APP_VERSION = Constants.expoConfig?.version ?? '0.0.0'; +const GIT_COMMIT = (Constants.expoConfig?.extra as { commit?: string } | undefined)?.commit ?? 'dev'; const DEBUG_CATEGORIES = [ { id: 'jmap', label: 'JMAP', description: 'JMAP request and response logs.' },