Skip to content

Commit

Permalink
fix(identity): change how to get icon assets
Browse files Browse the repository at this point in the history
  • Loading branch information
rdlabo committed Dec 4, 2024
1 parent b9c5c6b commit c9d11ce
Showing 1 changed file with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,28 @@ import StripeIdentity
return
}

// Configure a square brand logo. Recommended image size is 32 x 32 points.
let configuration = IdentityVerificationSheet.Configuration(
brandLogo: UIImage(named: "AppIcon")!
)
self.identityVerificationSheet = IdentityVerificationSheet(
verificationSessionId: verificationId!,
ephemeralKeySecret: ephemeralKeySecret!,
configuration: configuration
)
if let iconFileName = Bundle.main.object(forInfoDictionaryKey: "CFBundleIcons") as? [String: Any],
let primaryIcon = iconFileName["CFBundlePrimaryIcon"] as? [String: Any],
let iconFilesArray = primaryIcon["CFBundleIconFiles"] as? [String],
let fileName = iconFilesArray.first {

self.plugin?.notifyListeners(IdentityVerificationSheetEvents.Loaded.rawValue, data: [:])
call.resolve([:])
let configuration = IdentityVerificationSheet.Configuration(
brandLogo: UIImage(named: fileName) ?? UIImage()
)

self.identityVerificationSheet = IdentityVerificationSheet(
verificationSessionId: verificationId!,
ephemeralKeySecret: ephemeralKeySecret!,
configuration: configuration
)

self.plugin?.notifyListeners(IdentityVerificationSheetEvents.Loaded.rawValue, data: [:])
call.resolve([:])
} else {
let errorText = "CFBundleIcons or CFBundlePrimaryIcon or CFBundleIconFiles is not found. You should check ios image assets"
self.plugin?.notifyListeners(IdentityVerificationSheetEvents.FailedToLoad.rawValue, data: ["message": errorText])
call.reject(errorText)
}
}

func present(_ call: CAPPluginCall) {
Expand Down

0 comments on commit c9d11ce

Please sign in to comment.