Skip to content

Commit 7c8b74d

Browse files
committed
Fixed Failure of web OTP on iOS. Closes #7
1 parent 44dfdf1 commit 7c8b74d

File tree

12 files changed

+54
-16
lines changed

12 files changed

+54
-16
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.9.3
2+
3+
* Fixed failure of web OTP on iOS devices
4+
15
## 0.9.2
26

37
* Bank account payment: fixed issue where the reference value passed to checkout is different from what is returned after transaction.

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1515
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
1616
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
17-
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
18-
9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; };
1917
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
2018
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
2119
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
@@ -177,11 +175,17 @@
177175
97C146E61CF9000F007C117D /* Project object */ = {
178176
isa = PBXProject;
179177
attributes = {
180-
LastUpgradeCheck = 0910;
178+
LastUpgradeCheck = 1010;
181179
ORGANIZATIONNAME = "The Chromium Authors";
182180
TargetAttributes = {
183181
97C146ED1CF9000F007C117D = {
184182
CreatedOnToolsVersion = 7.3.1;
183+
DevelopmentTeam = EP5N73U5P2;
184+
SystemCapabilities = {
185+
com.apple.BackgroundModes = {
186+
enabled = 1;
187+
};
188+
};
185189
};
186190
};
187191
};
@@ -209,9 +213,7 @@
209213
buildActionMask = 2147483647;
210214
files = (
211215
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
212-
9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */,
213216
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
214-
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
215217
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
216218
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
217219
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
@@ -334,12 +336,14 @@
334336
CLANG_WARN_BOOL_CONVERSION = YES;
335337
CLANG_WARN_COMMA = YES;
336338
CLANG_WARN_CONSTANT_CONVERSION = YES;
339+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
337340
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
338341
CLANG_WARN_EMPTY_BODY = YES;
339342
CLANG_WARN_ENUM_CONVERSION = YES;
340343
CLANG_WARN_INFINITE_RECURSION = YES;
341344
CLANG_WARN_INT_CONVERSION = YES;
342345
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
346+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
343347
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
344348
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
345349
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -388,12 +392,14 @@
388392
CLANG_WARN_BOOL_CONVERSION = YES;
389393
CLANG_WARN_COMMA = YES;
390394
CLANG_WARN_CONSTANT_CONVERSION = YES;
395+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
391396
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
392397
CLANG_WARN_EMPTY_BODY = YES;
393398
CLANG_WARN_ENUM_CONVERSION = YES;
394399
CLANG_WARN_INFINITE_RECURSION = YES;
395400
CLANG_WARN_INT_CONVERSION = YES;
396401
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
402+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
397403
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
398404
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
399405
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -428,6 +434,7 @@
428434
buildSettings = {
429435
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
430436
CURRENT_PROJECT_VERSION = 1;
437+
DEVELOPMENT_TEAM = EP5N73U5P2;
431438
ENABLE_BITCODE = NO;
432439
FRAMEWORK_SEARCH_PATHS = (
433440
"$(inherited)",
@@ -451,6 +458,7 @@
451458
buildSettings = {
452459
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
453460
CURRENT_PROJECT_VERSION = 1;
461+
DEVELOPMENT_TEAM = EP5N73U5P2;
454462
ENABLE_BITCODE = NO;
455463
FRAMEWORK_SEARCH_PATHS = (
456464
"$(inherited)",
@@ -492,4 +500,4 @@
492500
/* End XCConfigurationList section */
493501
};
494502
rootObject = 97C146E61CF9000F007C117D /* Project object */;
495-
}
503+
}

example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0910"
3+
LastUpgradeVersion = "1010"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -26,7 +26,6 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
language = ""
3029
shouldUseLaunchSchemeArgsEnv = "YES">
3130
<Testables>
3231
</Testables>
@@ -46,7 +45,6 @@
4645
buildConfiguration = "Debug"
4746
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4847
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
49-
language = ""
5048
launchStyle = "0"
5149
useCustomWorkingDirectory = "NO"
5250
ignoresPersistentStateOnLaunch = "NO"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>BuildSystemType</key>
6+
<string>Original</string>
7+
</dict>
8+
</plist>

example/ios/Runner/Info.plist

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
<string>1</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true/>
25+
<key>UIBackgroundModes</key>
26+
<array>
27+
<string>fetch</string>
28+
<string>remote-notification</string>
29+
</array>
2530
<key>UILaunchStoryboardName</key>
2631
<string>LaunchScreen</string>
2732
<key>UIMainStoryboardFile</key>

ios/Classes/PSTCKAuthViewController.m

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ - (void)viewWillLayoutSubviews {
6565
#pragma mark UI Action Methods
6666

6767
- (void)tappedCancelButton:(id)cancelButton {
68-
#pragma unused(cancelButton)
68+
#pragma unused(cancelButton)
6969
self.completion();
7070
}
7171

@@ -74,7 +74,7 @@ - (void)tappedCancelButton:(id)cancelButton {
7474
@implementation PSTCKAuthViewController (UIWebViewDelegate)
7575

7676
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
77-
#pragma unused(webView, navigationType)
77+
#pragma unused(webView, navigationType)
7878
NSString *url = [[request URL] absoluteString];
7979

8080
// Prevent loading URL if it is the redirectURL
@@ -90,7 +90,11 @@ - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)
9090
}
9191

9292
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
93-
#pragma unused(webView)
93+
#pragma unused(webView)
94+
95+
NSLog(@"%@", error);
96+
NSString * myString = error.description;
97+
NSLog(@"%@", myString);
9498

9599
// Turn off network activity indicator upon failure to load web view
96100
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
@@ -107,11 +111,11 @@ - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
107111
}
108112

109113
- (void)webViewDidFinishLoad:(UIWebView *)webView {
110-
#pragma unused(webView)
111-
114+
#pragma unused(webView)
115+
112116
// Turn off network activity indicator upon finishing web view load
113117
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
114-
118+
115119
}
116120

117121
@end

lib/src/api/service/mobile_service.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ class MobileService extends BaseApiService {
1414
HttpHeaders.userAgentHeader: PlatformInfo().userAgent,
1515
HttpHeaders.acceptHeader: 'application/json',
1616
'X-Paystack-Build': PlatformInfo().paystackBuild,
17+
'X-PAYSTACK-USER-AGENT':
18+
jsonEncode({'lang': Platform.isIOS ? 'objective-c' : 'kotlin'}),
19+
'bindings_version': Platform.isIOS
20+
? '3.0.5' // Latest version of Paystack official iOS SDK
21+
: '3.0.10', // Latest version of Paystack official Android SDK
22+
'X-FLUTTER-USER-AGENT': jsonEncode({'version': '0.9.3'})
1723
});
1824

1925
// Mobile Charge

lib/src/widgets/birthday_widget.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import 'package:intl/intl.dart';
99
class BirthdayWidget extends StatefulWidget {
1010
final String message;
1111

12+
// TODO: Use iOS date picker
13+
1214
BirthdayWidget({@required this.message});
1315

1416
@override

lib/src/widgets/checkout/bank_checkout.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ class _BankCheckoutState extends BaseCheckoutMethodState<BankCheckout> {
199199
}
200200

201201
void _validateInputs() {
202+
// TODO: Close keyboard
202203
final FormState form = _formKey.currentState;
203204
if (form.validate()) {
204205
form.save();

lib/src/widgets/input/card_input.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ class _CardInputState extends State<CardInput> {
102102
}
103103

104104
void _validateInputs() {
105+
// TODO: Close keyboard
105106
final FormState form = _formKey.currentState;
106107
if (form.validate()) {
107108
form.save();

0 commit comments

Comments
 (0)