forked from OneSignal/OneSignal-Android-SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Dev/bgy/rebase #5
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
• Adds an update handler to methods that update tags to allow developers to respond when the HTTP request is finished (or fails) • Adds a new public method oneSignalLog() to allow wrapper SDK's to use OneSignal logging
• Since users may call sendTags() multiple times, and the sendTags() requests are batched, this would have resulted in only the most recent callback/handler being called. • Implemented an array of SendTagsHandlers to make sure that when the batched SendTags request is finished, it will execute each unique handler individually.
• The SDK was not checking to make sure that a ChangeTagsUpdateHandler reference was non-null before executing it. • Added checks to make sure null handlers aren't invoked • Creates a copy of the sendTagsHandlers array since it gets cleared immediately afterwards
• Since developers can manually require consent by editing the manifest, the wrapper SDK's need a way of knowing if the Android SDK is waiting on the user's privacy consent • Exposes a public getter that returns TRUE if consent is required but hasn't been provided yet.
• Adds a testcase to make sure that the new requiresUserPrivacyConsent() method returns correct results
• Adds curly braces since the for-loops are indented. Applies the change to all loops for consistency.
Add requiresUserPrivacyConsent() getter
Add Update Handler for Send/Delete Tags
Corrected wakeful service fallback to job call
• Adds a ChangeTagsUpdateHandler to allow for callbacks when sending/deleting tags • Publicly exposes onesignalLog() method so that wrapper SDK's can use it. • Adds a getter method for requiresUserPrivacyConsent • Corrects wakeful service GCM fallback
• In rare situations, the main UI thread can block on the user state synchronization making a potentially very long running HTTP request • The user state synchronization model of the Android SDK needs to be significantly refactored & simplified • In the mean time, this commit makes a minor change so that the user state synchronizer never blocks/holds locks while making HTTP requests
• In the previous commit, I wanted to explicitly use a sync lock object for different methods to synchronize on, to allow more fine-grained control over what parts of methods get synchronized • However, I mistakenly left out a method called getToSyncUserState(). • This commit removes the method synchronization and synchronizes on the syncLock, an instance property that other methods also use to synchronize on.
• We have several demo projects for Android, but the default demo project has few options • This commit adds multiple buttons to the demo to test several different aspects of the SDK without having to open a different project or deal with modules/etc.
• Fixes a somewhat frequent ANR (more details in 3.10.1 release notes)
Improve Android SDK Demo Project
• It appears that in a previous commit (f614e8b) we added code to disable the FirebaseInstanceIdService if there isn't a default Firebase app • It looks like we tried to handle the case where the FirebaseInstanceIdService class was missing, but we were only catching NoClassDefFound errors • After some further research, it looks like we should also be catching IllegalArgumentExceptions as well since this is what the package manager instance will throw if the FirebaseInstanceIdService class is missing
* Fixes reported NPE from RestoreJobService.onHandleWork. Issue OneSignal#591 * Issue maybe related to bug in Android 6.0.1 with BaseBundle.java:127 - This works around any possible issue here.
* If OneSignal was not initialized from onCreate of the application class on Android 7 and older. * This was due to the appContext not being set before trying to read from shared preferences. * All entry points now set the appContext to avoid any future issue with dependencies on this. - Includes OneSignal BroadcastReceivers, Services, and Activities. * Fixes OneSignal#618
* If the Android Oreo notification channel has a Medium importance or lower we now correctly skip setting sound, led, and vibration settings for pre-Oreo devices. * Refactored these setting into a new setAlertnessOptions method to group this logic.
* This allows overriding the API 26 check so when we have FCM high priority wakelock we can start a IntentService instead of using a JobService, - A JobService won't start when doze is active so the job would delayed otherwise. * Implementing the flag will be in the next commit, split this out so we can see what was changed easier if we need to apply any upstream changes from Google.
* Adding a result prevents the GMS app from putting a confusing CANCELLED entry into the logcat.
* Only the most recent 49 notifications will be restore instead of just limiting on the past week. - Ensures only the most recent relevant notifications are shown. * Also increased delay between restoring each notification to 200ms. * This fixes the following logcat messages - E/NotificationService: Package has already posted 50 notifications. Not showing more. package=#### - E/NotificationService: Package enqueue rate is 10.56985. Shedding events. package=#### * This can mitigate OneSignal#644
* This is safe as OneSignalPrefs will cache the value if the context is not set yet.
• Apps should be able to add observers (ie. addSubscriptionObserver) even if privacy consent has not yet been granted.
• Adds tests to make sure that apps can add the observers even if privacy consent hasn't been granted • The tests verify that the observers fire correctly once consent is granted.
Remove Privacy Consent Requirement to Add Observers
* This handles the IllegalArgumentException which can throw on Oreo+ when a high priority notification is sent and when a NotificationExtenderService is setup. - Only thrown in the case where FCM could not add the app to the whitelist.
* Added boot permission check to setPersisted(true) which could throw on some devices.
* Lowered parcel size from package manager which means less chance of requesting over the limit. * Package manager may have already die so it won't fix these cases.
• Adds public methods setExternalUserId() and removeExternalUserId() that let developers map their own userID's in our system • TODO: Add tests to ensure the methods generate correct API requests and that it uses the on_session request if it hasn't already occurred
• It turns out the Android SDK already has a state synchronizer that can persist previously set player values and will not send duplicate requests if the value is unchanged. • This commit switches to utilizing then state synchronizer • Adds a new test to make sure that the external ID is not sent if setExternalUserId() is called but the ID is the same as the previous session/s
* ACTION_BOOT_COMPLETED is invalid, BOOT_COMPLETED is the correct intent action
* Thrown in rare cases due to know Android issue - https://issuetracker.google.com/issues/63622293 * Fixes issue OneSignal#673
Set External User ID
• Includes miscellaneous bug fixes and improvements
• Adds the set & remove external ID methods to the unity proxy
Add External ID Methods to Unity Proxy
* Wont't be commonly used, however it is valid if you need to call provideUserConsent before OneSignal.init
…s handlers instead of only retaining a reference to the most recent handler. • So in the past, if getTags() was called multiple times, only the handler for the most recent call would get executed. • Makes a small change to the example project to fix a crash when GDPR consent was not granted
* Also omit trying to restore notifications if notifications are disabled. * Misc code cleanup around this
* Badge count is now always set to based on the notifications in the shade, regardless if they are from OneSignal or not * Fixing issue where new notifications would not show if there are already 49 notifications in the shade - Now handles removing oldest notifications to make room for new ones. * Clearing notifications now works even if the privacy was not accepted. * Fixed issue where badges did not clear if clear notifications was called before init. * Badge counts are now updated after restoring notifications.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.