Merge branch 'spike/nativephp-mobile'

This commit is contained in:
Dwindi Ramadhana
2026-02-21 22:43:17 +07:00
72 changed files with 3111 additions and 37 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
.DS_Store
**/.DS_Store

106
apk-direct-release-guide.md Normal file
View File

@@ -0,0 +1,106 @@
# APK Direct Release Guide (Local Build + Cloudflare R2)
This is the Dewemoji direct APK release flow.
## 1) One-time setup
### Required tools (local machine)
```bash
brew install awscli
brew install --cask android-platform-tools
```
### Required environment variables
```bash
export R2_ACCOUNT_ID="..."
export R2_ACCESS_KEY_ID="..."
export R2_SECRET_ACCESS_KEY="..."
export R2_BUCKET="dewemoji-downloads"
export R2_PUBLIC_BASE_URL="https://downloads.dewemoji.com"
```
Optional:
```bash
export DEWEMOJI_APK_URL="https://dewemoji.com/downloads/dewemoji-latest.apk"
```
### Optional signing environment (recommended)
```bash
export ANDROID_KEYSTORE_PATH="/absolute/path/release.jks"
export ANDROID_KEYSTORE_PASSWORD="..."
export ANDROID_KEY_ALIAS="..."
export ANDROID_KEY_PASSWORD="..."
```
---
## 2) Canonical URLs used by app updater
- `https://dewemoji.com/downloads/version.json`
- `https://dewemoji.com/downloads/dewemoji-latest.apk`
These endpoints redirect to R2 objects.
---
## 3) Release steps
Run from repo root.
### A. Build APK
```bash
./scripts/apk/build-release.sh
```
Output APK:
- `dewemoji-capacitor/dist/apk/dewemoji-v{versionName}-{versionCode}.apk`
### B. Publish APK + metadata to R2
```bash
./scripts/apk/publish-r2.sh \
--apk dewemoji-capacitor/dist/apk/dewemoji-v1.1.2-112.apk \
--version-name 1.1.2 \
--version-code 112 \
--min-supported-version-code 100 \
--notes "Bug fixes and update UX improvements" \
--force false
```
### C. Verify published release
```bash
./scripts/apk/verify-release.sh --base-url https://dewemoji.com/downloads
```
---
## 4) Versioning rules
1. Site-only deploy: do not bump APK version and do not publish new `version.json`.
2. Runtime/app-shell change: bump `versionCode` + `versionName`, then publish.
3. `versionCode` must always increase.
4. App update prompt appears only when remote `versionCode` is higher.
---
## 5) Rollback
1. Keep all versioned APK objects immutable (never overwrite).
2. Re-upload previous good APK to `apk/dewemoji-latest.apk`.
3. Re-publish `apk/version.json` with matching checksum/version fields.
4. Re-run verify script.
---
## 6) Notes
- Direct APK update is user-confirmed install (Android policy), not silent.
- Never embed R2 credentials in app.
- Keep app update payload over HTTPS only.

View File

@@ -9,6 +9,7 @@ use App\Models\Subscription;
use App\Models\UserKeyword;
use App\Services\System\SettingsService;
use Illuminate\Contracts\View\View;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@@ -264,7 +265,40 @@ class SiteController extends Controller
public function download(): View
{
return view('site.download');
$downloadBaseUrl = rtrim((string) config('dewemoji.apk_release.public_base_url', ''), '/');
$androidEnabled = (bool) config('dewemoji.apk_release.enabled', false) && $downloadBaseUrl !== '';
return view('site.download', [
'androidEnabled' => $androidEnabled,
'androidVersionJsonUrl' => $androidEnabled ? $downloadBaseUrl.'/version.json' : '',
'androidLatestApkUrl' => $androidEnabled ? $downloadBaseUrl.'/dewemoji-latest.apk' : '',
]);
}
public function downloadVersionJson(Request $request): RedirectResponse|JsonResponse
{
$target = $this->apkReleaseTargetUrl('version_json');
if ($target === '') {
return response()->json(['ok' => false, 'error' => 'apk_release_not_configured'], 404);
}
return redirect()->away($target, 302, [
'Cache-Control' => 'no-store, no-cache, must-revalidate',
'Pragma' => 'no-cache',
]);
}
public function downloadLatestApk(Request $request): RedirectResponse|JsonResponse
{
$target = $this->apkReleaseTargetUrl('latest_apk');
if ($target === '') {
return response()->json(['ok' => false, 'error' => 'apk_release_not_configured'], 404);
}
return redirect()->away($target, 302, [
'Cache-Control' => 'no-store, no-cache, must-revalidate',
'Pragma' => 'no-cache',
]);
}
public function privacy(): View
@@ -465,6 +499,21 @@ class SiteController extends Controller
return (string) config('dewemoji.data_path');
}
private function apkReleaseTargetUrl(string $key): string
{
if (!(bool) config('dewemoji.apk_release.enabled', false)) {
return '';
}
$base = trim((string) config('dewemoji.apk_release.r2_public_base_url', ''));
$objectKey = trim((string) config("dewemoji.apk_release.r2_keys.{$key}", ''));
if ($base === '' || $objectKey === '') {
return '';
}
return rtrim($base, '/').'/'.ltrim($objectKey, '/');
}
/**
* @param array<string,mixed> $emoji
*/

View File

@@ -123,4 +123,17 @@ return [
'token' => (string) env('DEWEMOJI_METRICS_TOKEN', ''),
'allow_ips' => array_values(array_filter(array_map('trim', explode(',', (string) env('DEWEMOJI_METRICS_ALLOW_IPS', '127.0.0.1,::1'))))),
],
'apk_release' => [
'enabled' => filter_var(env('DEWEMOJI_APK_RELEASE_ENABLED', false), FILTER_VALIDATE_BOOL),
'app_id' => (string) env('DEWEMOJI_APK_APP_ID', 'com.dewemoji.app'),
'channel' => (string) env('DEWEMOJI_APK_CHANNEL', 'stable'),
'min_supported_version_code' => (int) env('DEWEMOJI_APK_MIN_SUPPORTED_VERSION_CODE', 1),
'public_base_url' => (string) env('DEWEMOJI_APK_PUBLIC_BASE_URL', 'https://dewemoji.com/downloads'),
'r2_public_base_url' => (string) env('DEWEMOJI_R2_PUBLIC_BASE_URL', ''),
'r2_keys' => [
'latest_apk' => (string) env('DEWEMOJI_R2_APK_LATEST_KEY', 'apk/dewemoji-latest.apk'),
'version_json' => (string) env('DEWEMOJI_R2_APK_VERSION_KEY', 'apk/version.json'),
],
],
];

View File

@@ -105,47 +105,47 @@
<button id="quick-action-btn" class="rounded-full bg-white/10 text-white border border-white/10 px-5 py-2 text-sm font-semibold hover:bg-white/20 transition-colors">
Quick action
</button>
<div id="quick-action-menu" class="hidden absolute right-0 mt-2 w-60 rounded-2xl border border-slate-200 bg-white p-2 shadow-xl dark:border-white/10 dark:bg-[#0b0b0f]/95 dark:backdrop-blur">
<div id="quick-action-menu" class="hidden absolute left-0 sm:left-auto sm:right-0 mt-2 w-60 max-w-[calc(100vw-2rem)] rounded-2xl border border-slate-200 bg-white p-2 shadow-xl z-50 dark:border-white/10 dark:bg-[#0b0b0f]/95 dark:backdrop-blur">
<div class="text-[11px] uppercase tracking-[0.3em] text-slate-500 px-3 py-2 dark:text-gray-500">Actions</div>
@if ($isAdmin)
<a href="{{ route('dashboard.admin.users') }}" class="flex items-center gap-3 px-3 py-2 rounded-xl text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<a href="{{ route('dashboard.admin.users') }}" class="flex items-center gap-3 rounded-xl px-4 py-3 min-h-11 text-base sm:text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<i data-lucide="users" class="w-4 h-4"></i><span>Manage users</span>
</a>
<a href="{{ route('dashboard.admin.subscriptions') }}" class="flex items-center gap-3 px-3 py-2 rounded-xl text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<a href="{{ route('dashboard.admin.subscriptions') }}" class="flex items-center gap-3 rounded-xl px-4 py-3 min-h-11 text-base sm:text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<i data-lucide="credit-card" class="w-4 h-4"></i><span>Grant subscription</span>
</a>
<a href="{{ route('dashboard.admin.catalog') }}" class="flex items-center gap-3 px-3 py-2 rounded-xl text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<a href="{{ route('dashboard.admin.catalog') }}" class="flex items-center gap-3 rounded-xl px-4 py-3 min-h-11 text-base sm:text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<i data-lucide="package-search" class="w-4 h-4"></i><span>Manage catalog</span>
</a>
<a href="{{ route('dashboard.admin.webhooks') }}" class="flex items-center gap-3 px-3 py-2 rounded-xl text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<a href="{{ route('dashboard.admin.webhooks') }}" class="flex items-center gap-3 rounded-xl px-4 py-3 min-h-11 text-base sm:text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<i data-lucide="webhook" class="w-4 h-4"></i><span>Review webhooks</span>
</a>
<a href="{{ route('dashboard.admin.audit_logs') }}" class="flex items-center gap-3 px-3 py-2 rounded-xl text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<a href="{{ route('dashboard.admin.audit_logs') }}" class="flex items-center gap-3 rounded-xl px-4 py-3 min-h-11 text-base sm:text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<i data-lucide="list-checks" class="w-4 h-4"></i><span>Audit logs</span>
</a>
<a href="{{ route('dashboard.admin.settings') }}" class="flex items-center gap-3 px-3 py-2 rounded-xl text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<a href="{{ route('dashboard.admin.settings') }}" class="flex items-center gap-3 rounded-xl px-4 py-3 min-h-11 text-base sm:text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<i data-lucide="settings" class="w-4 h-4"></i><span>Update settings</span>
</a>
<a href="{{ route('profile.edit') }}" class="flex items-center gap-3 px-3 py-2 rounded-xl text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<a href="{{ route('profile.edit') }}" class="flex items-center gap-3 rounded-xl px-4 py-3 min-h-11 text-base sm:text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<i data-lucide="user-round" class="w-4 h-4"></i><span>Edit profile</span>
</a>
@else
<a href="{{ route('dashboard.keywords') }}" class="flex items-center gap-3 px-3 py-2 rounded-xl text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<a href="{{ route('dashboard.keywords') }}" class="flex items-center gap-3 rounded-xl px-4 py-3 min-h-11 text-base sm:text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<i data-lucide="hash" class="w-4 h-4"></i><span>My keywords</span>
</a>
<a href="{{ route('dashboard.keywords') }}#add" class="flex items-center gap-3 px-3 py-2 rounded-xl text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<a href="{{ route('dashboard.keywords') }}#add" class="flex items-center gap-3 rounded-xl px-4 py-3 min-h-11 text-base sm:text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<i data-lucide="plus-circle" class="w-4 h-4"></i><span>Add keyword</span>
</a>
<a href="{{ route('dashboard.api-keys') }}" class="flex items-center gap-3 px-3 py-2 rounded-xl text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<a href="{{ route('dashboard.api-keys') }}" class="flex items-center gap-3 rounded-xl px-4 py-3 min-h-11 text-base sm:text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<i data-lucide="key-round" class="w-4 h-4"></i><span>Manage API keys</span>
</a>
<a href="{{ route('dashboard.billing') }}" class="flex items-center gap-3 px-3 py-2 rounded-xl text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<a href="{{ route('dashboard.billing') }}" class="flex items-center gap-3 rounded-xl px-4 py-3 min-h-11 text-base sm:text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<i data-lucide="badge-dollar-sign" class="w-4 h-4"></i><span>Billing overview</span>
</a>
<a href="{{ route('dashboard.preferences') }}" class="flex items-center gap-3 px-3 py-2 rounded-xl text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<a href="{{ route('dashboard.preferences') }}" class="flex items-center gap-3 rounded-xl px-4 py-3 min-h-11 text-base sm:text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<i data-lucide="settings-2" class="w-4 h-4"></i><span>Preferences</span>
</a>
<a href="{{ route('profile.edit') }}" class="flex items-center gap-3 px-3 py-2 rounded-xl text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<a href="{{ route('profile.edit') }}" class="flex items-center gap-3 rounded-xl px-4 py-3 min-h-11 text-base sm:text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<i data-lucide="user-round" class="w-4 h-4"></i><span>Edit profile</span>
</a>
@endif
@@ -156,15 +156,15 @@
<button id="export-btn" class="rounded-full border border-white/10 px-5 py-2 text-sm font-semibold text-gray-200 hover:bg-white/5 transition-colors">
Export
</button>
<div id="export-menu" class="hidden absolute right-0 mt-2 w-56 rounded-2xl border border-slate-200 bg-white p-2 shadow-xl dark:border-white/10 dark:bg-[#0b0b0f]/95 dark:backdrop-blur">
<div id="export-menu" class="hidden absolute left-0 sm:left-auto sm:right-0 mt-2 w-56 max-w-[calc(100vw-2rem)] rounded-2xl border border-slate-200 bg-white p-2 shadow-xl z-50 dark:border-white/10 dark:bg-[#0b0b0f]/95 dark:backdrop-blur">
<div class="text-[11px] uppercase tracking-[0.3em] text-slate-500 px-3 py-2 dark:text-gray-500">Export CSV</div>
<a href="{{ route('dashboard.admin.export', array_merge(['type' => 'users'], $exportQuery)) }}" class="flex items-center gap-3 px-3 py-2 rounded-xl text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<a href="{{ route('dashboard.admin.export', array_merge(['type' => 'users'], $exportQuery)) }}" class="flex items-center gap-3 rounded-xl px-4 py-3 min-h-11 text-base sm:text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<i data-lucide="users" class="w-4 h-4"></i><span>Users</span>
</a>
<a href="{{ route('dashboard.admin.export', array_merge(['type' => 'subscriptions'], $exportQuery)) }}" class="flex items-center gap-3 px-3 py-2 rounded-xl text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<a href="{{ route('dashboard.admin.export', array_merge(['type' => 'subscriptions'], $exportQuery)) }}" class="flex items-center gap-3 rounded-xl px-4 py-3 min-h-11 text-base sm:text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<i data-lucide="credit-card" class="w-4 h-4"></i><span>Subscriptions</span>
</a>
<a href="{{ route('dashboard.admin.export', array_merge(['type' => 'webhooks'], $exportQuery)) }}" class="flex items-center gap-3 px-3 py-2 rounded-xl text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<a href="{{ route('dashboard.admin.export', array_merge(['type' => 'webhooks'], $exportQuery)) }}" class="flex items-center gap-3 rounded-xl px-4 py-3 min-h-11 text-base sm:text-sm text-slate-700 hover:bg-slate-100 dark:text-gray-200 dark:hover:bg-white/10">
<i data-lucide="webhook" class="w-4 h-4"></i><span>Webhooks</span>
</a>
</div>

View File

@@ -86,7 +86,7 @@
<th class="px-4 py-3 text-left">Keyword</th>
<th class="px-4 py-3 text-left">Language</th>
<th class="px-4 py-3 text-left">Status</th>
<th class="px-4 py-3 text-right">Actions</th>
<th class="hidden px-4 py-3 text-right md:table-cell">Actions</th>
</tr>
</thead>
<tbody id="keyword-table">
@@ -104,7 +104,44 @@
</div>
</div>
</td>
<td class="px-4 py-3 font-semibold text-white">{{ $item->keyword }}</td>
<td class="px-4 py-3 font-semibold text-white">
{{ $item->keyword }}
@php
$isActiveMobile = (bool) ($item->is_active ?? true);
$canActivateMobile = $isActiveMobile || $isPersonal || !$limitReached;
@endphp
<div class="mt-3 flex flex-wrap gap-2 md:hidden">
<button
type="button"
class="edit-btn rounded-full border border-white/10 px-3 py-1.5 text-xs text-gray-200 hover:bg-white/10"
data-id="{{ $item->id }}"
data-emoji="{{ $item->emoji_slug }}"
data-keyword="{{ $item->keyword }}"
data-lang="{{ $item->lang }}"
>
Edit
</button>
<form method="POST" action="{{ route('dashboard.keywords.toggle_active', $item->id) }}" class="inline">
@csrf
@method('PUT')
<input type="hidden" name="is_active" value="{{ $isActiveMobile ? '0' : '1' }}">
<button
type="submit"
class="rounded-full border border-white/10 px-3 py-1.5 text-xs text-gray-200 hover:bg-white/10 {{ (!$canActivateMobile && !$isActiveMobile) ? 'opacity-50 cursor-not-allowed' : '' }}"
{{ (!$canActivateMobile && !$isActiveMobile) ? 'disabled' : '' }}
>
{{ $isActiveMobile ? 'Deactivate' : 'Activate' }}
</button>
</form>
<form method="POST" action="{{ route('dashboard.keywords.delete', $item->id) }}" class="inline">
@csrf
@method('DELETE')
<button type="submit" class="rounded-full border border-white/10 px-3 py-1.5 text-xs text-gray-200 hover:bg-white/10">
Delete
</button>
</form>
</div>
</td>
<td class="px-4 py-3 text-xs uppercase tracking-[0.15em] text-gray-400">{{ $item->lang ?? 'und' }}</td>
<td class="px-4 py-3">
@php
@@ -115,7 +152,7 @@
{{ $isActive ? 'Active' : 'Inactive' }}
</span>
</td>
<td class="px-4 py-3 text-right">
<td class="hidden px-4 py-3 text-right md:table-cell">
<button
type="button"
class="edit-btn rounded-full border border-white/10 px-3 py-1 text-xs text-gray-200 hover:bg-white/10"

View File

@@ -1,7 +1,7 @@
@extends('site.layout')
@section('title', 'Download - Dewemoji')
@section('meta_description', 'Download Dewemoji for Chrome and get notified when Android app is available.')
@section('meta_description', 'Download Dewemoji for Chrome and Android.')
@push('jsonld')
<script type="application/ld+json">
@@ -78,16 +78,33 @@
</section>
<section class="glass-card rounded-2xl p-6">
<div class="text-xs uppercase tracking-[0.25em] text-gray-400">Coming soon</div>
<div class="text-xs uppercase tracking-[0.25em] text-gray-400">
{{ $androidEnabled ? 'Available now' : 'Coming soon' }}
</div>
<h2 class="mt-2 text-2xl font-semibold">Android App</h2>
<p class="mt-2 text-sm text-gray-300">Native app release is in progress. We will launch internal testing first, then public release.</p>
<div class="mt-5 inline-flex items-center gap-2 rounded-full border border-white/10 px-4 py-2 text-xs text-gray-300 bg-white/5">
<i data-lucide="smartphone" class="w-4 h-4"></i>
Android release in preparation
</div>
<div class="mt-4 text-xs text-gray-400">
Recommended for now: use web dashboard + Chrome extension.
</div>
@if($androidEnabled)
<p class="mt-2 text-sm text-gray-300">Direct APK distribution from Dewemoji download channel.</p>
<a
href="{{ $androidLatestApkUrl }}"
rel="noopener"
class="mt-5 inline-flex items-center gap-2 rounded-full bg-brand-sun text-black px-5 py-2.5 text-sm font-semibold hover:brightness-95 transition-colors"
>
<i data-lucide="smartphone" class="w-4 h-4"></i>
Download APK
</a>
<div class="mt-4 text-xs text-gray-400">
Update metadata: <a href="{{ $androidVersionJsonUrl }}" class="underline hover:text-gray-200">{{ $androidVersionJsonUrl }}</a>
</div>
@else
<p class="mt-2 text-sm text-gray-300">Native app release is in progress. We will launch internal testing first, then public release.</p>
<div class="mt-5 inline-flex items-center gap-2 rounded-full border border-white/10 px-4 py-2 text-xs text-gray-300 bg-white/5">
<i data-lucide="smartphone" class="w-4 h-4"></i>
Android release in preparation
</div>
<div class="mt-4 text-xs text-gray-400">
Recommended for now: use web dashboard + Chrome extension.
</div>
@endif
</section>
<section class="glass-card rounded-2xl p-6 lg:col-span-2">
@@ -100,12 +117,14 @@
</div>
<div class="mt-1 text-sm text-emerald-100">Available</div>
</div>
<div class="rounded-xl border border-amber-500/30 bg-amber-500/10 p-4">
<div class="flex items-center gap-2 text-xs uppercase tracking-[0.2em] text-amber-300">
<div class="rounded-xl {{ $androidEnabled ? 'border border-emerald-500/30 bg-emerald-500/10' : 'border border-amber-500/30 bg-amber-500/10' }} p-4">
<div class="flex items-center gap-2 text-xs uppercase tracking-[0.2em] {{ $androidEnabled ? 'text-emerald-300' : 'text-amber-300' }}">
<i data-lucide="bot" class="w-4 h-4"></i>
<span>Android</span>
</div>
<div class="mt-1 text-sm text-amber-100">In progress</div>
<div class="mt-1 text-sm {{ $androidEnabled ? 'text-emerald-100' : 'text-amber-100' }}">
{{ $androidEnabled ? 'Available' : 'In progress' }}
</div>
</div>
<div class="rounded-xl border border-sky-500/30 bg-sky-500/10 p-4">
<div class="flex items-center gap-2 text-xs uppercase tracking-[0.2em] text-sky-300">

View File

@@ -17,6 +17,8 @@ Route::get('/emoji/{slug}', [SiteController::class, 'emojiDetail'])->name('emoji
Route::get('/pricing', [SiteController::class, 'pricing'])->name('pricing');
Route::post('/pricing/currency', [SiteController::class, 'setPricingCurrency'])->name('pricing.currency');
Route::get('/download', [SiteController::class, 'download'])->name('download');
Route::get('/downloads/version.json', [SiteController::class, 'downloadVersionJson'])->name('downloads.version');
Route::get('/downloads/dewemoji-latest.apk', [SiteController::class, 'downloadLatestApk'])->name('downloads.latest-apk');
Route::get('/support', [SiteController::class, 'support'])->name('support');
Route::get('/privacy', [SiteController::class, 'privacy'])->name('privacy');
Route::get('/terms', [SiteController::class, 'terms'])->name('terms');

View File

@@ -11,6 +11,10 @@ class SitePagesTest extends TestCase
parent::setUp();
config()->set('dewemoji.data_path', base_path('tests/Fixtures/emojis.fixture.json'));
config()->set('dewemoji.apk_release.enabled', true);
config()->set('dewemoji.apk_release.r2_public_base_url', 'https://downloads.example.com');
config()->set('dewemoji.apk_release.r2_keys.latest_apk', 'apk/dewemoji-latest.apk');
config()->set('dewemoji.apk_release.r2_keys.version_json', 'apk/version.json');
}
public function test_core_pages_are_available(): void
@@ -39,4 +43,15 @@ class SitePagesTest extends TestCase
{
$this->get('/emoji/unknown-slug')->assertNotFound();
}
public function test_download_redirect_endpoints_are_available(): void
{
$this->get('/downloads/version.json')
->assertStatus(302)
->assertRedirect('https://downloads.example.com/apk/version.json');
$this->get('/downloads/dewemoji-latest.apk')
->assertStatus(302)
->assertRedirect('https://downloads.example.com/apk/dewemoji-latest.apk');
}
}

View File

@@ -185,7 +185,34 @@ This avoids extension users hitting endpoints that are not ready.
---
## 8) Rollback Strategy
## 8) APK Release (Direct Download)
APK release is independent from site redeploy.
Canonical URLs used by the app updater:
1. `https://dewemoji.com/downloads/version.json`
2. `https://dewemoji.com/downloads/dewemoji-latest.apk`
Set these env vars on app server:
```env
DEWEMOJI_APK_RELEASE_ENABLED=true
DEWEMOJI_APK_PUBLIC_BASE_URL=https://dewemoji.com/downloads
DEWEMOJI_R2_PUBLIC_BASE_URL=https://downloads.your-r2-domain.com
DEWEMOJI_R2_APK_VERSION_KEY=apk/version.json
DEWEMOJI_R2_APK_LATEST_KEY=apk/dewemoji-latest.apk
```
Validate redirects:
```bash
curl -I https://dewemoji.com/downloads/version.json
curl -I https://dewemoji.com/downloads/dewemoji-latest.apk
```
---
## 9) Rollback Strategy
If release is broken:
1. Re-deploy previous known-good git commit.
@@ -198,4 +225,3 @@ php artisan queue:restart
```
3. If issue is emoji dataset, use snapshot activation in admin catalog.

15
dewemoji-capacitor/.gitignore vendored Normal file
View File

@@ -0,0 +1,15 @@
node_modules/
.DS_Store
# Capacitor / Android generated files
android/.gradle/
android/.idea/
android/local.properties
android/app/build/
android/build/
dist/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*

101
dewemoji-capacitor/android/.gitignore vendored Normal file
View File

@@ -0,0 +1,101 @@
# Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore
# Built application files
*.apk
*.aar
*.ap_
*.aab
# Files for the ART/Dalvik VM
*.dex
# Java class files
*.class
# Generated files
bin/
gen/
out/
# Uncomment the following line in case you need and you don't have the release build type files in your app
# release/
# Gradle files
.gradle/
build/
# Local configuration file (sdk path, etc)
local.properties
# Proguard folder generated by Eclipse
proguard/
# Log Files
*.log
# Android Studio Navigation editor temp files
.navigation/
# Android Studio captures folder
captures/
# IntelliJ
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml
# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
#*.jks
#*.keystore
# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/
# Google Services (e.g. APIs or Firebase)
# google-services.json
# Freeline
freeline.py
freeline/
freeline_project_description.json
# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md
# Version control
vcs.xml
# lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/
# Android Profiling
*.hprof
# Cordova plugins for Capacitor
capacitor-cordova-android-plugins
# Copied web assets
app/src/main/assets/public
# Generated Config files
app/src/main/assets/capacitor.config.json
app/src/main/assets/capacitor.plugins.json
app/src/main/res/xml/config.xml

View File

@@ -0,0 +1,2 @@
/build/*
!/build/.npmkeep

View File

@@ -0,0 +1,59 @@
apply plugin: 'com.android.application'
android {
namespace "com.dewemoji.app"
compileSdk rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.dewemoji.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
flatDir{
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
}
}
configurations.all {
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk7'
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-jdk8'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
implementation project(':capacitor-android')
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
implementation project(':capacitor-cordova-android-plugins')
}
apply from: 'capacitor.build.gradle'
try {
def servicesJSON = file('google-services.json')
if (servicesJSON.text) {
apply plugin: 'com.google.gms.google-services'
}
} catch(Exception e) {
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}

View File

@@ -0,0 +1,19 @@
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
}
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
}
if (hasProperty('postBuildExtras')) {
postBuildExtras()
}

View File

@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@@ -0,0 +1,26 @@
package com.getcapacitor.myapp;
import static org.junit.Assert.*;
import android.content.Context;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.getcapacitor.app", appContext.getPackageName());
}
}

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation"
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBarLaunch"
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"></meta-data>
</provider>
</application>
<!-- Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
</manifest>

View File

@@ -0,0 +1,357 @@
package com.dewemoji.app;
import android.app.AlertDialog;
import android.app.DownloadManager;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.core.content.FileProvider;
import androidx.core.content.ContextCompat;
import androidx.core.view.WindowCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.core.view.WindowInsetsControllerCompat;
import com.getcapacitor.BridgeActivity;
import org.json.JSONObject;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.Locale;
public class MainActivity extends BridgeActivity {
private static final String TAG = "DewemojiUpdater";
private static final String VERSION_URL = "https://dewemoji.com/downloads/version.json";
private static final int CONNECT_TIMEOUT_MS = 10_000;
private static final int READ_TIMEOUT_MS = 15_000;
@Nullable
private DownloadManager downloadManager;
private long activeDownloadId = -1L;
@Nullable
private String activeExpectedSha = null;
@Nullable
private BroadcastReceiver downloadReceiver = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
hideSystemBars();
downloadManager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
registerDownloadReceiver();
checkForUpdates(false);
}
@Override
public void onDestroy() {
super.onDestroy();
if (downloadReceiver != null) {
unregisterReceiver(downloadReceiver);
downloadReceiver = null;
}
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
hideSystemBars();
}
}
private void hideSystemBars() {
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
WindowInsetsControllerCompat controller =
new WindowInsetsControllerCompat(getWindow(), getWindow().getDecorView());
controller.hide(WindowInsetsCompat.Type.statusBars() | WindowInsetsCompat.Type.navigationBars());
controller.setSystemBarsBehavior(
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
);
}
private void checkForUpdates(boolean manual) {
new Thread(() -> {
try {
UpdateMetadata metadata = fetchVersionMetadata();
if (metadata == null) {
return;
}
long installedVersion = getInstalledVersionCode();
if (metadata.versionCode <= installedVersion) {
if (manual) {
runOnUiThread(() ->
Toast.makeText(this, "Dewemoji is up to date", Toast.LENGTH_SHORT).show()
);
}
return;
}
runOnUiThread(() -> showUpdateDialog(metadata));
} catch (Exception ex) {
Log.w(TAG, "Update check failed", ex);
if (manual) {
runOnUiThread(() ->
Toast.makeText(this, "Update check failed", Toast.LENGTH_SHORT).show()
);
}
}
}).start();
}
@Nullable
private UpdateMetadata fetchVersionMetadata() throws Exception {
HttpURLConnection conn = (HttpURLConnection) new URL(VERSION_URL).openConnection();
conn.setRequestMethod("GET");
conn.setConnectTimeout(CONNECT_TIMEOUT_MS);
conn.setReadTimeout(READ_TIMEOUT_MS);
conn.setRequestProperty("Accept", "application/json");
int code = conn.getResponseCode();
if (code < 200 || code >= 300) {
throw new IllegalStateException("Unexpected status " + code);
}
try (InputStream in = new BufferedInputStream(conn.getInputStream());
ByteArrayOutputStream out = new ByteArrayOutputStream()) {
byte[] buffer = new byte[8192];
int read;
while ((read = in.read(buffer)) != -1) {
out.write(buffer, 0, read);
}
String json = out.toString(StandardCharsets.UTF_8.name());
JSONObject obj = new JSONObject(json);
return UpdateMetadata.fromJson(obj);
} finally {
conn.disconnect();
}
}
private long getInstalledVersionCode() throws Exception {
PackageManager packageManager = getPackageManager();
PackageInfo info = packageManager.getPackageInfo(getPackageName(), 0);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
return info.getLongVersionCode();
}
return info.versionCode;
}
private void showUpdateDialog(UpdateMetadata metadata) {
StringBuilder message = new StringBuilder();
message.append("New version ").append(metadata.versionName).append(" is available.");
if (!metadata.notes.isEmpty()) {
message.append("\n\n").append(metadata.notes);
}
if (metadata.force) {
message.append("\n\nThis update is required.");
}
AlertDialog.Builder builder = new AlertDialog.Builder(this)
.setTitle("Update Dewemoji")
.setMessage(message.toString())
.setPositiveButton("Update", (dialog, which) -> startApkDownload(metadata))
.setCancelable(!metadata.force);
if (!metadata.force) {
builder.setNegativeButton("Later", null);
}
builder.show();
}
private void startApkDownload(UpdateMetadata metadata) {
if (downloadManager == null) {
Toast.makeText(this, "Download manager unavailable", Toast.LENGTH_SHORT).show();
return;
}
Uri uri = Uri.parse(metadata.apkUrl);
DownloadManager.Request request = new DownloadManager.Request(uri);
request.setTitle("Dewemoji update");
request.setDescription("Downloading version " + metadata.versionName);
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationInExternalPublicDir(
Environment.DIRECTORY_DOWNLOADS,
"dewemoji-latest.apk"
);
request.setMimeType("application/vnd.android.package-archive");
activeExpectedSha = metadata.sha256.toLowerCase(Locale.US);
activeDownloadId = downloadManager.enqueue(request);
Toast.makeText(this, "Downloading update...", Toast.LENGTH_SHORT).show();
}
private void registerDownloadReceiver() {
downloadReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (!DownloadManager.ACTION_DOWNLOAD_COMPLETE.equals(intent.getAction())) {
return;
}
long downloadId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1L);
if (downloadId <= 0 || downloadId != activeDownloadId) {
return;
}
verifyAndInstallDownloadedApk(downloadId);
}
};
ContextCompat.registerReceiver(
this,
downloadReceiver,
new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE),
ContextCompat.RECEIVER_NOT_EXPORTED
);
}
private void verifyAndInstallDownloadedApk(long downloadId) {
if (downloadManager == null) {
return;
}
DownloadManager.Query query = new DownloadManager.Query().setFilterById(downloadId);
try (Cursor cursor = downloadManager.query(query)) {
if (cursor == null || !cursor.moveToFirst()) {
showUpdateError("Download record not found");
return;
}
int statusCol = cursor.getColumnIndex(DownloadManager.COLUMN_STATUS);
int uriCol = cursor.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI);
int reasonCol = cursor.getColumnIndex(DownloadManager.COLUMN_REASON);
int status = statusCol >= 0 ? cursor.getInt(statusCol) : DownloadManager.STATUS_FAILED;
String localUri = uriCol >= 0 ? cursor.getString(uriCol) : null;
int reason = reasonCol >= 0 ? cursor.getInt(reasonCol) : -1;
if (status != DownloadManager.STATUS_SUCCESSFUL || localUri == null || localUri.isEmpty()) {
showUpdateError("Download failed (" + reason + ")");
return;
}
Uri apkUri = Uri.parse(localUri);
String localSha = computeSha256(apkUri);
if (localSha == null || activeExpectedSha == null || !localSha.equalsIgnoreCase(activeExpectedSha)) {
showUpdateError("Checksum mismatch");
return;
}
installApk(apkUri);
} catch (Exception ex) {
Log.e(TAG, "Failed to verify update APK", ex);
showUpdateError("Update verification failed");
}
}
@Nullable
private String computeSha256(Uri uri) {
try (InputStream input = getContentResolver().openInputStream(uri)) {
if (input == null) {
return null;
}
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] buffer = new byte[8192];
int read;
while ((read = input.read(buffer)) > 0) {
digest.update(buffer, 0, read);
}
byte[] bytes = digest.digest();
StringBuilder out = new StringBuilder(bytes.length * 2);
for (byte b : bytes) {
out.append(String.format(Locale.US, "%02x", b));
}
return out.toString();
} catch (Exception ex) {
Log.e(TAG, "Failed to compute checksum", ex);
return null;
}
}
private void installApk(Uri downloadUri) {
try {
Uri installUri = downloadUri;
if ("file".equals(downloadUri.getScheme())) {
installUri = FileProvider.getUriForFile(
this,
getPackageName() + ".fileprovider",
new java.io.File(downloadUri.getPath())
);
}
Intent installIntent = new Intent(Intent.ACTION_VIEW);
installIntent.setDataAndType(installUri, "application/vnd.android.package-archive");
installIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
installIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(installIntent);
} catch (ActivityNotFoundException ex) {
showUpdateError("No installer found");
} catch (Exception ex) {
Log.e(TAG, "Failed to launch APK installer", ex);
showUpdateError("Cannot open installer");
}
}
private void showUpdateError(String message) {
runOnUiThread(() -> new AlertDialog.Builder(this)
.setTitle("Update failed")
.setMessage(message)
.setPositiveButton("OK", (DialogInterface dialog, int which) -> dialog.dismiss())
.show());
}
private static class UpdateMetadata {
final String versionName;
final long versionCode;
final String apkUrl;
final String sha256;
final String notes;
final boolean force;
private UpdateMetadata(
String versionName,
long versionCode,
String apkUrl,
String sha256,
String notes,
boolean force
) {
this.versionName = versionName;
this.versionCode = versionCode;
this.apkUrl = apkUrl;
this.sha256 = sha256;
this.notes = notes;
this.force = force;
}
static UpdateMetadata fromJson(JSONObject obj) {
String versionName = obj.optString("versionName", "");
long versionCode = obj.optLong("versionCode", 0);
String apkUrl = obj.optString("apkUrl", "");
String sha256 = obj.optString("sha256", "");
String notes = obj.optString("notes", "");
boolean force = obj.optBoolean("force", false);
if (versionName.isEmpty() || versionCode <= 0 || apkUrl.isEmpty() || sha256.isEmpty()) {
throw new IllegalStateException("Invalid version metadata payload");
}
return new UpdateMetadata(versionName, versionCode, apkUrl, sha256, notes, force);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -0,0 +1,34 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillType="evenOdd"
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
android:strokeColor="#00000000"
android:strokeWidth="1">
<aapt:attr name="android:fillColor">
<gradient
android:endX="78.5885"
android:endY="90.9159"
android:startX="48.7653"
android:startY="61.0927"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
android:strokeColor="#00000000"
android:strokeWidth="1" />
</vector>

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportHeight="108"
android:viewportWidth="108">
<path
android:fillColor="#26A69A"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeColor="#33FFFFFF"
android:strokeWidth="0.8" />
</vector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="app_name">Dewemoji</string>
<string name="title_activity_main">Dewemoji</string>
<string name="package_name">com.dewemoji.app</string>
<string name="custom_url_scheme">com.dewemoji.app</string>
</resources>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:background">@null</item>
</style>
<style name="AppTheme.NoActionBarLaunch" parent="Theme.SplashScreen">
<item name="android:background">@drawable/splash</item>
</style>
</resources>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="my_images" path="." />
<cache-path name="my_cache_images" path="." />
</paths>

View File

@@ -0,0 +1,18 @@
package com.getcapacitor.myapp;
import static org.junit.Assert.*;
import org.junit.Test;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}

View File

@@ -0,0 +1,29 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.7.2'
classpath 'com.google.gms:google-services:4.4.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
apply from: "variables.gradle"
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

View File

@@ -0,0 +1,3 @@
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
include ':capacitor-android'
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')

View File

@@ -0,0 +1,22 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true

Binary file not shown.

View File

@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

252
dewemoji-capacitor/android/gradlew vendored Executable file
View File

@@ -0,0 +1,252 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

94
dewemoji-capacitor/android/gradlew.bat vendored Normal file
View File

@@ -0,0 +1,94 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -0,0 +1,5 @@
include ':app'
include ':capacitor-cordova-android-plugins'
project(':capacitor-cordova-android-plugins').projectDir = new File('./capacitor-cordova-android-plugins/')
apply from: 'capacitor.settings.gradle'

View File

@@ -0,0 +1,16 @@
ext {
minSdkVersion = 24
compileSdkVersion = 35
targetSdkVersion = 35
androidxActivityVersion = '1.9.2'
androidxAppCompatVersion = '1.7.0'
androidxCoordinatorLayoutVersion = '1.2.0'
androidxCoreVersion = '1.15.0'
androidxFragmentVersion = '1.8.4'
coreSplashScreenVersion = '1.0.1'
androidxWebkitVersion = '1.12.1'
junitVersion = '4.13.2'
androidxJunitVersion = '1.2.1'
androidxEspressoCoreVersion = '3.6.1'
cordovaAndroidVersion = '13.0.0'
}

View File

@@ -0,0 +1,9 @@
{
"appId": "com.dewemoji.app",
"appName": "Dewemoji",
"webDir": "www",
"server": {
"url": "https://dewemoji.com",
"cleartext": false
}
}

1075
dewemoji-capacitor/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,17 @@
{
"name": "dewemoji-capacitor",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"@capacitor/android": "^8.1.0",
"@capacitor/cli": "^7.5.0",
"@capacitor/core": "^8.1.0"
}
}

View File

@@ -0,0 +1,23 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Dewemoji</title>
<style>
html, body { height: 100%; margin: 0; font-family: system-ui, -apple-system, sans-serif; background: #0b1220; color: #fff; }
.wrap { display: grid; place-items: center; height: 100%; padding: 24px; text-align: center; }
.card { max-width: 460px; }
h1 { margin: 0 0 8px; font-size: 24px; }
p { opacity: 0.85; line-height: 1.5; }
</style>
</head>
<body>
<div class="wrap">
<div class="card">
<h1>Dewemoji</h1>
<p>If this screen appears, the app could not load <code>https://dewemoji.com</code>. Check internet connection and try again.</p>
</div>
</div>
</body>
</html>

69
scripts/apk/build-release.sh Executable file
View File

@@ -0,0 +1,69 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
ANDROID_DIR="${ROOT_DIR}/dewemoji-capacitor/android"
APP_GRADLE="${ANDROID_DIR}/app/build.gradle"
DIST_DIR="${ROOT_DIR}/dewemoji-capacitor/dist/apk"
if [[ ! -f "${APP_GRADLE}" ]]; then
echo "error: missing ${APP_GRADLE}" >&2
exit 1
fi
version_name="$(awk '/versionName /{gsub(/"/, "", $2); print $2; exit}' "${APP_GRADLE}")"
version_code="$(awk '/versionCode /{print $2; exit}' "${APP_GRADLE}")"
if [[ -z "${version_name}" || -z "${version_code}" ]]; then
echo "error: failed to read versionName/versionCode from ${APP_GRADLE}" >&2
exit 1
fi
mkdir -p "${DIST_DIR}"
echo "== Build release APK =="
(
cd "${ANDROID_DIR}"
./gradlew clean assembleRelease
)
unsigned_apk="${ANDROID_DIR}/app/build/outputs/apk/release/app-release-unsigned.apk"
signed_apk_default="${ANDROID_DIR}/app/build/outputs/apk/release/app-release.apk"
input_apk=""
if [[ -f "${signed_apk_default}" ]]; then
input_apk="${signed_apk_default}"
elif [[ -f "${unsigned_apk}" ]]; then
input_apk="${unsigned_apk}"
else
echo "error: release APK not found under app/build/outputs/apk/release" >&2
exit 1
fi
output_apk="${DIST_DIR}/dewemoji-v${version_name}-${version_code}.apk"
if [[ -n "${ANDROID_KEYSTORE_PATH:-}" && -n "${ANDROID_KEYSTORE_PASSWORD:-}" && -n "${ANDROID_KEY_ALIAS:-}" && -n "${ANDROID_KEY_PASSWORD:-}" ]]; then
if ! command -v apksigner >/dev/null 2>&1; then
echo "error: apksigner is required for signing but not found" >&2
exit 1
fi
echo "== Sign APK =="
apksigner sign \
--ks "${ANDROID_KEYSTORE_PATH}" \
--ks-pass "pass:${ANDROID_KEYSTORE_PASSWORD}" \
--ks-key-alias "${ANDROID_KEY_ALIAS}" \
--key-pass "pass:${ANDROID_KEY_PASSWORD}" \
--out "${output_apk}" \
"${input_apk}"
apksigner verify --verbose "${output_apk}" >/dev/null
else
echo "warning: signing env vars are not fully set; copying unsigned/gradle output as-is"
cp "${input_apk}" "${output_apk}"
fi
sha256="$(shasum -a 256 "${output_apk}" | awk '{print $1}')"
echo "Built APK: ${output_apk}"
echo "Version: ${version_name} (${version_code})"
echo "SHA256: ${sha256}"

View File

@@ -0,0 +1,78 @@
#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<USAGE
Usage:
scripts/apk/make-version-json.sh \
--version-name 1.1.2 \
--version-code 112 \
--sha256 <hex> \
--notes "Release notes" \
[--out ./version.json] \
[--apk-url https://dewemoji.com/downloads/dewemoji-latest.apk] \
[--app-id com.dewemoji.app] \
[--channel stable] \
[--min-supported-version-code 100] \
[--force false]
USAGE
}
out="./version.json"
apk_url="https://dewemoji.com/downloads/dewemoji-latest.apk"
app_id="com.dewemoji.app"
channel="stable"
min_supported_version_code="100"
force="false"
version_name=""
version_code=""
sha256=""
notes=""
published_at="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
while [[ $# -gt 0 ]]; do
case "$1" in
--version-name) version_name="$2"; shift 2 ;;
--version-code) version_code="$2"; shift 2 ;;
--sha256) sha256="$2"; shift 2 ;;
--notes) notes="$2"; shift 2 ;;
--out) out="$2"; shift 2 ;;
--apk-url) apk_url="$2"; shift 2 ;;
--app-id) app_id="$2"; shift 2 ;;
--channel) channel="$2"; shift 2 ;;
--min-supported-version-code) min_supported_version_code="$2"; shift 2 ;;
--force) force="$2"; shift 2 ;;
--published-at) published_at="$2"; shift 2 ;;
-h|--help) usage; exit 0 ;;
*) echo "error: unknown argument '$1'" >&2; usage; exit 1 ;;
esac
done
if [[ -z "${version_name}" || -z "${version_code}" || -z "${sha256}" ]]; then
echo "error: --version-name, --version-code, and --sha256 are required" >&2
usage
exit 1
fi
python3 - <<PY
import json
from pathlib import Path
payload = {
"appId": "${app_id}",
"channel": "${channel}",
"versionName": "${version_name}",
"versionCode": int("${version_code}"),
"minSupportedVersionCode": int("${min_supported_version_code}"),
"apkUrl": "${apk_url}",
"sha256": "${sha256}",
"publishedAt": "${published_at}",
"notes": "${notes}",
"force": "${force}".lower() == "true",
}
out = Path("${out}")
out.parent.mkdir(parents=True, exist_ok=True)
out.write_text(json.dumps(payload, ensure_ascii=True, indent=2) + "\n", encoding="utf-8")
print(out)
PY

115
scripts/apk/publish-r2.sh Executable file
View File

@@ -0,0 +1,115 @@
#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<USAGE
Usage:
scripts/apk/publish-r2.sh \
--apk /path/to/dewemoji-v1.1.2-112.apk \
--version-name 1.1.2 \
--version-code 112 \
[--notes "Release notes"] \
[--min-supported-version-code 100] \
[--force false]
Required env:
R2_ACCOUNT_ID
R2_ACCESS_KEY_ID
R2_SECRET_ACCESS_KEY
R2_BUCKET
Optional env:
R2_PUBLIC_BASE_URL (example: https://downloads.dewemoji.com)
DEWEMOJI_APK_URL (default: https://dewemoji.com/downloads/dewemoji-latest.apk)
USAGE
}
for required in R2_ACCOUNT_ID R2_ACCESS_KEY_ID R2_SECRET_ACCESS_KEY R2_BUCKET; do
if [[ -z "${!required:-}" ]]; then
echo "error: missing env ${required}" >&2
exit 1
fi
done
if ! command -v aws >/dev/null 2>&1; then
echo "error: aws cli is required" >&2
exit 1
fi
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
MAKE_VERSION_SCRIPT="${ROOT_DIR}/scripts/apk/make-version-json.sh"
apk=""
version_name=""
version_code=""
notes=""
min_supported_version_code="100"
force="false"
while [[ $# -gt 0 ]]; do
case "$1" in
--apk) apk="$2"; shift 2 ;;
--version-name) version_name="$2"; shift 2 ;;
--version-code) version_code="$2"; shift 2 ;;
--notes) notes="$2"; shift 2 ;;
--min-supported-version-code) min_supported_version_code="$2"; shift 2 ;;
--force) force="$2"; shift 2 ;;
-h|--help) usage; exit 0 ;;
*) echo "error: unknown argument '$1'" >&2; usage; exit 1 ;;
esac
done
if [[ -z "${apk}" || -z "${version_name}" || -z "${version_code}" ]]; then
echo "error: --apk, --version-name, and --version-code are required" >&2
usage
exit 1
fi
if [[ ! -f "${apk}" ]]; then
echo "error: apk file not found: ${apk}" >&2
exit 1
fi
endpoint="https://${R2_ACCOUNT_ID}.r2.cloudflarestorage.com"
export AWS_ACCESS_KEY_ID="${R2_ACCESS_KEY_ID}"
export AWS_SECRET_ACCESS_KEY="${R2_SECRET_ACCESS_KEY}"
tmp_dir="$(mktemp -d)"
trap 'rm -rf "${tmp_dir}"' EXIT
sha256="$(shasum -a 256 "${apk}" | awk '{print $1}')"
versioned_key="apk/dewemoji-v${version_name}-${version_code}.apk"
latest_key="apk/dewemoji-latest.apk"
version_json_key="apk/version.json"
apk_url="${DEWEMOJI_APK_URL:-https://dewemoji.com/downloads/dewemoji-latest.apk}"
version_json_path="${tmp_dir}/version.json"
"${MAKE_VERSION_SCRIPT}" \
--version-name "${version_name}" \
--version-code "${version_code}" \
--sha256 "${sha256}" \
--notes "${notes}" \
--apk-url "${apk_url}" \
--min-supported-version-code "${min_supported_version_code}" \
--force "${force}" \
--out "${version_json_path}"
echo "== Upload versioned APK =="
aws --endpoint-url "${endpoint}" s3 cp "${apk}" "s3://${R2_BUCKET}/${versioned_key}" --content-type application/vnd.android.package-archive
echo "== Upload latest APK alias =="
aws --endpoint-url "${endpoint}" s3 cp "${apk}" "s3://${R2_BUCKET}/${latest_key}" --content-type application/vnd.android.package-archive
echo "== Upload version metadata =="
aws --endpoint-url "${endpoint}" s3 cp "${version_json_path}" "s3://${R2_BUCKET}/${version_json_key}" --content-type application/json --cache-control no-store
echo "Published to R2 bucket: ${R2_BUCKET}"
echo "Versioned APK key: ${versioned_key}"
echo "Latest APK key: ${latest_key}"
echo "Version JSON key: ${version_json_key}"
if [[ -n "${R2_PUBLIC_BASE_URL:-}" ]]; then
base="${R2_PUBLIC_BASE_URL%/}"
echo "Public versioned APK URL: ${base}/${versioned_key}"
echo "Public latest APK URL: ${base}/${latest_key}"
echo "Public version JSON URL: ${base}/${version_json_key}"
fi

67
scripts/apk/verify-release.sh Executable file
View File

@@ -0,0 +1,67 @@
#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<USAGE
Usage:
scripts/apk/verify-release.sh [--base-url https://dewemoji.com/downloads]
USAGE
}
base_url="https://dewemoji.com/downloads"
while [[ $# -gt 0 ]]; do
case "$1" in
--base-url) base_url="$2"; shift 2 ;;
-h|--help) usage; exit 0 ;;
*) echo "error: unknown argument '$1'" >&2; usage; exit 1 ;;
esac
done
version_url="${base_url%/}/version.json"
apk_url="${base_url%/}/dewemoji-latest.apk"
tmp_dir="$(mktemp -d)"
trap 'rm -rf "${tmp_dir}"' EXIT
version_file="${tmp_dir}/version.json"
apk_file="${tmp_dir}/dewemoji-latest.apk"
echo "== Fetch version metadata =="
curl -fsSL "${version_url}" -o "${version_file}"
python3 - <<PY
import json
from pathlib import Path
obj = json.loads(Path("${version_file}").read_text(encoding="utf-8"))
required = ["appId", "channel", "versionName", "versionCode", "apkUrl", "sha256", "publishedAt"]
missing = [k for k in required if k not in obj]
if missing:
raise SystemExit(f"error: missing fields in version.json: {', '.join(missing)}")
print(f"versionName={obj['versionName']}")
print(f"versionCode={obj['versionCode']}")
print(f"apkUrl={obj['apkUrl']}")
print(f"sha256={obj['sha256']}")
PY
echo "== Download latest APK =="
curl -fL "${apk_url}" -o "${apk_file}"
local_sha="$(shasum -a 256 "${apk_file}" | awk '{print $1}')"
expected_sha="$(python3 - <<PY
import json
from pathlib import Path
obj = json.loads(Path("${version_file}").read_text(encoding="utf-8"))
print(obj["sha256"])
PY
)"
echo "local_sha=${local_sha}"
echo "expected_sha=${expected_sha}"
if [[ "${local_sha}" != "${expected_sha}" ]]; then
echo "error: checksum mismatch" >&2
exit 1
fi
echo "OK: release metadata and APK checksum are consistent"