Skip to content

Commit

Permalink
chore: deprecate "userPropertyString" in favor of "saveUserProperty"
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn committed Jul 27, 2021
1 parent d51c6f0 commit dfca7fa
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ have the same parameters. Up to 500 event names are supported.
Make sure to check the [Log Events](https://firebase.google.com/docs/analytics/android/events) docs to validate
that you are using a valid event name (1st parameter) and parameter structure (2nd event).

##### `setUserPropertyString(parameters)`
##### `saveUserProperty(parameters)`
- `parameters` (Dictionary)
- `value` (String)
- `name` (String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,31 @@ public void resetAnalyticsData()
this.analyticsInstance().resetAnalyticsData();
}

// clang-format off
@Kroll.method
@Kroll.setProperty
public void setEnabled(Boolean enabled)
// clang-format on
{
this.analyticsInstance().setAnalyticsCollectionEnabled(enabled);
}

// clang-format off
@Kroll.method
@Kroll.setProperty
public void setUserPropertyString(KrollDict parameters)
// clang-format on
{
Log.w(LCAT, "The \"userPropertyString\" property is deprecated in favor of the \"saveUserProperty({ name: '...', value: '...'})\" method!");
this.saveUserProperty(parameters);
}

@Kroll.method
public void saveUserProperty(KrollDict parameters)
{
this.analyticsInstance().setUserProperty(TiConvert.toString(parameters, "name"),
TiConvert.toString(parameters, "value"));
TiConvert.toString(parameters, "value"));
}

// clang-format off
@Kroll.method
@Kroll.setProperty
public void setUserID(String id)
// clang-format on
{
this.analyticsInstance().setUserId(id);
}
Expand All @@ -99,11 +100,9 @@ public void fetchInstallationID(KrollFunction callback) {
});
}

// clang-format off
@Kroll.method
@Kroll.setProperty
public void setScreenNameAndScreenClass(KrollDict parameters)
// clang-format on
{
if (!parameters.containsKey("screenName")) {
Log.e(LCAT, "Unable to set current screen without the missing \"screenName\" key");
Expand Down
4 changes: 3 additions & 1 deletion ios/Classes/FirebaseAnalyticsModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@

- (void)log:(id)arguments;

- (void)setUserPropertyString:(id)arguments;
- (void)saveUserProperty:(id)arguments;

- (void)setUserPropertyString:(id)arguments; // DEPRECATED: Use "saveUserProperty(arguments)" method instead

- (void)setUserID:(NSString *)userID;

Expand Down
6 changes: 6 additions & 0 deletions ios/Classes/FirebaseAnalyticsModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ - (void)log:(id)arguments
}

- (void)setUserPropertyString:(id)arguments
{
DEPRECATED_REPLACED(@"userPropertyString", @"5.1.0", @"saveUserProperty({ name: '...', value: '...' })");
[self saveUserProperty:arguments];
}

- (void)saveUserProperty:(id)arguments
{
ENSURE_SINGLE_ARG(arguments, NSDictionary);

Expand Down
2 changes: 1 addition & 1 deletion ios/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 5.0.0
version: 5.1.0
apiversion: 2
architectures: arm64 x86_64
description: titanium-firebase-analytics
Expand Down

0 comments on commit dfca7fa

Please sign in to comment.