提交 d353435d 编写于 作者: taohebin@dcloud.io's avatar taohebin@dcloud.io

Merge branch 'dev' into alpha

export type uni = {
/**
* createNotificationProgress()
* @description
* 创建通知栏下载进度消息
* @param {CreateNotificationProgressOptions}
* @return {void}
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "4.4",
* "uniVer": "3.9+",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* }
* @example
```typescript
uni.createNotificationProgress({
title: "正在下载升级包",
content: "进度 50%",
progress: 50,
onClick:()=>{
console.log("正在下载");
}
}
```
*/
createNotificationProgress : (options : CreateNotificationProgressOptions) => void,
/**
* finishNotificationProgress()
* @description
* 通知栏显示下载完成,并且传入点击通知栏消息的回调。
* @param {FinishNotificationProgressOptions}
* @return {void}
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "4.4",
* "uniVer": "3.9+",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* }
* @example
```typescript
uni.finishNotificationProgress({
title: "安装升级包",
content: "下载完成。",
onClick: () => {
uni.installApk({
filePath: e.tempFilePath,
complete(res) {
console.log(res);
}
})
}
}
```
*/
finishNotificationProgress : (options: FinishNotificationProgressOptions) => void,
/**
* cancelNotificationProgress()
* @description
* 取消通知消息显示
* @param {void}
* @return {void}
* @uniPlatform {
* "app": {
* "android": {
* "osVer": "4.4",
* "uniVer": "3.9+",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* }
* @example
```typescript
uni.cancelNotificationProgress()
```
*/
cancelNotificationProgress : () => void
}
export type CreateNotificationProgressOptions = {
/**
* 通知标题
* @defaultValue 应用名称
*/
title ?: string | null
/**
* 通知内容
*/
content : string,
/**
* 进度
*/
progress : number,
/**
* 点击通知消息回调
* @defaultValue null
*/
onClick? : (() => void) | null
}
export type FinishNotificationProgressOptions = {
/**
* 通知标题
* @defaultValue 应用名称
*/
title ?: string | null
/**
* 通知内容
*/
content : string,
/**
* 点击通知消息回调
*/
onClick : () => void
}
export type CreateNotificationProgress = (options : CreateNotificationProgressOptions) => void;
export type CancelNotificationProgress = () => void;
export type FinishNotificationProgress = (options: FinishNotificationProgressOptions) => void
\ No newline at end of file
## 1.0.7(2023-12-11)
去除无用代码
## 1.0.6(2023-12-11)
修改文档
## 1.0.5(2023-12-11)
1.修改插件名称
2.修改插件引入方式为import导入
## 1.0.4(2023-11-30) ## 1.0.4(2023-11-30)
1. createNotificationProgress增加`onClick`回调 1. createNotificationProgress增加`onClick`回调
2.修复在小米部分系统上,通知消息会归类于不重要通知的bug 2.修复在小米部分系统上,通知消息会归类于不重要通知的bug
......
{ {
"id": "uni-progress-notification", "id": "uts-progressNotification",
"displayName": "uni-progress-notification", "displayName": "uts-progressNotification",
"version": "1.0.4", "version": "1.0.7",
"description": "uni-progress-notification", "description": "uts-progressNotification",
"keywords": [ "keywords": [
"uni-progress-notification" "uts-progressNotification"
], ],
"repository": "", "repository": "",
"engines": { "engines": {
...@@ -32,34 +32,6 @@ ...@@ -32,34 +32,6 @@
}, },
"uni_modules": { "uni_modules": {
"dependencies": [], "dependencies": [],
"uni-ext-api": {
"uni": {
"createNotificationProgress": {
"name": "createNotificationProgress",
"app": {
"js": true,
"kotlin": true,
"swift": false
}
},
"finishNotificationProgress": {
"name": "finishNotificationProgress",
"app": {
"js": true,
"kotlin": true,
"swift": false
}
},
"cancelNotificationProgress": {
"name": "cancelNotificationProgress",
"app": {
"js": true,
"kotlin": true,
"swift": false
}
}
}
},
"encrypt": [], "encrypt": [],
"platforms": { "platforms": {
"cloud": { "cloud": {
...@@ -108,4 +80,4 @@ ...@@ -108,4 +80,4 @@
} }
} }
} }
} }
\ No newline at end of file
# uni-download-notification # uts-progressNotification
## 使用说明 ## 使用说明
Android平台创建显示进度的通知栏消息 Android平台创建显示进度的通知栏消息
**注意: 需要自定义基座,否则点击通知栏消息不会拉起应用** **注意: 需要自定义基座,否则点击通知栏消息不会拉起应用**
### uni.createNotificationProgress(options : CreateNotificationProgressOptions) : void, ### 导入
需要import导入插件
### createNotificationProgress(options : CreateNotificationProgressOptions) : void,
创建显示进度的通知栏消息 创建显示进度的通知栏消息
...@@ -35,7 +39,7 @@ export type CreateNotificationProgressOptions = { ...@@ -35,7 +39,7 @@ export type CreateNotificationProgressOptions = {
} }
``` ```
### uni.finishNotificationProgress(options: FinishNotificationProgressOptions) : void ### finishNotificationProgress(options: FinishNotificationProgressOptions) : void
完成时调用的API,比如下载完成后需要显示下载完成并隐藏进度时调用。 完成时调用的API,比如下载完成后需要显示下载完成并隐藏进度时调用。
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="uts.sdk.modules.uniPush"> package="uts.sdk.modules.utsProgressNotification">
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<application> <application>
<activity android:name="uts.sdk.modules.uniProgressNotification.TransparentActivity" <activity android:name="uts.sdk.modules.utsProgressNotification.TransparentActivity"
android:theme="@style/DCNotificationProgressTranslucentTheme" android:hardwareAccelerated="true" android:theme="@style/DCNotificationProgressTranslucentTheme" android:hardwareAccelerated="true"
android:screenOrientation="user" android:exported="true"> android:screenOrientation="user" android:exported="true">
</activity> </activity>
</application> </application>
</manifest> </manifest>
\ No newline at end of file
...@@ -15,7 +15,7 @@ export class TransparentActivity extends Activity { ...@@ -15,7 +15,7 @@ export class TransparentActivity extends Activity {
override onCreate(savedInstanceState : Bundle | null) { override onCreate(savedInstanceState : Bundle | null) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
this.fullScreen(this) this.fullScreen(this)
const action = this.getIntent().getAction() const action = this.getIntent().getAction()
if (action == ACTION_DOWNLOAD_FINISH) { if (action == ACTION_DOWNLOAD_FINISH) {
setTimeout(() => { setTimeout(() => {
......
...@@ -111,7 +111,7 @@ function reset() { ...@@ -111,7 +111,7 @@ function reset() {
function createPendingIntent(context : Context, action : string) : PendingIntent { function createPendingIntent(context : Context, action : string) : PendingIntent {
const i = new Intent(action); const i = new Intent(action);
i.setComponent(new ComponentName(context.getPackageName(), "uts.sdk.modules.uniProgressNotification.TransparentActivity")); i.setComponent(new ComponentName(context.getPackageName(), "uts.sdk.modules.utsProgressNotification.TransparentActivity"));
let flags = PendingIntent.FLAG_ONE_SHOT; let flags = PendingIntent.FLAG_ONE_SHOT;
if (Build.VERSION.SDK_INT >= 23) { if (Build.VERSION.SDK_INT >= 23) {
flags = PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE; flags = PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE;
......
export type CreateNotificationProgressOptions = {
/**
* 通知标题
* @defaultValue 应用名称
*/
title ?: string | null
/**
* 通知内容
*/
content : string,
/**
* 进度
*/
progress : number,
/**
* 点击通知消息回调
* @defaultValue null
*/
onClick? : (() => void) | null
}
export type FinishNotificationProgressOptions = {
/**
* 通知标题
* @defaultValue 应用名称
*/
title ?: string | null
/**
* 通知内容
*/
content : string,
/**
* 点击通知消息回调
*/
onClick : () => void
}
export type CreateNotificationProgress = (options : CreateNotificationProgressOptions) => void;
export type CancelNotificationProgress = () => void;
export type FinishNotificationProgress = (options: FinishNotificationProgressOptions) => void
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册