Skip to content

Commit

Permalink
Merge branch 'hotfix/1.4.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
DoFabien committed Oct 3, 2020
2 parents db31fd7 + 4c2ae4a commit b2ca1e7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "fr.dogeo.osmgo"
minSdkVersion 21
targetSdkVersion 29
versionCode 12127
versionName "1.4.0"
versionCode 12131
versionName "1.4.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "Fabien Del Olmo",
"description": "Cartographiez les tous!",
"homepage": "https://github.com/DoFabien/OsmGo",
"version": "1.4.0",
"version": "1.4.1",
"scripts": {
"ng": "ng",
"start": "ng serve --host 0.0.0.0",
Expand Down
24 changes: 10 additions & 14 deletions src/app/services/osmApi.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,20 @@ export class OsmApiService {

// DETAIL DE L'UTILISATEUR
getUserDetail$(_user?, _password?, basicAuth = false, passwordSaved = true, test = false): Observable<User> {
const PATH_API = '/api/0.6/user/details'
const PATH_API = '/api/0.6/user/details.json'
let _observable;
if (!basicAuth) {
_observable = Observable.create(
observer => {
this.auth.xhr({
method: 'GET',
path: PATH_API,
options: { header: { 'Content-Type': 'text/xml' } },
options: { header: { 'Content-Type': 'application/json' } },
}, (err, details) => {
if (err) {
observer.error({ response: err.response || '??', status: err.status || 0 });
}
observer.next(details)
observer.next(JSON.parse(details))
});
})
} else {
Expand All @@ -126,25 +126,21 @@ export class OsmApiService {
let headers = new HttpHeaders();
headers = headers
.set('Authorization', `Basic ${btoa(_user + ':' + _password)}`)
.set('Content-Type', 'text/xml');
.set('Content-Type', 'application/json');

_observable = this.http.get(url, { headers: headers, responseType: 'text' })
.pipe(
map(res => new DOMParser().parseFromString(res, 'text/xml'))
)
_observable = this.http.get(url, { headers: headers})

}

return _observable.pipe(
map((res: Document) => {
const xml = res
const x_user = xml.getElementsByTagName('user')[0];
const uid = x_user.getAttribute('id');
const display_name = x_user.getAttribute('display_name');
map((res: any) => {
const x_user = res.user;
const uid = x_user['id'];
const display_name = x_user['display_name'];
const _userInfo: User = { user: _user, password: passwordSaved ?_password : null, uid: uid, display_name: display_name, connected: true, authType: basicAuth ? 'basic' : 'oauth',};
if (!test){
this.configService.setUserInfo(_userInfo);
}

return _userInfo;
}),
catchError((error: any) => {
Expand Down
2 changes: 1 addition & 1 deletion src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const environment = {
production: true,
version: '1.4.0'
version: '1.4.1'
};

0 comments on commit b2ca1e7

Please sign in to comment.