Skip to content

Commit

Permalink
Release 1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
nsingh-branch committed Mar 13, 2024
1 parent d1abf8a commit 6490863
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 3 deletions.
4 changes: 2 additions & 2 deletions BranchLinkSimulator.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.6;
MARKETING_VERSION = 1.7;
PRODUCT_BUNDLE_IDENTIFIER = "io.branch.link-simulator";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
Expand Down Expand Up @@ -358,7 +358,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.6;
MARKETING_VERSION = 1.7;
PRODUCT_BUNDLE_IDENTIFIER = "io.branch.link-simulator";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
Expand Down
2 changes: 1 addition & 1 deletion BranchLinkSimulator/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

Branch.setAPIUrl("https://protected-api.branch.io")
Branch.getInstance().enableLogging()

// Retrieve or create the bls_session_id
let blsSessionId: String
if let savedId = UserDefaults.standard.string(forKey: "blsSessionId") {
Expand Down
58 changes: 58 additions & 0 deletions BranchLinkSimulator/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ struct HomeView: View {
@State private var showingEventActionSheet = false
@State private var selectedEventType: BranchStandardEvent = .purchase

@State private var showingQRSheet = false
@State private var qrCodeImage: UIImage? = nil

var body: some View {
NavigationView {
VStack {
Expand Down Expand Up @@ -73,6 +76,32 @@ struct HomeView: View {
.background(Color.blue)
.cornerRadius(8)
}
Button(action: createURL) {
Label("Create Branch Link", systemImage: "link")
.labelStyle(.titleAndIcon)
.foregroundColor(.white)
.padding()
.frame(maxWidth: .infinity)
.background(Color.blue)
.cornerRadius(8)
}
Button(action: createQRCode) {
Label("Create Branch QR Code", systemImage: "qrcode")
.labelStyle(.titleAndIcon)
.foregroundColor(.white)
.padding()
.frame(maxWidth: .infinity)
.background(Color.blue)
.cornerRadius(8)
}
.sheet(isPresented: $showingQRSheet) {
if let qrImage = qrCodeImage {
Image(uiImage: qrImage)
.interpolation(.none)
.resizable()
.scaledToFit()
}
}
}
.headerProminence(.standard)
.listRowSeparator(.hidden)
Expand Down Expand Up @@ -187,6 +216,35 @@ struct HomeView: View {
}
}
}

func createURL() {
let buo: BranchUniversalObject = BranchUniversalObject(canonicalIdentifier: "item/12345")
let lp: BranchLinkProperties = BranchLinkProperties()

buo.getShortUrl(with: lp) { url, error in
if (error != nil) {
self.showToast(message: "Error creating link: \(error)")
} else {
self.showToast(message: "Created \(url ?? "N/A")")
}
}
}

func createQRCode() {
let buo: BranchUniversalObject = BranchUniversalObject(canonicalIdentifier: "item/12345")
let lp: BranchLinkProperties = BranchLinkProperties()
let qrCode = BranchQRCode()

qrCode.getAsImage(buo, linkProperties: lp) { image, error in
if (error != nil) {
self.showToast(message: "Error creating QR Code: \(error)")

} else {
self.qrCodeImage = image
self.showingQRSheet = true
}
}
}
}

extension View {
Expand Down

0 comments on commit 6490863

Please sign in to comment.