Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.8.0 #71

Merged
merged 9 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 37 additions & 21 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

jobs:
test-ios:
runs-on: macos-13
runs-on: macos-14
defaults:
run:
working-directory: "./example"
Expand All @@ -21,11 +21,14 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version-file: "./.tool-versions"
- run: sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer
# Xcode_16.2.app is available, but it does not have any simulator pre-installed.
# So it is not really usable.
# Let's use Xcode_16.1.app instead.
- run: sudo xcode-select -s /Applications/Xcode_16.1.app/Contents/Developer
- uses: subosito/flutter-action@v2
with:
# This has to be kept in sync with .tool-versions
flutter-version: '3.24.2'
flutter-version: '3.27.1'
channel: 'stable'
# This action takes 1m30s to finish. Enable cache to make it shorter.
cache: true
Expand All @@ -36,7 +39,7 @@ jobs:
- run: flutter build ipa --no-codesign

test-android:
runs-on: macos-13
runs-on: macos-14
defaults:
run:
working-directory: "./example"
Expand All @@ -45,14 +48,14 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version-file: "./.tool-versions"
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#java
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#java
- name: Set java version
run: |
echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
echo "JAVA_HOME=$JAVA_HOME_21_arm64" >> $GITHUB_ENV
- uses: subosito/flutter-action@v2
with:
# This has to be kept in sync with .tool-versions
flutter-version: '3.24.2'
flutter-version: '3.27.1'
channel: 'stable'
# This action takes 1m30s to finish. Enable cache to make it shorter.
cache: true
Expand All @@ -71,7 +74,7 @@ jobs:
- uses: subosito/flutter-action@v2
with:
# This has to be kept in sync with .tool-versions
flutter-version: '3.24.2'
flutter-version: '3.27.1'
channel: 'stable'
# This action takes 1m30s to finish. Enable cache to make it shorter.
cache: true
Expand All @@ -93,9 +96,10 @@ jobs:
publish_dir: ./doc/api

deploy-ios:
runs-on: macos-13
runs-on: macos-14
needs: ["test-ios"]
if: ${{ github.ref == 'refs/heads/main' }}
# We cannot build in PRs because secrets are not available in PRs.
if: ${{ github.repository == 'authgear/authgear-sdk-flutter' && github.ref == 'refs/heads/main' }}
defaults:
run:
working-directory: "./example"
Expand All @@ -104,12 +108,15 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version-file: "./.tool-versions"
- run: sudo xcode-select -s /Applications/Xcode_15.2.app/Contents/Developer
# Xcode_16.2.app is available, but it does not have any simulator pre-installed.
# So it is not really usable.
# Let's use Xcode_16.1.app instead.
- run: sudo xcode-select -s /Applications/Xcode_16.1.app/Contents/Developer
- run: npm install -g appcenter-cli
- uses: subosito/flutter-action@v2
with:
# This has to be kept in sync with .tool-versions
flutter-version: '3.24.2'
flutter-version: '3.27.1'
channel: 'stable'
# This action takes 1m30s to finish. Enable cache to make it shorter.
cache: true
Expand All @@ -119,23 +126,31 @@ jobs:
- run: dart format --set-exit-if-changed lib
- name: Prepare certificate and provisioning profile
env:
IOS_CERTIFICATE_PASSWORD: ${{ secrets.IOS_CERTIFICATE_PASSWORD }}
IOS_CERTIFICATE_BASE64: ${{ secrets.IOS_CERTIFICATE_BASE64 }}
IOS_PROVISIONING_PROFILE_BASE64: ${{ secrets.IOS_PROVISIONING_PROFILE_BASE64 }}
IOS_KEYCHAIN_PASSWORD: ${{ secrets.IOS_KEYCHAIN_PASSWORD }}
run: |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db

# import certificate and provisioning profile from secrets
echo -n "$IOS_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH

echo -n "$IOS_PROVISIONING_PROFILE_BASE64" | base64 --decode -o $PP_PATH

security create-keychain -p "" $KEYCHAIN_PATH
security set-keychain-settings $KEYCHAIN_PATH
security unlock-keychain -p "" $KEYCHAIN_PATH
# create temporary keychain
security create-keychain -p "$IOS_KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$IOS_KEYCHAIN_PASSWORD" $KEYCHAIN_PATH

security import $CERTIFICATE_PATH -P "" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$IOS_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -k "$IOS_KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH

# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Build .ipa
Expand All @@ -148,9 +163,10 @@ jobs:
run: appcenter distribute release --debug --silent --file "./build/ios/ipa/Authgear Flutter.ipa" --store "App Store Connect Users" --app "Oursky/Authgear-Demo-Flutter-iOS" --release-notes "no release notes"

deploy-android:
runs-on: macos-13
runs-on: macos-14
needs: ["test-android"]
if: ${{ github.ref == 'refs/heads/main' }}
# We cannot build in PRs because secrets are not available in PRs.
if: ${{ github.repository == 'authgear/authgear-sdk-flutter' && github.ref == 'refs/heads/main' }}
defaults:
run:
working-directory: "./example"
Expand All @@ -159,15 +175,15 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version-file: "./.tool-versions"
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#java
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#java
- name: Set java version
run: |
echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
echo "JAVA_HOME=$JAVA_HOME_21_arm64" >> $GITHUB_ENV
- run: npm install -g appcenter-cli
- uses: subosito/flutter-action@v2
with:
# This has to be kept in sync with .tool-versions
flutter-version: '3.24.2'
flutter-version: '3.27.1'
channel: 'stable'
# This action takes 1m30s to finish. Enable cache to make it shorter.
cache: true
Expand Down
6 changes: 3 additions & 3 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
flutter 3.24.2-stable
nodejs 20.17.0
ruby 3.3.3
flutter 3.27.1-stable
nodejs 20.18.1
ruby 3.3.6
53 changes: 17 additions & 36 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,55 +1,36 @@
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
plugins {
id "com.android.application"
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion
namespace = "com.authgear.exampleapp.flutter"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = JavaVersion.VERSION_1_8
}

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.authgear.exampleapp.flutter"
applicationId = "com.authgear.exampleapp.flutter"
// minSdkVersion flutter.minSdkVersion
// 21 is required to use androidx.security
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
minSdk = 21
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}

signingConfigs {
Expand All @@ -64,6 +45,7 @@ android {
buildTypes {
release {
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
}
Expand All @@ -73,6 +55,5 @@ flutter {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "com.tencent.mm.opensdk:wechat-sdk-android:6.8.0"
}
8 changes: 8 additions & 0 deletions example/android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# When I run `flutter build apk ...`, it refuses to build and ask me to add these rules.
# So I did.
-dontwarn com.google.errorprone.annotations.CanIgnoreReturnValue
-dontwarn com.google.errorprone.annotations.CheckReturnValue
-dontwarn com.google.errorprone.annotations.Immutable
-dontwarn com.google.errorprone.annotations.RestrictedApi
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.concurrent.GuardedBy
3 changes: 1 addition & 2 deletions example/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.authgear.exampleapp.flutter">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application android:usesCleartextTraffic="true" />
</manifest>
3 changes: 1 addition & 2 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.authgear.exampleapp.flutter">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<!-- NOTE(backup): Please search NOTE(backup) before you modify allowBackup, fullBackupContent, or dataExtractionRules -->
<application
Expand Down
3 changes: 1 addition & 2 deletions example/android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.authgear.exampleapp.flutter">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
16 changes: 0 additions & 16 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
buildscript {
// Flutter 3.24.2 requires kotlin to be 1.7.x
// As of 2024-09-06, the latest kotlin 1.7.x is 1.7.21
// See https://kotlinlang.org/docs/releases.html#release-details
ext.kotlin_version = '1.7.21'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
Expand Down
2 changes: 1 addition & 1 deletion example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
3 changes: 1 addition & 2 deletions example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
30 changes: 22 additions & 8 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.1.0" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
}

include ":app"
Loading