Skip to content

Commit dd17f94

Browse files
Add iOS API getUserAttribute
1 parent 937dc34 commit dd17f94

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/ios/IBGPlugin.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,6 @@
4040

4141
- (void)removeUserAttribute:(CDVInvokedUrlCommand *)command;
4242

43+
- (void)getUserAttribute:(CDVInvokedUrlCommand *)command;
44+
4345
@end

src/ios/IBGPlugin.m

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,21 @@ - (void) removeUserAttribute:(CDVInvokedUrlCommand*)command
12671267
[self.commandDelegate sendPluginResult:result callbackId:[command callbackId]];
12681268
}
12691269

1270+
/**
1271+
* Returns the user attribute associated with a given key.
1272+
*/
1273+
- (void) getUserAttribute:(CDVInvokedUrlCommand*)command
1274+
{
1275+
CDVPluginResult* result;
1276+
1277+
NSString* key = [command argumentAtIndex:0];
1278+
NSString* userAttribute = @[[Instabug userAttributeForKey:key]];
1279+
1280+
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString: userAttribute];
1281+
1282+
[self.commandDelegate sendPluginResult:result callbackId:[command callbackId]];
1283+
}
1284+
12701285
/**
12711286
* Shows one of the surveys that were not shown before, that also have
12721287
* conditions that match the current device/user.

0 commit comments

Comments
 (0)