Skip to content

Commit 93d8fc1

Browse files
authored
Merge pull request #117 from square/artem/targetSDK24_android_only
- Update target SDK to 34
2 parents 7b1cd0a + 8bf92a1 commit 93d8fc1

11 files changed

Lines changed: 72 additions & 50 deletions

File tree

.github/workflows/main.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ jobs:
55
runs-on: macos-latest
66
steps:
77
- uses: actions/checkout@v2
8-
- uses: actions/setup-java@v1
8+
- uses: actions/setup-java@v3
99
with:
10-
java-version: '12.x'
10+
java-version: '17'
11+
distribution: 'temurin'
1112
- uses: subosito/flutter-action@v1
1213
with:
1314
channel: 'stable' # or: 'beta', 'dev' or 'master'

android/build.gradle

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ version '2.0-SNAPSHOT'
1919
buildscript {
2020
repositories {
2121
google()
22-
jcenter()
22+
mavenCentral()
2323
}
2424

2525
dependencies {
26-
classpath 'com.android.tools.build:gradle:3.1.2'
26+
classpath 'com.android.tools.build:gradle:8.5.2'
2727
}
2828
}
2929

3030
rootProject.allprojects {
3131
repositories {
3232
google()
33-
jcenter()
33+
mavenCentral()
3434
maven {
3535
url "https://sdk.squareup.com/android"
3636
credentials {
@@ -44,14 +44,14 @@ rootProject.allprojects {
4444
apply plugin: 'com.android.library'
4545

4646
def DEFAULT_PLAY_SERVICES_BASE_VERSION = '16.0.1'
47-
def READER_SDK_VERSION = '[1.7.5, 2.0)'
47+
def READER_SDK_VERSION = '1.7.5'
4848

4949
android {
50-
compileSdkVersion 32
51-
50+
compileSdkVersion 34
51+
namespace 'com.squareup.readersdkflutterplugin'
5252
defaultConfig {
5353
minSdkVersion 24
54-
targetSdkVersion 31
54+
targetSdkVersion 34
5555
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
5656
multiDexEnabled true
5757
}

android/src/main/AndroidManifest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.squareup.readersdkflutterplugin">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32

43
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
54

example/android/app/build.gradle

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,9 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2626
apply plugin: 'kotlin-android'
2727

2828
android {
29-
compileSdkVersion 33
30-
31-
lintOptions {
32-
disable 'InvalidPackage'
33-
checkReleaseBuilds false
34-
}
35-
compileSdkVersion 33
36-
ndkVersion = "21.4.7075529"
29+
namespace 'com.example.flutter.squareup.sdk.reader'
30+
compileSdkVersion 34
31+
ndkVersion = "26.1.10909125"
3732

3833
sourceSets {
3934
main.java.srcDirs += 'src/main/kotlin'
@@ -43,30 +38,52 @@ android {
4338
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4439
applicationId "com.example.flutter.squareup.sdk.reader"
4540
minSdkVersion 26
46-
targetSdkVersion 33
41+
targetSdkVersion 34
4742
versionCode flutterVersionCode.toInteger()
4843
versionName flutterVersionName
4944
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
5045
multiDexEnabled true
5146
}
5247

48+
compileOptions {
49+
sourceCompatibility JavaVersion.VERSION_1_8
50+
targetCompatibility JavaVersion.VERSION_1_8
51+
}
52+
53+
kotlinOptions {
54+
jvmTarget = "1.8"
55+
}
56+
57+
java {
58+
toolchain {
59+
languageVersion = JavaLanguageVersion.of(17)
60+
}
61+
}
62+
5363
buildTypes {
5464
release {
5565
// TODO: Add your own signing config for the release build.
5666
// Signing with the debug keys for now, so `flutter run --release` works.
5767
signingConfig signingConfigs.debug
58-
}
68+
minifyEnabled false
69+
shrinkResources false }
5970
}
60-
6171
packagingOptions {
62-
exclude("META-INF/*.kotlin_module")
72+
resources {
73+
excludes += ['META-INF/*.kotlin_module']
74+
}
6375
}
6476

77+
6578
dexOptions {
6679
preDexLibraries true
6780
jumboMode true
6881
keepRuntimeAnnotatedClasses false
6982
}
83+
lint {
84+
checkReleaseBuilds false
85+
disable 'InvalidPackage'
86+
}
7087
}
7188

7289
flutter {

example/android/app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.example.flutter.squareup.sdk.reader">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32

43
<!-- The INTERNET permission is required for development. Specifically,
54
flutter needs it to communicate with the running application
65
to allow setting breakpoints, to provide hot reload, etc.
76
-->
7+
<uses-feature
8+
android:name="android.hardware.camera"
9+
android:required="true" />
10+
811
<uses-permission android:name="android.permission.INTERNET"/>
912
<uses-permission android:name="android.permission.CAMERA" />
13+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
1014

1115

1216
<!-- io.flutter.app.FlutterApplication is an android.app.Application that

example/android/build.gradle

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ buildscript {
1010
}
1111

1212
dependencies {
13-
classpath 'com.android.tools.build:gradle:7.1.2'
13+
classpath 'com.android.tools.build:gradle:8.5.2'
1414
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1515
classpath 'com.dipien:bye-bye-jetifier:1.2.1'
1616
}
@@ -28,16 +28,15 @@ allprojects {
2828
}
2929

3030
ext {
31-
// Override the reader sdk version with the this parameter
32-
// make sure the version is above min version 1.7.5
33-
readerSdkVersion = "[1.7.5, 2.0)"
31+
// Override the reader sdk version with this parameter
32+
// Make sure the version is above min version 1.7.5
33+
readerSdkVersion = "1.7.5"
3434
}
3535

3636
rootProject.buildDir = '../build'
37+
3738
subprojects {
3839
project.buildDir = "${rootProject.buildDir}/${project.name}"
39-
}
40-
subprojects {
4140
project.evaluationDependsOn(':app')
4241
}
4342

example/android/gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ android.enableJetifier=true
2222

2323
## The Application Secret from the OAuth tab in the Square Application Control Panel.
2424
#SQUARE_READER_SDK_REPOSITORY_PASSWORD=
25+
android.defaults.buildfeatures.buildconfig=true
26+
android.nonTransitiveRClass=false
27+
android.nonFinalResIds=false

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip

example/lib/main.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class ExampleApp extends StatelessWidget {
4141
ThemeData _buildTheme() {
4242
var base = ThemeData.light();
4343
return base.copyWith(
44-
backgroundColor: Color.fromRGBO(64, 135, 225, 1.0),
4544
canvasColor: Colors.transparent,
4645
scaffoldBackgroundColor: Color.fromRGBO(64, 135, 225, 1.0),
4746
buttonTheme: ButtonThemeData(
@@ -54,15 +53,16 @@ ThemeData _buildTheme() {
5453
),
5554
),
5655
textTheme: TextTheme(
57-
button: TextStyle(
58-
fontSize: 20.0,
59-
fontWeight: FontWeight.w600,
60-
color: Colors.white,
61-
),
62-
bodyText1: TextStyle(
63-
fontSize: 24.0,
64-
fontWeight: FontWeight.w600,
65-
color: Colors.white,
66-
)),
56+
labelLarge: TextStyle(
57+
fontSize: 20.0,
58+
fontWeight: FontWeight.w600,
59+
color: Colors.white,
60+
),
61+
bodyLarge: TextStyle(
62+
fontSize: 24.0,
63+
fontWeight: FontWeight.w600,
64+
color: Colors.white,
65+
),
66+
),
6767
);
6868
}

example/lib/screens/widgets/buttons.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,10 @@ class SQRaisedButton extends StatelessWidget {
128128
Widget build(BuildContext context) => ElevatedButton(
129129
child: Text(text),
130130
style: ElevatedButton.styleFrom(
131-
primary: Color.fromRGBO(57, 114, 178, 1.0),
131+
backgroundColor: Color.fromRGBO(57, 114, 178, 1.0),
132132
padding: EdgeInsets.all(15.0),
133-
onPrimary: Colors.white,
134-
shape:
135-
RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)),
133+
foregroundColor: Colors.white,
134+
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)),
136135
),
137136
onPressed: onPressed,
138137
);

0 commit comments

Comments
 (0)