Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: switch to webview plugins #33

Merged
merged 13 commits into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ The following platforms are supported:

- Android
- iOS
- Linux
- macOS
- Web
- Windows

| **Android** | **iOS** | **Web** |
| ------------------------------ | ---------------------- | ---------------------- |
Expand Down Expand Up @@ -103,24 +105,27 @@ dependencies:
casdoor_flutter_sdk: ^1.0.0
```

Note here that for Android and Web
Notes for different platforms:

## Android and iOS

Please check the [documentation](https://inappwebview.dev/docs/intro) of the InAppWebView package for more details.

## Android

In order to capture the callback url, the following activity needs to be added to your AndroidManifest.xml. Be sure to relpace YOUR_CALLBACK_URL_SCHEME_HERE with your actual callback url scheme.
Increase the SDK version in `android/app/build.gradle` to 34:

```
<activity android:name="com.example.casdoor_flutter_sdk.CallbackActivity"
android:exported="true">
<intent-filter android:label="casdoor_flutter_sdk">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="casdoor" />
</intent-filter>
</activity>
...
android {
compileSdkVersion 34
...
```

## Windows and Linux

Please check the [documentation](https://pub.dev/packages/desktop_webview_window) of the desktop_webview_window package for more details.

## Web

On the Web platform an endpoint needs to be created that captures the callback URL and sends it to the application using the JavaScript postMessage() method. In the ./web folder of the project, create an HTML file with the name e.g. callback.html with content:
Expand Down Expand Up @@ -157,12 +162,18 @@ getSignupUrl(enablePassword)
getSigninUrl()
```

#### Get code
#### Get code in a new window (all platforms)

```typescript
show()
```

#### Get code inside the app (Android and iOS)

```typescript
showFullscreen()
```

#### Get token

```typescript
Expand Down
9 changes: 0 additions & 9 deletions android/.gitignore

This file was deleted.

51 changes: 0 additions & 51 deletions android/build.gradle

This file was deleted.

1 change: 0 additions & 1 deletion android/settings.gradle

This file was deleted.

3 changes: 0 additions & 3 deletions android/src/main/AndroidManifest.xml

This file was deleted.

This file was deleted.

38 changes: 0 additions & 38 deletions ios/.gitignore

This file was deleted.

Empty file removed ios/Assets/.gitkeep
Empty file.
18 changes: 0 additions & 18 deletions ios/Classes/CasdoorFlutterSdkPlugin.h

This file was deleted.

29 changes: 0 additions & 29 deletions ios/Classes/CasdoorFlutterSdkPlugin.m

This file was deleted.

Loading
Loading