Skip to content

Commit

Permalink
Fix Android 12 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
NCrashed committed Jan 23, 2023
1 parent 289e8bf commit 2b7705c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ channel and adding satoshis-denominated "rate" into fiat channel state
```
git clone https://github.com/btcontract/wallet.git
cd wallet
git checkout 4.1.0
git checkout 4.1.1
podman build -t sbw .
podman run -v $PWD:/app/simplebitcoinwallet/wallet:z sbw
```
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
targetSdkVersion 31
minSdkVersion 21

versionName '4.1.0'
versionCode 98
versionName '4.1.1'
versionCode 99

ndk {
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@ class AwaitService extends Service { me =>
val awaitedBodyText = intent.getStringExtra(AwaitService.BODY_TO_DISPLAY)
val awaitedTitleText = intent.getStringExtra(AwaitService.TITLE_TO_DISPLAY)

val disaplyIntent = PendingIntent.getActivity(me, 0, new Intent(me, ClassNames.mainActivityClass), 0)
val cancelIntent = PendingIntent.getService(me, 0, new Intent(me, AwaitService.awaitServiceClass).setAction(AwaitService.ACTION_CANCEL), 0)
val (disaplyIntent, cancelIntent) = if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
val disaplyIntent = PendingIntent.getActivity(me, 0, new Intent(me, ClassNames.mainActivityClass), PendingIntent.FLAG_IMMUTABLE)
val cancelIntent = PendingIntent.getService(me, 0, new Intent(me, AwaitService.awaitServiceClass).setAction(AwaitService.ACTION_CANCEL), PendingIntent.FLAG_IMMUTABLE)
(disaplyIntent, cancelIntent)
} else {
val disaplyIntent = PendingIntent.getActivity(me, 0, new Intent(me, ClassNames.mainActivityClass), 0)
val cancelIntent = PendingIntent.getService(me, 0, new Intent(me, AwaitService.awaitServiceClass).setAction(AwaitService.ACTION_CANCEL), 0)
(disaplyIntent, cancelIntent)
}

val notification =
new NotificationCompat.Builder(me, AwaitService.CHANNEL_ID).setContentTitle(awaitedTitleText).setContentText(awaitedBodyText)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,12 @@ protected void onNfcFeatureFound() {

protected void initializeNfc() {
nfcAdapter = NfcAdapter.getDefaultAdapter(this);
nfcPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, this.getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
nfcPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, this.getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), PendingIntent.FLAG_IMMUTABLE);
} else {
nfcPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, this.getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);
}

IntentFilter tagDetected = new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED);
IntentFilter ndefDetected = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
IntentFilter techDetected = new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED);
Expand Down
2 changes: 1 addition & 1 deletion sign-apk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -xe
echo $PATH
SDK_DERIVATION=/nix/store/w1259lpbs1wg39ji71hbyvvq7q8d3ac4-build-tools-31.0.0
VERSION=4.1.0
VERSION=4.1.1
rm app/build/outputs/apk/release/Valet-$VERSION-aligned.apk || true
$SDK_DERIVATION/libexec/android-sdk/build-tools/31.0.0/zipalign -v 4 app/build/outputs/apk/release/Valet-$VERSION.apk app/build/outputs/apk/release/Valet-$VERSION-aligned.apk
apksigner sign --ks release.keystore --ks-key-alias release --v1-signing-enabled true --v2-signing-enabled true app/build/outputs/apk/release/Valet-$VERSION-aligned.apk

0 comments on commit 2b7705c

Please sign in to comment.