ios: add a CallKit icon

The SDK will now search for an asset called "CallKitIcon" on the main bundle,
and fallback to a built-in asset it it's not there, allowing SDK users to
customize it by just adding asset with that name.
This commit is contained in:
Saúl Ibarra Corretgé 2019-04-24 09:36:47 +02:00 committed by Saúl Ibarra Corretgé
parent 4c286b8580
commit 6bf962817b
5 changed files with 35 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "CallKit@1x.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "CallKit@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "CallKit@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -206,14 +206,20 @@ RCT_EXPORT_METHOD(updateCall:(NSString *)callUUID
// iconTemplateImageData
NSString *iconTemplateImageName = dictionary[@"iconTemplateImageName"];
NSData *iconTemplateImageData;
UIImage *iconTemplateImage;
if (iconTemplateImageName) {
UIImage *iconTemplateImage
= [UIImage imageNamed:iconTemplateImageName
inBundle:[NSBundle bundleForClass:self.class]
compatibleWithTraitCollection:nil];
// First try to load the resource from the main bundle.
iconTemplateImage = [UIImage imageNamed:iconTemplateImageName];
// If that didn't work, use the one built-in.
if (!iconTemplateImage) {
iconTemplateImage = [UIImage imageNamed:iconTemplateImageName
inBundle:[NSBundle bundleForClass:self.class]
compatibleWithTraitCollection:nil];
}
if (iconTemplateImage) {
iconTemplateImageData
= UIImagePNGRepresentation(iconTemplateImage);
iconTemplateImageData = UIImagePNGRepresentation(iconTemplateImage);
}
}