Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
flutter_jdsdk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李增强
flutter_jdsdk
Commits
db3cb48d
Commit
db3cb48d
authored
Aug 02, 2021
by
汪林玲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
统一插件
parent
3c95241b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
54 deletions
+15
-54
example/pubspec.yaml
example/pubspec.yaml
+1
-1
ios/Classes/JdsdkPlugin.m
ios/Classes/JdsdkPlugin.m
+5
-5
lib/jdsdk.dart
lib/jdsdk.dart
+5
-7
pubspec.yaml
pubspec.yaml
+4
-41
No files found.
example/pubspec.yaml
View file @
db3cb48d
...
@@ -3,7 +3,7 @@ description: Demonstrates how to use the jdsdk plugin.
...
@@ -3,7 +3,7 @@ description: Demonstrates how to use the jdsdk plugin.
publish_to
:
'
none'
publish_to
:
'
none'
environment
:
environment
:
sdk
:
"
>=2.
1
.0
<3.0.0"
sdk
:
"
>=2.
8
.0
<3.0.0"
dependencies
:
dependencies
:
flutter
:
flutter
:
...
...
ios/Classes/JdsdkPlugin.m
View file @
db3cb48d
...
@@ -16,21 +16,21 @@
...
@@ -16,21 +16,21 @@
NSString
*
appKey
=
call
.
arguments
[
@"appKey"
];
NSString
*
appKey
=
call
.
arguments
[
@"appKey"
];
NSString
*
appSecret
=
call
.
arguments
[
@"appSecret"
];
NSString
*
appSecret
=
call
.
arguments
[
@"appSecret"
];
[[
KeplerApiManager
sharedKPService
]
asyncInitSdk
:
appKey
secretKey
:
appSecret
sucessCallback
:^
(){
[[
KeplerApiManager
sharedKPService
]
asyncInitSdk
:
appKey
secretKey
:
appSecret
sucessCallback
:^
(){
result
(
@
"{status:1}"
);
result
(@
{
@"errorCode"
:
@"0"
,
@"errorMessage"
:
@"成功"
,
@"data"
:
@{}}
);
}
failedCallback
:^
(
NSError
*
error
){
}
failedCallback
:^
(
NSError
*
error
){
result
(
@
"{status:0}"
);
result
(@
{
@"errorCode"
:
@"-1"
,
@"errorMessage"
:
@"初始化失败"
,
@"data"
:
@{}}
);
}];
}];
}
else
if
([
@"openUrl"
isEqualToString
:
call
.
method
]){
}
else
if
([
@"openUrl"
isEqualToString
:
call
.
method
]){
NSString
*
url
=
call
.
arguments
[
@"url"
];
NSString
*
url
=
call
.
arguments
[
@"url"
];
//判断是否安装京东app
//判断是否安装京东app
if
([[
UIApplication
sharedApplication
]
canOpenURL
:[
NSURL
URLWithString
:[
NSString
stringWithFormat
:
@"openapp.jdmobile://"
]]])
{
if
([[
UIApplication
sharedApplication
]
canOpenURL
:[
NSURL
URLWithString
:[
NSString
stringWithFormat
:
@"openapp.jdmobile://"
]]])
{
[[
KeplerApiManager
sharedKPService
]
openKeplerPageWithURL
:
url
userInfo
:
nil
successCallback
:^
{
[[
KeplerApiManager
sharedKPService
]
openKeplerPageWithURL
:
url
userInfo
:
nil
successCallback
:^
{
result
(
@
"{status:1}"
);
result
(
@
YES
);
}
failedCallback
:^
(
NSInteger
code
,
NSString
*
_Nonnull
url
)
{
}
failedCallback
:^
(
NSInteger
code
,
NSString
*
_Nonnull
url
)
{
result
(
@
"{status:0}"
);
result
(
@
NO
);
}];
}];
}
else
{
}
else
{
result
(
@
"{status:0}"
);
result
(
@
NO
);
}
}
}
else
{
}
else
{
result
(
FlutterMethodNotImplemented
);
result
(
FlutterMethodNotImplemented
);
...
...
lib/jdsdk.dart
View file @
db3cb48d
...
@@ -4,16 +4,14 @@ import 'package:flutter/services.dart';
...
@@ -4,16 +4,14 @@ import 'package:flutter/services.dart';
class
Jdsdk
{
class
Jdsdk
{
static
const
MethodChannel
_channel
=
const
MethodChannel
(
'jdsdk'
);
static
const
MethodChannel
_channel
=
const
MethodChannel
(
'jdsdk'
);
///
///
/// 初始化京东sdk
/// 初始化京东sdk
/// [appKey] appKey
/// [appKey] appKey
/// [appSecret] app密钥
/// [appSecret] app密钥
///
///
static
Future
<
String
>
init
(
static
Future
<
Map
<
String
,
dynamic
>>
init
({
@required
String
appKey
,
@required
String
appSecret
})
async
{
{
@required
String
appKey
,
@required
String
appSecret
})
async
{
final
Map
<
String
,
dynamic
>
version
=
await
_channel
.
invokeMethod
(
'init'
,
{
"appKey"
:
appKey
,
"appSecret"
:
appSecret
});
final
String
version
=
await
_channel
.
invokeMethod
(
'init'
,
{
"appKey"
:
appKey
,
"appSecret"
:
appSecret
});
return
version
;
return
version
;
}
}
...
@@ -21,8 +19,8 @@ class Jdsdk {
...
@@ -21,8 +19,8 @@ class Jdsdk {
/// 打开京东的任意URL
/// 打开京东的任意URL
/// [url] 待打开的url地址
/// [url] 待打开的url地址
///
///
static
Future
<
String
>
openUrl
({
@required
String
url
})
async
{
static
Future
<
bool
>
openUrl
({
@required
String
url
})
async
{
final
String
version
=
await
_channel
.
invokeMethod
(
'openUrl'
,
{
"url"
:
url
});
final
bool
version
=
await
_channel
.
invokeMethod
(
'openUrl'
,
{
"url"
:
url
});
return
version
;
return
version
;
}
}
}
}
pubspec.yaml
View file @
db3cb48d
...
@@ -4,8 +4,10 @@ version: 0.0.1
...
@@ -4,8 +4,10 @@ version: 0.0.1
author
:
wuchaowen <chaowen1110@gmail.com>
author
:
wuchaowen <chaowen1110@gmail.com>
homepage
:
https://github.com/selfimgr/flutter_jdsdk.git
homepage
:
https://github.com/selfimgr/flutter_jdsdk.git
publish_to
:
'
none'
environment
:
environment
:
sdk
:
"
>=2.
1
.0
<3.0.0"
sdk
:
"
>=2.
8
.0
<3.0.0"
dependencies
:
dependencies
:
flutter
:
flutter
:
...
@@ -15,46 +17,7 @@ dev_dependencies:
...
@@ -15,46 +17,7 @@ dev_dependencies:
flutter_test
:
flutter_test
:
sdk
:
flutter
sdk
:
flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter
:
flutter
:
# This section identifies this Flutter project as a plugin project.
# The androidPackage and pluginClass identifiers should not ordinarily
# be modified. They are used by the tooling to maintain consistency when
# adding or updating assets for this project.
plugin
:
plugin
:
androidPackage
:
com.jd.jdsdk
androidPackage
:
com.jd.jdsdk
pluginClass
:
JdsdkPlugin
pluginClass
:
JdsdkPlugin
\ No newline at end of file
# To add assets to your plugin package, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
#
# For details regarding assets in packages, see
# https://flutter.dev/assets-and-images/#from-packages
#
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# To add custom fonts to your plugin package, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts in packages, see
# https://flutter.dev/custom-fonts/#from-packages
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment