Skip to content

Commit 32fd40b

Browse files
PlezBlipmateus.ricciardigithubdoandre
authored
fix: Upgrade iOS version and improve WebView loading (#12)
* upgrading ios version to 26 * fix: improve webview loading --------- Co-authored-by: mateus.ricciardi <mateus.ricciardi@BLIP-C02HGN0SQ05D.local> Co-authored-by: Andre Rossi <andre.rossi@blip.ai>
1 parent bf98e79 commit 32fd40b

8 files changed

Lines changed: 27 additions & 15 deletions

File tree

.DS_Store

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

samples/blip-sdk-webview-objective-c/blip-sdk-objective-c.xcodeproj/project.pbxproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@
273273
developmentRegion = English;
274274
hasScannedForEncodings = 0;
275275
knownRegions = (
276+
English,
276277
en,
277278
Base,
278279
);
@@ -560,7 +561,7 @@
560561
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
561562
DEVELOPMENT_TEAM = 2U6X6P3626;
562563
INFOPLIST_FILE = "blip-sdk-objective-c/Info.plist";
563-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
564+
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
564565
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
565566
PRODUCT_BUNDLE_IDENTIFIER = "net.take.blip-sdk-objective-c";
566567
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -575,7 +576,7 @@
575576
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
576577
DEVELOPMENT_TEAM = 2U6X6P3626;
577578
INFOPLIST_FILE = "blip-sdk-objective-c/Info.plist";
578-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
579+
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
579580
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
580581
PRODUCT_BUNDLE_IDENTIFIER = "net.take.blip-sdk-objective-c";
581582
PRODUCT_NAME = "$(TARGET_NAME)";
0 Bytes
Binary file not shown.

samples/blip-sdk-webview-swift/blip-sdk-webview.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@
584584
"$(PROJECT_DIR)",
585585
);
586586
INFOPLIST_FILE = "blip-sdk-webview/Info.plist";
587-
IPHONEOS_DEPLOYMENT_TARGET = 18.6;
587+
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
588588
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
589589
PRODUCT_BUNDLE_IDENTIFIER = "net.take.blip-sdk-webview";
590590
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -603,7 +603,7 @@
603603
"$(PROJECT_DIR)",
604604
);
605605
INFOPLIST_FILE = "blip-sdk-webview/Info.plist";
606-
IPHONEOS_DEPLOYMENT_TARGET = 18.6;
606+
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
607607
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
608608
PRODUCT_BUNDLE_IDENTIFIER = "net.take.blip-sdk-webview";
609609
PRODUCT_NAME = "$(TARGET_NAME)";

src/.DS_Store

0 Bytes
Binary file not shown.

src/BlipChat.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@
355355
DYLIB_INSTALL_NAME_BASE = "@rpath";
356356
INFOPLIST_FILE = BlipChat/Info.plist;
357357
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
358-
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
358+
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
359359
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
360360
OTHER_SWIFT_FLAGS = "-DDEBUG";
361361
PRODUCT_BUNDLE_IDENTIFIER = net.take.BlipChat;
@@ -379,7 +379,7 @@
379379
DYLIB_INSTALL_NAME_BASE = "@rpath";
380380
INFOPLIST_FILE = BlipChat/Info.plist;
381381
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
382-
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
382+
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
383383
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
384384
OTHER_SWIFT_FLAGS = "-DRELEASE";
385385
PRODUCT_BUNDLE_IDENTIFIER = net.take.BlipChat;

src/BlipChat/ThreadViewController.swift

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ internal class ThreadViewController: UIViewController, WKNavigationDelegate, UIS
9191
.replacingOccurrences(of: Constants.SCRIPT_SDK_URL_KEY, with: self.options.customWidgetUrl ?? Constants.BLIP_SDK_URL)
9292
.replacingOccurrences(of: Constants.IFRAME_URL_KEY, with: self.options.customCommonUrl ?? Constants.IFRAME_URL)
9393
.replacingOccurrences(of: Constants.CUSTOM_COMMON_URL_KEY, with: self.options.customCommonUrl ?? "");
94-
95-
self.webView.load(URLRequest(url:URL(string:Constants.BLIP_BLANK_PAGE)!))
94+
9695
baseUrl = URL(string: "https://\(Bundle.main.bundleIdentifier!.lowercased())/")
97-
98-
UIDevice.current.setValue(UIInterfaceOrientation.portrait.rawValue, forKey: "orientation")
96+
97+
loadChatContent()
98+
requestPortraitOrientation()
9999
}
100100

101101
deinit {
@@ -139,12 +139,27 @@ internal class ThreadViewController: UIViewController, WKNavigationDelegate, UIS
139139
/// Handle cancel button on nav bar
140140
@objc func handleCancel() {
141141
if self.webView.url != baseUrl {
142-
self.webView.load(URLRequest(url:URL(string:Constants.BLIP_BLANK_PAGE)!))
142+
loadChatContent()
143143
} else {
144144
self.navigationController?.popViewController(animated: true)
145145
}
146146
}
147147

148+
private func loadChatContent() {
149+
self.webView.loadHTMLString(html, baseURL: baseUrl)
150+
}
151+
152+
private func requestPortraitOrientation() {
153+
if #available(iOS 16.0, *), let windowScene = view.window?.windowScene {
154+
let geometryPreferences = UIWindowScene.GeometryPreferences.iOS(interfaceOrientations: .portrait)
155+
windowScene.requestGeometryUpdate(geometryPreferences) { error in
156+
print("BLiP Chat - Failed to request portrait orientation: \(error.localizedDescription)")
157+
}
158+
} else {
159+
UIViewController.attemptRotationToDeviceOrientation()
160+
}
161+
}
162+
148163
override func didReceiveMemoryWarning() {
149164
super.didReceiveMemoryWarning()
150165
}
@@ -154,8 +169,6 @@ internal class ThreadViewController: UIViewController, WKNavigationDelegate, UIS
154169
for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
155170
if navigationAction.targetFrame == nil { // Verify for link
156171
webView.load(navigationAction.request)
157-
} else if navigationAction.request.url?.absoluteString == Constants.BLIP_BLANK_PAGE { // Verify for blank page
158-
webView.loadHTMLString(html, baseURL: baseUrl)
159172
}
160173
return nil
161174
}
@@ -164,8 +177,6 @@ internal class ThreadViewController: UIViewController, WKNavigationDelegate, UIS
164177
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
165178
if navigationAction.targetFrame == nil { // Verify for link
166179
webView.load(navigationAction.request)
167-
} else if navigationAction.request.url?.absoluteString == Constants.BLIP_BLANK_PAGE { // Verify for blank page
168-
webView.loadHTMLString(html, baseURL: baseUrl)
169180
}
170181
decisionHandler(.allow)
171182
}

0 commit comments

Comments
 (0)