Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
Intranet
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Matteo
Intranet
Commits
bce9a8a7
Commit
bce9a8a7
authored
Mar 02, 2022
by
Matteo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Aggiunta gestione aggiornamento app
parent
d7956b0d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
1 deletions
+45
-1
app.module.ts
src/app/app.module.ts
+3
-0
home.page.ts
src/app/pages/home/home.page.ts
+22
-1
util.service.ts
src/app/service/util.service.ts
+20
-0
No files found.
src/app/app.module.ts
View file @
bce9a8a7
...
...
@@ -22,6 +22,7 @@ import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import
{
HttpClient
}
from
'@angular/common/http'
;
//import { Push } from '@ionic-native/push/ngx';
import
{
IonicStorageModule
}
from
'@ionic/storage-angular'
;
import
{
AppVersion
}
from
'@awesome-cordova-plugins/app-version/ngx'
;
export
function
createTranslateLoader
(
http
:
HttpClient
)
{
return
new
TranslateHttpLoader
(
http
,
'./assets/i18n/'
,
'.json'
);
...
...
@@ -37,6 +38,7 @@ export function createTranslateLoader(http: HttpClient) {
IonicStorageModule
.
forRoot
(),
FormsModule
,
HttpClientModule
,
TranslateModule
.
forRoot
({
loader
:
{
provide
:
TranslateLoader
,
...
...
@@ -55,6 +57,7 @@ export function createTranslateLoader(http: HttpClient) {
EmailComposer
,
InAppBrowser
,
SocialSharing
,
AppVersion
,
//Push,
{
provide
:
RouteReuseStrategy
,
useClass
:
IonicRouteStrategy
}
],
...
...
src/app/pages/home/home.page.ts
View file @
bce9a8a7
...
...
@@ -13,6 +13,7 @@ import { environment } from '../../../environments/environment';
import
{
Struttura
}
from
'src/app/interface/struttura'
;
import
{
ParereResponse
}
from
'src/app/interface/parere-response'
;
import
{
EventsService
}
from
'src/app/service/events.service'
;
import
{
AppVersion
}
from
'@awesome-cordova-plugins/app-version/ngx'
;
@
Component
({
selector
:
'app-home'
,
...
...
@@ -27,9 +28,29 @@ export class HomePage {
public
menuCtrl
:
MenuController
,
private
utilService
:
UtilService
,
public
translate
:
TranslateService
,
public
platform
:
Platform
public
platform
:
Platform
,
private
appVersion
:
AppVersion
)
{
this
.
caricaDati
(
true
);
this
.
getVersion
();
}
async
getVersion
()
{
if
(
UtilService
.
getVersion
)
return
;
let
version
=
await
this
.
appVersion
.
getVersionNumber
();
this
.
utilService
.
getVersion
().
subscribe
((
lastVersion
:
String
)
=>
{
var
numeri
=
lastVersion
.
split
(
'.'
);
for
(
let
i
:
number
=
0
;
i
<
numeri
.
length
;
i
++
)
{
Number
.
parseInt
(
numeri
[
i
]);
}
if
(
version
!=
lastVersion
)
{
this
.
utilService
.
presentAlert
(
"Avviso"
,
""
,
"E' presente una nuova versione dell'app sullo store ("
+
lastVersion
+
"), aggiorna la app"
,
[
"OK"
]);
}
UtilService
.
getVersion
=
true
;
});
}
caricaDati
(
startUp
:
boolean
)
...
...
src/app/service/util.service.ts
View file @
bce9a8a7
...
...
@@ -123,8 +123,28 @@ export class UtilService {
public
static
strutturaSegreteria
:
Struttura
;
public
static
pushRegistrationId
:
string
;
public
static
redirectToNotifiche
:
boolean
=
false
;
public
static
getVersion
:
boolean
=
false
;
public
startup
:
boolean
=
true
;
getVersion
()
{
var
piattaforma
=
this
.
platform
.
is
(
"android"
)?
"android"
:
"ios;"
var
param
=
UtilService
.
encodeBody
({
app
:
environment
.
struttura
,
piattaforma
:
piattaforma
});
return
this
.
httpClient
.
post
<
String
>
(
this
.
httpClientDataService
.
BASE_ADDRESS
+
'/intranet/ultimaVersione.do'
,
param
,
this
.
httpClientDataService
.
httpOptions
)
.
pipe
(
catchError
(
this
.
handleError
),
tap
(
(
res
:
String
)
=>
{
if
(
res
!=
null
&&
res
!=
""
)
{
return
res
;
}
else
{
return
null
;
}
})
);
}
static
setStruttura
(
id
:
number
)
{
if
(
this
.
strutture
.
length
>
0
)
...
...
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