Quantcast
Channel: Ionic Forum - Latest posts
Viewing all 228535 articles
Browse latest View live

Facebook login ionic

$
0
0

How did you solve it? I’m having this exact issue using Ionic 4 and testing on an Android 8.0 device. I followed @dayanajabif tutorial found in https://ionicthemes.com/tutorials/about/ionic-facebook-login . Route navigation is not working for some reason, it does work on other types of authentication I have on the app. Code example here:

private async nativeFacebookLogin() {
    // the permissions your facebook app needs from the user
    const permissions = ['public_profile', 'email'];

    await this.facebook.login(permissions).then(response => {
        const userId = response.authResponse.userID;
        console.log('facebook response:', response);
        this.uid = userId;
        // Getting name and gender properties
        this.facebook.api('/me?fields=name,email', permissions)
        .then(user => {
        user.picture = 'https://graph.facebook.com/' + userId + '/picture?type=large';
        const email = user.email;
        this.dataService.getUser(this.uid).subscribe((data) => {
          console.log('user is:', data.data());
          if (data.data() !== undefined) {
            this.user = data.data();
            this.deviceStorage.set('user', JSON.stringify(data.data()));
            this.deviceStorage.set('uid', this.uid);
            this.dataService.userNewListener(this.uid);
            if (data.data().isNew) {
              this.zone.run(() => {
                this.router.navigate(['/profile']);
              });
              this.toastService.showToast('Please set up your profile first.');
            } else {
              this.zone.run(() => {
                this.router.navigate(['/home']);
              });
              this.toastService.showToast('User has signed in successfully.');
            }
          } else {
            this.dataService.addUser(this.uid, {email, uid: this.uid, isNew: true, isFb: true}).then(() => {
              const obj =  {email, uid: this.uid, isNew: true, isFb: true};
              this.deviceStorage.set('uid', this.uid);
              this.deviceStorage.set('user', JSON.stringify(obj));
              this.toastService.showToast('Please set up your profile first.');
              this.zone.run(() => {
                this.router.navigate(['/profile']);
              });
            }).catch((err) => { console.log('facebookNerror 3 :' + err); });
          }
        });
        }).catch((err) => { console.log('facebookNerror 2 :' + err); });
      }, error => {
      console.log(error);
    }).catch((err) => { 
      console.log('facebookNerror 1 :' + err);
      this.toastService.showToast('Native facebook error:');
      this.toastService.showToast('Native facebook error:' + err);
    });
}

Error in Ionic 4 + dynamic forms

$
0
0

If I open up the comment and I did the same in old project, it fixes the error message,
but still my new project doesn’t display any content in app.component.html even I tried just to display the header.

My app.component.html for both projects are side by side:

I got no error message when I inspect in browser. In my old project, I got following when I inspect the page and check elements :

New Project, I got this instead:

Any suggestions?

In-app-purchases-2 - Manage subscriptions on 4.20.0

$
0
0

Hi,
I’m using the in-app-purchase-2 plugin on an Ionic 3 project. I’d like to use the manageSubscriptions of the plugin, but is missing on the latest version (4.20.0). I saw that few months ago this functionality was merged on the v4 branch of the @ionic-native repository. Is it possible to update the version too?

Thank you,

Pier

*ngFor needs to pruduce 1 btn for each different object, except when object has same value

$
0
0

I’m creating an app that will list of classes for a teacher on a chosen day, each class being a button on the screen. This list is made using *ngFor and pulls data from a ts file, that originally came from a PHP/database query.

The button would then be pressed by the teacher to show which students should be in class that day. It is an attendance/absence monitoring app.

However, I am testing the *ngFor to make my list, and because the data is stored as 3 objects, each with info for a student, three buttons are being created dynamically by the *ngFor - when in fact, as the three students are in the same class, I need just one button.

The next button would only need to be created for the teacher’s next class that day.

This is an algorithm problem I guess, or possibly there is a different query to be made to get the data from SQL. I don’t know.

I am lost.

HTML FILE 

<ion-list>
    <ion-card padding *ngFor="let cour of planning; let i = index" (click)="showStudents($event, i)">
      <h2>{{ cour.cours }}</h2>
      <p>{{ cour.time }}</p>
      <p>{{ cour.date }}</p>
      <p>{{ cour.lieux }}</p>
      <p>{{ cour.duration }}</p>
    </ion-card>
  </ion-list>

SERVICE.TS

getCoursList(date, idIntervenant) {
return this.http.post('http://localhost/Attendance App/myApp/src/app/api/getCours.php?id='+idIntervenant, {
  date,
}).subscribe(data => {
  console.log(Object.values(data));
  let planningData = Object.values(data);
  const grabArray = planningData[0];
  const id = grabArray.intervenant;
  if (id !== undefined) {
    // console.log('test array', id);
    let navExtras: NavigationExtras = { 
      state: {
        planning: planningData
      }
    }
    this.router.navigate(['/cours/', id], navExtras);
  };
},
  error => {
    console.log(error);
  });

}

PHP QUERY TO DATABASE 

if (isset($_POST["date"])) {

// $id = $_POST["id"];
$origDate = date("Y-m-d", strtotime($_POST['date']));
$date = $origDate;
$id = $_GET['id'];

$stmt = $conn->prepare("SELECT * FROM planning WHERE intervenant = :id AND date = :date");
$stmt->execute([':id' => $id, ':date' => $date]);

if ($stmt->rowCount() > 0) {
    $output = array();
    $output = $stmt->fetchAll();
    echo json_encode($output);
} else {
    $errors = "No data found for this date";
    echo json_encode($errors);
}
// $conn->close();

}

DATA RECEIVED FROM PHP QUERY - 1 ARRAY CONTAINING 3 OBJECTS

[object Array]: [Object, Object, Object]

0: Object cours: “Suivi individuel” date: “2019-07-06” duration: “1h30” etudiant: “james ross” id_planning: 19 intervenant: “2” lieux: “Nice 2” time: “12:00”

proto : Object

1: Object cours: “Suivi individuel” date: “2019-07-06” duration: “1h30” etudiant: “Tupac Shakur” id_planning: 20 intervenant: “2” lieux: “Nice 2” time: “12:00”

proto : Object

2: Object cours: “Suivi individuel” date: “2019-07-06” duration: “1h30” etudiant: “Joyner lucas” id_planning: 21 intervenant: “2” lieux: “Nice 2” time: “12:00”

proto : Object length: “3”

The three students above are all going to the same class, at the same time etc, so I want only one button to be produced dynamically.

If the teacher had a second lesson that day, it would produce a second button, and so on.

At present there are no error messages, I am just not getting the desired result.

Can someone help ?! ionic 1.3.3 on iOS 12 with error: not set for url='unsafe:ionic://localhost%23/menu/aboutUs'

Ionic 4 infinite scroll not working

$
0
0

I have the same problem with Ionicv4

Firebase.h file not found

$
0
0

Ionic 3 app with cordova-plugin-firebasex works fine in Android, but in iOS gives the error when doing a build
'Firebase.h' file not found
referring to FirebasePlugin.m.
Any idea how to resolve this? I’ve tried removing and re-adding the plugin, and also re-adding the iOS platform, but no luck!

Thanks.

Failed build for Android: Execution failed for task ':app:processDebugResources'

$
0
0

after adding those values in the file strings, it returns me error of mergeDebugResources in the construction on duplicate values

FAILURE: Build failed with an exception.

  • What went wrong:

Execution failed for task ‘:mergeDebugResources’.

[string/fb_app_id] /Users/user/Desktop/home-made-repo/platforms/android/res/values/facebookconnect.xml [string/fb_app_id] /Users/user/Desktop/home-made-repo/platforms/android/res/values/strings.xml: Error: Duplicate resources
[string/fb_app_name] /Users/user/Desktop/home-made-repo/platforms/android/res/values/facebookconnect.xml [string/fb_app_name] /Users/user/Desktop/home-made-repo/platforms/android/res/values/strings.xml: Error: Duplicate resources


I have problem with ionic native plugin for printing ionic 4

$
0
0

I have a problem with this code when I run in the android device also ios I have the same problem

TypeError: Printer.getPlugin(...).check is not a function
    at vendor.js:79303
    at vendor.js:78443
    at new ZoneAwarePromise (polyfills.js:3272)
    at tryNativePromise (vendor.js:78442)
    at getPromise (vendor.js:78463)
    at vendor.js:79301
    at Printer.push../node_modules/@ionic-native/printer/ngx/index.js.Printer.check (vendor.js:79308)
    at Printer.push../node_modules/@ionic-native/printer/ngx/index.js.Printer.isAvailable (vendor.js:79294)
    at SaleInfoPage.push../src/app/paenter code herege/sale-info/sale-info.page.ts.SaleInfoPage.print (main.js:1037)
    at Object.eval [as handleEvent] (SaleInfoPage.html:54)

ionic info

Ionic CLI : 5.2.1 (/usr/local/lib/node_modules/ionic) Ionic Framework : @ionic/angular 4.6.0 @angular-devkit/build-angular : 0.13.9 @angular-devkit/schematics : 7.3.9 @angular/cli : 7.3.9 @ionic/angular-toolkit : 1.5.1

Cordova:

Cordova CLI : 8.0.0 Cordova Platforms : android 8.0.0, ios 4.5.5 Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 9 other plugins)

Utility:

cordova-res : 0.5.0 (update available: 0.5.2) native-run : 0.2.6 (update available: 0.2.7)

System:

Android SDK Tools : 26.1.1 (/Users/shahab/Library/Android/sdk/) ios-deploy : 2.0.0 NodeJS : v8.11.3 (/usr/local/bin/node) npm : 5.6.0 OS : macOS Mojave Xcode : Xcode 10.2.1 Build version 10E


code

print()
  {
    this.printer.isAvailable().then(function(){
      this.printer.print("https://www.techiediaries.com").then(function(){
            alert("printing done successfully !");
          },function(){
            alert("Error while printing !");
          });
    }, function(e){
        console.log(e);
        alert('Error : printing is unavailable on your device ');
    });
  }

Android status bar no icon shown

$
0
0

Thanks this.statusbar.styleLightContent(); is working for me

How can I run my mobile application on a website?

$
0
0

I have a project that works to configure a mobile application, I need on my main page to show the embedded mobile application so that the user can see how your application is going, I have developed my mobile application in ionic 3 and I have that application inside me my website project, I’m working on ruby on rails.

I have seen that you can show a website in an ionic mobile application but I do not want that, I want the opposite, I want to show the mobile application on my website.

Is it possible to do this? How could I do it?

I’m looking for something like this: https://ionicframework.com/docs/api/action-sheet

my mobile application within the project of my website:

1

bug iphone 8 back

$
0
0

Hello

in my application I load the categories of my wordpress, then click, a view with the articles of the category.
The problem is that on Iphone 8, when I click the back button and I return to the list of categories, it displays the name of the last category consulted for all categories listed.
And no idea of ​​how to solve this problem since on the simulator everything works fine.

Ideas ?

Thank you

Ionic Native Secure Storage Not Working on Android Q

$
0
0

Hi, I am in the same situation. It seems that the com.android.credentials.UNLOCK was somehow never officially defined in the documentation (hidden feature). I am trying to find a parallel way to get a list with the unofficial intents but it seems to be complicated. I found info about some people trying to dump logs about the broadcast messages being sent in Android devices. Maybe could be a potential approach to capture the new name (if it was not removed/completely changed but renamed). I hope, we can find a solution soon.

I am trying to find an alternative plugin too, but no luck until now. Maybe with this new introduced feature in Android Q (https://android-developers.googleblog.com/2019/04/android-q-scoped-storage-best-practices.html), it is not anymore necessary to have a lock pattern/pin to encrypt the info and call the unlock intent but it would mean, a new implementation would be required for Android.

It appears to exist another thread in the plugin forum regarding this topic:

*ngFor needs to pruduce 1 btn for each different object, except when object has same value

$
0
0

Given only what you’ve written here, the primary issue I see is with the database design. The planning table seems to be at enrollment granularity, although it contains information unrelated to enrollment (such as course duration and name). I would redesign the database structure so that there is a table with one record per course, another with one record per student, and then use foreign keys to link both of those to the “enrollment” table that currently seems to exist. That way you can select out of the course table here and your problem should melt away.

If rearchitecting the database isn’t feasible, you can loop through on the JavaScript side making a separate array containing an entry for each course (although since all I see are course names, that becomes somewhat fragile).

Tag ion-radio checked="true" issue

$
0
0

If you have a bound ngModel or form control, that wins and you must make changes via that binding. The “checked” attribute only takes effect if there is no binding.


New Google Floating Style

$
0
0

Hello Everyone I’m desperated, my client asks me for a new input style as the google style I’m almos there, but I’m with a big problem on the overflow as you can see:

All the colors are changing correctly, but the label is being cutted in the middle. Can anyone help me please? I’ve tryed to use overflow: visible; padding-top, margin and nothing :confused:

Thats My SCSS:

* {
  --background-focused: transparent;
}
ion-toolbar {
  --background: #3880ff !important;
  --color: #fff !important;
}

#menu_header {
  --background: #3880ff !important;
  --color: #fff !important;
}
#avatar_menu {
  margin-right: 10px !important;
}

.item-input {
  margin-top: 5px;
  &.invalid {
    color: red;
  }
}

ion-label.google-label {
  color: #fff;
  background-color: #3880ff;
  font-size: 12px;
  margin-left: 10px !important;
  padding-left: 4px !important;
  padding-right: 4px !important;
  position: absolute !important;
  margin-bottom: 5px !important;
  z-index: 9;
}

ion-input.google-input {
  padding-top: 10px !important;
  color: white;
  border: 2px solid white;
  width: 100%;
  max-width: 100%;
  padding-left: 10px !important;
  border-radius: 5px;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
}

.item-label-floating {
  &.ion-invalid.ion-touched {
    .google-label {
      color: #f53d3d !important;
    }
    .google-input {
      border: 2px solid #f53d3d !important;
    }
  }
  &.item-has-value {
    .google-label {
      padding-left: 4px !important;
      padding-right: 4px !important;
      color: #062f77 !important;
      -webkit-transform: translate3d(0, -50%, 0) !important;
      transform: translate3d(0, -50%, 0) !important;
      -webkit-transform-origin: left top;
      transform-origin: left top;
      -webkit-transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
      transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
      transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1), transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
      transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1), transform 0.15s cubic-bezier(0.4, 0, 0.2, 1),
        -webkit-transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
      &.invalid {
        .google-label {
          color: #f53d3d !important;
        }
        .google-input {
          border: 2px solid #f53d3d !important;
        }
      }
    }

    &.ion-valid.ion-touched {
      .google-label {
        color: #fff !important;
      }
    }
  }
  &.item-has-focus {
    .google-label {
      padding-left: 4px !important;
      padding-right: 4px !important;
      color: #062f77 !important;
      -webkit-transform: translate3d(0, -50%, 0) !important;
      transform: translate3d(0, -50%, 0) !important;
      -webkit-transform-origin: left top;
      transform-origin: left top;
      -webkit-transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
      transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
      transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1), transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
      transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1), transform 0.15s cubic-bezier(0.4, 0, 0.2, 1),
        -webkit-transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .google-input {
      border: 2px solid #062f77;
    }
    &.invalid {
      .google-label {
        color: #f53d3d !important;
      }
      .google-input {
        border: 2px solid #f53d3d !important;
      }
    }

    &.ion-valid.ion-touched {
      .google-label {
        color: #062f77 !important;
      }
    }
  }
}
        <ion-item lines="none" [class.invalid]="showErrors('email')">
          <ion-label class="google-label" position="floating">
            E-Mail
          </ion-label>
          <ion-input formControlName="email" class="google-input" type="text">
          </ion-input>
        </ion-item>

Router Link only works once

$
0
0

It was a bug, just updated and it works, sorry for the late answer.

How to handle: invalid views to insert

$
0
0

I have an App using lazy loading, and is running the app in a browser, so when a user enters the url for my site he is navigated to

/index.html#/home

if the user now changes the url to a url like

/index.html#/

he will get an error like

console.js:35 ERROR Error: Uncaught (in promise): invalid views to insert
at c (polyfills.js:3)
at Object.reject (polyfills.js:3)
at NavControllerBase._fireError (nav-controller-base.js:223)
at NavControllerBase._failed (nav-controller-base.js:216)
at nav-controller-base.js:263

in the console

How can I verify that the url exist before letting the nav-controller throw this error.

In Sentry, where I record all errors it looks like this

I think this happens when the user double clicks on the back navigation arrow, but haven’t been able to verify

Ionic 4 infinite scroll not working

Android build failed after updating cordova@6.4

$
0
0

it fixing my error by deleting some deprecated plugin, in my case

cordova-plugin-mauron85-background-geolocation 2.3.6 "CDVBackgroundGeolocation"
cordova-plugin-local-notification
Viewing all 228535 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>