Skip to content

Commit 50f7656

Browse files
committed
fix Adaptive icon on Android
1 parent 88f14a8 commit 50f7656

File tree

6 files changed

+63
-54
lines changed

6 files changed

+63
-54
lines changed

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"apply:android": "npx tsc configure/configure-android.ts && node configure/configure-android.js",
3434
"apply:ios": "npx tsc configure/configure-ios.ts && node configure/configure-ios.js",
3535
"env:custom": "npm run config -- --environment=development --awsUrl=https://aws.abcpay.cash/bws/api \n\n# Environment set to: dev\n\n",
36-
"resources": "capacitor-resources -p android,ios",
36+
"resources": "cordova-res android --copy && cp resources/android/ic_launcher.xml android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml && cp resources/android/ic_launcher_round.xml android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml ",
3737
"generate:android-bundle": "cd android && ./gradlew task && ./gradlew bundle",
3838
"sign:android": "bundletool build-apks --mode=universal --bundle=./android/app/build/outputs/bundle/release/app-release.aab --output=./apks/apcpay-release.apks --ks=release.jks --ks-pass=pass:123456 --ks-key-alias=release --key-pass=pass:123456",
3939
"final:android-release": "npm run build:android-release && rm -rf apks && npm run generate:android-bundle && npm run sign:android",
@@ -57,7 +57,7 @@
5757
"@angular/router": "~13.1.1",
5858
"@angular/service-worker": "^13.1.1",
5959
"@bcpros/cordova-plugin-qrscanner": "^3.0.1",
60-
"@capacitor/android": "3.3.3",
60+
"@capacitor/android": "3.5.0",
6161
"@capacitor/core": "^3.2.3",
6262
"@capacitor/ios": "^3.2.3",
6363
"@capacitor/project": "^1.0.28",
@@ -87,8 +87,6 @@
8787
"base64-js": "^1.5.1",
8888
"bitauth": "git+https://github.com/bitpay/bitauth.git#68cf0353bf517a7e5293478608839fa904351eb6",
8989
"buffer-compare": "^1.1.1",
90-
"capacitor-fcm": "^2.0.0",
91-
"capacitor-resources": "^2.0.5",
9290
"chart.js": "^3.5.1",
9391
"cordova": "^10.0.0",
9492
"cordova-android": "^10.1.0",
@@ -113,6 +111,7 @@
113111
"cordova-plugin-whitelist": "^1.3.5",
114112
"cordova-plugin-x-socialsharing": "^6.0.3",
115113
"cordova-plugin-x-toast": "^2.7.2",
114+
"cordova-res": "^0.15.4",
116115
"countries-list": "^2.6.1",
117116
"crypto-browserify": "^3.12.0",
118117
"dotenv": "^10.0.0",

resources/android/ic_launcher.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@mipmap/ic_launcher_background"/>
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
5+
</adaptive-icon>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@mipmap/ic_launcher_background"/>
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
5+
</adaptive-icon>
2.03 KB
Loading
10.3 KB
Loading

src/app/providers/push-notifications/push-notifications.ts

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { HttpClient } from '@angular/common/http';
22
import { Injectable } from '@angular/core';
33
import { TranslateService } from '@ngx-translate/core';
44
import { timer } from 'rxjs';
5-
import { FCM } from "capacitor-fcm";
5+
// import { FCM } from "capacitor-fcm";
66
// providers
77
import { AppProvider } from '../app/app';
88
import { BwcProvider } from '../bwc/bwc';
@@ -35,7 +35,7 @@ export class PushNotificationsProvider {
3535
private notifications = [];
3636
private currentNotif: HTMLIonModalElement;
3737
private openWalletId;
38-
public fcm ;
38+
// public fcm ;
3939
constructor(
4040
public http: HttpClient,
4141
public profileProvider: ProfileProvider,
@@ -53,7 +53,7 @@ export class PushNotificationsProvider {
5353
this.isIOS = this.platformProvider.isIOS;
5454
this.isAndroid = this.platformProvider.isAndroid;
5555
this.usePushNotifications = this.platformProvider.isCordova;
56-
this.fcm = new FCM();
56+
// this.fcm = new FCM();
5757
}
5858

5959
public init(): void {
@@ -63,37 +63,37 @@ export class PushNotificationsProvider {
6363
if (!config.pushNotifications.enabled) return;
6464
await this.registerNotifications();
6565
// On success, we should be able to receive notifications
66-
this.fcm
67-
.getToken()
68-
.then(async token => {
69-
if (!token) {
70-
setTimeout(() => {
71-
this.init();
72-
}, 5000);
73-
return;
74-
}
75-
this.logger.debug('Get token for push notifications: ' + token.token);
76-
this._token = token.token;
77-
this.enable();
78-
// enabling topics
79-
if (
80-
this.appProvider.info.name != 'copay' &&
81-
config.offersAndPromotions.enabled
82-
)
83-
await this.subscribeToTopic('offersandpromotions');
84-
if (
85-
this.appProvider.info.name != 'copay' &&
86-
config.productsUpdates.enabled
87-
)
88-
await this.subscribeToTopic('productsupdates');
89-
90-
this.fcmInterval = setInterval(() => {
91-
this.renewSubscription();
92-
}, 5 * 60 * 1000); // 5 min
93-
94-
}).catch(error=>{
95-
this.logger.error(error);
96-
});
66+
// this.fcm
67+
// .getToken()
68+
// .then(async token => {
69+
// if (!token) {
70+
// setTimeout(() => {
71+
// this.init();
72+
// }, 5000);
73+
// return;
74+
// }
75+
// this.logger.debug('Get token for push notifications: ' + token.token);
76+
// this._token = token.token;
77+
// this.enable();
78+
// // enabling topics
79+
// if (
80+
// this.appProvider.info.name != 'copay' &&
81+
// config.offersAndPromotions.enabled
82+
// )
83+
// await this.subscribeToTopic('offersandpromotions');
84+
// if (
85+
// this.appProvider.info.name != 'copay' &&
86+
// config.productsUpdates.enabled
87+
// )
88+
// await this.subscribeToTopic('productsupdates');
89+
//
90+
// this.fcmInterval = setInterval(() => {
91+
// this.renewSubscription();
92+
// }, 5 * 60 * 1000); // 5 min
93+
//
94+
// }).catch(error=>{
95+
// this.logger.error(error);
96+
// });
9797
});
9898

9999
// Show us the notification payload if the app is open on our device
@@ -225,8 +225,8 @@ export class PushNotificationsProvider {
225225
}
226226

227227
// disabling topics
228-
this.unsubscribeFromTopic('offersandpromotions');
229-
this.unsubscribeFromTopic('productsupdates');
228+
// this.unsubscribeFromTopic('offersandpromotions');
229+
// this.unsubscribeFromTopic('productsupdates');
230230

231231
const opts = {
232232
showHidden: true
@@ -246,23 +246,23 @@ export class PushNotificationsProvider {
246246
}
247247

248248
public async subscribeToTopic(topic: string): Promise<void> {
249-
await this.fcm.subscribeTo({ topic: topic })
250-
.then(r => {
251-
return this.logger.info(r);
252-
})
253-
.catch(err => {
254-
return this.logger.error(err);
255-
});
249+
// await this.fcm.subscribeTo({ topic: topic })
250+
// .then(r => {
251+
// return this.logger.info(r);
252+
// })
253+
// .catch(err => {
254+
// return this.logger.error(err);
255+
// });
256256
}
257257

258258
public async unsubscribeFromTopic(topic: string): Promise<void> {
259-
await this.fcm.unsubscribeFrom({ topic: topic })
260-
.then(r => {
261-
return this.logger.info(r);
262-
})
263-
.catch(err => {
264-
return this.logger.error(err);
265-
});
259+
// await this.fcm.unsubscribeFrom({ topic: topic })
260+
// .then(r => {
261+
// return this.logger.info(r);
262+
// })
263+
// .catch(err => {
264+
// return this.logger.error(err);
265+
// });
266266
}
267267

268268
private _subscribe(walletClient): void {

0 commit comments

Comments
 (0)