Skip to content

Commit

Permalink
add defaults iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
AGulev committed Jan 8, 2024
1 parent 69f563a commit 20bfebd
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions firebase_remoteconfig/src/firebase_remoteconfig_ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,21 @@ void Initialize()
}
}

void SetDefaults()
void SetDefaults(const char* json)
{
//TODO
@try {
NSData *jsonData = [@(json) dataUsingEncoding:NSUTF8StringEncoding];
NSError *error;
NSDictionary *defaultValues = [NSJSONSerialization JSONObjectWithData:jsonData options:kNilOptions error:&error];
if (!defaultValues) {
AddToQueueCallback(MSG_ERROR, [[NSString stringWithFormat:@"{ \"error\": \"Unable to set default values (%1$@)\"}", [error code]] UTF8String]);
return;
}
[g_remoteConfig setDefaults:defaultValues];
SendSimpleMessage(MSG_DEFAULTS_SET);
} @catch (NSException* e) {
AddToQueueCallback(MSG_ERROR, [[NSString stringWithFormat:@"{ \"error\": \"Unable to set default values for Firebase Remote Config (%1$@)\"}", e.reason] UTF8String]);
}
}

void SetMinimumFetchInterval(double fetchInterval)
Expand Down

0 comments on commit 20bfebd

Please sign in to comment.