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

[User Model] Add GetTags #84

Merged
merged 8 commits into from
Jan 5, 2024
Merged

Conversation

emawby
Copy link
Contributor

@emawby emawby commented Dec 18, 2023

Description

One Line Summary

Add GetTags to the User Model SDK

Details

  1. Bump iOS and Android versions
  2. Add GetTags to iOS and Android bindings
  3. Add GetTags to the core library

I recommend reviewing by commit since the iOS binary bump includes a lot of file changes

Motivation

Add ability to get the current users tags. Tags are refreshed whenever fetchUser is called (start of session or user change) and are otherwise up to date as tags are changed locally.

Scope

Android and iOS. New method on User namespace

Testing

Unit testing

N/A

Manual testing

Tested on iOS and Android using sample app built in vscode with maui extension

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

@@ -35,6 +35,7 @@ public void Initialize()
public void AddTags(IDictionary<string, string> tags) => OneSignalNative.User.AddTags(tags);
public void RemoveTag(string key) => OneSignalNative.User.RemoveTag(key);
public void RemoveTags(params string[] keys) => OneSignalNative.User.RemoveTags(keys);
public IDictionary<string, string> GetTags() => OneSignalNative.User.GetTags();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

error CS1061: 'IUserManager' does not contain a definition for 'GetTags' and no accessible extension method 'GetTags' accepting a first argument of type 'IUserManager' could be found (are you missing a using directive or an assembly reference?) [/Users/elliotmawby/Documents/GitHub/OneSignal-DotNet-SDK/OneSignalSDK.DotNet.Android/OneSignalSDK.DotNet.Android.csproj::TargetFramework=net7.0-android]

@emawby emawby changed the title WiP [User Model] Add GetTags [User Model] Add GetTags Dec 19, 2023
Copy link
Contributor

@shepherd-l shepherd-l left a comment

Choose a reason for hiding this comment

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

LGTM

getTags correctly reflected the user's tags when I added and removed tags in the example app.

Tested on
Android Emulator: Pixel 4 API 31
iOS Simulator: iPhone 15 iOS 17

However addTags sends the incorrect value on iOS (mentioned here: #78)

@emawby emawby merged commit 47d3e07 into user-model/dotnet7-upgrade Jan 5, 2024
1 check passed
@emawby emawby deleted the user-model/getTags branch January 5, 2024 19:04
@emawby emawby mentioned this pull request Jan 24, 2024
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.

3 participants