wepin_flutter

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

wepin flutter

wepin-flutter-sdk #
Wepin Flutter SDK for Android OS and iOS

⏩ Get App ID and Key #
Contact to wepin.contact@iotrust.kr
⏩ Install #
wepin-flutter-sdk #
Add a dependency 'wepin_flutter' in your pubspec.yaml file.
dependencies:
wepin_flutter: ^0.0.4
copied to clipboard
or
flutter pub add wepin_flutter
copied to clipboard
⏩ Add Permission for Android #
Add the below line in your app's AndroidMainfest.xml file
<uses-permission android:name="android.permission.INTERNET" />
copied to clipboard
⏩ Config Deep Link #
Deep link scheme format: 'wepin.' + Your App ID
For Android #
Add the below line in your app's AndroidMainfest.xml file
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!--For Deep Link => Urlscheme Format : wepin. + appID-->
<data
android:scheme="wepin.88889999000000000000000000000000"
/>
</intent-filter>
</activity>
copied to clipboard
For iOS #
Add the URL scheme as below:

Open your iOS project with the xcode
Click on Project Navigator
Select Target Project in Targets
Select Info Tab
Click the '+' buttons on URL Types
Enter Identifier and URL Schemes

Idenetifier: bundle id of your project
URL Schems: 'wepin.' + Your App ID




⏩ Import SDK #
import 'package:wepin_flutter/wepin.dart';
import 'package:wepin_flutter/wepin_inputs.dart';
import 'package:wepin_flutter/wepin_outputs.dart';
copied to clipboard
⏩ Initialize #

Create Wepin instance

Wepin _wepin = Wepin();
copied to clipboard

Add method in your app's 'initState()' for Handing Deeplink

import 'package:uni_links/uni_links.dart';
....

class _SampleApp extends State<SampleApp> {
StreamSubscription? _sub;
final String _appId = 'test_app_id';
final String _appSdkKey =
'test_app_key';

@override
void initState() {
if (kDebugMode) {
print('initState');
}
super.initState();

_wepin = Wepin();
_handleDeepLink();
}
....

// Handle incoming links - the ones that the app will recieve from the OS
// while already started.

void _handleDeepLink() {
if (kDebugMode) {
print('_handleDeepLink');
}
if (!kIsWeb) {
// It will handle app links while the app is already started - be it in
// the foreground or in the background.
_sub = uriLinkStream.listen((Uri? uri) {
if (!mounted) return;
if (kDebugMode) {
print('got_uri: $uri');
}
_wepin.handleWepinLink(uri!);
}, onError: (Object err) {
if (!mounted) return;
if (kDebugMode) {
print('got_err: $err');
}
});
}
}
copied to clipboard
⏩ Methods #
Methods of Wepin SDK.
Initialize #
Future<void> initialize(BuildContext appContext, WepinOptions wepinOptions)
copied to clipboard
This method initializing Wepin SDK.
Parameters

appContext <BuildContext> : context of your app
wepinOptions <WepinOptions>

appId <String>
appKey <String>
widgetAttributes <WidgetAttributes>

defaultLanguage
defaultCurrency





Example
WidgetAttributes widgetAttributes = WidgetAttributes('ko', 'krw');
WepinOptions wepinOptions =
WepinOptions(_appId, _appSdkKey, widgetAttributes);
_wepin.initialize(context, wepinOptions)
copied to clipboard
isInitialized #
bool isInitialized()
copied to clipboard
This method checks Wepin SDK is initialized.
Example
_wepin.isInitialized()
copied to clipboard
Return value

<bool>

true if Wepin SDK is already initialized.



openWidget #
void openWidget()
copied to clipboard
This method shows Wepin widget
Example
_wepin.openWidget()
copied to clipboard
closeWidget #
void closeWidget()
copied to clipboard
This method closes Wepin widget.
Example
_wepin.closeWidget()
copied to clipboard
getAccounts #
List<Account>? getAccounts()
copied to clipboard
This method returns user's accounts.
Example
_wepin.getAccounts()
copied to clipboard
Return value


If user is logged in, it returns list of user's account

account <Account>

network <dynamic>
address <dynamic>





If user is not logged in, it returns null


finalize #
void finalize()
copied to clipboard
This method finalize Wepin widget.
Example
_wepin.finalize()
copied to clipboard
getStatus (Support from version 0.0.4-alpha) #
Future<String> getStatus()
copied to clipboard
The method returns lifecycle of wepin.
Example
await _wepin.getStatus()
copied to clipboard
Return value

WepinLifeCycle

not_initialized: if wepin is not initialized
initializing: if wepin is initializing
initialized: if wepin is initialized
before_login: if wepin is initialized but the user is not logged in
login: if the user is logged in



login (Support from version 0.0.4-alpha) #
Future<WepinUser> login()
copied to clipboard
This method returns information of the logged-in user. If a user is not logged in, Wepin widget will show login page.
Example
await _wepin.login()
copied to clipboard
Return value

WepinUser

status <String> <'success'|'fail'>
UserInfo?

userId <dynamic>
email <dynamic>
provider <dynamic> <'google'|'apple'|'email'|'naver'|'discord'|'external_token'>





getSignForLogin (Support from version 0.0.4-alpha) #
This method signs the idToken received after logging in with OAuth using a PrivateKey.
String getSignForLogin(String privKey, String idToken)
copied to clipboard
Example
_wepin.getSignForLogin(_testPrivKey, _testIdToken);
copied to clipboard
Parameters

privKey
idToken

Return value

signned token

Please inquire about the issuance of a private key by contacting wepin.contact@iotrust.kr #
loginWithExternalToken (Support from version 0.0.4-alpha) #
This method logs in to the Wepin with external token(e.g., idToken).
Future<WepinUser> loginWithExternalToken(String idToken, String sign)
copied to clipboard
Example
await _wepin.loginWithExternalToken(_testIdToken, _testSignedIdToken)
copied to clipboard
Parameters

idToken
sign

Return value

WepinUser

status <String> <'success'|'fail'>
UserInfo?

userId <dynamic>
email <dynamic>
provider <dynamic> <'google'|'apple'|'email'|'naver'|'discord'|'external_token'>





logout (Support from version 0.0.4-alpha) #
This method logs out from the Wepin
Future<void> logout()
copied to clipboard
Example
await _wepin.logout()
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.