Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-api
提交
41917372
U
uni-api
项目概览
DCloud
/
uni-api
通知
677
Star
23
Fork
12
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-api
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
41917372
编写于
3月 29, 2023
作者:
杜庆泉
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复 getWifilIST 可能多次回调的问题
上级
06350ede
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
35 deletion
+45
-35
pages/index/index.vue
pages/index/index.vue
+21
-18
uni_modules/uni-wifi/utssdk/app-android/config.json
uni_modules/uni-wifi/utssdk/app-android/config.json
+3
-0
uni_modules/uni-wifi/utssdk/app-android/index.uts
uni_modules/uni-wifi/utssdk/app-android/index.uts
+21
-17
未找到文件。
pages/index/index.vue
浏览文件 @
41917372
...
@@ -31,7 +31,8 @@
...
@@ -31,7 +31,8 @@
memListener
:
null
,
memListener
:
null
,
setUserCaptureScreenFlag
:
false
,
setUserCaptureScreenFlag
:
false
,
setUserCaptureScreenText
:
'
禁止截屏
'
,
setUserCaptureScreenText
:
'
禁止截屏
'
,
permissionGranted
:
false
permissionGranted
:
false
,
id
:
0
}
}
},
},
onLoad
()
{
onLoad
()
{
...
@@ -45,23 +46,25 @@
...
@@ -45,23 +46,25 @@
console
.
log
(
res
)
console
.
log
(
res
)
},
},
onGetWifiList2_assert0
()
{
onGetWifiList2_assert0
()
{
const
fn
=
res
=>
console
.
log
(
'
onGetWifiList res
'
,
res
)
console
.
log
(
"
------- onGetWifiList2_assert0:
"
,
this
.
id
);
uni
.
startWifi
({
success
(){
const
fn
=
res
=>
console
.
log
(
'
onGetWifiList res
'
,
res
)
uni
.
onGetWifiList
(
fn
)
uni
.
startWifi
({
success
(){
uni
.
getWifiList
({
uni
.
onGetWifiList
(
fn
)
success
()
{
uni
.
getWifiList
({
console
.
log
(
'
getWifiList success
'
);
success
()
{
uni
.
offGetWifiList
(
fn
)
console
.
log
(
'
getWifiList success
'
);
uni
.
stopWifi
({
uni
.
offGetWifiList
(
fn
)
success
()
{},
uni
.
stopWifi
({
fail
(
e
)
{
success
()
{},
console
.
log
(
"
stopWifi fail:
"
,
e
);
fail
(
e
)
{
}
console
.
log
(
"
stopWifi fail:
"
,
e
);
})
}
}
})
})
}
}})
})
},
}})
this
.
id
++
},
testConnnectWifi
(){
testConnnectWifi
(){
...
...
uni_modules/uni-wifi/utssdk/app-android/config.json
0 → 100644
浏览文件 @
41917372
{
"minSdkVersion"
:
"19"
}
\ No newline at end of file
uni_modules/uni-wifi/utssdk/app-android/index.uts
浏览文件 @
41917372
...
@@ -306,17 +306,8 @@ class CustomBroadcastReceiver extends BroadcastReceiver {
...
@@ -306,17 +306,8 @@ class CustomBroadcastReceiver extends BroadcastReceiver {
if (intent.action == WifiManager.SCAN_RESULTS_AVAILABLE_ACTION) {
if (intent.action == WifiManager.SCAN_RESULTS_AVAILABLE_ACTION) {
startWifiScaning = false;
startWifiScaning = false;
let ret : UniWifiResult = {
errCode: 0,
errSubject: "uni-getWifiList",
errMsg: "getWifiList:ok"
}
if(Global.supendGetWifiSuccess != null){
Global.supendGetWifiSuccess?.(ret)
}
if(Global.supendGetWifiComplete != null){
Global.supendGetWifiComplete?.(ret)
}
// wifi 扫描结果回调
// wifi 扫描结果回调
let results = this.mWifiManager!.scanResults;
let results = this.mWifiManager!.scanResults;
...
@@ -336,15 +327,27 @@ class CustomBroadcastReceiver extends BroadcastReceiver {
...
@@ -336,15 +327,27 @@ class CustomBroadcastReceiver extends BroadcastReceiver {
const data = new JSONObject();
const data = new JSONObject();
data["wifiList"] = Global.scanList
data["wifiList"] = Global.scanList
Global.onGetWifiListCallback?.(data);
Global.onGetWifiListCallback?.(data);
/**
* 确保onGetWifiList 只会被执行一次
*/
Global.onGetWifiListCallback = null
}
}
// for (let perCallback in Global.onGetWifiListCallback) {
// const data = new JSONObject();
// data["wifiList"] = Global.scanList
// perCallback(data);
// }
}
}
let ret : UniWifiResult = {
errCode: 0,
errSubject: "uni-getWifiList",
errMsg: "getWifiList:ok"
}
if(Global.supendGetWifiSuccess != null){
Global.supendGetWifiSuccess?.(ret)
Global.supendGetWifiSuccess = null
}
if(Global.supendGetWifiComplete != null){
Global.supendGetWifiComplete?.(ret)
Global.supendGetWifiComplete = null
}
}
}
}
}
...
@@ -845,4 +848,5 @@ export function getConnectedWifi(option : GetConnectedWifiOptions) {
...
@@ -845,4 +848,5 @@ export function getConnectedWifi(option : GetConnectedWifiOptions) {
}
}
option.fail?.(res)
option.fail?.(res)
option.complete?.(res)
option.complete?.(res)
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录