forked from RevenueCat/purchases-flutter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade Flutter Android APIs (RevenueCat#74)
* updates to new Android APIs * fixes activity being null in old API * adds tests * adds pedantic * moves function around * missing await * adds test_driver * adds comment
- Loading branch information
Showing
15 changed files
with
204 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
include: package:pedantic/analysis_options.1.8.0.yaml | ||
analyzer: | ||
exclude: | ||
# Ignore generated files | ||
- '**/*.g.dart' | ||
- 'lib/src/generated/*.dart' | ||
linter: | ||
rules: | ||
- public_member_api_docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...id/app/src/androidTest/java/com/revenuecat/purchases_flutter/EmbeddingV1ActivityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.revenuecat.purchases_flutter; | ||
|
||
import androidx.test.rule.ActivityTestRule; | ||
|
||
import com.revenuecat.purchases_flutter_example.EmbeddingV1Activity; | ||
|
||
import dev.flutter.plugins.e2e.FlutterRunner; | ||
import org.junit.Rule; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(FlutterRunner.class) | ||
public class EmbeddingV1ActivityTest { | ||
@Rule | ||
public ActivityTestRule<EmbeddingV1Activity> rule = | ||
new ActivityTestRule<>(EmbeddingV1Activity.class); | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
...e/android/app/src/androidTest/java/com/revenuecat/purchases_flutter/MainActivityTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.revenuecat.purchases_flutter; | ||
|
||
import androidx.test.rule.ActivityTestRule; | ||
import dev.flutter.plugins.e2e.FlutterRunner; | ||
import org.junit.Rule; | ||
import org.junit.runner.RunWith; | ||
import io.flutter.embedding.android.FlutterActivity; | ||
|
||
@RunWith(FlutterRunner.class) | ||
public class MainActivityTest { | ||
@Rule | ||
public ActivityTestRule<FlutterActivity> rule = new ActivityTestRule<>(FlutterActivity.class); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
...droid/app/src/main/java/com/revenuecat/purchases_flutter_example/EmbeddingV1Activity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.revenuecat.purchases_flutter_example; | ||
|
||
import android.os.Bundle; | ||
import com.revenuecat.purchases_flutter.PurchasesFlutterPlugin; | ||
import io.flutter.app.FlutterActivity; | ||
import io.flutter.view.FlutterMain; | ||
|
||
public class EmbeddingV1Activity extends FlutterActivity { | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
FlutterMain.startInitialization(this); | ||
super.onCreate(savedInstanceState); | ||
PurchasesFlutterPlugin.registerWith(registrarFor("com.revenuecat.purchases_flutter")); | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
example/android/app/src/main/java/com/revenuecat/purchases_flutter_example/MainActivity.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2019, the Chromium project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'dart:io'; | ||
import 'dart:async'; | ||
import 'package:flutter_driver/flutter_driver.dart'; | ||
|
||
Future<void> main() async { | ||
final FlutterDriver driver = await FlutterDriver.connect(); | ||
final String result = | ||
await driver.requestData(null, timeout: const Duration(minutes: 1)); | ||
await driver.close(); | ||
exit(result == 'pass' ? 0 : 1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:e2e/e2e.dart'; | ||
import 'package:purchases_flutter/purchases_flutter.dart'; | ||
|
||
// Execute the following in the `example` folder run these tests: | ||
// `flutter drive --driver=test_driver/purchases_flutter_e2e_test.dart ../test/purchases_flutter_e2e.dart` | ||
|
||
void main() { | ||
E2EWidgetsFlutterBinding.ensureInitialized(); | ||
|
||
testWidgets('Can setup Purchases', (WidgetTester tester) async { | ||
final Future<void> future = Purchases.setup('apiKey', appUserId: 'cesar'); | ||
expect(future, completes); | ||
}); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters