Skip to content

Commit

Permalink
indirection: made packageName accessible using the binding class
Browse files Browse the repository at this point in the history
made packageName accessible to receive.dart file and test files via
(await ZulipBinding.instance.packageInfo)?.packageName ?? "com.zulip.flutter"
  • Loading branch information
Abhisheksainii committed Dec 21, 2024
1 parent 198e540 commit ff11675
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/notifications/receive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ class NotificationService {
await addFcmToken(connection, token: token);

case TargetPlatform.iOS:
const appBundleId = 'com.zulip.flutter'; // TODO(#407) find actual value live
await addApnsToken(connection, token: token, appid: appBundleId);
// TODO(#407) find actual value live
await addApnsToken(connection, token: token, appid: (await ZulipBinding.instance.packageInfo)?.packageName ?? "com.zulip.flutter");

case TargetPlatform.linux:
case TargetPlatform.macOS:
Expand Down
2 changes: 1 addition & 1 deletion test/api/core_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ void main() {
});
}

const packageInfo = PackageInfo(version: '0.0.1', buildNumber: '1');
const packageInfo = PackageInfo(version: '0.0.1', buildNumber: '1', packageName: 'com.zulip.flutter.test');

const testCases = [
('ZulipFlutter/0.0.1+1 (Android 14)', AndroidDeviceInfo(release: '14', sdkInt: 34), ),
Expand Down
4 changes: 2 additions & 2 deletions test/model/store_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ void main() {
if (defaultTargetPlatform == TargetPlatform.android) {
checkLastRequestFcm(token: '012abc');
} else {
checkLastRequestApns(token: '012abc', appid: 'com.zulip.flutter');
checkLastRequestApns(token: '012abc', appid:(await testBinding.packageInfo)?.packageName?? 'com.zulip.flutter.test');
}

if (defaultTargetPlatform == TargetPlatform.android) {
Expand Down Expand Up @@ -1071,7 +1071,7 @@ void main() {
if (defaultTargetPlatform == TargetPlatform.android) {
checkLastRequestFcm(token: '012abc');
} else {
checkLastRequestApns(token: '012abc', appid: 'com.zulip.flutter');
checkLastRequestApns(token: '012abc', appid:(await testBinding.packageInfo)?.packageName?? 'com.zulip.flutter.test');
}

if (defaultTargetPlatform == TargetPlatform.android) {
Expand Down
2 changes: 1 addition & 1 deletion test/notifications/receive_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void main() {
group('tokens', () {
test('APNs token registration using correct app bundle ID', () async {
await init();
check(await testBinding.getAppBundleId())
check((await testBinding.packageInfo)?.packageName?? 'com.zulip.flutter.test')
.equals('com.zulip.flutter.test');
}, );
});
Expand Down

0 comments on commit ff11675

Please sign in to comment.