Skip to content

Commit

Permalink
feat: switch to webview plugins (#33)
Browse files Browse the repository at this point in the history
* Refactor: remove platform specific code

* refactor: move files to src subdirectory

* feat: add file for simpler import

* feat: add parameter class

* refactor: simplify method invocation and prepare for Dart plugins

* feat: add desktop plugin for windows and linux

* feat: add mobile plugin for android, ios and macos

* fix: add exceptions to library import file

* feat: update dependencies

* feat: add exception classes

* fix: update testing stubs

* fix: update readme

* fix: add missing platforms to readme
  • Loading branch information
fischermario committed Oct 15, 2023
1 parent c870116 commit 14dfbb4
Show file tree
Hide file tree
Showing 30 changed files with 698 additions and 743 deletions.
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

0 comments on commit 14dfbb4

Please sign in to comment.