Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-api
提交
fac7d96b
U
uni-api
项目概览
DCloud
/
uni-api
通知
720
Star
25
Fork
17
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
2
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-api
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
fac7d96b
编写于
11月 30, 2022
作者:
杜庆泉
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of
https://gitcode.net/dcloud/uni-api
into dev
上级
23c87d0a
eba92949
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
63 addition
and
26 deletion
+63
-26
pages/index/index.vue
pages/index/index.vue
+12
-4
uni_modules/uni-memorywarning/changelog.md
uni_modules/uni-memorywarning/changelog.md
+5
-2
uni_modules/uni-memorywarning/package.json
uni_modules/uni-memorywarning/package.json
+2
-2
uni_modules/uni-wifi/utssdk/app-ios/index.uts
uni_modules/uni-wifi/utssdk/app-ios/index.uts
+44
-18
未找到文件。
pages/index/index.vue
浏览文件 @
fac7d96b
...
...
@@ -50,10 +50,18 @@
partialInfo
:
false
,
complete
:(
res
)
=>
{
console
.
log
(
res
);
uni
.
showToast
({
icon
:
'
none
'
,
title
:
res
.
wifi
.
SSID
})
if
(
res
.
errCode
==
0
)
{
uni
.
showToast
({
icon
:
'
none
'
,
title
:
res
.
wifi
.
SSID
})
}
else
{
uni
.
showToast
({
icon
:
'
none
'
,
title
:
res
.
errMsg
})
}
}
});
},
...
...
uni_modules/uni-memorywarning/changelog.md
浏览文件 @
fac7d96b
## 1.0.0(2022-11-12)
支持内存警告监听功能
## 1.1.0(2022-11-30)
实现iOS平台内存警告监听
## 1.0.0(2022-11-12)
实现Android平台内存警告监听功能
uni_modules/uni-memorywarning/package.json
浏览文件 @
fac7d96b
{
"id"
:
"uni-memorywarning"
,
"displayName"
:
"uni-MemoryWarning"
,
"version"
:
"1.
0
.0"
,
"version"
:
"1.
1
.0"
,
"description"
:
"UTS 实现内存警告监听"
,
"keywords"
:
[
"onMemoryWarning"
],
"repository"
:
""
,
"engines"
:
{
"HBuilderX"
:
"^3.6.
9
"
"HBuilderX"
:
"^3.6.
11
"
},
"dcloudext"
:
{
"type"
:
"uts"
,
...
...
uni_modules/uni-wifi/utssdk/app-ios/index.uts
浏览文件 @
fac7d96b
...
...
@@ -149,6 +149,7 @@ function fetchConnectedWifiWithLocationPromise(option: GetConnectedWifiOptions)
let bssid = BSSID! as string
wifiInfo.SSID = ssid
wifiInfo.BSSID = bssid
wifiInfo.secure = false
wifiInfo.signalStrength = 0
wifiInfo.frequency = 0
break;
...
...
@@ -177,7 +178,12 @@ function fetchConnectedWifiWithLocationPromise(option: GetConnectedWifiOptions)
/*
* 保存全局数据信息
*/
class GloabInfo {
static alreadyStartWifi: boolean
}
/* =================================== 对外暴露的接口 ==============================================*/
...
...
@@ -187,11 +193,12 @@ function fetchConnectedWifiWithLocationPromise(option: GetConnectedWifiOptions)
* 初始化wifi模块
*/
export function startWifi(option: WifiOption) {
GloabInfo.alreadyStartWifi = true
let res = {
errCode:
12001
,
errMsg: "s
ystem not support
"
errCode:
0
,
errMsg: "s
tartWifi: ok
"
}
option.
fail
?.(res)
option.
success
?.(res)
option.complete?.(res)
}
...
...
@@ -199,6 +206,7 @@ export function startWifi(option: WifiOption) {
* 停止wifi模块
*/
export function stopWifi() {
GloabInfo.alreadyStartWifi = false
LocationPromiseService.promiseCompletionHandler = []
}
...
...
@@ -233,21 +241,39 @@ export function offGetWifiList(callback: UTSCallback) {
* 获取当前连接的wifi信息
*/
export function getConnectedWifi(option: GetConnectedWifiOptions) {
if (UIDevice.current.systemVersion >= "13.0") {
requestLocationPromise((success) => {
if (success == true) {
fetchConnectedWifiWithLocationPromise(option)
}else {
let res = {
errCode: 12010,
errMsg: "have no location promise"
}
option.fail?.(res)
option.complete?.(res)
}
})
let wifiInfo = new UniWifiInfo()
wifiInfo.SSID = ""
wifiInfo.BSSID = ""
wifiInfo.secure = false
wifiInfo.signalStrength = 0
wifiInfo.frequency = 0
if (GloabInfo.alreadyStartWifi == false) {
let res = {
errCode: 12000,
errMsg: "not invoke startWifi",
wifi: wifiInfo
}
option.fail?.(res)
option.complete?.(res)
} else{
fetchConnectedWifiWithLocationPromise(option)
if (UIDevice.current.systemVersion >= "13.0") {
requestLocationPromise((success) => {
if (success == true) {
fetchConnectedWifiWithLocationPromise(option)
}else {
let res = {
errCode: 12010,
errMsg: "have no location promise",
wifi: wifiInfo
}
option.fail?.(res)
option.complete?.(res)
}
})
} else{
fetchConnectedWifiWithLocationPromise(option)
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录