Commit 0de9dac8 authored by wangqinghua's avatar wangqinghua

plugin

parent 4680eda7
......@@ -3,6 +3,7 @@
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/platforms" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
<excludeFolder url="file://$MODULE_DIR$/www" />
......
......@@ -82,4 +82,11 @@
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^3.0.0" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
<plugin name="cordova-plugin-app-version" spclearec="^0.1.9" />
<plugin name="cordova-plugin-badge" spec="^0.8.8" />
<plugin name="cordova-plugin-file" spec="^6.0.1" />
<plugin name="cordova-plugin-file-opener2" spec="^2.2.0">
<variable name="ANDROID_SUPPORT_V4_VERSION" value="27.+" />
</plugin>
<plugin name="cordova-plugin-file-transfer" spec="^1.7.1" />
</widget>
......@@ -738,6 +738,21 @@
}
}
},
"@ionic-native/app-version": {
"version": "5.4.0",
"resolved": "http://r.cnpmjs.org/@ionic-native/app-version/download/@ionic-native/app-version-5.4.0.tgz",
"integrity": "sha1-meB4vvfp5Uc+Gx6vDxT2AqDohBA=",
"requires": {
"@types/cordova": "^0.0.34"
},
"dependencies": {
"@types/cordova": {
"version": "0.0.34",
"resolved": "http://r.cnpmjs.org/@types/cordova/download/@types/cordova-0.0.34.tgz",
"integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ="
}
}
},
"@ionic-native/core": {
"version": "5.4.0",
"resolved": "http://r.cnpmjs.org/@ionic-native/core/download/@ionic-native/core-5.4.0.tgz",
......@@ -776,6 +791,21 @@
}
}
},
"@ionic-native/file-transfer": {
"version": "5.4.0",
"resolved": "http://r.cnpmjs.org/@ionic-native/file-transfer/download/@ionic-native/file-transfer-5.4.0.tgz",
"integrity": "sha1-77as+/YyBgAJRWJiROJo3IY0Q90=",
"requires": {
"@types/cordova": "^0.0.34"
},
"dependencies": {
"@types/cordova": {
"version": "0.0.34",
"resolved": "http://r.cnpmjs.org/@types/cordova/download/@types/cordova-0.0.34.tgz",
"integrity": "sha1-6nrd907Ow9dimCegw54smt3HPQQ="
}
}
},
"@ionic-native/splash-screen": {
"version": "5.4.0",
"resolved": "http://r.cnpmjs.org/@ionic-native/splash-screen/download/@ionic-native/splash-screen-5.4.0.tgz",
......@@ -2791,6 +2821,11 @@
}
}
},
"cordova-plugin-app-version": {
"version": "0.1.9",
"resolved": "http://r.cnpmjs.org/cordova-plugin-app-version/download/cordova-plugin-app-version-0.1.9.tgz",
"integrity": "sha1-nbBgeGMzenEEiTAuX1CpBPFEm9s="
},
"cordova-plugin-badge": {
"version": "0.8.8",
"resolved": "http://r.cnpmjs.org/cordova-plugin-badge/download/cordova-plugin-badge-0.8.8.tgz",
......@@ -2812,6 +2847,11 @@
"resolved": "http://r.cnpmjs.org/cordova-plugin-file-opener2/download/cordova-plugin-file-opener2-2.2.0.tgz",
"integrity": "sha1-9WLxsCoqZsbE2/2eO12GG9me/kE="
},
"cordova-plugin-file-transfer": {
"version": "1.7.1",
"resolved": "http://r.cnpmjs.org/cordova-plugin-file-transfer/download/cordova-plugin-file-transfer-1.7.1.tgz",
"integrity": "sha1-p12L4uvDu5sjxbG70ZkhTsJnWGs="
},
"cordova-plugin-ionic-keyboard": {
"version": "2.1.3",
"resolved": "http://r.cnpmjs.org/cordova-plugin-ionic-keyboard/download/cordova-plugin-ionic-keyboard-2.1.3.tgz",
......
......@@ -20,17 +20,21 @@
"@angular/platform-browser": "^7.2.2",
"@angular/platform-browser-dynamic": "^7.2.2",
"@angular/router": "^7.2.2",
"@ionic-native/app-version": "^5.4.0",
"@ionic-native/core": "^5.0.0",
"@ionic-native/file": "^5.4.0",
"@ionic-native/file-opener": "^5.4.0",
"@ionic-native/file-transfer": "^5.4.0",
"@ionic-native/splash-screen": "^5.0.0",
"@ionic-native/status-bar": "^5.0.0",
"@ionic/angular": "^4.1.0",
"@ionic/pro": "2.0.4",
"cordova-android": "8.0.0",
"cordova-plugin-badge": "0.8.8",
"cordova-plugin-file": "6.0.1",
"cordova-plugin-file-opener2": "2.2.0",
"cordova-plugin-app-version": "^0.1.9",
"cordova-plugin-badge": "^0.8.8",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-file-opener2": "^2.2.0",
"cordova-plugin-file-transfer": "^1.7.1",
"core-js": "^2.5.4",
"rxjs": "~6.3.3",
"zone.js": "~0.8.29"
......@@ -78,11 +82,13 @@
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-app-version": {},
"cordova-plugin-badge": {},
"cordova-plugin-file": {},
"cordova-plugin-file-opener2": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
}
},
"cordova-plugin-file-transfer": {}
},
"platforms": [
"android"
......
......@@ -26,6 +26,9 @@
"cordova-plugin-ionic-keyboard": {
"PACKAGE_NAME": "io.ionic.starter"
},
"cordova-plugin-app-version": {
"PACKAGE_NAME": "io.ionic.starter"
},
"cordova-plugin-badge": {
"PACKAGE_NAME": "io.ionic.starter"
},
......@@ -35,7 +38,10 @@
"cordova-plugin-file-opener2": {
"ANDROID_SUPPORT_V4_VERSION": "27.+",
"PACKAGE_NAME": "io.ionic.starter"
},
"cordova-plugin-file-transfer": {
"PACKAGE_NAME": "io.ionic.starter"
}
},
"dependent_plugins": {}
}
}
\ No newline at end of file
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
### Expected Behaviour
### Actual Behaviour
### Reproduce Scenario (including but not limited to)
#### Steps to Reproduce
#### Platform and Version (eg. Android 5.0 or iOS 9.2.1)
#### (Android) What device vendor (e.g. Samsung, HTC, Sony...)
#### Cordova CLI info
cordova info
Here is the output:
#### Plugin version
cordova plugin version | grep cordova-plugin-file-opener2
Here is the output:
#### Sample Code that illustrates the problem
#### Logs taken while reproducing problem
# appveyor file
# http://www.appveyor.com/docs/appveyor-yml
max_jobs: 1
shallow_clone: true
init:
- git config --global core.autocrlf true
image:
- Visual Studio 2017
environment:
nodejs_version: "4"
matrix:
- PLATFORM: windows-10-store
install:
- npm cache clean -f
- node --version
- npm install -g cordova-paramedic@https://github.com/apache/cordova-paramedic.git
- npm install -g cordova
build: off
test_script:
- cordova-paramedic --config pr\%PLATFORM% --plugin . --justBuild
root: true
extends: semistandard
rules:
indent:
- error
- 4
camelcase: off
padded-blocks: off
operator-linebreak: off
no-throw-literal: off
\ No newline at end of file
<!--
Please make sure the checklist boxes are all checked before submitting the PR. The checklist
is intended as a quick reference, for complete details please see our Contributor Guidelines:
http://cordova.apache.org/contribute/contribute_guidelines.html
Thanks!
-->
### Platforms affected
### What does this PR do?
### What testing has been done on this change?
### Checklist
- [ ] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database
- [ ] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
- [ ] Added automated test coverage as appropriate for this change.
{
"browser": true
, "devel": true
, "bitwise": true
, "undef": true
, "trailing": true
, "quotmark": false
, "indent": 4
, "unused": "vars"
, "latedef": "nofunc"
, "globals": {
"module": false,
"exports": false,
"require": false,
"cordova": false,
"File": true,
"FileSystem": true,
"FileReader": true,
"FileWriter": true,
"FileError": true,
"LocalFileSystem": true,
"Metadata": true,
"Flags": true,
"DirectoryEntry": true,
"resolveLocalFileSystemURL": false,
"requestFileSystem": true,
"FILESYSTEM_PREFIX": true,
"FILESYSTEM_PROTOCOL": true
}
}
#If ignorance is bliss, then somebody knock the smile off my face
*.csproj.user
*.suo
*.cache
Thumbs.db
*.DS_Store
*.bak
*.cache
*.log
*.swp
*.user
/.project
node_modules
sudo: false
addons:
jwt:
secure: JYUSu0UCRC8cpcuh39sn9RqkGBFbG7Hcil3NTpTWbnDRbNrlZeCzDDSirSRD9rPC+M3AEmTo3zKHuWusjUSV4NWLoad/Yd0JXgSNKmxxdESlN6stxCn7oK1I7DwcSlW7capx/44fEjOZ5hajO4mjM/QYuu7+QOuaKvhP5jQjong=
env:
global:
- SAUCE_USERNAME=snay
- TRAVIS_NODE_VERSION="4.2"
matrix:
include:
- env: PLATFORM=browser-firefox
os: linux
language: node_js
node_js: '4.2'
- env: PLATFORM=browser-safari
os: linux
language: node_js
node_js: '4.2'
- env: PLATFORM=browser-edge
os: linux
language: node_js
node_js: '4.2'
- env: PLATFORM=ios-9.3
os: osx
osx_image: xcode7.3
language: node_js
node_js: '4.2'
- env: PLATFORM=ios-10.0
os: osx
osx_image: xcode7.3
language: node_js
node_js: '4.2'
- env: PLATFORM=android-4.4
os: linux
language: android
jdk: oraclejdk8
android:
components:
- tools
- env: PLATFORM=android-5.1
os: linux
language: android
jdk: oraclejdk8
android:
components:
- tools
- env: PLATFORM=android-6.0
os: linux
language: android
jdk: oraclejdk8
android:
components:
- tools
- env: PLATFORM=android-7.0
os: linux
language: android
jdk: oraclejdk8
android:
components:
- tools
before_install:
- rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm
&& git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm
install $TRAVIS_NODE_VERSION
- node --version
- if [[ "$PLATFORM" =~ android ]]; then gradle --version; fi
- if [[ "$PLATFORM" =~ ios ]]; then npm install -g ios-deploy; fi
- if [[ "$PLATFORM" =~ android ]]; then echo y | android update sdk -u --filter android-22,android-23,android-24,android-25,android-26;
fi
- git clone https://github.com/apache/cordova-paramedic /tmp/paramedic && pushd /tmp/paramedic
&& npm install && popd
- npm install -g cordova
install:
- npm install
script:
- npm test
- node /tmp/paramedic/main.js --config pr/$PLATFORM --plugin $(pwd) --shouldUseSauce
--buildName travis-plugin-file-$TRAVIS_JOB_NUMBER
......@@ -49,6 +49,14 @@
"is_top_level": true,
"variables": {}
},
"cordova-plugin-app-version": {
"source": {
"type": "registry",
"id": "cordova-plugin-app-version"
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-badge": {
"source": {
"type": "registry",
......@@ -72,5 +80,13 @@
},
"is_top_level": true,
"variables": {}
},
"cordova-plugin-file-transfer": {
"source": {
"type": "registry",
"id": "cordova-plugin-file-transfer"
},
"is_top_level": true,
"variables": {}
}
}
\ No newline at end of file
resources/icon.png

59.4 KB | W: | H:

resources/icon.png

70.4 KB | W: | H:

resources/icon.png
resources/icon.png
resources/icon.png
resources/icon.png
  • 2-up
  • Swipe
  • Onion skin
3f1bbdf1aefcb5ce7b60770ce907c68f
\ No newline at end of file
b27a9654b61f960b7ffc65645f8be36e
\ No newline at end of file
import { Component } from '@angular/core';
// import {App} from "@ionic/pro";
import { Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import {environment} from "../environments/environment";
import {AppVersion} from "@ionic-native/app-version";
@Component({
selector: 'app-root',
......@@ -13,7 +13,8 @@ export class AppComponent {
constructor(
private platform: Platform,
private splashScreen: SplashScreen,
private statusBar: StatusBar
private statusBar: StatusBar,
private appVersion:AppVersion,
) {
this.initializeApp();
// console.log(App)
......@@ -21,8 +22,15 @@ export class AppComponent {
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.splashScreen.hide();
this.splashScreen.hide();
this.statusBar.show();
this.statusBar.overlaysWebView(false);
this.statusBar.backgroundColorByHexString('#e12724');
this.statusBar.styleLightContent();
this.appVersion.getVersionNumber().then((version:string)=>{
alert(version);
})
});
}
}
import { AppVersion } from '@ionic-native/app-version';
import { FileOpener } from '@ionic-native/file-opener';
import { FileTransfer, FileTransferObject } from '@ionic-native/file-transfer';
import { File } from '@ionic-native/file';
import { Injectable } from '@angular/core';
import {AlertController} from "@ionic/angular";
import { AppService, AppGlobal } from './http.service'
@Injectable()
export class AppUpdateService {
constructor(private appVersion: AppVersion,
private fileOpener: FileOpener,
private fileTransfer: FileTransfer,
private fileTransferObject: FileTransferObject,
private file: File,
private alertCtrl: AlertController,
private appService: AppService,
) {
}
//检查是否需要软件更新
detectionUpgrade(apkUrl, allowChoose) {
if (allowChoose) {
this.alertCtrl.create({
title: '升级提示',
subTitle: '发现新版本,是否立即升级?',
buttons: [ {
text: '确定',
handler: () => {
this.downloadApp(apkUrl);
}
}]
}).present();
} else {
this.downloadApp(apkUrl);
}
}
//与服务器版本比较,不是最新的,返回最新的下载地址
compariVersion() {
return this.appService.ObserverHttpGet("/wisdomgroup/app/compariVersion", {});
}
//下载更新APP
downloadApp(apkUrl) {
let alert = this.alertCtrl.create({
title: '下载进度:0%',
enableBackdropDismiss: false,
buttons: ['后台下载']
});
const xhr = new XMLHttpRequest();
const url = AppGlobal.domain + apkUrl;
xhr.open("GET", url);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.responseType = "blob";
xhr.addEventListener("loadstart", (ev) => {
// 开始下载事件:下载进度条的显示
alert.present();
});
xhr.addEventListener("progress", (ev) => {
// 下载中事件:计算下载进度
let progress = Math.round(100.0 * ev.loaded / ev.total);
let title = document.getElementsByClassName('alert-title')[0];
title && (title.innerHTML = '下载进度:' + progress + '%');
});
xhr.addEventListener("load", (ev) => {
alert.dismiss();
// 下载完成事件:处理下载文件
const blob = xhr.response;
const fileName = 'temp.apk';
if (blob) {
let path = this.file.externalDataDirectory;
this.file.writeFile(path, fileName, blob, {
replace: true
}).then(
() => {
this.fileOpener.open(
path + fileName,
'application/vnd.android.package-archive'
).catch((err) => {
this.appService.alert('打开apk失败!'+err);
})
}).catch((err) => {
this.appService.alert('失败!');
})
}
});
xhr.addEventListener("loadend", (ev) => {
// 结束下载事件
});
xhr.addEventListener("error", (ev) => {
this.appService.alert('下载apk失败!');
});
xhr.addEventListener("abort", (ev) => {
});
xhr.send();
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment