Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(badge): import UserNotifications to support MacOS #27

Merged
merged 2 commits into from
Apr 13, 2023

Conversation

kainosnoema
Copy link
Contributor

@kainosnoema kainosnoema commented Apr 12, 2023

Description

We're maintaining a private fork of Capacitor with slight changes for Mac OS compatibility with WKWebView (works great, actually), and the Badge plugin works well with one small tweak: need to import UserNotifications explicitly since it's not imported by default by Mac OS (as it is in iOS). I realize you're not attempting to support Mac OS here but it's a small, harmless addition that would be great to get in—otherwise we'll have to maintain our own fork of this repo.

Pull request checklist

  • The changes have been tested successfully.
  • A changeset has been created (npm run changeset).

iOS automatically imports UserNotifications, but Mac OS does not. This
actually fixes the plugin to let it work in Mac OS builds.

Signed-off-by: Evan Owen <[email protected]>
@kainosnoema
Copy link
Contributor Author

kainosnoema commented Apr 12, 2023

I'm having trouble getting the verification to run, getting some errors related to Java versions (have 1.8.0_361 installed). Maybe someone can help point me in the right direction of resolving it:

@capawesome/capacitor-badge:verify:android: FAILURE: Build failed with an exception.
@capawesome/capacitor-badge:verify:android:
@capawesome/capacitor-badge:verify:android: * What went wrong:
@capawesome/capacitor-badge:verify:android: A problem occurred configuring root project 'android'.
@capawesome/capacitor-badge:verify:android: > Could not resolve all files for configuration ':classpath'.
@capawesome/capacitor-badge:verify:android:    > Could not resolve com.android.tools.build:gradle:7.4.1.
@capawesome/capacitor-badge:verify:android:      Required by:
@capawesome/capacitor-badge:verify:android:          project :
@capawesome/capacitor-badge:verify:android:       > No matching variant of com.android.tools.build:gradle:7.4.1 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5' but:
@capawesome/capacitor-badge:verify:android:           - Variant 'apiElements' capability com.android.tools.build:gradle:7.4.1 declares a library, packaged as a jar, and its dependencies declared externally:
@capawesome/capacitor-badge:verify:android:               - Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
@capawesome/capacitor-badge:verify:android:               - Other compatible attribute:
@capawesome/capacitor-badge:verify:android:                   - Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
...

@robingenz
Copy link
Member

I'm having trouble getting the verification to run, getting some errors related to Java versions (have 1.8.0_361 installed). Maybe someone can help point me in the right direction of resolving it:

@capawesome/capacitor-badge:verify:android: FAILURE: Build failed with an exception.
@capawesome/capacitor-badge:verify:android:
@capawesome/capacitor-badge:verify:android: * What went wrong:
@capawesome/capacitor-badge:verify:android: A problem occurred configuring root project 'android'.
@capawesome/capacitor-badge:verify:android: > Could not resolve all files for configuration ':classpath'.
@capawesome/capacitor-badge:verify:android:    > Could not resolve com.android.tools.build:gradle:7.4.1.
@capawesome/capacitor-badge:verify:android:      Required by:
@capawesome/capacitor-badge:verify:android:          project :
@capawesome/capacitor-badge:verify:android:       > No matching variant of com.android.tools.build:gradle:7.4.1 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.5' but:
@capawesome/capacitor-badge:verify:android:           - Variant 'apiElements' capability com.android.tools.build:gradle:7.4.1 declares a library, packaged as a jar, and its dependencies declared externally:
@capawesome/capacitor-badge:verify:android:               - Incompatible because this component declares an API of a component compatible with Java 11 and the consumer needed a runtime of a component compatible with Java 8
@capawesome/capacitor-badge:verify:android:               - Other compatible attribute:
@capawesome/capacitor-badge:verify:android:                   - Doesn't say anything about org.gradle.plugin.api-version (required '7.5')
...

You need to use Java 11. Let’s the if the pipeline run is successful.

@robingenz
Copy link
Member

@kainosnoema Please note that all plugins are already updated to Capacitor 5 for the next release. just FYI

@kainosnoema
Copy link
Contributor Author

You need to use Java 11. Let’s the if the pipeline run is successful.

Doh of course, I just installed the one recommended on java.com.. haven't done that in awhile. Ok.

Please note that all plugins are already updated to Capacitor 5 for the next release. just FYI

Got it, that's fine we'll be upgrading to Capacitor 5 soon. For now we have a workaround to get this building in our project so this change is low priority. Just wanted to suggest it in case we might be able to remove our workaround down the road.

@robingenz robingenz changed the title fix(badge): add UserNotifications import to fix build on Mac OS fix(badge): import UserNotifications to support MacOS Apr 13, 2023
@robingenz robingenz merged commit 8bbaee3 into capawesome-team:main Apr 13, 2023
@github-actions github-actions bot mentioned this pull request Apr 13, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants