Skip to content

Push Notification: fix compatibility with latest Android #1478

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

Closed
wants to merge 23 commits into from

Conversation

ichan-mb
Copy link
Member

We also needed this PR: fuse-open/uno#504 to make it works

Now, on Android 13 later, we can lazy request permission for push notifications same with iOS. First, define it on the unoproj

"Android": {
  "PushNotifications": {
      "RegisterOnLaunch": false
    }
}

and in your App, you can call the register method to ask for permission. Example:

<App>
	<JavaScript>

		var push = require("FuseJS/Push");
		var Observable = require("FuseJS/Observable")

		var log = new Observable()

		push.on("registrationSucceeded", function(regID) {
			console.log("Reg Succeeded: " + regID);
			log.value = "Reg Succeeded: " + regID
		});

		push.on("error", function(reason) {
			console.log("Reg Failed: " + reason);
			log.value = "Reg Failed: " + reason
		});

		push.on("receivedMessage", function(payload) {
			console.log("Recieved Push Notification: " + payload);
			log.value = "Recieved Push Notification: " + payload
		});

		module.exports.log = log
		module.exports.register = function() {
			push.register()
		}

	</JavaScript>
	<ClientPanel>
		<StackPanel>
			<Text Value="{log}" />
			<Button Text="Register Notification" Clicked="{register}" />
		</StackPanel>
	</ClientPanel>
</App>

This PR contains:

  • Changelog
  • Documentation
  • Tests

Copy link
Member

@mortend mortend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice and great timing!

I was debugging push notifications on Android with @ckarmy last night. We tried upgrading firebase-messaging and firebase-analytics but push notifications still didn't arrive. Now it looks like your patches will solve the problem. :)

Just one request: Can you rebase your branch on latest master to remove that merge-commit?

Fuse.PushNotifications: Android 12 compatibility fix

Apps targeting Android 12 and higher are required to specify an explicit
value for `android:exported` when the corresponding component has an
intent filter defined.

2.6.1

Fuse.Launcher.Phone: implement SMS launcher

* Add Launcher.LaunchSms(string phoneNumber, string body) method.

* Add sms(phoneNumber: string, body?: string) method to FuseJS/Phone
  module.

* Add Sms trigger action for UX.

upgrade @fuse-open/uno (2.7.0)

CHANGELOG: add v2.7 changes

2.7.0

Fuse.Scripting.JavaScript: support async/await

This adds "regenerator-runtime"  which makes it possible to use
async/await from transpiled JavaScript or TypeScript code, e.g.:

    async example() {
        try {
            await Foo.requestPermission()
            console.log("Permission granted!")
        } catch (e) {
            console.error(e)
        }
    }

Source: https://github.com/facebook/regenerator/tree/e4b592a44ef0d3a366cc7ad6125c4d9c8f6cc597/packages/runtime

Fuse.Scripting: use compiler to generate closures

Use lambda expressions instead of manually created closure classes.

There was a bug in Uno blocking us from using lambda expressions before,
fixed by fuse-open/uno#446.

Fuse.Scripting: add Context parameter to native promises

Make most native promises in Fuselibs receive the Context parameter.

Like fuse-open#1467 but without the parts changing public API.

README: link to tsconfig

use nodejs v16

Use nodejs v16 on AppVeyor and upgrade package-lock.json to version 2.

README: remove Travis CI build status

iOS: update deprecated include header

upgrade @fuse-open/uno (2.8.0)

CHANGELOG: add v2.8 changes

2.8.0

doc-export: add Fuse.Controls.DrawingPanel

Fuse.LocalNotifications: fix package name on Android

Use a macro that will expand to the package name of the app being built,
fixing the build error introduced in 98a3359.
@ichan-mb ichan-mb force-pushed the feature-drawing-panel branch 2 times, most recently from c3148b5 to 85059ba Compare July 28, 2023 22:27
ichan-mb and others added 19 commits July 29, 2023 05:29
Apps targeting Android 12 and higher are required to specify an explicit
value for `android:exported` when the corresponding component has an
intent filter defined.
* Add Launcher.LaunchSms(string phoneNumber, string body) method.

* Add sms(phoneNumber: string, body?: string) method to FuseJS/Phone
  module.

* Add Sms trigger action for UX.
This adds "regenerator-runtime"  which makes it possible to use
async/await from transpiled JavaScript or TypeScript code, e.g.:

    async example() {
        try {
            await Foo.requestPermission()
            console.log("Permission granted!")
        } catch (e) {
            console.error(e)
        }
    }

Source: https://github.com/facebook/regenerator/tree/e4b592a44ef0d3a366cc7ad6125c4d9c8f6cc597/packages/runtime
Use lambda expressions instead of manually created closure classes.

There was a bug in Uno blocking us from using lambda expressions before,
fixed by fuse-open/uno#446.
Make most native promises in Fuselibs receive the Context parameter.

Like fuse-open#1467 but without the parts changing public API.
Use nodejs v16 on AppVeyor and upgrade package-lock.json to version 2.
Use a macro that will expand to the package name of the app being built,
fixing the build error introduced in 98a3359.
@ichan-mb ichan-mb force-pushed the feature-drawing-panel branch from 85059ba to d718ec9 Compare July 28, 2023 22:33
@ichan-mb
Copy link
Member Author

I just did rebase, but is it correct? now it introduces so many previous commits and so many file changes, even though the changes are already in the repo

@ichan-mb
Copy link
Member Author

I am sorry, this is bad PR, I am closing it. Please review the new one: #1479

@ichan-mb ichan-mb closed this Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants