v0.4.0: bubble for Android 0.4.0 — an inverted (lighter) icon, chosen in Settings on both
The original icon is a little dark: resources/icon-inverted.png and ic_launcher_inverted.png are its negative (alpha kept). - Desktop: Settings → Appearance → Icon (Dark / Inverted), saved on click; sets the window icon and rewrites the launcher's installed copy - Android: Settings → Icon; two launcher activity-aliases, one enabled
This commit is contained in:
@@ -35,12 +35,25 @@
|
|||||||
android:name="me.teafry.voipmessages.MainActivity"
|
android:name="me.teafry.voipmessages.MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:windowSoftInputMode="adjustResize|stateHidden">
|
android:windowSoftInputMode="adjustResize|stateHidden" />
|
||||||
|
<!-- The launcher entry, one per icon: Settings → Icon enables one and
|
||||||
|
disables the other (Icons.java). -->
|
||||||
|
<activity-alias android:name="me.teafry.voipmessages.LauncherDark"
|
||||||
|
android:targetActivity="me.teafry.voipmessages.MainActivity"
|
||||||
|
android:icon="@drawable/ic_launcher" android:exported="true" android:enabled="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity-alias>
|
||||||
|
<activity-alias android:name="me.teafry.voipmessages.LauncherInverted"
|
||||||
|
android:targetActivity="me.teafry.voipmessages.MainActivity"
|
||||||
|
android:icon="@drawable/ic_launcher_inverted" android:exported="true" android:enabled="false">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity-alias>
|
||||||
<activity android:name="me.teafry.voipmessages.ChatActivity" android:exported="false"
|
<activity android:name="me.teafry.voipmessages.ChatActivity" android:exported="false"
|
||||||
android:windowSoftInputMode="adjustResize" />
|
android:windowSoftInputMode="adjustResize" />
|
||||||
<activity android:name="me.teafry.voipmessages.NewChatActivity" android:exported="false"
|
<activity android:name="me.teafry.voipmessages.NewChatActivity" android:exported="false"
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package me.teafry.voipmessages;
|
||||||
|
|
||||||
|
import android.content.ComponentName;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The launcher icon: the dark original or its negative (lighter), like the
|
||||||
|
* desktop's Settings → Appearance → Icon. Each is its own launcher entry
|
||||||
|
* (activity-alias); the choice is which one is enabled, so the launcher
|
||||||
|
* itself remembers it.
|
||||||
|
*/
|
||||||
|
final class Icons {
|
||||||
|
private Icons() {}
|
||||||
|
|
||||||
|
private static ComponentName dark(Context c) {
|
||||||
|
return new ComponentName(c, "me.teafry.voipmessages.LauncherDark");
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ComponentName inverted(Context c) {
|
||||||
|
return new ComponentName(c, "me.teafry.voipmessages.LauncherInverted");
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean isInverted(Context c) {
|
||||||
|
return c.getPackageManager().getComponentEnabledSetting(inverted(c)) == PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setInverted(Context c, boolean on) {
|
||||||
|
PackageManager pm = c.getPackageManager();
|
||||||
|
// The new entry first, so there's never a moment with no icon at all.
|
||||||
|
pm.setComponentEnabledSetting(on ? inverted(c) : dark(c), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||||
|
pm.setComponentEnabledSetting(on ? dark(c) : inverted(c), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -81,6 +81,18 @@ public final class SettingsActivity extends BaseActivity {
|
|||||||
notify.setOnCheckedChangeListener((v, on) -> Config.prefs(c).edit().putBoolean("notifications", on).apply());
|
notify.setOnCheckedChangeListener((v, on) -> Config.prefs(c).edit().putBoolean("notifications", on).apply());
|
||||||
box.addView(notify);
|
box.addView(notify);
|
||||||
|
|
||||||
|
section("Icon");
|
||||||
|
boolean inv = Icons.isInverted(c);
|
||||||
|
row("Launcher icon", inv ? "Inverted (lighter)" : "Dark", v -> {
|
||||||
|
new AlertDialog.Builder(c).setTitle("Launcher icon")
|
||||||
|
.setSingleChoiceItems(new String[] {"Dark", "Inverted (lighter)"}, inv ? 1 : 0, (d, i) -> {
|
||||||
|
if ((i == 1) != inv) Icons.setInverted(c, i == 1);
|
||||||
|
d.dismiss();
|
||||||
|
changed();
|
||||||
|
}).show();
|
||||||
|
});
|
||||||
|
note("The home screen can take a few seconds to show the new one.");
|
||||||
|
|
||||||
section("Accounts");
|
section("Accounts");
|
||||||
Config cfg = Config.get(c);
|
Config cfg = Config.get(c);
|
||||||
kv("voip.ms", cfg.voipUser == null ? "Not set up" : Sync.voipError != null ? "⚠ " + Sync.voipError : cfg.voipUser);
|
kv("voip.ms", cfg.voipUser == null ? "Not set up" : Sync.voipError != null ? "⚠ " + Sync.voipError : cfg.voipUser);
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 60 KiB |
+2
-2
@@ -26,8 +26,8 @@ import sys
|
|||||||
import zipfile
|
import zipfile
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
VERSION_NAME = "0.3.0"
|
VERSION_NAME = "0.4.0"
|
||||||
VERSION_CODE = 3
|
VERSION_CODE = 4
|
||||||
|
|
||||||
PACKAGE = "me.teafry.voipmessages"
|
PACKAGE = "me.teafry.voipmessages"
|
||||||
DEV_PACKAGE = PACKAGE + ".dev"
|
DEV_PACKAGE = PACKAGE + ".dev"
|
||||||
|
|||||||
+2
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "voipms-desktop",
|
"name": "voipms-desktop",
|
||||||
"productName": "bubble",
|
"productName": "bubble",
|
||||||
"version": "0.3.0",
|
"version": "0.4.0",
|
||||||
"description": "Signal-style desktop SMS client for voip.ms",
|
"description": "Signal-style desktop SMS client for voip.ms",
|
||||||
"author": "trav <trav@teafry.me>",
|
"author": "trav <trav@teafry.me>",
|
||||||
"private": true,
|
"private": true,
|
||||||
@@ -52,6 +52,7 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"out/**",
|
"out/**",
|
||||||
"resources/icon.png",
|
"resources/icon.png",
|
||||||
|
"resources/icon-inverted.png",
|
||||||
"package.json"
|
"package.json"
|
||||||
],
|
],
|
||||||
"extraResources": [
|
"extraResources": [
|
||||||
|
|||||||
Binary file not shown.
@@ -1 +1 @@
|
|||||||
{"version_name": "0.3.0", "version_code": 3, "package": "me.teafry.voipmessages"}
|
{"version_name": "0.4.0", "version_code": 4, "package": "me.teafry.voipmessages"}
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 213 KiB |
+32
-2
@@ -7,7 +7,7 @@ import path from 'node:path'
|
|||||||
import os from 'node:os'
|
import os from 'node:os'
|
||||||
import { pathToFileURL } from 'node:url'
|
import { pathToFileURL } from 'node:url'
|
||||||
import { charCount, groupMembers, isGroup, normalizeNumber, SMS_TEXT_LIMIT } from '@shared/phone'
|
import { charCount, groupMembers, isGroup, normalizeNumber, SMS_TEXT_LIMIT } from '@shared/phone'
|
||||||
import type { ChatExport, Credentials, Did, MediaRef, Message, NewContact, OutgoingAttachment, Provider, Settings, SyncStatus, Theme } from '@shared/types'
|
import type { ChatExport, IconStyle, Credentials, Did, MediaRef, Message, NewContact, OutgoingAttachment, Provider, Settings, SyncStatus, Theme } from '@shared/types'
|
||||||
import type { AppState } from '@shared/api'
|
import type { AppState } from '@shared/api'
|
||||||
import { addToAddressBook, ContactDirectory, listAddressBooks } from './contacts'
|
import { addToAddressBook, ContactDirectory, listAddressBooks } from './contacts'
|
||||||
import { localDay, MessageDb, type NewMessage } from './db'
|
import { localDay, MessageDb, type NewMessage } from './db'
|
||||||
@@ -275,6 +275,30 @@ async function readMedia(id: number, index: number): Promise<{ mime: string; dat
|
|||||||
return { mime: ref.mime ?? guessMime(ref.file) ?? 'application/octet-stream', data: new Uint8Array(fs.readFileSync(media.filePath(ref.file))) }
|
return { mime: ref.mime ?? guessMime(ref.file) ?? 'application/octet-stream', data: new Uint8Array(fs.readFileSync(media.filePath(ref.file))) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---- icon: the dark original or its negative (Settings → Appearance) ----
|
||||||
|
const iconFile = (style: IconStyle | undefined): string =>
|
||||||
|
path.join(__dirname, '../../resources', style === 'inverted' ? 'icon-inverted.png' : 'icon.png')
|
||||||
|
|
||||||
|
// The window's icon, and the launcher's (the copy scripts/install-desktop.sh
|
||||||
|
// put in ~/.local/share/icons), so the dash and Alt+Tab match too.
|
||||||
|
function applyIcon(): void {
|
||||||
|
const file = iconFile(settings.icon)
|
||||||
|
win?.setIcon(file)
|
||||||
|
if (SANDBOX || !app.isPackaged) return
|
||||||
|
const installed = path.join(os.homedir(), '.local/share/icons/hicolor/512x512/apps/voipms-desktop.png')
|
||||||
|
try {
|
||||||
|
if (!fs.existsSync(installed)) return
|
||||||
|
const want = fs.readFileSync(file)
|
||||||
|
if (Buffer.compare(want, fs.readFileSync(installed)) === 0) return
|
||||||
|
fs.writeFileSync(installed, want)
|
||||||
|
// GNOME caches icons by name: nudge it to look again.
|
||||||
|
const now = new Date()
|
||||||
|
fs.utimesSync(path.join(os.homedir(), '.local/share/icons/hicolor'), now, now)
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('[icon] could not update the launcher icon:', (e as Error).message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ---- theme + zoom ----
|
// ---- theme + zoom ----
|
||||||
function applyTheme(): void {
|
function applyTheme(): void {
|
||||||
nativeTheme.themeSource = settings.theme
|
nativeTheme.themeSource = settings.theme
|
||||||
@@ -476,6 +500,11 @@ function registerIpc(): void {
|
|||||||
gvSync?.resetBackfill()
|
gvSync?.resetBackfill()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
ipcMain.handle('setIcon', (_e, icon: IconStyle) => {
|
||||||
|
settings = { ...settings, icon }
|
||||||
|
saveSettings(settings)
|
||||||
|
applyIcon()
|
||||||
|
})
|
||||||
// Theme takes effect (and is saved) immediately, without the dialog's Save.
|
// Theme takes effect (and is saved) immediately, without the dialog's Save.
|
||||||
ipcMain.handle('setTheme', (_e, theme: Theme) => {
|
ipcMain.handle('setTheme', (_e, theme: Theme) => {
|
||||||
settings = { ...settings, theme }
|
settings = { ...settings, theme }
|
||||||
@@ -596,7 +625,7 @@ function createWindow(): void {
|
|||||||
title: SANDBOX ? 'bubble (sandbox)' : 'bubble',
|
title: SANDBOX ? 'bubble (sandbox)' : 'bubble',
|
||||||
backgroundColor: windowBackground(),
|
backgroundColor: windowBackground(),
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
icon: path.join(__dirname, '../../resources/icon.png'),
|
icon: iconFile(settings.icon),
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
preload: path.join(__dirname, '../preload/index.js'),
|
preload: path.join(__dirname, '../preload/index.js'),
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
@@ -662,6 +691,7 @@ app.whenReady().then(async () => {
|
|||||||
protocol.handle('mms-media', serveMedia)
|
protocol.handle('mms-media', serveMedia)
|
||||||
registerIpc()
|
registerIpc()
|
||||||
createWindow()
|
createWindow()
|
||||||
|
applyIcon()
|
||||||
// The sandbox stays away from the real address book.
|
// The sandbox stays away from the real address book.
|
||||||
if (!SANDBOX) void contacts.load()
|
if (!SANDBOX) void contacts.load()
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ const api: Api = {
|
|||||||
saveSetup: (creds, settings) => ipcRenderer.invoke('saveSetup', creds, settings),
|
saveSetup: (creds, settings) => ipcRenderer.invoke('saveSetup', creds, settings),
|
||||||
updateSettings: (settings) => ipcRenderer.invoke('updateSettings', settings),
|
updateSettings: (settings) => ipcRenderer.invoke('updateSettings', settings),
|
||||||
setTheme: (theme) => ipcRenderer.invoke('setTheme', theme),
|
setTheme: (theme) => ipcRenderer.invoke('setTheme', theme),
|
||||||
|
setIcon: (icon) => ipcRenderer.invoke('setIcon', icon),
|
||||||
signOut: () => ipcRenderer.invoke('signOut'),
|
signOut: () => ipcRenderer.invoke('signOut'),
|
||||||
connectGoogleVoice: () => ipcRenderer.invoke('connectGoogleVoice'),
|
connectGoogleVoice: () => ipcRenderer.invoke('connectGoogleVoice'),
|
||||||
connectGoogleVoiceCookies: (text) => ipcRenderer.invoke('connectGoogleVoiceCookies', text),
|
connectGoogleVoiceCookies: (text) => ipcRenderer.invoke('connectGoogleVoiceCookies', text),
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import type { AppState, RabbitStatus } from '@shared/api'
|
import type { AppState, RabbitStatus } from '@shared/api'
|
||||||
import { formatNumber } from '@shared/phone'
|
import { formatNumber } from '@shared/phone'
|
||||||
import type { AddressBook, GvStatus, Settings, SyncStatus, Theme } from '@shared/types'
|
import type { AddressBook, GvStatus, IconStyle, Settings, SyncStatus, Theme } from '@shared/types'
|
||||||
import { CloseIcon } from './Icons'
|
import { CloseIcon } from './Icons'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -16,8 +16,9 @@ export function SettingsDialog({ state, sync, onClose, onChanged }: Props) {
|
|||||||
const [note, setNote] = useState<string>()
|
const [note, setNote] = useState<string>()
|
||||||
// voip.ms numbers; Google Voice has its own section.
|
// voip.ms numbers; Google Voice has its own section.
|
||||||
const smsDids = state.dids.filter((d) => d.smsEnabled && d.provider !== 'gvoice')
|
const smsDids = state.dids.filter((d) => d.smsEnabled && d.provider !== 'gvoice')
|
||||||
// Theme is saved on click, so it never makes the dialog dirty.
|
// Theme and icon are saved on click, so they never make the dialog dirty.
|
||||||
const dirty = JSON.stringify({ ...s, theme: undefined }) !== JSON.stringify({ ...state.settings, theme: undefined })
|
const clicked = { theme: undefined, icon: undefined }
|
||||||
|
const dirty = JSON.stringify({ ...s, ...clicked }) !== JSON.stringify({ ...state.settings, ...clicked })
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const onKey = (e: KeyboardEvent): void => {
|
const onKey = (e: KeyboardEvent): void => {
|
||||||
@@ -67,6 +68,25 @@ export function SettingsDialog({ state, sync, onClose, onChanged }: Props) {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="field">
|
||||||
|
Icon
|
||||||
|
<div className="segmented" role="radiogroup" aria-label="Icon">
|
||||||
|
{(['dark', 'inverted'] as IconStyle[]).map((t) => (
|
||||||
|
<button
|
||||||
|
key={t}
|
||||||
|
role="radio"
|
||||||
|
aria-checked={(s.icon ?? 'dark') === t}
|
||||||
|
className={(s.icon ?? 'dark') === t ? 'on' : ''}
|
||||||
|
onClick={() => {
|
||||||
|
setS({ ...s, icon: t })
|
||||||
|
void window.api.setIcon(t).then(onChanged)
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t === 'dark' ? 'Dark' : 'Inverted'}
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<label className="field">
|
<label className="field">
|
||||||
Show new messages in the notification list
|
Show new messages in the notification list
|
||||||
<input type="checkbox" checked={s.notifications} onChange={(e) => setS({ ...s, notifications: e.target.checked })} />
|
<input type="checkbox" checked={s.notifications} onChange={(e) => setS({ ...s, notifications: e.target.checked })} />
|
||||||
|
|||||||
+2
-1
@@ -1,5 +1,5 @@
|
|||||||
// The typed bridge exposed to the renderer as window.api.
|
// The typed bridge exposed to the renderer as window.api.
|
||||||
import type { AddressBook, ChatExport, ContactInfo, NewContact, Conversation, Credentials, Did, Message, OutgoingAttachment, SearchHit, Settings, SyncStatus, Theme } from './types'
|
import type { IconStyle, AddressBook, ChatExport, ContactInfo, NewContact, Conversation, Credentials, Did, Message, OutgoingAttachment, SearchHit, Settings, SyncStatus, Theme } from './types'
|
||||||
|
|
||||||
export interface AppState {
|
export interface AppState {
|
||||||
configured: boolean
|
configured: boolean
|
||||||
@@ -23,6 +23,7 @@ export interface Api {
|
|||||||
saveSetup(creds: Credentials, settings: Settings): Promise<void>
|
saveSetup(creds: Credentials, settings: Settings): Promise<void>
|
||||||
updateSettings(settings: Settings): Promise<void>
|
updateSettings(settings: Settings): Promise<void>
|
||||||
setTheme(theme: Theme): Promise<void>
|
setTheme(theme: Theme): Promise<void>
|
||||||
|
setIcon(icon: IconStyle): Promise<void>
|
||||||
signOut(): Promise<void>
|
signOut(): Promise<void>
|
||||||
connectGoogleVoice(): Promise<void>
|
connectGoogleVoice(): Promise<void>
|
||||||
connectGoogleVoiceCookies(text: string): Promise<void>
|
connectGoogleVoiceCookies(text: string): Promise<void>
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ export type Direction = 'in' | 'out'
|
|||||||
export type MessageStatus = 'delivered' | 'pending' | 'failed'
|
export type MessageStatus = 'delivered' | 'pending' | 'failed'
|
||||||
export type MessageKind = 'sms' | 'mms'
|
export type MessageKind = 'sms' | 'mms'
|
||||||
export type Theme = 'system' | 'light' | 'dark'
|
export type Theme = 'system' | 'light' | 'dark'
|
||||||
|
// The app icon: the original dark photo, or its negative (lighter).
|
||||||
|
export type IconStyle = 'dark' | 'inverted'
|
||||||
|
|
||||||
// One MMS attachment. `url` is where voip.ms serves it; `file` is our cached
|
// One MMS attachment. `url` is where voip.ms serves it; `file` is our cached
|
||||||
// copy (a name inside <dataDir>/media), filled in once downloaded or sent.
|
// copy (a name inside <dataDir>/media), filled in once downloaded or sent.
|
||||||
@@ -127,6 +129,7 @@ export interface Settings {
|
|||||||
defaultDid?: string
|
defaultDid?: string
|
||||||
backfillFloor: string // YYYY-MM-DD, stop backfill here
|
backfillFloor: string // YYYY-MM-DD, stop backfill here
|
||||||
theme: Theme
|
theme: Theme
|
||||||
|
icon?: IconStyle // absent = dark
|
||||||
notifications: boolean // new messages go to the notification list
|
notifications: boolean // new messages go to the notification list
|
||||||
contactBook?: string // where "Add to contacts" puts them; default: GNOME Contacts' default
|
contactBook?: string // where "Add to contacts" puts them; default: GNOME Contacts' default
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user