Skip to content

Commit d112def

Browse files
author
etiennetheodore@orange.fr
committedJul 23, 2019
feat: adding isiOSBeta then launch TestFlight
1 parent 2c8a9bf commit d112def

File tree

5 files changed

+31
-3
lines changed

5 files changed

+31
-3
lines changed
 

‎README.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ For iOS 9 and above, your `Info.plist` file __MUST__ have the following:
1313
```
1414
<key>LSApplicationQueriesSchemes</key>
1515
<array>
16+
<string>itms-beta</string>
1617
<string>itms</string>
1718
</array>
1819
```

‎example/ios/Flutter/Debug.xcconfig

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
12
#include "Generated.xcconfig"

‎example/ios/Flutter/Release.xcconfig

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
12
#include "Generated.xcconfig"

‎ios/Classes/LaunchReviewPlugin.m

+17
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,23 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
2828
} else {
2929
iTunesLink = [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id%@", appId];
3030
}
31+
32+
if ([call.arguments[@"is_ios_beta"] boolValue]) {
33+
NSURL *customAppURL = [NSURL URLWithString:@"itms-beta://"];
34+
if ([[UIApplication sharedApplication] canOpenURL:customAppURL]) {
35+
36+
// TestFlight is installed
37+
38+
// Special link that includes the app's Apple ID
39+
iTunesLink = [NSString stringWithFormat:@"itms-beta://beta.itunes.apple.com/v1/app/id%@", appId];
40+
NSURL* itunesURL = [NSURL URLWithString:iTunesLink];
41+
42+
if ([[UIApplication sharedApplication] canOpenURL:itunesURL]) {
43+
[[UIApplication sharedApplication] openURL:itunesURL];
44+
}
45+
result(nil);
46+
}
47+
}
3148

3249
NSURL* itunesURL = [NSURL URLWithString:iTunesLink];
3350
if ([[UIApplication sharedApplication] canOpenURL:itunesURL]) {

‎lib/launch_review.dart

+11-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,16 @@ class LaunchReview {
66
/// Note: It will not work with the iOS Simulator.
77
///
88
/// Set writeReview to false to only show the app store page. Used only in iOS.
9-
static void launch({String androidAppId, String iOSAppId, bool writeReview = true}) async {
10-
await _channel.invokeMethod(
11-
'launch', {'android_id': androidAppId, 'ios_id': iOSAppId, 'write_review': writeReview});
9+
static void launch(
10+
{String androidAppId,
11+
String iOSAppId,
12+
bool writeReview = true,
13+
bool isiOSBeta = false}) async {
14+
await _channel.invokeMethod('launch', {
15+
'android_id': androidAppId,
16+
'ios_id': iOSAppId,
17+
'write_review': writeReview,
18+
'is_ios_beta': isiOSBeta
19+
});
1220
}
1321
}

0 commit comments

Comments
 (0)
Please sign in to comment.