Skip to content

Commit af2a51a

Browse files
authored
Merge branch 'cypherstack:staging' into cl_coinselect
2 parents 07908c2 + bd597d2 commit af2a51a

78 files changed

Lines changed: 8756 additions & 11034 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yaml

Lines changed: 65 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
tags:
66
- 'v[0-9]+.[0-9]+.[0-9]+'
7+
branches:
8+
- staging
79
workflow_dispatch:
810
inputs:
911
version:
@@ -40,9 +42,12 @@ jobs:
4042
VERSION="${{ github.ref_name }}"
4143
VERSION="${VERSION#v}"
4244
BUILD_NUMBER="${{ github.run_number }}"
43-
else
45+
elif [ -n "${{ inputs.version }}" ]; then
4446
VERSION="${{ inputs.version }}"
4547
BUILD_NUMBER="${{ inputs.build_number }}"
48+
else
49+
VERSION="0.0.0-staging.${{ github.run_number }}"
50+
BUILD_NUMBER="${{ github.run_number }}"
4651
fi
4752
echo "version=${VERSION}" >> $GITHUB_OUTPUT
4853
echo "build_number=${BUILD_NUMBER}" >> $GITHUB_OUTPUT
@@ -114,9 +119,12 @@ jobs:
114119
VERSION="${{ github.ref_name }}"
115120
VERSION="${VERSION#v}"
116121
BUILD_NUMBER="${{ github.run_number }}"
117-
else
122+
elif [ -n "${{ inputs.version }}" ]; then
118123
VERSION="${{ inputs.version }}"
119124
BUILD_NUMBER="${{ inputs.build_number }}"
125+
else
126+
VERSION="0.0.0-staging.${{ github.run_number }}"
127+
BUILD_NUMBER="${{ github.run_number }}"
120128
fi
121129
echo "version=${VERSION}" >> $GITHUB_OUTPUT
122130
echo "build_number=${BUILD_NUMBER}" >> $GITHUB_OUTPUT
@@ -161,7 +169,17 @@ jobs:
161169
env:
162170
KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
163171
run: |
164-
echo "$KEYSTORE_BASE64" | base64 --decode > android/keystore.jks
172+
printf '%s' "$KEYSTORE_BASE64" | base64 --decode > android/keystore-orig.jks
173+
[ -s android/keystore-orig.jks ] || { echo "ERROR: ANDROID_KEYSTORE_BASE64 secret is empty or not set"; exit 1; }
174+
keytool -importkeystore \
175+
-srckeystore android/keystore-orig.jks \
176+
-destkeystore android/keystore.jks \
177+
-deststoretype pkcs12 \
178+
-srcstorepass "${{ secrets.ANDROID_STORE_PASSWORD }}" \
179+
-deststorepass "${{ secrets.ANDROID_STORE_PASSWORD }}" \
180+
-noprompt \
181+
-J-Dkeystore.pkcs12.legacy
182+
rm android/keystore-orig.jks
165183
cat > android/key.properties <<EOF
166184
storeFile=../keystore.jks
167185
storePassword=${{ secrets.ANDROID_STORE_PASSWORD }}
@@ -209,9 +227,12 @@ jobs:
209227
VERSION="${{ github.ref_name }}"
210228
VERSION="${VERSION#v}"
211229
BUILD_NUMBER="${{ github.run_number }}"
212-
else
230+
elif [ -n "${{ inputs.version }}" ]; then
213231
VERSION="${{ inputs.version }}"
214232
BUILD_NUMBER="${{ inputs.build_number }}"
233+
else
234+
VERSION="0.0.0-staging.${{ github.run_number }}"
235+
BUILD_NUMBER="${{ github.run_number }}"
215236
fi
216237
echo "version=${VERSION}" >> $GITHUB_OUTPUT
217238
echo "build_number=${BUILD_NUMBER}" >> $GITHUB_OUTPUT
@@ -236,6 +257,25 @@ jobs:
236257
-b "${{ steps.ver.outputs.build_number }}" \
237258
-p windows -a stack_wallet -d -s
238259
260+
# The Actions windows-2022 runner user lacks SeCreateSymbolicLinkPrivilege,
261+
# so link_assets.sh's mklink /D calls either fail or produce broken reparse
262+
# points that Flutter's asset resolver cannot traverse. Replace each of
263+
# the five gitignored asset directories with real copies instead.
264+
- name: Replace asset symlinks with copies (CI workaround)
265+
run: |
266+
set -euo pipefail
267+
for dirname in default_themes icon lottie in_app_logo_icons svg; do
268+
target="assets/${dirname}"
269+
source="asset_sources/${dirname}/stack_wallet"
270+
# Remove whatever link_assets.sh left (reparse point, symlink, or nothing).
271+
# cmd.exe rmdir on a junction/symlink removes the link, not the target.
272+
if [ -e "$target" ] || [ -L "$target" ]; then
273+
cmd.exe /c rmdir "$(cygpath -w "$target")" 2>/dev/null || rm -rf "$target"
274+
fi
275+
mkdir -p "$target"
276+
cp -r "${source}/." "$target/"
277+
done
278+
239279
- name: Get dependencies
240280
run: flutter pub get
241281

@@ -280,16 +320,10 @@ jobs:
280320
- name: Build
281321
run: flutter build windows --release
282322

283-
- name: Package
284-
shell: pwsh
285-
run: |
286-
Compress-Archive -Path build\windows\x64\runner\Release\* `
287-
-DestinationPath "stack_wallet-windows-x86_64-${{ steps.ver.outputs.version }}.zip"
288-
289323
- uses: actions/upload-artifact@v4
290324
with:
291325
name: stack_wallet-windows-x86_64-${{ steps.ver.outputs.version }}
292-
path: stack_wallet-windows-x86_64-${{ steps.ver.outputs.version }}.zip
326+
path: build/windows/x64/runner/Release/
293327

294328
build-macos:
295329
runs-on: macos-latest
@@ -306,9 +340,12 @@ jobs:
306340
VERSION="${{ github.ref_name }}"
307341
VERSION="${VERSION#v}"
308342
BUILD_NUMBER="${{ github.run_number }}"
309-
else
343+
elif [ -n "${{ inputs.version }}" ]; then
310344
VERSION="${{ inputs.version }}"
311345
BUILD_NUMBER="${{ inputs.build_number }}"
346+
else
347+
VERSION="0.0.0-staging.${{ github.run_number }}"
348+
BUILD_NUMBER="${{ github.run_number }}"
312349
fi
313350
echo "version=${VERSION}" >> $GITHUB_OUTPUT
314351
echo "build_number=${BUILD_NUMBER}" >> $GITHUB_OUTPUT
@@ -380,9 +417,12 @@ jobs:
380417
VERSION="${{ github.ref_name }}"
381418
VERSION="${VERSION#v}"
382419
BUILD_NUMBER="${{ github.run_number }}"
383-
else
420+
elif [ -n "${{ inputs.version }}" ]; then
384421
VERSION="${{ inputs.version }}"
385422
BUILD_NUMBER="${{ inputs.build_number }}"
423+
else
424+
VERSION="0.0.0-staging.${{ github.run_number }}"
425+
BUILD_NUMBER="${{ github.run_number }}"
386426
fi
387427
echo "version=${VERSION}" >> $GITHUB_OUTPUT
388428
echo "build_number=${BUILD_NUMBER}" >> $GITHUB_OUTPUT
@@ -454,9 +494,19 @@ jobs:
454494
- uses: actions/download-artifact@v4
455495
with:
456496
path: artifacts
457-
merge-multiple: true
497+
498+
- name: Package artifacts
499+
run: |
500+
mkdir -p release-files
501+
for dir in artifacts/stack_wallet-windows-*/; do
502+
[ -d "$dir" ] || continue
503+
name=$(basename "$dir")
504+
(cd "$dir" && zip -r "../../release-files/${name}.zip" .)
505+
done
506+
find artifacts/ \( -name "*.tar.gz" -o -name "*.zip" -o -name "*.ipa" \) -mindepth 2 -exec mv {} release-files/ \;
507+
find artifacts/ -name "*.apk" -mindepth 2 -exec mv {} release-files/ \;
458508
459509
- uses: softprops/action-gh-release@v2
460510
with:
461511
generate_release_notes: true
462-
files: artifacts/*
512+
files: release-files/*

crypto_plugins/flutter_libmwc

lib/app_config.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'wallets/crypto_currency/intermediate/frost_currency.dart';
66

77
part 'app_config.g.dart';
88

9-
enum AppFeature { themeSelection, buy, swap, tor }
9+
enum AppFeature { themeSelection, buy, swap, tor, shopinBit, cakePay }
1010

1111
abstract class AppConfig {
1212
static const appName = _prefix + _separator + suffix;
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import 'package:drift/drift.dart';
2+
import 'package:drift_flutter/drift_flutter.dart';
3+
import 'package:path/path.dart' as path;
4+
5+
import '../../../models/shopinbit/shopinbit_order_model.dart'
6+
show ShopInBitCategory, ShopInBitOrderStatus;
7+
import '../../../utilities/stack_file_system.dart';
8+
import 'tables/cakepay_orders.dart';
9+
import 'tables/shopin_bit_settings.dart';
10+
import 'tables/shopin_bit_tickets.dart';
11+
12+
part 'shared_database.g.dart';
13+
14+
abstract final class SharedDrift {
15+
static bool _didInit = false;
16+
17+
static SharedDatabase? _db;
18+
19+
static SharedDatabase get() {
20+
if (!_didInit) {
21+
driftRuntimeOptions.dontWarnAboutMultipleDatabases = true;
22+
_didInit = true;
23+
}
24+
25+
return _db ??= SharedDatabase._();
26+
}
27+
}
28+
29+
@DriftDatabase(
30+
tables: [CakepayOrders, ShopinBitSettings, ShopInBitTickets],
31+
daos: [ShopinBitSettingsDao],
32+
)
33+
final class SharedDatabase extends _$SharedDatabase {
34+
SharedDatabase._([QueryExecutor? executor])
35+
: super(executor ?? _openConnection());
36+
37+
@override
38+
int get schemaVersion => 2;
39+
40+
@override
41+
MigrationStrategy get migration => MigrationStrategy(
42+
onUpgrade: (m, from, to) async {
43+
if (from == 1 && to == 2) {
44+
await m.createTable(shopinBitSettings);
45+
await m.createTable(shopInBitTickets);
46+
}
47+
},
48+
);
49+
50+
static QueryExecutor _openConnection() {
51+
return driftDatabase(
52+
name: "shared",
53+
native: DriftNativeOptions(
54+
shareAcrossIsolates: true,
55+
databasePath: () async {
56+
final dir = await StackFileSystem.applicationDriftDirectory();
57+
return path.join(dir.path, "shared", "shared.db");
58+
},
59+
),
60+
);
61+
}
62+
}
63+
64+
@DriftAccessor(tables: [ShopinBitSettings])
65+
class ShopinBitSettingsDao extends DatabaseAccessor<SharedDatabase>
66+
with _$ShopinBitSettingsDaoMixin {
67+
ShopinBitSettingsDao(super.db);
68+
69+
Future<ShopinBitSetting> getSettings() async {
70+
final ShopinBitSetting? row = await (select(
71+
shopinBitSettings,
72+
)..where((t) => t.id.equals(0))).getSingleOrNull();
73+
if (row != null) return row;
74+
75+
return into(
76+
shopinBitSettings,
77+
).insertReturning(ShopinBitSettingsCompanion.insert(id: const Value(0)));
78+
}
79+
80+
Future<void> setGuidelinesAccepted(bool accepted) =>
81+
_update(ShopinBitSettingsCompanion(guidelinesAccepted: Value(accepted)));
82+
83+
Future<void> setSetupComplete(bool complete) =>
84+
_update(ShopinBitSettingsCompanion(setupComplete: Value(complete)));
85+
86+
Future<void> setDisplayName(String name) =>
87+
_update(ShopinBitSettingsCompanion(displayName: Value(name)));
88+
89+
Future<void> _update(ShopinBitSettingsCompanion changes) async {
90+
await getSettings(); // ensure row exists
91+
await (update(
92+
shopinBitSettings,
93+
)..where((t) => t.id.equals(0))).write(changes);
94+
}
95+
}

0 commit comments

Comments
 (0)