diff --git a/OAT.xml b/OAT.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7bc10b374421b7396033f54333b5b6bf6e19703c
--- /dev/null
+++ b/OAT.xml
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/.gitignore b/packages/sign_in_with_apple/sign_in_with_apple/.gitignore
deleted file mode 100644
index e9dc58d3d6e29e2b992b3ccde0dbe0f64cbd1934..0000000000000000000000000000000000000000
--- a/packages/sign_in_with_apple/sign_in_with_apple/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.DS_Store
-.dart_tool/
-
-.packages
-.pub/
-
-build/
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/.metadata b/packages/sign_in_with_apple/sign_in_with_apple/.metadata
deleted file mode 100644
index fefd4b55abd82d7148948188c009ccf633a77aeb..0000000000000000000000000000000000000000
--- a/packages/sign_in_with_apple/sign_in_with_apple/.metadata
+++ /dev/null
@@ -1,10 +0,0 @@
-# This file tracks properties of this Flutter project.
-# Used by Flutter tool to assess capabilities and perform upgrades etc.
-#
-# This file should be version controlled and should not be manually edited.
-
-version:
- revision: 0b8abb4724aa590dd0f429683339b1e045a1594d
- channel: unknown
-
-project_type: plugin
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/CHANGELOG.md b/packages/sign_in_with_apple/sign_in_with_apple/CHANGELOG.md
index 822627871a27a3b3cbeda8d5635081391141b3d9..53693b9589a12273a863c02355c8a4bf2cc92b25 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple/CHANGELOG.md
+++ b/packages/sign_in_with_apple/sign_in_with_apple/CHANGELOG.md
@@ -1,24 +1,3 @@
-## 6.1.2
-
-- Switch to modern Gradle setup (https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply) for the example app
-
-## 6.1.1
-
-- Removes references to Flutter v1 Android embedding classes.
-
-## 6.1.0
-
-- Set min Flutter SDK to 3.19.0
-- Upgrade `sign_in_with_apple_platform_interface` to `1.1.0`
-- Upgrade `sign_in_with_apple_web` to `2.1.0`
-- Android: Bump Kotlin version to 1.7.10 (Flutter 3.19.1 default)
-- Android: Bump `compileSdkVersion` to 34 (Flutter 3.19.1 default)
-
-## 6.0.0
-
-- Migrate to package:web
-- Bump minimum Flutter version to 3.19.1
-
## 5.0.0
- Support Gradle 8 ([@davidmartos96](https://github.com/davidmartos96) in [#375](https://github.com/aboutyou/dart_packages/pull/375))
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/README.md b/packages/sign_in_with_apple/sign_in_with_apple/README.md
index 1edf00ca320dbc75d9a4cff8ae4646dcc12bb6b5..5affb15c2add333a06a8221ffa92a2976ba4a585 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple/README.md
+++ b/packages/sign_in_with_apple/sign_in_with_apple/README.md
@@ -51,11 +51,6 @@ Your server should then daily verify the session with Apple (via a refresh token
Before you can start integrating (or even testing) Sign in with Apple you need a [paid membership to the Apple Developer Program](https://developer.apple.com/programs/). Sign in with Apple is one of the restricted services which is not available for free with just an Apple ID ([source](https://developer.apple.com/programs/whats-included/)).
-#### Apple Mail Relay
-
-Since the users can use the private email relay, it is necessary to add an SPF record to the domains used to send emails, please read more here: https://developer.apple.com/help/account/configure-app-capabilities/configure-private-email-relay-service/
-Without it, your service will not be able to send emails to users who choose to use Apple's private relay, and the emails will not be delivered.
-
### Setup
#### Register an App ID
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/android/.gitignore b/packages/sign_in_with_apple/sign_in_with_apple/android/.gitignore
deleted file mode 100644
index c6cbe562a42726ab875d51cb513723b234787300..0000000000000000000000000000000000000000
--- a/packages/sign_in_with_apple/sign_in_with_apple/android/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-*.iml
-.gradle
-/local.properties
-/.idea/workspace.xml
-/.idea/libraries
-.DS_Store
-/build
-/captures
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/android/build.gradle b/packages/sign_in_with_apple/sign_in_with_apple/android/build.gradle
index be973c33437cd87a415e1bcd4a6fadc60014f19e..5873721aca0370e5c8155c1f2432d4afdc4adce4 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple/android/build.gradle
+++ b/packages/sign_in_with_apple/sign_in_with_apple/android/build.gradle
@@ -2,7 +2,7 @@ group 'com.aboutyou.dart_packages.sign_in_with_apple'
version '1.0-SNAPSHOT'
buildscript {
- ext.kotlin_version = '1.7.10'
+ ext.kotlin_version = '1.6.0'
repositories {
google()
mavenCentral()
@@ -25,7 +25,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
- compileSdkVersion 34
+ compileSdkVersion 28
// Conditional for compatibility with AGP <4.2.
if (project.android.hasProperty("namespace")) {
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/android/src/main/kotlin/com/aboutyou/dart_packages/sign_in_with_apple/SignInWithApplePlugin.kt b/packages/sign_in_with_apple/sign_in_with_apple/android/src/main/kotlin/com/aboutyou/dart_packages/sign_in_with_apple/SignInWithApplePlugin.kt
index ce83cdd9202b7b01e1f38106a2e218c6a622e2ef..2698f121bca93a4e706e3a1fc37b2206408d149f 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple/android/src/main/kotlin/com/aboutyou/dart_packages/sign_in_with_apple/SignInWithApplePlugin.kt
+++ b/packages/sign_in_with_apple/sign_in_with_apple/android/src/main/kotlin/com/aboutyou/dart_packages/sign_in_with_apple/SignInWithApplePlugin.kt
@@ -14,6 +14,7 @@ import io.flutter.plugin.common.MethodChannel
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
import io.flutter.plugin.common.MethodChannel.Result
import io.flutter.plugin.common.PluginRegistry.ActivityResultListener
+import io.flutter.plugin.common.PluginRegistry.Registrar
import io.flutter.Log
val TAG = "SignInWithApple"
@@ -36,9 +37,24 @@ public class SignInWithApplePlugin: FlutterPlugin, MethodCallHandler, ActivityAw
channel = null
}
+ // This static function is optional and equivalent to onAttachedToEngine. It supports the old
+ // pre-Flutter-1.12 Android projects. You are encouraged to continue supporting
+ // plugin registration via this function while apps migrate to use the new Android APIs
+ // post-flutter-1.12 via https://flutter.dev/go/android-project-migration.
+ //
+ // It is encouraged to share logic between onAttachedToEngine and registerWith to keep
+ // them functionally equivalent. Only one of onAttachedToEngine or registerWith will be called
+ // depending on the user's project. onAttachedToEngine or registerWith must both be defined
+ // in the same class.
companion object {
var lastAuthorizationRequestResult: Result? = null
var triggerMainActivityToHideChromeCustomTab : (() -> Unit)? = null
+
+ @JvmStatic
+ fun registerWith(registrar: Registrar) {
+ val channel = MethodChannel(registrar.messenger(), "com.aboutyou.dart_packages.sign_in_with_apple")
+ channel.setMethodCallHandler(SignInWithApplePlugin())
+ }
}
override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/.gitignore b/packages/sign_in_with_apple/sign_in_with_apple/example/.gitignore
deleted file mode 100644
index ae1f1838ee7e87b1fa976268adc723e1020af38e..0000000000000000000000000000000000000000
--- a/packages/sign_in_with_apple/sign_in_with_apple/example/.gitignore
+++ /dev/null
@@ -1,37 +0,0 @@
-# Miscellaneous
-*.class
-*.log
-*.pyc
-*.swp
-.DS_Store
-.atom/
-.buildlog/
-.history
-.svn/
-
-# IntelliJ related
-*.iml
-*.ipr
-*.iws
-.idea/
-
-# The .vscode folder contains launch configuration and tasks you configure in
-# VS Code which you may wish to be included in version control, so this line
-# is commented out by default.
-#.vscode/
-
-# Flutter/Dart/Pub related
-**/doc/api/
-.dart_tool/
-.flutter-plugins
-.flutter-plugins-dependencies
-.packages
-.pub-cache/
-.pub/
-/build/
-
-# Web related
-lib/generated_plugin_registrant.dart
-
-# Exceptions to above rules.
-!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/.metadata b/packages/sign_in_with_apple/sign_in_with_apple/example/.metadata
deleted file mode 100644
index b6f8d30f06d522eea355ae62dc9efece9b1a03fb..0000000000000000000000000000000000000000
--- a/packages/sign_in_with_apple/sign_in_with_apple/example/.metadata
+++ /dev/null
@@ -1,10 +0,0 @@
-# This file tracks properties of this Flutter project.
-# Used by Flutter tool to assess capabilities and perform upgrades etc.
-#
-# This file should be version controlled and should not be manually edited.
-
-version:
- revision: 0b8abb4724aa590dd0f429683339b1e045a1594d
- channel: unknown
-
-project_type: app
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/android/.gitignore b/packages/sign_in_with_apple/sign_in_with_apple/example/android/.gitignore
deleted file mode 100644
index 6f568019d3c69d4966bb5a0f759980a1472afc1e..0000000000000000000000000000000000000000
--- a/packages/sign_in_with_apple/sign_in_with_apple/example/android/.gitignore
+++ /dev/null
@@ -1,13 +0,0 @@
-gradle-wrapper.jar
-/.gradle
-/captures/
-/gradlew
-/gradlew.bat
-/local.properties
-GeneratedPluginRegistrant.java
-
-# Remember to never publicly share your keystore.
-# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
-key.properties
-**/*.keystore
-**/*.jks
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/android/app/build.gradle b/packages/sign_in_with_apple/sign_in_with_apple/example/android/app/build.gradle
index 84cda3d19059d47705eae3530092c72cdcf684a3..d472ef836e6d9fdb820849cec3195987f3d1c4e1 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple/example/android/app/build.gradle
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/android/app/build.gradle
@@ -1,9 +1,3 @@
-plugins {
- id "com.android.application"
- id "kotlin-android"
- id "dev.flutter.flutter-gradle-plugin"
-}
-
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
@@ -12,6 +6,11 @@ if (localPropertiesFile.exists()) {
}
}
+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'
@@ -22,6 +21,10 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
+
android {
compileSdkVersion flutter.compileSdkVersion
@@ -59,3 +62,7 @@ android {
flutter {
source '../..'
}
+
+dependencies {
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/android/build.gradle b/packages/sign_in_with_apple/sign_in_with_apple/example/android/build.gradle
index bc157bd1a12b9084c8bb65ade59863a6b71818c8..020668af1ccfc6a61b3e78987667005ab0150e8d 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple/example/android/build.gradle
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/android/build.gradle
@@ -1,3 +1,16 @@
+buildscript {
+ ext.kotlin_version = '1.6.0'
+ repositories {
+ google()
+ mavenCentral()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:7.2.2'
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+ }
+}
+
allprojects {
repositories {
google()
@@ -13,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}
-tasks.register("clean", Delete) {
+task clean(type: Delete) {
delete rootProject.buildDir
}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/android/settings.gradle b/packages/sign_in_with_apple/sign_in_with_apple/example/android/settings.gradle
index 599ca9d6d0f0c97d19f2d26368c307b35273f054..44e62bcf06ae649ea809590f8a861059886502e8 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple/example/android/settings.gradle
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/android/settings.gradle
@@ -1,25 +1,11 @@
-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
- }()
+include ':app'
- includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
+def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
+def properties = new Properties()
- repositories {
- google()
- mavenCentral()
- gradlePluginPortal()
- }
-}
+assert localPropertiesFile.exists()
+localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
-plugins {
- id "dev.flutter.flutter-plugin-loader" version "1.0.0"
- id "com.android.application" version "7.4.2" apply false
- id "org.jetbrains.kotlin.android" version "1.7.10" apply false
-}
-
-include ":app"
\ No newline at end of file
+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"
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ios/.gitignore b/packages/sign_in_with_apple/sign_in_with_apple/example/ios/.gitignore
deleted file mode 100644
index 7a7f9873ad7dceb4dc17087fb06c800fa0191376..0000000000000000000000000000000000000000
--- a/packages/sign_in_with_apple/sign_in_with_apple/example/ios/.gitignore
+++ /dev/null
@@ -1,34 +0,0 @@
-**/dgph
-*.mode1v3
-*.mode2v3
-*.moved-aside
-*.pbxuser
-*.perspectivev3
-**/*sync/
-.sconsign.dblite
-.tags*
-**/.vagrant/
-**/DerivedData/
-Icon?
-**/Pods/
-**/.symlinks/
-profile
-xcuserdata
-**/.generated/
-Flutter/App.framework
-Flutter/Flutter.framework
-Flutter/Flutter.podspec
-Flutter/Generated.xcconfig
-Flutter/ephemeral/
-Flutter/app.flx
-Flutter/app.zip
-Flutter/flutter_assets/
-Flutter/flutter_export_environment.sh
-ServiceDefinitions.json
-Runner/GeneratedPluginRegistrant.*
-
-# Exceptions to above rules.
-!default.mode1v3
-!default.mode2v3
-!default.pbxuser
-!default.perspectivev3
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/lib/main.dart b/packages/sign_in_with_apple/sign_in_with_apple/example/lib/main.dart
index a09dbe5bb647a705e71350f3daffefcc6c65861e..0438bffb3a3594fdd8c639a47c557d59d27724de 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple/example/lib/main.dart
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/lib/main.dart
@@ -1,24 +1,24 @@
import 'dart:io';
+// Needed because we can't import `dart:html` into a mobile app,
+// while on the flip-side access to `dart:io` throws at runtime (hence the `kIsWeb` check below)
+import 'html_shim.dart' if (dart.library.html) 'dart:html' show window;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
-import 'package:sign_in_with_apple/sign_in_with_apple.dart';
-// Needed because we can't import `web` into a mobile app,
-// while on the flip-side access to `dart:io` throws at runtime (hence the `kIsWeb` check below)
-import 'html_shim.dart' if (dart.library.js_interop) 'package:web/web.dart'
- show window;
+import 'package:sign_in_with_apple/sign_in_with_apple.dart';
void main() {
+ print('onGenerateRoute start!');
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
- const MyApp({super.key});
+ const MyApp({Key? key}) : super(key: key);
@override
- State createState() => _MyAppState();
+ _MyAppState createState() => _MyAppState();
}
class _MyAppState extends State {
@@ -28,7 +28,6 @@ class _MyAppState extends State {
onGenerateRoute: ((settings) {
// This is also invoked for incoming deep links
- // ignore: avoid_print
print('onGenerateRoute: $settings');
return null;
@@ -51,11 +50,10 @@ class _MyAppState extends State {
// TODO: Set the `clientId` and `redirectUri` arguments to the values you entered in the Apple Developer portal during the setup
clientId:
'de.lunaone.flutter.signinwithappleexample.service',
+
redirectUri:
// For web your redirect URI needs to be the host of the "current page",
// while for Android you will be using the API server that redirects back into your app via a deep link
- // NOTE(tp): For package local development use (as described in `Development.md`)
- // Uri.parse('https://siwa-flutter-plugin.dev/')
kIsWeb
? Uri.parse('https://${window.location.host}/')
: Uri.parse(
@@ -67,8 +65,7 @@ class _MyAppState extends State {
state: 'example-state',
);
- // ignore: avoid_print
- print(credential);
+ print('onGenerateRoute: $credential');
// This is the endpoint that will convert an authorization code obtained
// via Sign in with Apple into a session in your system
@@ -96,8 +93,7 @@ class _MyAppState extends State {
// If we got this far, a session based on the Apple ID credential has been created in your system,
// and you can now set this as the app's session
- // ignore: avoid_print
- print(session);
+ print('onGenerateRoute: $session');
},
),
),
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/macos/.gitignore b/packages/sign_in_with_apple/sign_in_with_apple/example/macos/.gitignore
deleted file mode 100644
index 746adbb6b9e14b7e685c91e280a4d37a672afbd8..0000000000000000000000000000000000000000
--- a/packages/sign_in_with_apple/sign_in_with_apple/example/macos/.gitignore
+++ /dev/null
@@ -1,7 +0,0 @@
-# Flutter-related
-**/Flutter/ephemeral/
-**/Pods/
-
-# Xcode-related
-**/dgph
-**/xcuserdata/
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/.gitignore b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..6ca13b3170eec5dd5ac5ad7f1c4dd0118845f473
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/.gitignore
@@ -0,0 +1,19 @@
+/node_modules
+/oh_modules
+/local.properties
+/.idea
+**/build
+/.hvigor
+.cxx
+/.clangd
+/.clang-format
+/.clang-tidy
+**/.test
+*.har
+**/BuildProfile.ets
+**/oh-package-lock.json5
+
+**/src/main/resources/rawfile/flutter_assets/
+**/libs/arm64-v8a/libapp.so
+**/libs/arm64-v8a/libflutter.so
+**/libs/arm64-v8a/libvmservice_snapshot.so
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/AppScope/app.json5 b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..197d17a2f485d3c663d8e3cf6f51a7bdbb0db784
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/AppScope/app.json5
@@ -0,0 +1,10 @@
+{
+ "app": {
+ "bundleName": "com.example.sign_in_with_apple",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/AppScope/resources/base/element/string.json b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..7751d60ac809eca9b048be633ea0da0ff83c045d
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "sign_in_with_apple"
+ }
+ ]
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/AppScope/resources/base/media/app_icon.png b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/AppScope/resources/base/media/app_icon.png differ
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/build-profile.json5 b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..1d12140d202702d7c73d64f1b291fe5c45a660ce
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/build-profile.json5
@@ -0,0 +1,27 @@
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.0(12)",
+ "runtimeOS": "HarmonyOS"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/.gitignore b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..2795a1c5b1fe53659dd1b71d90ba0592eaf7e043
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/.gitignore
@@ -0,0 +1,7 @@
+
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/build-profile.json5 b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..633d360fbc91a3186a23b66ab71b27e5618944cb
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/build-profile.json5
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+{
+ "apiType": 'stageMode',
+ "buildOption": {
+ },
+ "targets": [
+ {
+ "name": "default",
+ "runtimeOS": "HarmonyOS"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/hvigorfile.ts b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..5bda56eeac3f79703639db986e2faaa433b0e48c
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/hvigorfile.ts
@@ -0,0 +1,17 @@
+/*
+* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
+export { hapTasks } from '@ohos/hvigor-ohos-plugin';
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/oh-package.json5 b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c86f63b1bef60773dbe5b730f92671909506fe43
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/oh-package.json5
@@ -0,0 +1,11 @@
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {
+ "sign_in_with_apple": "file:D:\\code\\Flutter\\result\\sign_in_with_apple\\sign_in_with_apple\\example\\ohos\\har/sign_in_with_apple.har"
+ }
+}
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b5888ed9002dd328f9abd3141ee3e63e88b40d0f
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import { FlutterAbility, FlutterEngine } from '@ohos/flutter_ohos';
+import { GeneratedPluginRegistrant } from '../plugins/GeneratedPluginRegistrant';
+
+export default class EntryAbility extends FlutterAbility {
+ configureFlutterEngine(flutterEngine: FlutterEngine) {
+ super.configureFlutterEngine(flutterEngine)
+ GeneratedPluginRegistrant.registerWith(flutterEngine)
+ }
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/ets/pages/Index.ets b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..5d9647743f4651f3dab7aa3076ed0707b207b436
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import common from '@ohos.app.ability.common';
+import { FlutterPage } from '@ohos/flutter_ohos'
+
+let storage = LocalStorage.getShared()
+const EVENT_BACK_PRESS = 'EVENT_BACK_PRESS'
+
+@Entry(storage)
+@Component
+struct Index {
+ private context = getContext(this) as common.UIAbilityContext
+ @LocalStorageLink('viewId') viewId: string = "";
+
+ build() {
+ Column() {
+ FlutterPage({ viewId: this.viewId })
+ }
+ }
+
+ onBackPress(): boolean {
+ this.context.eventHub.emit(EVENT_BACK_PRESS)
+ return true
+ }
+}
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/ets/pages/SignInWithApplePage.ets b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/ets/pages/SignInWithApplePage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..d2d1f8b619f328052d5a1cb03219480d34592cfe
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/ets/pages/SignInWithApplePage.ets
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import { CustomSignPage } from 'sign_in_with_apple'
+import web_webview from '@ohos.web.webview';
+import { router, window } from '@kit.ArkUI';
+import { common } from '@kit.AbilityKit';
+
+class Params {
+ url: string = ''
+}
+
+@Entry
+@Component
+struct SignInWithApplePlugin {
+ @State url: string = '';
+ @State controller: web_webview.WebviewController = new web_webview.WebviewController();
+ isBack: boolean = false;
+ private context = getContext(this) as common.UIAbilityContext
+
+ aboutToAppear() {
+ let params = router.getParams() as Params
+ this.url = params.url
+ this.setWindowLayoutFullScreen()
+ }
+
+ setWindowLayoutFullScreen() {
+ try {
+ let SystemBarProperties: window.SystemBarProperties = {
+ statusBarContentColor: '#000000',
+ navigationBarContentColor: '#000000'
+ };
+ window.getLastWindow(this.context).then((windowClass) => {
+ windowClass.setWindowLayoutFullScreen(true)
+ windowClass.setWindowSystemBarEnable(["status"]).then(() => {
+ })
+ windowClass.setWindowSystemBarProperties(SystemBarProperties)
+ })
+ } catch (e) {
+ console.log('SignInWithApplePlugin:'+JSON.stringify(e));
+ }
+ }
+
+ build() {
+ RelativeContainer() {
+ CustomSignPage({ url: this.url, controller: this.controller})
+ }
+ .margin({top: 40})
+ .width('100%')
+ }
+
+ onBackPress(): boolean {
+ if(this.controller.accessBackward()) {
+ this.controller.backward()
+ return true
+ } else {
+ router.back()
+ }
+ return true
+ }
+}
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f4d0c8ed6434f58fe1b412c3423ccefbdd0a0e2e
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/ets/plugins/GeneratedPluginRegistrant.ets
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import { FlutterEngine, Log } from '@ohos/flutter_ohos';
+import SignInWithApplePlugin from 'sign_in_with_apple';
+
+/**
+ * Generated file. Do not edit.
+ * This file is generated by the Flutter tool based on the
+ * plugins that support the Ohos platform.
+ */
+
+const TAG = "GeneratedPluginRegistrant";
+
+export class GeneratedPluginRegistrant {
+
+ static registerWith(flutterEngine: FlutterEngine) {
+ try {
+ flutterEngine.getPlugins()?.add(new SignInWithApplePlugin());
+ } catch (e) {
+ Log.e(
+ TAG,
+ "Tried to register plugins with FlutterEngine ("
+ + flutterEngine
+ + ") failed.");
+ Log.e(TAG, "Received exception while registering", e);
+ }
+ }
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/module.json5 b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..7bbf78b18f39991b1404061c7437538c7d532bb7
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/module.json5
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "phone"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:icon",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:icon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "requestPermissions": [
+ {"name" : "ohos.permission.INTERNET"},
+ ]
+ }
+}
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/base/element/color.json b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/base/element/string.json b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..e6d6437398940d006d1f384d50464e64bc83838d
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "sign_in_with_apple"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/base/media/icon.png b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/base/media/icon.png differ
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/base/profile/main_pages.json b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..a890a993087352365127a4db148577a6ec54d4d2
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,6 @@
+{
+ "src": [
+ "pages/Index",
+ "pages/SignInWithApplePage"
+ ]
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/en_US/element/string.json b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..e6d6437398940d006d1f384d50464e64bc83838d
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/en_US/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "sign_in_with_apple"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/zh_CN/element/string.json b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..52d1cbbe03301d89b7fde064db94ab9d2b618fd5
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/entry/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "模块描述"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "sign_in_with_apple"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/hvigor/hvigor-config.json5 b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..541ba35711b75986f9295410ee38fdb8f2572878
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/hvigor/hvigor-config.json5
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+{
+ "modelVersion": "5.0.0",
+ "dependencies": {
+ }
+}
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/hvigorfile.ts b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..38626e385a5b47dd3cba0e1e83c614f091b7cc9e
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/oh-package.json5 b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..ae553157f42dff580be3cd4a05325254158441bb
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/ohos/oh-package.json5
@@ -0,0 +1,20 @@
+{
+ "modelVersion": "5.0.0",
+ "name": "sign_in_with_apple",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {
+ "@ohos/flutter_ohos": "file:./har/flutter.har"
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.6"
+ },
+ "overrides": {
+ "@ohos/flutter_ohos": "file:./har/flutter.har",
+ "sign_in_with_apple": "file:D:\\code\\Flutter\\result\\sign_in_with_apple\\sign_in_with_apple\\example\\ohos\\har/sign_in_with_apple.har",
+ "@ohos/flutter_module": "file:./entry"
+ }
+}
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/pubspec.lock b/packages/sign_in_with_apple/sign_in_with_apple/example/pubspec.lock
deleted file mode 100644
index 5ca25a1a9518a1d14c8c69eb07e6c446e7fc4c26..0000000000000000000000000000000000000000
--- a/packages/sign_in_with_apple/sign_in_with_apple/example/pubspec.lock
+++ /dev/null
@@ -1,271 +0,0 @@
-# Generated by pub
-# See https://dart.dev/tools/pub/glossary#lockfile
-packages:
- async:
- dependency: transitive
- description:
- name: async
- sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
- url: "https://pub.dev"
- source: hosted
- version: "2.11.0"
- boolean_selector:
- dependency: transitive
- description:
- name: boolean_selector
- sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
- url: "https://pub.dev"
- source: hosted
- version: "2.1.1"
- characters:
- dependency: transitive
- description:
- name: characters
- sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
- url: "https://pub.dev"
- source: hosted
- version: "1.3.0"
- clock:
- dependency: transitive
- description:
- name: clock
- sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
- url: "https://pub.dev"
- source: hosted
- version: "1.1.1"
- collection:
- dependency: transitive
- description:
- name: collection
- sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
- url: "https://pub.dev"
- source: hosted
- version: "1.18.0"
- fake_async:
- dependency: transitive
- description:
- name: fake_async
- sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
- url: "https://pub.dev"
- source: hosted
- version: "1.3.1"
- flutter:
- dependency: "direct main"
- description: flutter
- source: sdk
- version: "0.0.0"
- flutter_lints:
- dependency: "direct dev"
- description:
- name: flutter_lints
- sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7
- url: "https://pub.dev"
- source: hosted
- version: "3.0.1"
- flutter_test:
- dependency: "direct dev"
- description: flutter
- source: sdk
- version: "0.0.0"
- flutter_web_plugins:
- dependency: transitive
- description: flutter
- source: sdk
- version: "0.0.0"
- http:
- dependency: "direct main"
- description:
- name: http
- sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
- url: "https://pub.dev"
- source: hosted
- version: "1.2.1"
- http_parser:
- dependency: transitive
- description:
- name: http_parser
- sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
- url: "https://pub.dev"
- source: hosted
- version: "4.0.2"
- leak_tracker:
- dependency: transitive
- description:
- name: leak_tracker
- sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
- url: "https://pub.dev"
- source: hosted
- version: "10.0.0"
- leak_tracker_flutter_testing:
- dependency: transitive
- description:
- name: leak_tracker_flutter_testing
- sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
- url: "https://pub.dev"
- source: hosted
- version: "2.0.1"
- leak_tracker_testing:
- dependency: transitive
- description:
- name: leak_tracker_testing
- sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
- url: "https://pub.dev"
- source: hosted
- version: "2.0.1"
- lints:
- dependency: transitive
- description:
- name: lints
- sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
- url: "https://pub.dev"
- source: hosted
- version: "3.0.0"
- matcher:
- dependency: transitive
- description:
- name: matcher
- sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
- url: "https://pub.dev"
- source: hosted
- version: "0.12.16+1"
- material_color_utilities:
- dependency: transitive
- description:
- name: material_color_utilities
- sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
- url: "https://pub.dev"
- source: hosted
- version: "0.8.0"
- meta:
- dependency: transitive
- description:
- name: meta
- sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
- url: "https://pub.dev"
- source: hosted
- version: "1.11.0"
- path:
- dependency: transitive
- description:
- name: path
- sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
- url: "https://pub.dev"
- source: hosted
- version: "1.9.0"
- plugin_platform_interface:
- dependency: transitive
- description:
- name: plugin_platform_interface
- sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
- url: "https://pub.dev"
- source: hosted
- version: "2.1.8"
- sign_in_with_apple:
- dependency: "direct main"
- description:
- path: ".."
- relative: true
- source: path
- version: "6.1.0"
- sign_in_with_apple_platform_interface:
- dependency: "direct overridden"
- description:
- path: "../../sign_in_with_apple_platform_interface"
- relative: true
- source: path
- version: "1.0.0"
- sign_in_with_apple_web:
- dependency: "direct overridden"
- description:
- path: "../../sign_in_with_apple_web"
- relative: true
- source: path
- version: "2.0.0"
- sky_engine:
- dependency: transitive
- description: flutter
- source: sdk
- version: "0.0.99"
- source_span:
- dependency: transitive
- description:
- name: source_span
- sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
- url: "https://pub.dev"
- source: hosted
- version: "1.10.0"
- stack_trace:
- dependency: transitive
- description:
- name: stack_trace
- sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
- url: "https://pub.dev"
- source: hosted
- version: "1.11.1"
- stream_channel:
- dependency: transitive
- description:
- name: stream_channel
- sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
- url: "https://pub.dev"
- source: hosted
- version: "2.1.2"
- string_scanner:
- dependency: transitive
- description:
- name: string_scanner
- sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
- url: "https://pub.dev"
- source: hosted
- version: "1.2.0"
- term_glyph:
- dependency: transitive
- description:
- name: term_glyph
- sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
- url: "https://pub.dev"
- source: hosted
- version: "1.2.1"
- test_api:
- dependency: transitive
- description:
- name: test_api
- sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
- url: "https://pub.dev"
- source: hosted
- version: "0.6.1"
- typed_data:
- dependency: transitive
- description:
- name: typed_data
- sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
- url: "https://pub.dev"
- source: hosted
- version: "1.3.2"
- vector_math:
- dependency: transitive
- description:
- name: vector_math
- sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
- url: "https://pub.dev"
- source: hosted
- version: "2.1.4"
- vm_service:
- dependency: transitive
- description:
- name: vm_service
- sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
- url: "https://pub.dev"
- source: hosted
- version: "13.0.0"
- web:
- dependency: transitive
- description:
- name: web
- sha256: "1d9158c616048c38f712a6646e317a3426da10e884447626167240d45209cbad"
- url: "https://pub.dev"
- source: hosted
- version: "0.5.0"
-sdks:
- dart: ">=3.3.0 <4.0.0"
- flutter: ">=3.19.1"
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/example/pubspec.yaml b/packages/sign_in_with_apple/sign_in_with_apple/example/pubspec.yaml
index 7b2b090d4759b383c56c6a91ad25cfcbe887d198..e6eeaee2b802611c04574a679f91be6902c76fd7 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple/example/pubspec.yaml
+++ b/packages/sign_in_with_apple/sign_in_with_apple/example/pubspec.yaml
@@ -4,30 +4,30 @@ publish_to: "none"
version: 1.0.0+1
environment:
- sdk: ^3.3.0
- flutter: ">=3.19.1 <4.0.0"
+ sdk: ">=2.18.5 <3.0.0"
+ flutter: ">=3.7.6 <4.0.0"
dependencies:
flutter:
sdk: flutter
- http: ^1.2.1
+ http: ^0.13.0
sign_in_with_apple:
path: ../
dev_dependencies:
- flutter_lints: ^3.0.1
+ flutter_lints: ^1.0.4
flutter_test:
sdk: flutter
-# Use the latest packages from the repo for the example
+## Use the latest packages from the repo for the example
dependency_overrides:
- sign_in_with_apple_platform_interface:
- path: ../../sign_in_with_apple_platform_interface
+ sign_in_with_apple_platform_interface:
+ path: ../../sign_in_with_apple_platform_interface
- sign_in_with_apple_web:
- path: ../../sign_in_with_apple_web
+ sign_in_with_apple_web:
+ path: ../../sign_in_with_apple_web
flutter:
uses-material-design: true
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ios/.gitignore b/packages/sign_in_with_apple/sign_in_with_apple/ios/.gitignore
deleted file mode 100644
index aa479fd3ce8a6914c7e3f0003901008259d50636..0000000000000000000000000000000000000000
--- a/packages/sign_in_with_apple/sign_in_with_apple/ios/.gitignore
+++ /dev/null
@@ -1,37 +0,0 @@
-.idea/
-.vagrant/
-.sconsign.dblite
-.svn/
-
-.DS_Store
-*.swp
-profile
-
-DerivedData/
-build/
-GeneratedPluginRegistrant.h
-GeneratedPluginRegistrant.m
-
-.generated/
-
-*.pbxuser
-*.mode1v3
-*.mode2v3
-*.perspectivev3
-
-!default.pbxuser
-!default.mode1v3
-!default.mode2v3
-!default.perspectivev3
-
-xcuserdata
-
-*.moved-aside
-
-*.pyc
-*sync/
-Icon?
-.tags*
-
-/Flutter/Generated.xcconfig
-/Flutter/flutter_export_environment.sh
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ios/Classes/SignInWithAppleAvailablePlugin.swift b/packages/sign_in_with_apple/sign_in_with_apple/ios/Classes/SignInWithAppleAvailablePlugin.swift
index 974cb7f74f9b8b5def73045733e4205df7523e37..f8a0a8f045a51dbb0546cc3b7368eb968b3294ef 120000
--- a/packages/sign_in_with_apple/sign_in_with_apple/ios/Classes/SignInWithAppleAvailablePlugin.swift
+++ b/packages/sign_in_with_apple/sign_in_with_apple/ios/Classes/SignInWithAppleAvailablePlugin.swift
@@ -1 +1,251 @@
-./../../darwin/Classes/SignInWithAppleAvailablePlugin.swift
\ No newline at end of file
+import AuthenticationServices
+
+#if os(OSX)
+import FlutterMacOS
+#elseif os(iOS)
+import Flutter
+#endif
+
+let methodChannelName = "com.aboutyou.dart_packages.sign_in_with_apple"
+
+@available(iOS 13.0, macOS 10.15, *)
+public class SignInWithAppleAvailablePlugin: NSObject, FlutterPlugin {
+ var _lastSignInWithAppleAuthorizationController: SignInWithAppleAuthorizationController?
+
+ // This plugin should not be registered with directly
+ //
+ // This is merely a cross-platform plugin to handle the case Sign in with Apple is available
+ // on the target platform
+ //
+ // Each target platform will still need a specific Plugin implementation
+ // which will need to decide whether or not Sign in with Apple is available
+ public static func register(with registrar: FlutterPluginRegistrar) {
+ print("SignInWithAppleAvailablePlugin tried to register which is not allowed")
+ }
+
+ public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
+ switch call.method {
+ case "isAvailable":
+ result(true)
+
+ case "performAuthorizationRequest":
+ // Makes sure arguments exists and is a List
+ guard let args = call.arguments as? [Any] else {
+ result(
+ SignInWithAppleGenericError.missingArguments(call).toFlutterError()
+ )
+ return
+ }
+
+ let signInController = SignInWithAppleAuthorizationController(result)
+
+ // store to keep alive
+ _lastSignInWithAppleAuthorizationController = signInController
+
+ signInController.performRequests(
+ requests: SignInWithAppleAuthorizationController.parseRequests(
+ rawRequests: args
+ )
+ )
+
+ case "getCredentialState":
+ // Makes sure arguments exists and is a Map
+ guard let args = call.arguments as? [String: Any] else {
+ result(
+ SignInWithAppleGenericError.missingArguments(call).toFlutterError()
+ )
+ return
+ }
+
+ guard let userIdentifier = args["userIdentifier"] as? String else {
+ result(
+ SignInWithAppleGenericError.missingArgument(
+ call,
+ "userIdentifier"
+ ).toFlutterError()
+ )
+ return
+ }
+
+ let appleIDProvider = ASAuthorizationAppleIDProvider()
+
+ appleIDProvider.getCredentialState(forUserID: userIdentifier) {
+ credentialState, error in
+ if let error = error {
+ result(
+ SignInWithAppleError
+ .credentialsError(error.localizedDescription)
+ .toFlutterError()
+ )
+ return
+ }
+
+ switch credentialState {
+ case .authorized:
+ result("authorized")
+ case .revoked:
+ result("revoked")
+ case .notFound:
+ result("notFound")
+
+ default:
+ result(
+ SignInWithAppleError
+ .unexpectedCredentialsState(credentialState)
+ .toFlutterError()
+ )
+ }
+ }
+
+ default:
+ result(FlutterMethodNotImplemented)
+ }
+ }
+}
+
+@available(iOS 13.0, macOS 10.15, *)
+class SignInWithAppleAuthorizationController: NSObject, ASAuthorizationControllerDelegate {
+ var callback: FlutterResult
+
+ init(_ callback: @escaping FlutterResult) {
+ self.callback = callback
+ }
+
+ // Parses a list of json requests into the proper [ASAuthorizationRequest] type.
+ //
+ // The parsing itself tries to be as lenient as possible to recover gracefully from parsing errors.
+ public static func parseRequests(rawRequests: [Any]) -> [ASAuthorizationRequest] {
+ var requests: [ASAuthorizationRequest] = []
+
+ for request in rawRequests {
+ guard let requestMap = request as? [String: Any] else {
+ print("[SignInWithApplePlugin]: Request is not an object");
+ continue
+ }
+
+ guard let type = requestMap["type"] as? String else {
+ print("[SignInWithApplePlugin]: Request type is not an string");
+ continue
+ }
+
+ switch (type) {
+ case "appleid":
+ let appleIDProvider = ASAuthorizationAppleIDProvider()
+ let appleIDRequest = appleIDProvider.createRequest()
+
+ if let nonce = requestMap["nonce"] as? String {
+ appleIDRequest.nonce = nonce;
+ }
+
+ if let state = requestMap["state"] as? String {
+ appleIDRequest.state = state;
+ }
+
+ if let scopes = requestMap["scopes"] as? [String] {
+ appleIDRequest.requestedScopes = []
+
+ for scope in scopes {
+ switch scope {
+ case "email":
+ appleIDRequest.requestedScopes?.append(.email)
+ case "fullName":
+ appleIDRequest.requestedScopes?.append(.fullName)
+ default:
+ print("[SignInWithApplePlugin]: Unknown scope for the Apple ID request: \(scope)");
+ continue;
+ }
+ }
+ }
+
+ requests.append(appleIDRequest)
+ case "password":
+ let passwordProvider = ASAuthorizationPasswordProvider()
+ let passwordRequest = passwordProvider.createRequest()
+
+ requests.append(passwordRequest)
+ default:
+ print("[SignInWithApplePlugin]: Unknown request type: \(type)");
+ continue;
+ }
+
+ }
+
+ return requests
+ }
+
+ public func performRequests(requests: [ASAuthorizationRequest]) {
+ let authorizationController = ASAuthorizationController(
+ authorizationRequests: requests
+ )
+
+ authorizationController.delegate = self
+ authorizationController.performRequests()
+ }
+
+ private func parseData(data: Data?) -> String? {
+ if let data = data {
+ return String(decoding: data, as: UTF8.self)
+ }
+
+ return nil
+ }
+
+ public func authorizationController(
+ controller _: ASAuthorizationController,
+ didCompleteWithAuthorization authorization: ASAuthorization
+ ) {
+ switch authorization.credential {
+ case let appleIDCredential as ASAuthorizationAppleIDCredential:
+ let result: [String: String?] = [
+ "type": "appleid",
+ "userIdentifier": appleIDCredential.user,
+ "givenName": appleIDCredential.fullName?.givenName,
+ "familyName": appleIDCredential.fullName?.familyName,
+ "email": appleIDCredential.email,
+ "identityToken": parseData(data: appleIDCredential.identityToken),
+ "authorizationCode": parseData(data: appleIDCredential.authorizationCode),
+ "state": appleIDCredential.state,
+ ]
+ callback(result)
+
+ case let passwordCredential as ASPasswordCredential:
+ let result: [String: String] = [
+ "type": "password",
+ "username": passwordCredential.user,
+ "password": passwordCredential.password,
+ ]
+ callback(result)
+
+ default:
+ // Not getting any credentials would result in an error (didCompleteWithError)
+ callback(
+ SignInWithAppleError.unknownCredentials(
+ authorization.credential
+ ).toFlutterError()
+ )
+ }
+ }
+
+ public func authorizationController(
+ controller _: ASAuthorizationController,
+ didCompleteWithError error: Error
+ ) {
+ if let error = error as? ASAuthorizationError {
+ callback(
+ SignInWithAppleError.authorizationError(
+ error.code,
+ error.localizedDescription
+ ).toFlutterError()
+ )
+ } else {
+ print("[SignInWithApplePlugin]: Unknown authorization error \(error)")
+
+ callback(
+ SignInWithAppleError.authorizationError(
+ ASAuthorizationError.Code.unknown,
+ error.localizedDescription
+ ).toFlutterError()
+ )
+ }
+ }
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ios/Classes/SignInWithAppleError.swift b/packages/sign_in_with_apple/sign_in_with_apple/ios/Classes/SignInWithAppleError.swift
index d629d07b414f08c5608a351cc92855d61e2b9f47..35ea67fa42202d64635fc0e8cce05b77d4a61183 120000
--- a/packages/sign_in_with_apple/sign_in_with_apple/ios/Classes/SignInWithAppleError.swift
+++ b/packages/sign_in_with_apple/sign_in_with_apple/ios/Classes/SignInWithAppleError.swift
@@ -1 +1,127 @@
-./../../darwin/Classes/SignInWithAppleError.swift
\ No newline at end of file
+import AuthenticationServices
+
+#if os(OSX)
+import FlutterMacOS
+#elseif os(iOS)
+import Flutter
+// UIKit is only available on iOS and we need it for UIDevice
+import UIKit
+#endif
+
+public enum SignInWithAppleGenericError {
+ // An error for the case we are running on a not supported platform
+ //
+ // We currently support macOS 10.15 or higher and iOS 13 or higher
+ case notSupported
+
+ // An error in case the arguments of a FlutterMethodCall are missing or don't have the proper type
+ case missingArguments(FlutterMethodCall)
+
+ // An error in case a concrete argument inside the arguments of a FlutterMethodCall is missing
+ // The second argument should be the identifier of the missing argument
+ case missingArgument(FlutterMethodCall, String)
+
+ func toFlutterError() -> FlutterError {
+ switch self {
+ case .notSupported:
+ var platform = "unknown platform"
+
+ #if os(OSX)
+ platform = "macOS \(ProcessInfo.processInfo.operatingSystemVersion)"
+ #elseif os(iOS)
+ platform = "\(UIDevice.current.systemName) \(UIDevice.current.systemVersion)"
+ #endif
+
+ return FlutterError(
+ code: "not-supported",
+ message: "Unsupported platform version: \(platform)",
+ details: nil
+ )
+ case .missingArguments(let call):
+ return FlutterError(
+ code: "missing-args",
+ message: "Missing arguments",
+ details: call.arguments
+ )
+ case .missingArgument(let call, let key):
+ return FlutterError(
+ code: "missing-arg",
+ message: "Argument '\(key)' is missing",
+ details: call.arguments
+ )
+ }
+ }
+}
+
+
+@available(iOS 13.0, macOS 10.15, *)
+public enum SignInWithAppleError {
+ // In case there was an error while getting the state of the credentials for a specific user identifier
+ // The first argument will be the localized error message
+ case credentialsError(String)
+
+ // In case we receive an unexpected credentials state
+ case unexpectedCredentialsState(ASAuthorizationAppleIDProvider.CredentialState)
+
+ // In case we get some unknown credential type in the successful authorization callback
+ //
+ // This contains the credential
+ case unknownCredentials(ASAuthorizationCredential)
+
+ // In case there was an error while trying to perform an authorization request
+ //
+ // This contains the actual authorization error code and the localized error message
+ case authorizationError(ASAuthorizationError.Code, String)
+
+ func toFlutterError() -> FlutterError {
+ switch self {
+ case .credentialsError(let message):
+ return FlutterError(
+ code: "credentials-error",
+ message: message,
+ details: nil
+ )
+ case .unexpectedCredentialsState(let credentialState):
+ return FlutterError(
+ code: "unexpected-credentials-state",
+ message: "Unexpected credential state: \(credentialState)",
+ details: nil
+ )
+ case .unknownCredentials(let credential):
+ return FlutterError(
+ code: "unknown-credentials",
+ message: "Unexpected credentials: \(credential)",
+ details: nil
+ )
+ case .authorizationError(let code, let message):
+ var errorCode = "authorization-error/unknown"
+
+ switch code {
+ case .unknown:
+ errorCode = "authorization-error/unknown"
+ case .canceled:
+ errorCode = "authorization-error/canceled"
+ case .invalidResponse:
+ errorCode = "authorization-error/invalidResponse"
+ case .notHandled:
+ errorCode = "authorization-error/notHandled"
+ case .failed:
+ errorCode = "authorization-error/failed"
+#if (os(iOS) && swift(>=5.5)) || (os(macOS) && swift(>=5.5.1))
+ // new case since Xcode 13, arrived earlier in iOS
+ // use https://swiftly.dev/swift-versions to match Swift to Xcode versions (as this is in practice driven by the OS SDK, not Swift version)
+ case .notInteractive:
+ errorCode = "authorization-error/notInteractive"
+#endif
+ @unknown default:
+ print("[SignInWithApplePlugin]: Unknown authorization error code: \(code)");
+ }
+
+ return FlutterError(
+ code: errorCode,
+ message: message,
+ details: nil
+ )
+ }
+ }
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ios/Classes/SignInWithAppleUnavailablePlugin.swift b/packages/sign_in_with_apple/sign_in_with_apple/ios/Classes/SignInWithAppleUnavailablePlugin.swift
index 2b17b8a884f43949f298a5c1f99ead10ee84096c..0f6370140301818a20b01774338743c2236ff315 120000
--- a/packages/sign_in_with_apple/sign_in_with_apple/ios/Classes/SignInWithAppleUnavailablePlugin.swift
+++ b/packages/sign_in_with_apple/sign_in_with_apple/ios/Classes/SignInWithAppleUnavailablePlugin.swift
@@ -1 +1,32 @@
-./../../darwin/Classes/SignInWithAppleUnavailablePlugin.swift
\ No newline at end of file
+import AuthenticationServices
+
+#if os(OSX)
+import FlutterMacOS
+#elseif os(iOS)
+import Flutter
+#endif
+
+public class SignInWithAppleUnavailablePlugin: NSObject, FlutterPlugin {
+ // This plugin should not be registered with directly
+ //
+ // This is merely a cross-platform plugin to handle the case Sign in with Apple is not available
+ // on the target platform
+ //
+ // Each target platform will still need a specific Plugin implementation
+ // which will need to decide whether or not Sign in with Apple is available
+ public static func register(with registrar: FlutterPluginRegistrar) {
+ print("SignInWithAppleUnavailablePlugin tried to register which is not allowed")
+ }
+
+
+ public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
+ if call.method == "isAvailable" {
+ result(false)
+ return
+ }
+
+ result(
+ SignInWithAppleGenericError.notSupported.toFlutterError()
+ )
+ }
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/lib/src/widgets/sign_in_with_apple_builder.dart b/packages/sign_in_with_apple/sign_in_with_apple/lib/src/widgets/sign_in_with_apple_builder.dart
index 2fc988557eda5c2ce531ef1e1f8e0ef22e10a6b7..460e6a586dd5af30c29501ebb6e8afe1a6c4cff4 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple/lib/src/widgets/sign_in_with_apple_builder.dart
+++ b/packages/sign_in_with_apple/sign_in_with_apple/lib/src/widgets/sign_in_with_apple_builder.dart
@@ -7,10 +7,10 @@ Widget _fallbackBuilder(BuildContext context) => const SizedBox.shrink();
/// A widget for conditionally rendering UI based on whether or not Sign in with Apple is available
class SignInWithAppleBuilder extends StatefulWidget {
const SignInWithAppleBuilder({
- super.key,
+ Key? key,
required this.builder,
this.fallbackBuilder = _fallbackBuilder,
- });
+ }) : super(key: key);
/// A [WidgetBuilder] which will be executed in case Sign in with Apple is available
final WidgetBuilder builder;
@@ -21,7 +21,7 @@ class SignInWithAppleBuilder extends StatefulWidget {
final WidgetBuilder fallbackBuilder;
@override
- State createState() => _SignInWithAppleBuilderState();
+ _SignInWithAppleBuilderState createState() => _SignInWithAppleBuilderState();
}
class _SignInWithAppleBuilderState extends State {
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/lib/src/widgets/sign_in_with_apple_button.dart b/packages/sign_in_with_apple/sign_in_with_apple/lib/src/widgets/sign_in_with_apple_button.dart
index a99408299b43f9f597abd202a2ff7e5259e011bb..34feada32828c7123ef33751f5e548d2c9cd3490 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple/lib/src/widgets/sign_in_with_apple_button.dart
+++ b/packages/sign_in_with_apple/sign_in_with_apple/lib/src/widgets/sign_in_with_apple_button.dart
@@ -10,14 +10,14 @@ const _appleIconSizeScale = 28 / 44;
/// https://developer.apple.com/design/human-interface-guidelines/sign-in-with-apple/overview/buttons/
class SignInWithAppleButton extends StatelessWidget {
const SignInWithAppleButton({
- super.key,
+ Key? key,
required this.onPressed,
this.text = 'Sign in with Apple',
this.height = 44,
this.style = SignInWithAppleButtonStyle.black,
this.borderRadius = const BorderRadius.all(Radius.circular(8.0)),
this.iconAlignment = IconAlignment.center,
- });
+ }) : super(key: key);
/// The callback that is be called when the button is pressed.
final VoidCallback onPressed;
@@ -159,7 +159,6 @@ class SignInWithAppleButton extends StatelessWidget {
borderRadius: borderRadius,
padding: EdgeInsets.zero,
color: _backgroundColor,
- onPressed: onPressed,
child: Container(
decoration: _decoration,
padding: const EdgeInsets.symmetric(
@@ -167,10 +166,11 @@ class SignInWithAppleButton extends StatelessWidget {
),
height: height,
child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
children: children,
+ mainAxisAlignment: MainAxisAlignment.center,
),
),
+ onPressed: onPressed,
),
),
);
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/macos/.gitignore b/packages/sign_in_with_apple/sign_in_with_apple/macos/.gitignore
deleted file mode 100644
index aa479fd3ce8a6914c7e3f0003901008259d50636..0000000000000000000000000000000000000000
--- a/packages/sign_in_with_apple/sign_in_with_apple/macos/.gitignore
+++ /dev/null
@@ -1,37 +0,0 @@
-.idea/
-.vagrant/
-.sconsign.dblite
-.svn/
-
-.DS_Store
-*.swp
-profile
-
-DerivedData/
-build/
-GeneratedPluginRegistrant.h
-GeneratedPluginRegistrant.m
-
-.generated/
-
-*.pbxuser
-*.mode1v3
-*.mode2v3
-*.perspectivev3
-
-!default.pbxuser
-!default.mode1v3
-!default.mode2v3
-!default.perspectivev3
-
-xcuserdata
-
-*.moved-aside
-
-*.pyc
-*sync/
-Icon?
-.tags*
-
-/Flutter/Generated.xcconfig
-/Flutter/flutter_export_environment.sh
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/macos/Classes/SignInWithAppleAvailablePlugin.swift b/packages/sign_in_with_apple/sign_in_with_apple/macos/Classes/SignInWithAppleAvailablePlugin.swift
index 974cb7f74f9b8b5def73045733e4205df7523e37..f8a0a8f045a51dbb0546cc3b7368eb968b3294ef 120000
--- a/packages/sign_in_with_apple/sign_in_with_apple/macos/Classes/SignInWithAppleAvailablePlugin.swift
+++ b/packages/sign_in_with_apple/sign_in_with_apple/macos/Classes/SignInWithAppleAvailablePlugin.swift
@@ -1 +1,251 @@
-./../../darwin/Classes/SignInWithAppleAvailablePlugin.swift
\ No newline at end of file
+import AuthenticationServices
+
+#if os(OSX)
+import FlutterMacOS
+#elseif os(iOS)
+import Flutter
+#endif
+
+let methodChannelName = "com.aboutyou.dart_packages.sign_in_with_apple"
+
+@available(iOS 13.0, macOS 10.15, *)
+public class SignInWithAppleAvailablePlugin: NSObject, FlutterPlugin {
+ var _lastSignInWithAppleAuthorizationController: SignInWithAppleAuthorizationController?
+
+ // This plugin should not be registered with directly
+ //
+ // This is merely a cross-platform plugin to handle the case Sign in with Apple is available
+ // on the target platform
+ //
+ // Each target platform will still need a specific Plugin implementation
+ // which will need to decide whether or not Sign in with Apple is available
+ public static func register(with registrar: FlutterPluginRegistrar) {
+ print("SignInWithAppleAvailablePlugin tried to register which is not allowed")
+ }
+
+ public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
+ switch call.method {
+ case "isAvailable":
+ result(true)
+
+ case "performAuthorizationRequest":
+ // Makes sure arguments exists and is a List
+ guard let args = call.arguments as? [Any] else {
+ result(
+ SignInWithAppleGenericError.missingArguments(call).toFlutterError()
+ )
+ return
+ }
+
+ let signInController = SignInWithAppleAuthorizationController(result)
+
+ // store to keep alive
+ _lastSignInWithAppleAuthorizationController = signInController
+
+ signInController.performRequests(
+ requests: SignInWithAppleAuthorizationController.parseRequests(
+ rawRequests: args
+ )
+ )
+
+ case "getCredentialState":
+ // Makes sure arguments exists and is a Map
+ guard let args = call.arguments as? [String: Any] else {
+ result(
+ SignInWithAppleGenericError.missingArguments(call).toFlutterError()
+ )
+ return
+ }
+
+ guard let userIdentifier = args["userIdentifier"] as? String else {
+ result(
+ SignInWithAppleGenericError.missingArgument(
+ call,
+ "userIdentifier"
+ ).toFlutterError()
+ )
+ return
+ }
+
+ let appleIDProvider = ASAuthorizationAppleIDProvider()
+
+ appleIDProvider.getCredentialState(forUserID: userIdentifier) {
+ credentialState, error in
+ if let error = error {
+ result(
+ SignInWithAppleError
+ .credentialsError(error.localizedDescription)
+ .toFlutterError()
+ )
+ return
+ }
+
+ switch credentialState {
+ case .authorized:
+ result("authorized")
+ case .revoked:
+ result("revoked")
+ case .notFound:
+ result("notFound")
+
+ default:
+ result(
+ SignInWithAppleError
+ .unexpectedCredentialsState(credentialState)
+ .toFlutterError()
+ )
+ }
+ }
+
+ default:
+ result(FlutterMethodNotImplemented)
+ }
+ }
+}
+
+@available(iOS 13.0, macOS 10.15, *)
+class SignInWithAppleAuthorizationController: NSObject, ASAuthorizationControllerDelegate {
+ var callback: FlutterResult
+
+ init(_ callback: @escaping FlutterResult) {
+ self.callback = callback
+ }
+
+ // Parses a list of json requests into the proper [ASAuthorizationRequest] type.
+ //
+ // The parsing itself tries to be as lenient as possible to recover gracefully from parsing errors.
+ public static func parseRequests(rawRequests: [Any]) -> [ASAuthorizationRequest] {
+ var requests: [ASAuthorizationRequest] = []
+
+ for request in rawRequests {
+ guard let requestMap = request as? [String: Any] else {
+ print("[SignInWithApplePlugin]: Request is not an object");
+ continue
+ }
+
+ guard let type = requestMap["type"] as? String else {
+ print("[SignInWithApplePlugin]: Request type is not an string");
+ continue
+ }
+
+ switch (type) {
+ case "appleid":
+ let appleIDProvider = ASAuthorizationAppleIDProvider()
+ let appleIDRequest = appleIDProvider.createRequest()
+
+ if let nonce = requestMap["nonce"] as? String {
+ appleIDRequest.nonce = nonce;
+ }
+
+ if let state = requestMap["state"] as? String {
+ appleIDRequest.state = state;
+ }
+
+ if let scopes = requestMap["scopes"] as? [String] {
+ appleIDRequest.requestedScopes = []
+
+ for scope in scopes {
+ switch scope {
+ case "email":
+ appleIDRequest.requestedScopes?.append(.email)
+ case "fullName":
+ appleIDRequest.requestedScopes?.append(.fullName)
+ default:
+ print("[SignInWithApplePlugin]: Unknown scope for the Apple ID request: \(scope)");
+ continue;
+ }
+ }
+ }
+
+ requests.append(appleIDRequest)
+ case "password":
+ let passwordProvider = ASAuthorizationPasswordProvider()
+ let passwordRequest = passwordProvider.createRequest()
+
+ requests.append(passwordRequest)
+ default:
+ print("[SignInWithApplePlugin]: Unknown request type: \(type)");
+ continue;
+ }
+
+ }
+
+ return requests
+ }
+
+ public func performRequests(requests: [ASAuthorizationRequest]) {
+ let authorizationController = ASAuthorizationController(
+ authorizationRequests: requests
+ )
+
+ authorizationController.delegate = self
+ authorizationController.performRequests()
+ }
+
+ private func parseData(data: Data?) -> String? {
+ if let data = data {
+ return String(decoding: data, as: UTF8.self)
+ }
+
+ return nil
+ }
+
+ public func authorizationController(
+ controller _: ASAuthorizationController,
+ didCompleteWithAuthorization authorization: ASAuthorization
+ ) {
+ switch authorization.credential {
+ case let appleIDCredential as ASAuthorizationAppleIDCredential:
+ let result: [String: String?] = [
+ "type": "appleid",
+ "userIdentifier": appleIDCredential.user,
+ "givenName": appleIDCredential.fullName?.givenName,
+ "familyName": appleIDCredential.fullName?.familyName,
+ "email": appleIDCredential.email,
+ "identityToken": parseData(data: appleIDCredential.identityToken),
+ "authorizationCode": parseData(data: appleIDCredential.authorizationCode),
+ "state": appleIDCredential.state,
+ ]
+ callback(result)
+
+ case let passwordCredential as ASPasswordCredential:
+ let result: [String: String] = [
+ "type": "password",
+ "username": passwordCredential.user,
+ "password": passwordCredential.password,
+ ]
+ callback(result)
+
+ default:
+ // Not getting any credentials would result in an error (didCompleteWithError)
+ callback(
+ SignInWithAppleError.unknownCredentials(
+ authorization.credential
+ ).toFlutterError()
+ )
+ }
+ }
+
+ public func authorizationController(
+ controller _: ASAuthorizationController,
+ didCompleteWithError error: Error
+ ) {
+ if let error = error as? ASAuthorizationError {
+ callback(
+ SignInWithAppleError.authorizationError(
+ error.code,
+ error.localizedDescription
+ ).toFlutterError()
+ )
+ } else {
+ print("[SignInWithApplePlugin]: Unknown authorization error \(error)")
+
+ callback(
+ SignInWithAppleError.authorizationError(
+ ASAuthorizationError.Code.unknown,
+ error.localizedDescription
+ ).toFlutterError()
+ )
+ }
+ }
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/macos/Classes/SignInWithAppleError.swift b/packages/sign_in_with_apple/sign_in_with_apple/macos/Classes/SignInWithAppleError.swift
index d629d07b414f08c5608a351cc92855d61e2b9f47..35ea67fa42202d64635fc0e8cce05b77d4a61183 120000
--- a/packages/sign_in_with_apple/sign_in_with_apple/macos/Classes/SignInWithAppleError.swift
+++ b/packages/sign_in_with_apple/sign_in_with_apple/macos/Classes/SignInWithAppleError.swift
@@ -1 +1,127 @@
-./../../darwin/Classes/SignInWithAppleError.swift
\ No newline at end of file
+import AuthenticationServices
+
+#if os(OSX)
+import FlutterMacOS
+#elseif os(iOS)
+import Flutter
+// UIKit is only available on iOS and we need it for UIDevice
+import UIKit
+#endif
+
+public enum SignInWithAppleGenericError {
+ // An error for the case we are running on a not supported platform
+ //
+ // We currently support macOS 10.15 or higher and iOS 13 or higher
+ case notSupported
+
+ // An error in case the arguments of a FlutterMethodCall are missing or don't have the proper type
+ case missingArguments(FlutterMethodCall)
+
+ // An error in case a concrete argument inside the arguments of a FlutterMethodCall is missing
+ // The second argument should be the identifier of the missing argument
+ case missingArgument(FlutterMethodCall, String)
+
+ func toFlutterError() -> FlutterError {
+ switch self {
+ case .notSupported:
+ var platform = "unknown platform"
+
+ #if os(OSX)
+ platform = "macOS \(ProcessInfo.processInfo.operatingSystemVersion)"
+ #elseif os(iOS)
+ platform = "\(UIDevice.current.systemName) \(UIDevice.current.systemVersion)"
+ #endif
+
+ return FlutterError(
+ code: "not-supported",
+ message: "Unsupported platform version: \(platform)",
+ details: nil
+ )
+ case .missingArguments(let call):
+ return FlutterError(
+ code: "missing-args",
+ message: "Missing arguments",
+ details: call.arguments
+ )
+ case .missingArgument(let call, let key):
+ return FlutterError(
+ code: "missing-arg",
+ message: "Argument '\(key)' is missing",
+ details: call.arguments
+ )
+ }
+ }
+}
+
+
+@available(iOS 13.0, macOS 10.15, *)
+public enum SignInWithAppleError {
+ // In case there was an error while getting the state of the credentials for a specific user identifier
+ // The first argument will be the localized error message
+ case credentialsError(String)
+
+ // In case we receive an unexpected credentials state
+ case unexpectedCredentialsState(ASAuthorizationAppleIDProvider.CredentialState)
+
+ // In case we get some unknown credential type in the successful authorization callback
+ //
+ // This contains the credential
+ case unknownCredentials(ASAuthorizationCredential)
+
+ // In case there was an error while trying to perform an authorization request
+ //
+ // This contains the actual authorization error code and the localized error message
+ case authorizationError(ASAuthorizationError.Code, String)
+
+ func toFlutterError() -> FlutterError {
+ switch self {
+ case .credentialsError(let message):
+ return FlutterError(
+ code: "credentials-error",
+ message: message,
+ details: nil
+ )
+ case .unexpectedCredentialsState(let credentialState):
+ return FlutterError(
+ code: "unexpected-credentials-state",
+ message: "Unexpected credential state: \(credentialState)",
+ details: nil
+ )
+ case .unknownCredentials(let credential):
+ return FlutterError(
+ code: "unknown-credentials",
+ message: "Unexpected credentials: \(credential)",
+ details: nil
+ )
+ case .authorizationError(let code, let message):
+ var errorCode = "authorization-error/unknown"
+
+ switch code {
+ case .unknown:
+ errorCode = "authorization-error/unknown"
+ case .canceled:
+ errorCode = "authorization-error/canceled"
+ case .invalidResponse:
+ errorCode = "authorization-error/invalidResponse"
+ case .notHandled:
+ errorCode = "authorization-error/notHandled"
+ case .failed:
+ errorCode = "authorization-error/failed"
+#if (os(iOS) && swift(>=5.5)) || (os(macOS) && swift(>=5.5.1))
+ // new case since Xcode 13, arrived earlier in iOS
+ // use https://swiftly.dev/swift-versions to match Swift to Xcode versions (as this is in practice driven by the OS SDK, not Swift version)
+ case .notInteractive:
+ errorCode = "authorization-error/notInteractive"
+#endif
+ @unknown default:
+ print("[SignInWithApplePlugin]: Unknown authorization error code: \(code)");
+ }
+
+ return FlutterError(
+ code: errorCode,
+ message: message,
+ details: nil
+ )
+ }
+ }
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/macos/Classes/SignInWithAppleUnavailablePlugin.swift b/packages/sign_in_with_apple/sign_in_with_apple/macos/Classes/SignInWithAppleUnavailablePlugin.swift
index 2b17b8a884f43949f298a5c1f99ead10ee84096c..0f6370140301818a20b01774338743c2236ff315 120000
--- a/packages/sign_in_with_apple/sign_in_with_apple/macos/Classes/SignInWithAppleUnavailablePlugin.swift
+++ b/packages/sign_in_with_apple/sign_in_with_apple/macos/Classes/SignInWithAppleUnavailablePlugin.swift
@@ -1 +1,32 @@
-./../../darwin/Classes/SignInWithAppleUnavailablePlugin.swift
\ No newline at end of file
+import AuthenticationServices
+
+#if os(OSX)
+import FlutterMacOS
+#elseif os(iOS)
+import Flutter
+#endif
+
+public class SignInWithAppleUnavailablePlugin: NSObject, FlutterPlugin {
+ // This plugin should not be registered with directly
+ //
+ // This is merely a cross-platform plugin to handle the case Sign in with Apple is not available
+ // on the target platform
+ //
+ // Each target platform will still need a specific Plugin implementation
+ // which will need to decide whether or not Sign in with Apple is available
+ public static func register(with registrar: FlutterPluginRegistrar) {
+ print("SignInWithAppleUnavailablePlugin tried to register which is not allowed")
+ }
+
+
+ public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
+ if call.method == "isAvailable" {
+ result(false)
+ return
+ }
+
+ result(
+ SignInWithAppleGenericError.notSupported.toFlutterError()
+ )
+ }
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ohos/.gitignore b/packages/sign_in_with_apple/sign_in_with_apple/ohos/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/ohos/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ohos/BuildProfile.ets b/packages/sign_in_with_apple/sign_in_with_apple/ohos/BuildProfile.ets
new file mode 100644
index 0000000000000000000000000000000000000000..c7fd7d77a23ab1f7fc61ea94df328906455050ae
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/ohos/BuildProfile.ets
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+export default class BuildProfile {
+ static readonly HAR_VERSION = '1.0.0';
+ static readonly BUILD_MODE_NAME = 'debug';
+ static readonly DEBUG = true;
+ static readonly TARGET_NAME = 'default';
+}
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ohos/Index.ets b/packages/sign_in_with_apple/sign_in_with_apple/ohos/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..7cb4fae5a5bf98c1c4eaf9dddb8fce167a7e7024
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/ohos/Index.ets
@@ -0,0 +1,22 @@
+/*
+* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import { SignInWithApplePlugin } from './src/main/ets/components/mainpage/SignInWithApplePlugin'
+
+export {
+ CustomSignPage
+} from './src/main/ets/components/mainpage/CustomSignPage'
+
+export default SignInWithApplePlugin
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ohos/build-profile.json5 b/packages/sign_in_with_apple/sign_in_with_apple/ohos/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..697dff23e224373edb713dc2b8a08ed7341d5b4c
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/ohos/build-profile.json5
@@ -0,0 +1,31 @@
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": true,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ },
+ "consumerFiles": [
+ "./consumer-rules.txt"
+ ]
+ }
+ },
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest"
+ }
+ ]
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ios/Assets/.gitkeep b/packages/sign_in_with_apple/sign_in_with_apple/ohos/consumer-rules.txt
similarity index 100%
rename from packages/sign_in_with_apple/sign_in_with_apple/ios/Assets/.gitkeep
rename to packages/sign_in_with_apple/sign_in_with_apple/ohos/consumer-rules.txt
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ohos/hvigorfile.ts b/packages/sign_in_with_apple/sign_in_with_apple/ohos/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..12a327db0aeeb9462eb1dc098f5e808df40e3dce
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/ohos/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import { harTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ohos/obfuscation-rules.txt b/packages/sign_in_with_apple/sign_in_with_apple/ohos/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..985b2aeb7658286b17bd26eab8f217c3fe75ea8b
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/ohos/obfuscation-rules.txt
@@ -0,0 +1,18 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ohos/oh-package.json5 b/packages/sign_in_with_apple/sign_in_with_apple/ohos/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..609826fff3045674a67d460ffcc837d197216c28
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/ohos/oh-package.json5
@@ -0,0 +1,11 @@
+{
+ "name": "sign_in_with_apple",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "Index.ets",
+ "author": "",
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@ohos/flutter_ohos": "file:./har/flutter.har"
+ }
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/ets/components/mainpage/CustomSignPage.ets b/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/ets/components/mainpage/CustomSignPage.ets
new file mode 100644
index 0000000000000000000000000000000000000000..5338ec8b6507c99de1e517376de17e5a32d46316
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/ets/components/mainpage/CustomSignPage.ets
@@ -0,0 +1,107 @@
+/*
+* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import web_webview from '@ohos.web.webview';
+import { router } from '@kit.ArkUI';
+
+const PHONE_USER_AGENT: string = 'Mozilla/5.0 (Linux; Android 9; VRD-AL10; HMSCore 6.3.0.331) AppleWebKit/537.36 (KHTMl, like Gecko) Chrome/92.0.4515.105 HuaweiBrowser/12.0.4.1 Mobile Safari/537.36'
+
+@Component
+export struct CustomSignPage {
+ @Link url: string
+ @Link controller: web_webview.WebviewController
+ @State hideProgress: boolean = false
+ @State progress: number = 0
+ @State inputValue: string = ''
+ @State errMsg: string = ''
+ @State isError: boolean = false
+
+ aboutToAppear() {
+ this.inputValue = this.url.split('com')[0]+'com'
+ }
+ build() {
+ Column() {
+ Row() {
+ Image($r('app.media.ic_public_cancel_filled'))
+ .width(24)
+ .height(24)
+ .margin({ right: 12 })
+ .onClick(() => {
+ router.back()
+ })
+ Text(this.inputValue)
+ .maxLines(1)
+ .textOverflow({ overflow: TextOverflow.Ellipsis })
+ .layoutWeight(1)
+ }
+ .padding({ left: 12, right: 12})
+ .height(33)
+ .width('100%')
+ Progress({ value: this.progress, total: 100 })
+ .width("100%")
+ .color('#0000ff')
+ .visibility(this.hideProgress ? Visibility.None : Visibility.Visible)
+ Column({space: 12}) {
+ Text('网站暂时无法打开')
+ .fontWeight(500)
+ .fontSize(16)
+ Text(this.errMsg)
+ .fontColor('rgba(0, 0, 0, 0.6)')
+ .fontSize(12)
+ }
+ .layoutWeight(1)
+ .width('100%')
+ .justifyContent(FlexAlign.Center)
+ .alignItems(HorizontalAlign.Center)
+ .visibility(this.isError ? Visibility.Visible : Visibility.None)
+ Web({ src: this.url, controller: this.controller})
+ .layoutWeight(1)
+ .userAgent(PHONE_USER_AGENT)
+ .visibility(this.isError ? Visibility.None : Visibility.Visible)
+ .onPageBegin((event) => {
+ console.log('CustomSignPage onPageBegin:' + JSON.stringify(event))
+ })
+ .onPageEnd((event) => {
+ console.log('CustomSignPage onPageEnd:' + JSON.stringify(event))
+ if (event) {
+ if(!event.url.startsWith(this.inputValue)) {
+ this.inputValue = event.url
+ }
+ }
+ })
+ .onProgressChange((event) => {
+ console.log('CustomSignPage onProgressChange:' + JSON.stringify(event))
+ this.progress = event ? event.newProgress : 0
+ if (this.progress === 100) {
+ this.hideProgress = true
+ } else {
+ this.hideProgress = false
+ }
+ })
+ .onErrorReceive((event) => {
+ if (event) {
+ console.log('CustomSignPage onErrorReceive isMainFrame:' + event.request.isMainFrame())
+ if(event.request.isMainFrame()) {
+ this.isError = true
+ this.errMsg = `NET_ERROR { ${event.error.getErrorInfo()}, ${event.error.getErrorCode()} }`
+ console.log('CustomSignPage onErrorReceive errMsg:' + this.errMsg)
+ }
+ }
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/ets/components/mainpage/SignInWithApplePlugin.ets b/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/ets/components/mainpage/SignInWithApplePlugin.ets
new file mode 100644
index 0000000000000000000000000000000000000000..79d5e3a6051f89d535e2effdd0c09ca86643bd28
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/ets/components/mainpage/SignInWithApplePlugin.ets
@@ -0,0 +1,158 @@
+/*
+* Copyright (c) 2024 SwanLink (Jiangsu) Technology Development Co., LTD.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import { AbilityAware,
+ AbilityPluginBinding,
+ FlutterPlugin, FlutterPluginBinding,
+ Log,
+ MethodCall,
+ MethodCallHandler,
+ MethodChannel,
+ MethodResult} from '@ohos/flutter_ohos';
+import { Want } from '@kit.AbilityKit';
+import web_webview from '@ohos.web.webview';
+import { Params } from '@ohos/flutter_ohos/src/main/ets/plugin/platform/PlatformView';
+import { router } from '@kit.ArkUI';
+
+
+const TAG = "SignInWithApple"
+const controller: web_webview.WebviewController = new web_webview.WebviewController();
+const url: string = ''
+
+/** SignInWithApplePlugin */
+export class SignInWithApplePlugin implements FlutterPlugin, MethodCallHandler, AbilityAware {
+ private CUSTOM_TABS_REQUEST_CODE: number = 1001;
+ private channel: MethodChannel | null = null
+ binding: AbilityPluginBinding | null = null
+ public static lastAuthorizationRequestResult: MethodResult | null = null
+ public static triggerMainActivityToHideChromeCustomTab: (() => void) | null = null
+
+ onAttachedToEngine(binding: FlutterPluginBinding): void {
+ this.channel = new MethodChannel(binding.getBinaryMessenger(), "com.aboutyou.dart_packages.sign_in_with_apple")
+ this.channel.setMethodCallHandler(this);
+ }
+
+ onDetachedFromEngine(binding: FlutterPluginBinding): void {
+ this.channel?.setMethodCallHandler(null)
+ this.channel = null
+ }
+
+ onAttachedToAbility(binding: AbilityPluginBinding): void {
+ this.binding = binding
+ // binding.addActivityResultListener(this)
+ }
+
+ onReattachedToAbilityForConfigChanges(binding: AbilityPluginBinding) {
+ this.onAttachedToAbility(binding)
+ }
+
+ onDetachedFromAbilityForConfigChanges() {
+ this.onDetachedFromAbility()
+ }
+
+ onDetachedFromAbility(): void {
+ // this.binding?.removeActivityResultListener(this)
+ this.binding = null
+ }
+
+ onActivityResult(requestCode: number, resultCode: number, data: Want): boolean {
+ if (requestCode == this.CUSTOM_TABS_REQUEST_CODE) {
+ let _lastAuthorizationRequestResult = SignInWithApplePlugin.lastAuthorizationRequestResult
+ _lastAuthorizationRequestResult?.error("authorization-error/canceled", "The user closed the Custom Tab", null)
+ if (_lastAuthorizationRequestResult != null) {
+ SignInWithApplePlugin.lastAuthorizationRequestResult = null
+ SignInWithApplePlugin.triggerMainActivityToHideChromeCustomTab = null
+ }
+ }
+
+ return false
+ }
+
+ onMethodCall(call: MethodCall, result: MethodResult): void {
+ Log.i(TAG, 'call:'+JSON.stringify(call.method))
+ Log.i(TAG, 'argument:'+JSON.stringify(call.argument))
+ switch (call.method) {
+ case "isAvailable":
+ break
+ case "performAuthorizationRequest":
+ let url: string = call.argument("url")
+ if (url == null) {
+ result.error("MISSING_ARG", "Missing 'url' argument", call.argument)
+ return
+ }
+ try {
+ Log.i(TAG, 'argument url:'+url)
+ const option: router.RouterOptions = {
+ url: "pages/SignInWithApplePage",
+ params: {url: url}
+ }
+ router.pushUrl(option)
+ // let want: Want = {
+ // // uncomment line below if wish to implicitly query only in the specific bundle.
+ // // bundleName: "com.example.myapplication",
+ // "action": "ohos.want.action.viewData",
+ // // entities can be omitted.
+ // // "entities": ["entity.system.browsable"],
+ // "uri": url,
+ // // "type": "text/plain"
+ // }
+ // this.binding?.getAbility().context.startAbility(want)
+ console.info(`explicit start ability succeed`)
+ } catch (error) {
+ console.info(`explicit start ability failed with ${error.code}`)
+ }
+ break
+ default:
+ result.notImplemented()
+ }
+ }
+ getUniqueClassName(): string {
+ return TAG
+ }
+}
+
+
+/**
+ * Activity which is used when the web-based authentication flow links back to the app
+ *
+ * DO NOT rename this or it's package name as it's configured in the consumer's `AndroidManifest.xml`
+ */
+export class SignInWithAppleCallback {
+ constructor() {
+ }
+ onCreate(savedInstanceState: Want) {
+ this.onCreate(savedInstanceState)
+ Log.i(TAG, "savedInstanceState:" + JSON.stringify(savedInstanceState))
+ // Note: The order is important here, as we first need to send the data to Flutter and then close the custom tab
+ // That way we can detect a manually closed tab in `SignInWithApplePlugin.onActivityResult` (by detecting that we're still waiting on data)
+ let lastAuthorizationRequestResult = SignInWithApplePlugin.lastAuthorizationRequestResult
+ if (lastAuthorizationRequestResult != null) {
+ lastAuthorizationRequestResult.success(savedInstanceState?.uri)
+ SignInWithApplePlugin.lastAuthorizationRequestResult = null
+ } else {
+ SignInWithApplePlugin.triggerMainActivityToHideChromeCustomTab = null
+
+ Log.e(TAG, "Received Sign in with Apple callback, but 'lastAuthorizationRequestResult' function was `null`")
+ }
+
+ let triggerMainActivityToHideChromeCustomTab = SignInWithApplePlugin.triggerMainActivityToHideChromeCustomTab
+ if (triggerMainActivityToHideChromeCustomTab != null) {
+ triggerMainActivityToHideChromeCustomTab()
+ SignInWithApplePlugin.triggerMainActivityToHideChromeCustomTab = null
+ } else {
+ Log.e(TAG, "Received Sign in with Apple callback, but 'triggerMainActivityToHideChromeCustomTab' function was `null`")
+ }
+ }
+}
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/module.json5 b/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..d2bda05c709b4a71cda58789bab5ef072e1a8093
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/module.json5
@@ -0,0 +1,11 @@
+{
+ "module": {
+ "name": "sign_in_with_apple",
+ "type": "har",
+ "deviceTypes": [
+ "default",
+ "tablet",
+ "2in1"
+ ]
+ }
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/resources/base/element/string.json b/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f51a9c8461a55f6312ef950344e3145b7f82d607
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "page_show",
+ "value": "page from package"
+ }
+ ]
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/resources/base/media/ic_public_cancel_filled.svg b/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/resources/base/media/ic_public_cancel_filled.svg
new file mode 100644
index 0000000000000000000000000000000000000000..8256169b9bc839ea0cb4c25d8925616cf0834087
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/resources/base/media/ic_public_cancel_filled.svg
@@ -0,0 +1,13 @@
+
+
\ No newline at end of file
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/resources/en_US/element/string.json b/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f51a9c8461a55f6312ef950344e3145b7f82d607
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/resources/en_US/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "page_show",
+ "value": "page from package"
+ }
+ ]
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/resources/zh_CN/element/string.json b/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f51a9c8461a55f6312ef950344e3145b7f82d607
--- /dev/null
+++ b/packages/sign_in_with_apple/sign_in_with_apple/ohos/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "page_show",
+ "value": "page from package"
+ }
+ ]
+}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/pubspec.lock b/packages/sign_in_with_apple/sign_in_with_apple/pubspec.lock
deleted file mode 100644
index 6cd435ca9bcd7684fa682d81a9bf5c658be8c585..0000000000000000000000000000000000000000
--- a/packages/sign_in_with_apple/sign_in_with_apple/pubspec.lock
+++ /dev/null
@@ -1,234 +0,0 @@
-# Generated by pub
-# See https://dart.dev/tools/pub/glossary#lockfile
-packages:
- async:
- dependency: transitive
- description:
- name: async
- sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
- url: "https://pub.dev"
- source: hosted
- version: "2.11.0"
- boolean_selector:
- dependency: transitive
- description:
- name: boolean_selector
- sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
- url: "https://pub.dev"
- source: hosted
- version: "2.1.1"
- characters:
- dependency: transitive
- description:
- name: characters
- sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
- url: "https://pub.dev"
- source: hosted
- version: "1.3.0"
- clock:
- dependency: transitive
- description:
- name: clock
- sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
- url: "https://pub.dev"
- source: hosted
- version: "1.1.1"
- collection:
- dependency: transitive
- description:
- name: collection
- sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
- url: "https://pub.dev"
- source: hosted
- version: "1.18.0"
- fake_async:
- dependency: transitive
- description:
- name: fake_async
- sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
- url: "https://pub.dev"
- source: hosted
- version: "1.3.1"
- flutter:
- dependency: "direct main"
- description: flutter
- source: sdk
- version: "0.0.0"
- flutter_lints:
- dependency: "direct dev"
- description:
- name: flutter_lints
- sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7
- url: "https://pub.dev"
- source: hosted
- version: "3.0.1"
- flutter_test:
- dependency: "direct dev"
- description: flutter
- source: sdk
- version: "0.0.0"
- flutter_web_plugins:
- dependency: transitive
- description: flutter
- source: sdk
- version: "0.0.0"
- leak_tracker:
- dependency: transitive
- description:
- name: leak_tracker
- sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
- url: "https://pub.dev"
- source: hosted
- version: "10.0.0"
- leak_tracker_flutter_testing:
- dependency: transitive
- description:
- name: leak_tracker_flutter_testing
- sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
- url: "https://pub.dev"
- source: hosted
- version: "2.0.1"
- leak_tracker_testing:
- dependency: transitive
- description:
- name: leak_tracker_testing
- sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
- url: "https://pub.dev"
- source: hosted
- version: "2.0.1"
- lints:
- dependency: transitive
- description:
- name: lints
- sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
- url: "https://pub.dev"
- source: hosted
- version: "3.0.0"
- matcher:
- dependency: transitive
- description:
- name: matcher
- sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
- url: "https://pub.dev"
- source: hosted
- version: "0.12.16+1"
- material_color_utilities:
- dependency: transitive
- description:
- name: material_color_utilities
- sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
- url: "https://pub.dev"
- source: hosted
- version: "0.8.0"
- meta:
- dependency: "direct main"
- description:
- name: meta
- sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
- url: "https://pub.dev"
- source: hosted
- version: "1.11.0"
- path:
- dependency: transitive
- description:
- name: path
- sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
- url: "https://pub.dev"
- source: hosted
- version: "1.9.0"
- plugin_platform_interface:
- dependency: transitive
- description:
- name: plugin_platform_interface
- sha256: f843e0027496f0d841166707029237a0bef39cfc0c79b93b1bb1a10beae73244
- url: "https://pub.dev"
- source: hosted
- version: "2.0.2"
- sign_in_with_apple_platform_interface:
- dependency: "direct main"
- description:
- name: sign_in_with_apple_platform_interface
- sha256: c2ef2ce6273fce0c61acd7e9ff5be7181e33d7aa2b66508b39418b786cca2119
- url: "https://pub.dev"
- source: hosted
- version: "1.1.0"
- sign_in_with_apple_web:
- dependency: "direct main"
- description:
- name: sign_in_with_apple_web
- sha256: c009e9beeb6c376e86aaa154fcc8b4e075d4bad90c56286b9668a51cdb6129ea
- url: "https://pub.dev"
- source: hosted
- version: "2.1.0"
- sky_engine:
- dependency: transitive
- description: flutter
- source: sdk
- version: "0.0.99"
- source_span:
- dependency: transitive
- description:
- name: source_span
- sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
- url: "https://pub.dev"
- source: hosted
- version: "1.10.0"
- stack_trace:
- dependency: transitive
- description:
- name: stack_trace
- sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
- url: "https://pub.dev"
- source: hosted
- version: "1.11.1"
- stream_channel:
- dependency: transitive
- description:
- name: stream_channel
- sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
- url: "https://pub.dev"
- source: hosted
- version: "2.1.2"
- string_scanner:
- dependency: transitive
- description:
- name: string_scanner
- sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
- url: "https://pub.dev"
- source: hosted
- version: "1.2.0"
- term_glyph:
- dependency: transitive
- description:
- name: term_glyph
- sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
- url: "https://pub.dev"
- source: hosted
- version: "1.2.1"
- test_api:
- dependency: transitive
- description:
- name: test_api
- sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
- url: "https://pub.dev"
- source: hosted
- version: "0.6.1"
- vector_math:
- dependency: transitive
- description:
- name: vector_math
- sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
- url: "https://pub.dev"
- source: hosted
- version: "2.1.4"
- vm_service:
- dependency: transitive
- description:
- name: vm_service
- sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
- url: "https://pub.dev"
- source: hosted
- version: "13.0.0"
-sdks:
- dart: ">=3.3.0 <4.0.0"
- flutter: ">=3.19.0"
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/pubspec.yaml b/packages/sign_in_with_apple/sign_in_with_apple/pubspec.yaml
index e79deeee053770035fc8305b3289ab3356179793..dcecd39b92c0618fd784642d996fef994a17cde9 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple/pubspec.yaml
+++ b/packages/sign_in_with_apple/sign_in_with_apple/pubspec.yaml
@@ -1,12 +1,12 @@
name: sign_in_with_apple
description: Flutter bridge to initiate Sign in with Apple (on iOS, macOS, and Android). Includes support for keychain entries as well as signing in with an Apple ID.
-version: 6.1.2
+version: 5.0.0
homepage: https://github.com/aboutyou/dart_packages/tree/master/packages/sign_in_with_apple
repository: https://github.com/aboutyou/dart_packages
environment:
- sdk: ^3.3.0
- flutter: ">=3.19.0"
+ sdk: ">=2.18.5 <3.0.0"
+ flutter: ">=3.7.6 <4.0.0"
dependencies:
flutter:
@@ -14,22 +14,22 @@ dependencies:
meta: ^1.3.0
- sign_in_with_apple_platform_interface: ^1.1.0
+ sign_in_with_apple_platform_interface: ^1.0.0
- sign_in_with_apple_web: ^2.1.0
+ sign_in_with_apple_web: ^1.0.0
dev_dependencies:
- flutter_lints: ^3.0.1
+ flutter_lints: ^1.0.4
flutter_test:
sdk: flutter
# Overrides useful for local development
-# dependency_overrides:
-# sign_in_with_apple_platform_interface:
-# path: ../sign_in_with_apple_platform_interface
+dependency_overrides:
+ sign_in_with_apple_platform_interface:
+ path: ../sign_in_with_apple_platform_interface
-# sign_in_with_apple_web:
-# path: ../sign_in_with_apple_web
+ sign_in_with_apple_web:
+ path: ../sign_in_with_apple_web
flutter:
plugin:
@@ -41,5 +41,7 @@ flutter:
pluginClass: SignInWithApplePlugin
macos:
pluginClass: SignInWithApplePlugin
+ ohos:
+ pluginClass: SignInWithApplePlugin
web:
default_package: sign_in_with_apple_web
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/black_button.png b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/black_button.png
index e6469b4ac3f525be70bf1429ec1a8a0ffc33c554..8e39b89c596e76ed6d04e95387d5fcc6286bc683 100644
Binary files a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/black_button.png and b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/black_button.png differ
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/center_aligned_icon.png b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/center_aligned_icon.png
index e6469b4ac3f525be70bf1429ec1a8a0ffc33c554..8e39b89c596e76ed6d04e95387d5fcc6286bc683 100644
Binary files a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/center_aligned_icon.png and b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/center_aligned_icon.png differ
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/custom_border_radius.png b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/custom_border_radius.png
index a5462438bf98b2343115da5c27f0735862e9aa06..0735f39cb6b61036805704c49c738912f6167194 100644
Binary files a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/custom_border_radius.png and b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/custom_border_radius.png differ
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/custom_height.png b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/custom_height.png
index 66546975390045a00b6f7adb422be1e696be40d5..043b023e79690b50e435c113638ac92e4c60d986 100644
Binary files a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/custom_height.png and b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/custom_height.png differ
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/custom_text.png b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/custom_text.png
index ae48f5e1ea6c980d561fc78dae778261d072f21f..126aab130547b16d1ea0e73b53ea698d59470a54 100644
Binary files a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/custom_text.png and b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/custom_text.png differ
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/left_aligned_icon.png b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/left_aligned_icon.png
index 0fafb3f3a633bbf8c758400c41e06ffe633ae8b3..527493f5624897a006a444a86071ade8482ecd08 100644
Binary files a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/left_aligned_icon.png and b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/left_aligned_icon.png differ
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/white_button.png b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/white_button.png
index 58998340e1a2e4d87505c9cecd421908580b65c3..60366a989c5ec36895500b42a154256a474bd513 100644
Binary files a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/white_button.png and b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/white_button.png differ
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/white_outlined_button.png b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/white_outlined_button.png
index 68beba5b6e1bea109a2f75541d2866e52d462c78..e9ad4c7913a75a61c1450d61d07dd50149149252 100644
Binary files a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/white_outlined_button.png and b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/goldens/white_outlined_button.png differ
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/sign_in_with_apple_button_test.dart b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/sign_in_with_apple_button_test.dart
index 19e760226da705098440bc9cb64d265695ab969a..e7c93167911e5cd161f57ec8e08b017d8a0a18e9 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/sign_in_with_apple_button_test.dart
+++ b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_button/sign_in_with_apple_button_test.dart
@@ -1,5 +1,3 @@
-// ignore_for_file: deprecated_member_use
-
import 'dart:io';
import 'package:flutter/cupertino.dart';
@@ -238,10 +236,10 @@ Future main() async {
class TestSetup extends StatelessWidget {
const TestSetup({
- super.key,
+ Key? key,
required this.child,
this.backgroundColor = Colors.white,
- });
+ }) : super(key: key);
final Widget child;
@@ -254,10 +252,10 @@ class TestSetup extends StatelessWidget {
padding: const EdgeInsets.all(10),
color: backgroundColor,
child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
children: [
child,
],
+ mainAxisAlignment: MainAxisAlignment.center,
),
),
theme: const CupertinoThemeData().copyWith(
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_test.dart b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_test.dart
index bd89ea9debd080a384475ae21a7289be9a637fba..99403d5cf901f71a5310ed546ff90fc52ac9e728 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_test.dart
+++ b/packages/sign_in_with_apple/sign_in_with_apple/test/sign_in_with_apple_test.dart
@@ -1,5 +1,3 @@
-// ignore_for_file: deprecated_member_use
-
import 'package:flutter_test/flutter_test.dart';
import 'package:sign_in_with_apple/sign_in_with_apple.dart';
diff --git a/packages/sign_in_with_apple/sign_in_with_apple/test/widgets/sign_in_with_apple_builder.dart b/packages/sign_in_with_apple/sign_in_with_apple/test/widgets/sign_in_with_apple_builder.dart
index 30b5b5c45afb54648147c55e52c4549a26d1f6f9..f0ff7e97c424ea74e04e30b672c9171d53a232ba 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple/test/widgets/sign_in_with_apple_builder.dart
+++ b/packages/sign_in_with_apple/sign_in_with_apple/test/widgets/sign_in_with_apple_builder.dart
@@ -1,5 +1,3 @@
-// ignore_for_file: deprecated_member_use
-
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
diff --git a/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/CHANGELOG.md b/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/CHANGELOG.md
index b0c9ffcf9acfd9f489c9f3348a3d485c5e7dffe6..6fadda91b38092eb8cbdc4ecaa6fb12abad8b838 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/CHANGELOG.md
+++ b/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/CHANGELOG.md
@@ -1,8 +1,3 @@
-## 1.1.0
-
-- Use proper type name in toString
-- Set min Flutter SDK to 3.19.0
-
## 1.0.0
- Initial open-source release.
diff --git a/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/lib/authorization_credential.dart b/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/lib/authorization_credential.dart
index 48f019fb7f1ab172b5fc57e76050da4ef81c5d2b..625221d1ad926e00acb6b51d873a3e9ce999ae9a 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/lib/authorization_credential.dart
+++ b/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/lib/authorization_credential.dart
@@ -1,7 +1,6 @@
import 'dart:convert';
import 'package:meta/meta.dart';
-
import './authorization_request.dart';
import './exceptions.dart';
@@ -76,7 +75,7 @@ class AuthorizationCredentialAppleID {
@override
String toString() {
- return 'AuthorizationCredentialAppleID($userIdentifier, $givenName, $familyName, $email, [identityToken set: ${identityToken != null}], $state)';
+ return 'AuthorizationAppleID($userIdentifier, $givenName, $familyName, $email, $state)';
}
}
@@ -96,7 +95,7 @@ class AuthorizationCredentialPassword {
@override
String toString() {
- return 'AuthorizationCredentialPassword($username, [REDACTED password])';
+ return 'AuthorizationCredential($username, [REDACTED PASSWORD])';
}
}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/lib/exceptions.dart b/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/lib/exceptions.dart
index 5f550a39ffa1147207ceff8fca67cf85116cf208..03b423c5d09c073ecb1458a07cfd323d1e0b71d5 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/lib/exceptions.dart
+++ b/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/lib/exceptions.dart
@@ -133,7 +133,7 @@ class SignInWithAppleAuthorizationException
final String message;
@override
- String toString() => 'SignInWithAppleAuthorizationException($code, $message)';
+ String toString() => 'SignInWithAppleAuthorizationError($code, $message)';
}
class SignInWithAppleCredentialsException implements SignInWithAppleException {
diff --git a/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/lib/method_channel_sign_in_with_apple.dart b/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/lib/method_channel_sign_in_with_apple.dart
index 41e34a1e4e056595246a72174faca25afd89f8bf..c8e2d2035ff94ac54eb0630024b875c99d6d5baa 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/lib/method_channel_sign_in_with_apple.dart
+++ b/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/lib/method_channel_sign_in_with_apple.dart
@@ -40,7 +40,7 @@ class MethodChannelSignInWithApple extends SignInWithApplePlatform {
/// Can be `null`, in which case no state will be passed to the request.
String? state,
}) async {
- if (Platform.isAndroid) {
+ if (Platform.isAndroid || Platform.operatingSystem == 'ohos') {
if (webAuthenticationOptions == null) {
throw Exception(
'`webAuthenticationOptions` argument must be provided on Android.',
@@ -145,7 +145,7 @@ class MethodChannelSignInWithApple extends SignInWithApplePlatform {
required String? nonce,
required String? state,
}) async {
- assert(Platform.isAndroid);
+ assert(Platform.isAndroid || Platform.operatingSystem == 'ohos');
// URL built according to https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js/incorporating_sign_in_with_apple_into_other_platforms#3332113
final uri = Uri(
diff --git a/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/pubspec.lock b/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/pubspec.lock
deleted file mode 100644
index 2cec26bbf8de5f178e799e62bb48eea252069c28..0000000000000000000000000000000000000000
--- a/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/pubspec.lock
+++ /dev/null
@@ -1,213 +0,0 @@
-# Generated by pub
-# See https://dart.dev/tools/pub/glossary#lockfile
-packages:
- async:
- dependency: transitive
- description:
- name: async
- sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
- url: "https://pub.dev"
- source: hosted
- version: "2.11.0"
- boolean_selector:
- dependency: transitive
- description:
- name: boolean_selector
- sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
- url: "https://pub.dev"
- source: hosted
- version: "2.1.1"
- characters:
- dependency: transitive
- description:
- name: characters
- sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
- url: "https://pub.dev"
- source: hosted
- version: "1.3.0"
- clock:
- dependency: transitive
- description:
- name: clock
- sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
- url: "https://pub.dev"
- source: hosted
- version: "1.1.1"
- collection:
- dependency: transitive
- description:
- name: collection
- sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
- url: "https://pub.dev"
- source: hosted
- version: "1.18.0"
- fake_async:
- dependency: transitive
- description:
- name: fake_async
- sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
- url: "https://pub.dev"
- source: hosted
- version: "1.3.1"
- flutter:
- dependency: "direct main"
- description: flutter
- source: sdk
- version: "0.0.0"
- flutter_lints:
- dependency: "direct dev"
- description:
- name: flutter_lints
- sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493
- url: "https://pub.dev"
- source: hosted
- version: "1.0.4"
- flutter_test:
- dependency: "direct dev"
- description: flutter
- source: sdk
- version: "0.0.0"
- leak_tracker:
- dependency: transitive
- description:
- name: leak_tracker
- sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
- url: "https://pub.dev"
- source: hosted
- version: "10.0.0"
- leak_tracker_flutter_testing:
- dependency: transitive
- description:
- name: leak_tracker_flutter_testing
- sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
- url: "https://pub.dev"
- source: hosted
- version: "2.0.1"
- leak_tracker_testing:
- dependency: transitive
- description:
- name: leak_tracker_testing
- sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
- url: "https://pub.dev"
- source: hosted
- version: "2.0.1"
- lints:
- dependency: transitive
- description:
- name: lints
- sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c
- url: "https://pub.dev"
- source: hosted
- version: "1.0.1"
- matcher:
- dependency: transitive
- description:
- name: matcher
- sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
- url: "https://pub.dev"
- source: hosted
- version: "0.12.16+1"
- material_color_utilities:
- dependency: transitive
- description:
- name: material_color_utilities
- sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
- url: "https://pub.dev"
- source: hosted
- version: "0.8.0"
- meta:
- dependency: "direct main"
- description:
- name: meta
- sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
- url: "https://pub.dev"
- source: hosted
- version: "1.11.0"
- path:
- dependency: transitive
- description:
- name: path
- sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
- url: "https://pub.dev"
- source: hosted
- version: "1.9.0"
- plugin_platform_interface:
- dependency: "direct main"
- description:
- name: plugin_platform_interface
- sha256: f843e0027496f0d841166707029237a0bef39cfc0c79b93b1bb1a10beae73244
- url: "https://pub.dev"
- source: hosted
- version: "2.0.2"
- sky_engine:
- dependency: transitive
- description: flutter
- source: sdk
- version: "0.0.99"
- source_span:
- dependency: transitive
- description:
- name: source_span
- sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
- url: "https://pub.dev"
- source: hosted
- version: "1.10.0"
- stack_trace:
- dependency: transitive
- description:
- name: stack_trace
- sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
- url: "https://pub.dev"
- source: hosted
- version: "1.11.1"
- stream_channel:
- dependency: transitive
- description:
- name: stream_channel
- sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
- url: "https://pub.dev"
- source: hosted
- version: "2.1.2"
- string_scanner:
- dependency: transitive
- description:
- name: string_scanner
- sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
- url: "https://pub.dev"
- source: hosted
- version: "1.2.0"
- term_glyph:
- dependency: transitive
- description:
- name: term_glyph
- sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
- url: "https://pub.dev"
- source: hosted
- version: "1.2.1"
- test_api:
- dependency: transitive
- description:
- name: test_api
- sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
- url: "https://pub.dev"
- source: hosted
- version: "0.6.1"
- vector_math:
- dependency: transitive
- description:
- name: vector_math
- sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
- url: "https://pub.dev"
- source: hosted
- version: "2.1.4"
- vm_service:
- dependency: transitive
- description:
- name: vm_service
- sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
- url: "https://pub.dev"
- source: hosted
- version: "13.0.0"
-sdks:
- dart: ">=3.3.0 <4.0.0"
- flutter: ">=3.19.0"
diff --git a/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/pubspec.yaml b/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/pubspec.yaml
index 438cf32344edf3b3c74dbfc7d40c5a525e79d136..36fa7c62461ea9eab411770452484831ab070cd9 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/pubspec.yaml
+++ b/packages/sign_in_with_apple/sign_in_with_apple_platform_interface/pubspec.yaml
@@ -1,11 +1,11 @@
name: sign_in_with_apple_platform_interface
description: A common platform interface for the sign_in_with_apple plugin.
repository: https://github.com/aboutyou/dart_packages/tree/master/packages/sign_in_with_apple/sign_in_with_apple_platform_interface
-version: 1.1.0
+version: 1.0.0
environment:
- sdk: ^3.3.0
- flutter: ">=3.19.0"
+ sdk: ">=2.12.0 <3.0.0"
+ flutter: ">=2.0.0"
dependencies:
flutter:
diff --git a/packages/sign_in_with_apple/sign_in_with_apple_web/CHANGELOG.md b/packages/sign_in_with_apple/sign_in_with_apple_web/CHANGELOG.md
index ce6256cfb9fdc4da310404b45d240ec1c1d908e4..d94de977582e7567131b0ca11e638cfb661a6697 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple_web/CHANGELOG.md
+++ b/packages/sign_in_with_apple/sign_in_with_apple_web/CHANGELOG.md
@@ -1,12 +1,3 @@
-## 2.1.0
-
-- Set min Flutter SDK to 3.19.0
-- Upgrade `sign_in_with_apple_platform_interface` to `1.1.0`
-
-## 2.0.0
-
-- Migrate to package:web
-
## 1.0.1
- Include error code from Apple JS in authentication exception when available.
diff --git a/packages/sign_in_with_apple/sign_in_with_apple_web/Development.md b/packages/sign_in_with_apple/sign_in_with_apple_web/Development.md
index f54f33abb88ded1aee4f6ccc7261c2598bd5140e..dff0446dcfa5109ccf0ad208c08451a87c424816 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple_web/Development.md
+++ b/packages/sign_in_with_apple/sign_in_with_apple_web/Development.md
@@ -28,5 +28,3 @@ sudo nano /etc/hosts
# Now you can finally visit your example page in the browse by executing
open "https://siwa-flutter-plugin.dev/"
```
-
-When using the Glitch example server, the redirect URL parameter must also be set to `https://siwa-flutter-plugin.dev/` for testing the web version.
diff --git a/packages/sign_in_with_apple/sign_in_with_apple_web/lib/sign_in_with_apple_web.dart b/packages/sign_in_with_apple/sign_in_with_apple_web/lib/sign_in_with_apple_web.dart
index 1dd81f4c3106f38f16d66d5b974f92dca48d8012..d0eb6597876e1b76afc0e5804f013379b85bc3ae 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple_web/lib/sign_in_with_apple_web.dart
+++ b/packages/sign_in_with_apple/sign_in_with_apple_web/lib/sign_in_with_apple_web.dart
@@ -2,9 +2,10 @@
library sign_in_with_apple_web;
import 'dart:async';
-import 'dart:js_interop';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
+import 'package:js/js.dart';
+import 'package:js/js_util.dart';
import 'package:sign_in_with_apple_platform_interface/sign_in_with_apple_platform_interface.dart';
/// The web implementation of [SignInWithApplePlatform].
@@ -45,11 +46,11 @@ class SignInWithApplePlugin extends SignInWithApplePlatform {
);
init(options);
- final response = await signIn().toDart;
+ final response = await promiseToFuture(signIn());
return AuthorizationCredentialAppleID(
authorizationCode: response.authorization.code,
- identityToken: response.authorization.idToken,
+ identityToken: response.authorization.id_token,
state: response.authorization.state,
email: response.user?.email,
givenName: response.user?.name?.firstName,
@@ -58,7 +59,7 @@ class SignInWithApplePlugin extends SignInWithApplePlatform {
);
} catch (e) {
// error per https://developer.apple.com/documentation/sign_in_with_apple/signinerrori
- final errorProp = (e as SignInErrorI).error;
+ final errorProp = getProperty(e, 'error');
final errorCode = errorProp is String ? errorProp : 'UNKNOWN_SIWA_ERROR';
throw SignInWithAppleCredentialsException(
@@ -68,7 +69,9 @@ class SignInWithApplePlugin extends SignInWithApplePlatform {
}
}
-extension type SignInWithAppleInitOptions._(JSObject _) implements JSObject {
+@JS()
+@anonymous
+class SignInWithAppleInitOptions {
external String? get clientId;
external String? get scope;
external String? get redirectURI;
@@ -88,39 +91,43 @@ extension type SignInWithAppleInitOptions._(JSObject _) implements JSObject {
}
@JS('console.log')
-external void log(JSAny? o);
+external void log(Object o);
@JS('AppleID.auth.init')
external void init(SignInWithAppleInitOptions options);
@JS('AppleID.auth.signIn')
-external JSPromise signIn();
+external Object /* like Future */ signIn();
/// Sign in with Apple authorization response
///
/// Spec: https://developer.apple.com/documentation/sign_in_with_apple/signinresponsei
-extension type SignInResponseI._(JSObject _) implements JSObject {
+@JS()
+@anonymous
+class SignInResponseI {
external AuthorizationI get authorization;
external UserI? get user;
}
-extension type SignInErrorI._(JSObject _) implements JSObject {
- external String? error;
-}
-
-extension type AuthorizationI._(JSObject _) implements JSObject {
+@JS()
+@anonymous
+class AuthorizationI {
external String get code;
- @JS('id_token')
- external String get idToken;
+ // ignore: non_constant_identifier_names
+ external String get id_token;
external String get state;
}
-extension type UserI._(JSObject _) implements JSObject {
+@JS()
+@anonymous
+class UserI {
external String get email;
external NameI? get name;
}
-extension type NameI._(JSObject _) implements JSObject {
+@JS()
+@anonymous
+class NameI {
external String get firstName;
external String get lastName;
}
diff --git a/packages/sign_in_with_apple/sign_in_with_apple_web/pubspec.lock b/packages/sign_in_with_apple/sign_in_with_apple_web/pubspec.lock
deleted file mode 100644
index 8b46877109dd0f4ee4da6e635918e69df31bb148..0000000000000000000000000000000000000000
--- a/packages/sign_in_with_apple/sign_in_with_apple_web/pubspec.lock
+++ /dev/null
@@ -1,93 +0,0 @@
-# Generated by pub
-# See https://dart.dev/tools/pub/glossary#lockfile
-packages:
- characters:
- dependency: transitive
- description:
- name: characters
- sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
- url: "https://pub.dev"
- source: hosted
- version: "1.3.0"
- collection:
- dependency: transitive
- description:
- name: collection
- sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
- url: "https://pub.dev"
- source: hosted
- version: "1.18.0"
- flutter:
- dependency: "direct main"
- description: flutter
- source: sdk
- version: "0.0.0"
- flutter_lints:
- dependency: "direct dev"
- description:
- name: flutter_lints
- sha256: b543301ad291598523947dc534aaddc5aaad597b709d2426d3a0e0d44c5cb493
- url: "https://pub.dev"
- source: hosted
- version: "1.0.4"
- flutter_web_plugins:
- dependency: "direct main"
- description: flutter
- source: sdk
- version: "0.0.0"
- lints:
- dependency: transitive
- description:
- name: lints
- sha256: a2c3d198cb5ea2e179926622d433331d8b58374ab8f29cdda6e863bd62fd369c
- url: "https://pub.dev"
- source: hosted
- version: "1.0.1"
- material_color_utilities:
- dependency: transitive
- description:
- name: material_color_utilities
- sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
- url: "https://pub.dev"
- source: hosted
- version: "0.8.0"
- meta:
- dependency: transitive
- description:
- name: meta
- sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
- url: "https://pub.dev"
- source: hosted
- version: "1.11.0"
- plugin_platform_interface:
- dependency: transitive
- description:
- name: plugin_platform_interface
- sha256: f843e0027496f0d841166707029237a0bef39cfc0c79b93b1bb1a10beae73244
- url: "https://pub.dev"
- source: hosted
- version: "2.0.2"
- sign_in_with_apple_platform_interface:
- dependency: "direct main"
- description:
- name: sign_in_with_apple_platform_interface
- sha256: c2ef2ce6273fce0c61acd7e9ff5be7181e33d7aa2b66508b39418b786cca2119
- url: "https://pub.dev"
- source: hosted
- version: "1.1.0"
- sky_engine:
- dependency: transitive
- description: flutter
- source: sdk
- version: "0.0.99"
- vector_math:
- dependency: transitive
- description:
- name: vector_math
- sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
- url: "https://pub.dev"
- source: hosted
- version: "2.1.4"
-sdks:
- dart: ">=3.3.0 <4.0.0"
- flutter: ">=3.19.0"
diff --git a/packages/sign_in_with_apple/sign_in_with_apple_web/pubspec.yaml b/packages/sign_in_with_apple/sign_in_with_apple_web/pubspec.yaml
index 1a14f965926756428b3399c184a1f547a09a0353..cb1158d4b6b5c3ac037cb2cbf8377f942f22a5a2 100644
--- a/packages/sign_in_with_apple/sign_in_with_apple_web/pubspec.yaml
+++ b/packages/sign_in_with_apple/sign_in_with_apple_web/pubspec.yaml
@@ -1,11 +1,11 @@
name: sign_in_with_apple_web
description: Platform plugin offering web support for Sign in with Apple plugin for Flutter.
repository: https://github.com/aboutyou/dart_packages/tree/master/packages/sign_in_with_apple/sign_in_with_apple_web
-version: 2.1.0
+version: 1.0.1
environment:
- sdk: ^3.3.0
- flutter: ">=3.19.0"
+ sdk: ">=2.12.0 <3.0.0"
+ flutter: ">=2.0.0"
flutter:
plugin:
@@ -21,7 +21,9 @@ dependencies:
flutter_web_plugins:
sdk: flutter
- sign_in_with_apple_platform_interface: ^1.1.0
+ sign_in_with_apple_platform_interface: ^1.0.0
+
+ js: ^0.6.3
dev_dependencies:
- flutter_lints: ^1.0.4
+ flutter_lints: ^1.0.4
\ No newline at end of file