How to do Facebook share for Ionic 5 Angular 12 with capacitor 3.

Has anyone done a facebook share for web and android versions for angular 12 with capacitor 3? Has to send image and text. I am not sure even if this is possible?

    import { Share } from '@capacitor/share';

await Share.share({
  title: 'See cool stuff',
  text: 'Really awesome thing you need to see right meow',
  url: 'http://ionicframework.com/',
  dialogTitle: 'Share with buddies',
});

NgModel shows only one value

Screenshot_2022-01-26_at_11_35_23_AM.png

Hello i want to retrieve multiples values from single column on db. And i did. They are shown on Console (Painting, Illustration, Graphic Design) but when i put the values on ion-toggles with ngModel only one is set to true. As you may see on the screenshot the values are returning but only Painting is true (toggle on right side)

Html

 <ion-list >
<ion-list-header>
I am Interested in...
</ion-list-header><div><br /></div>
   <ion-item>
  <ion-label>Painting</ion-label>
        <ion-toggle color="gold" [ngModel]="interest=='Painting' ? true:false" (ionChange)="creativeInterest(creative, 'Painting')"></ion-toggle>
</ion-item>

<ion-item>
  <ion-label>Graphic Design</ion-label>
  <ion-toggle color="tertiary" [ngModel]="interest=='Graphic Design' ? true:false" (ionChange)="creativeInterest(creative, 'Graphic Design')"></ion-toggle>
</ion-item>

<ion-item>
  <ion-label>Illustration</ion-label>
  <ion-toggle color="danger" [ngModel]="interest=='Illustration' ? true:false" (ionChange)="creativeInterest(creative, 'Illustration')"></ion-toggle>
</ion-item>

<ion-item>
  <ion-label>Sculpture</ion-label>
  <ion-toggle color="success" [ngModel]="interest=='Sculpture' ? true:false" (ionChange)="creativeInterest(creative, 'Sculpture')"></ion-toggle>
</ion-item>

<ion-item>
  <ion-label>Literature</ion-label>
  <ion-toggle color="danger" [ngModel]="interest=='Literature' ? true:false" (ionChange)="creativeInterest(creative, 'Literature')"></ion-toggle>
</ion-item>

<ion-item>
  <ion-label>Theater</ion-label>
  <ion-toggle color="dark" [ngModel]="interest=='Theater' ? true:false" (ionChange)="creativeInterest(creative, 'Theater')"></ion-toggle>
</ion-item>

<ion-item>
  <ion-label>Film</ion-label>
  <ion-toggle color="warning" [ngModel]="interest=='Film' ? true:false" (ionChange)="creativeInterest(creative, 'Film')"></ion-toggle>
</ion-item>

.ts

export class CreativeSettingsPage implements OnInit {
  creativeInterests: any=[];
 creative: any= {};
 userDetails: any = {};
 interest:any=[];
 constructor(
public userData: UserData
 ) {
this.userDetails = this.userData.getUserData();
 }

ngOnInit() {
this.creativeInsterestSet();
  }

creativeInsterestSet() {
this.userData.creativeInterests(this.userDetails.uid).pipe(
    map((data: any) => {
        if (data.success) {
            this.creativeInterests = data.creativeInterests;
            this.creativeInterests.filter(item =>  {
              this.interest=item.interest;
             console.log( this.interest);
          });

        }
    })
).subscribe()
}

Angular get value from NgModel

Hello I want to send multiple values from a to an api function.

on the db i store the values in text format. The value that is stored is array

on the Swal alert, I am getting [object object] but i want to get each value e.g. Painting or Graphic Design.

Here is my code so far.

html

<ion-item>
  <ion-label>Painting</ion-label>
  <ion-toggle color="gold" [(ngModel)]="creative.Painting" (click)="creativeInterest(creative)"></ion-toggle>
</ion-item>

<ion-item>
  <ion-label>Graphic Design</ion-label>
  <ion-toggle color="tertiary" [(ngModel)]="creative.Graphic Design" (click)="creativeInterest(creative)"></ion-toggle>
</ion-item>

.ts

   export class CreativeSettingsPage implements OnInit {
    creative: any = {};
    userDetails: any = {};
    constructor(
      public userData: UserData
  ) {
    this.userDetails = this.userData.getUserData();
   }

  ngOnInit() {
  }

  creativeInterest(creative:string)
  {
    this.userData.creativeSettings(this.userDetails.uid, creative).pipe(
      map((data: any) => {
        if (data.success) {
          Swal.fire({
            icon: 'success',
            title: creative,
            showConfirmButton: false,
            backdrop: false,
            timer: 2500
          })
        }
      })
    ).subscribe()
  }

user-data.ts

    creativeSettings(uid: number, creative:any) {
        const url = this.appData.getApiUrl() + 'creativeSettings';
        const data = this.jsonToURLEncoded({
            uid: uid,
            creative: creative
        });
        return this.http.post(url, data, { headers: this.options });
    }

php

function creativeSettings()
{
$request = \Slim\Slim::getInstance()->request();
$response['success'] = true; // 1 true if not errors OK NOTHING

$uid = $request->post('uid');
$creative_interests =  $request->post('creative');

$db = getDB();
$sql = "UPDATE users SET creative_interests = :creative_interests WHERE uid = :uid";
$stmt = $db->prepare($sql);
$stmt->bindParam("uid", $uid);
$stmt->bindParam("creative_interests", $creative_interests);
$stmt->execute();
$db = null;

echo json_encode($response);

}

Get array of a column value in array of objects in Angular 12

Hello i have an Angular 12 project and i want to retrieve all results in artisticBehaviour (except those who are NULL or same e.g. Actor, Actor) column in Users table.

ts function that i call all users from Users table.

allArtistsSet() {
    this.userData.allArtists(this.offset).pipe(
      map((data: any) => {
        if (data.success) {
            this.allArtists = data.artistsFeed;
 this.creativenessArtists = this.allArtists.filter((data) => data.artisticBehaviour != null);
        }
      })
    ).subscribe()
  }

html

<select style="background-color: #333;color: whitesmoke;padding: 5px;font-size: small; border-radius: 5px;width: 110px;">
                <option disabled>Creative Behaviour</option>
                <option>Creativeness</option>
                <option *ngFor="let creative of creativenessArtists" value="{{creative}}">{{creative}}</option>
                </select>

Search pipe in Angular with PHP

Hello i have a Ionic Angular project with PHP as backend. I created a search for users but in order for the project to run more faster i put a LIMIT of 20 users in the php function that calls the users and call the next 20 with an Angular PIPE function and so on.

So the user has to scroll down in order for the next 20 users to show and be able to search those names. Otherwise the search results work only for the first 20 names.

That way i can't put any filters also. Any way that a user may do a search in all the users in the database table?

PHP function

$sql = "SELECT f.friend_id,f.friend_two,f.friend_one, U.uid,U.username,U.name,U.first_name,U.last_name, U.profile_pic,U.media_edits,U.updates_count,U.friend_count,U.profile_views,U.group_count,U.bio,U.location,U.artisticBehaviour
 FROM users U ";
 $sql .= $sql_friends;
 $sql .=" LIMIT $offset, $limit";

Angular PIPE

 import {Pipe, PipeTransform} from '@angular/core';

@Pipe({
name: 'search',
})
export class SearchPipe implements PipeTransform {
 /**
* Takes a value and makes it lowercase.
*/
 transform(items: any[], terms: string): any[] {
if (!items) return [];
if (!terms) return items;

terms = terms.toLowerCase();
return items.filter(it => {

    if (it.group_name) {
        return it.group_name.toLowerCase().includes(terms);    
    }
    else if (it.username || it.title)
    {
        var match_username = it.username ? it.username.toLowerCase().includes(terms) : false;
        var match_title = it.title ? it.title.toLowerCase().includes(terms) : false;
        return match_username || match_title;
    }
    else 'No results';
});
}
}

Google problem with .htaccess

Does anyone now if google requires parameters on .htaccess file for php function calls?

I used to have a different .htaccess file and my google sign in used to work. Now i changed it and it doesnt.

htaccess

 RewriteEngine On

#RewriteBase /api/

Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]

AddType video/ogg  .ogv
AddType video/mp4  .mp4
AddType video/webm .webm

Include external .js files in Angular

Hello i want to add external .js files into my Ionic Angular Project

Ionic CLI : 5.4.16 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 5.2.3
@angular-devkit/build-angular : 0.901.11
@angular-devkit/schematics: 9.1.11
@angular/cli : 9.1.11
@ionic/angular-toolkit: 2.3.0

Utility:
cordova-res (update available: 0.15.2) : 0.15.1
native-run (update available: 1.3.0) : 0.3.0

I created a js folder into assets and i put the files into it. This is how i call them in index.html

<body>
  <app-root></app-root>
  <script type="text/javascript" src="./assets/js/jquery-2.1.4.min.js"></script>





  <script type="text/javascript" src="./assets/js/jquery-2.1.4.min.js"></script>
  <script type="text/javascript" src="./assets/js/charts.js"></script>
  <script type="text/javascript" src="./assets/js/isotope.pkgd.min.js"></script>
  <script type="text/javascript" src="./assets/js/jquery-ui.min.js"></script>
  <script type="text/javascript" src="./assets/js/jquery-2.1.4.min.js"></script>
  <script type="text/javascript" src="./assets/js/jquery.canvasjs.min.js"></script>
  <script type="text/javascript" src="./assets/js/jquery.countTo.js"></script>
  <script type="text/javascript" src="./assets/js/jquery.easy-autocomplete.minjs"></script>
    <script type="text/javascript" src="./assets/js/bootstrap.min.js"></script>     
    <script type="text/javascript" src="./assets/js/idangerous.swiper.min.js"></script>
    <script type="text/javascript" src="./assets/js/jquery.mixitup.js"></script>
    <script type="text/javascript" src="./assets/js/jquery.viewportchecker.min.js"></script>
    <script type="text/javascript" src="./assets/js/filters.js"></script>
  <script type="text/javascript" src="./assets/js/global.js"></script>
  <script type="text/javascript" src="./assets/js/script.js"></script>
  <script type="text/javascript" src="./assets/js/sortable.js"></script>
  <script type="text/javascript" src="./assets/js/magnific.js"></script>
  <script type="text/javascript" src="./assets/js/map.js"></script>
  <script type="text/javascript" src="./assets/js/wow.js"></script>
</body>

Gradle version can’t be find

Hello i want to publish my Ionic Cordova in Android.

I keep getting an error

ANDROID_SDK_ROOT=/Users/[myName]/Library/Android/sdk (recommended setting)
ANDROID_HOME=/Users/[myName]/Library/Android/sdk (DEPRECATED)
Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle 
in your path, or install Android Studio

This is my .bash_profile file

export ANDROID_HOME=/Users/[myName]/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools
export ANDROID_SDK_ROOT=/Users/[myName]/Library/Android/sdk
export ANDROID_AVD_HOME=~/.android/avd
export PATH=$HOME/.rbenv/bin:$PATH
export PATH=$PATH:/opt/gradle/bin
export PATH=$PATH:/Users/[myName]/.grade/wrapper
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_212.jdk/Contents/Home
export GRADLE_HOME=/User/[myName]/gradle/gradle-6.8/bin
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:Users/[myName]/.gradle/wrapper
export PATH=$PATH:$ANDROID_HOME/build-tools

And i have installed Android Studio. But i keep getting same error

Angular 7 Ngfor doesnt work

Hello i want to display the values of this api response. Like this

Producer: Simon
Writer: Simon

person1: [[{value: "Producer: Simon"}, {value: "Writer: Simon"}]]
  0: [{value: "Producer: Simon"}, {value: "Writer: Simon"}]
    0: {value: "Producer: Simon"}
    1: {value: "Writer: Simon"}

I tried this but i am getting {}

               <div *ngFor="let media1 of person1; let i = index">
                    {{media1}}
                </div>

And when i call like this <ion-label>{{person1}}</ion-label> i am getting [object Object]

Any help?

How to unserialize inside a PHP function

i want to unserialize? and display Array from my text field in db table.

This is what i use to serialize on Insert statement.

$persons = serialize(array($paymentData['anArray']));

and this returns after var_dump

["persons"]=> string(104) "a:1:{i:0;a:2:{i:0;a:1:{s:5:"value";s:15:"Producer: Simon";}i:1;a:1:{s:5:"value";s:13:"Writer: Simon";}}}"

Now the object that i return from Select statement is memberDetails

$sql = "SELECT *
FROM memberDetails M WHERE M.id=:id";
$db = getDB();
$stmt = $db->prepare($sql);
$stmt->bindParam("id", $id, PDO::PARAM_INT);
$stmt->execute();
$memberDetails = $stmt->fetch(PDO::FETCH_OBJ);
var_dump ($memberDetails); exit;
$response['success'] = true;
$response['memberDetails'] = $memberDetails;

echo json_encode($response);

So i want to return two values and display them: like this

Writer: Simon and Producer:Simon

Any help?

How to insert an id automatically – MySql

Hello i want to automatically add an id to the inserted row on my table in Mysql db.

The table has no uniquie key and no AUTO_INCREASMENT. I just want a function to add the id automatically when the row is inserted.

This is the statement i have

$db = getDB();
    if(isset($cId))
    {
        $cId = $request->post('cId');
    }
    else
    {
        $cId = '3';**//Here i want to put a new id **
    }

    $insert = array(
        'c_id' => $cId,
        'user_one' => $uid,
        'user_two' => $recieverId,
        'ip' => $_SERVER['REMOTE_ADDR'],
        'time' => date('Y-m-d H:i:s'),
    );

    $sql = "INSERT INTO conversation (c_id,user_one, user_two, ip, time) VALUES (?,?,?,?,?)";
    $stmt = $db->prepare($sql);
    $stmt->execute(array_values($insert));

$request->post('cId'); is returned as wanted

GROUP BY statement returns different values in row table

Hello i have a Mysql statement that supposes to return to results.

The statement is

SELECT c.user_one,c.user_two,c.c_id,r.reply
 FROM conversation_reply r
JOIN conversation c ON r.c_id_fk = c.c_id 
 WHERE c.user_one = '3'
 OR c.user_two = '3'
 GROUP BY r.reply

I have only two records in the table so the result should be:

   user_one   user_two   c_id     reply

     2          1         43     Hello One
     1          2         43     Hello Two 

Instead its like

    user_one   user_two   c_id     reply

     2          1         43     Hello One
     2          1         43     Hello Two 

If i loose the GROUP BY it returns 4 records but i only have two, like this

    user_one   user_two   c_id     reply

     1          2         43     Hello One
     2          1         43     Hello Two 
     1          2         43     Hello One
     2          1         43     Hello Two 

Any idea why?

Guideline 4.2 – Design – Minimum Functionality Reject

Hello i ve tried to upload my first app on the App Store but i got this mesage from Apple. Any ideas how to proceed?

*Your app provides a limited user experience as it is not sufficiently different from a mobile browsing experience. As such, the experience it provides is similar to the general experience of using Safari. Including iOS features such as push notifications, Core Location, and sharing do not provide a robust enough experience to be appropriate for the App Store.

Next Steps

To resolve this issue, please revise your app to provide a more robust user experience by including additional native iOS functionality.*

Audio file won’t play after uploading Ionic 3 Angular5

Hello i want to upload an audio file(.mp3). The file is uploaded on the folder, the value is inserted on the db (MySql) so far so good. But when i try to play the file on the uploads folder is says its corrupted or extension is wrong.the value is not base64 is the original name of the file

html

           <form [formGroup]="form" (ngSubmit)="onSubmit()"> <input type="file" name="avatar"     (change)="onFileSelect($event)" /> <button type="submit">Upload</button> </form>

ts

 onSubmit() {
const formData = new FormData();
formData.append('avatar', this.form.get('avatar').value);

this.group_id = 0;
this.media.tags = this.hashes;
this.media.audio = formData;
this.media.browser = true;
this.userData.uploadAudio(this.media, this.group_id ).subscribe(
  (res) => {
    this.uploadResponse = res;
      console.log(res);
  },
  (err) => {  
    console.log(err);
  }
);
 }

php

$mediaData = $request->post('media');
$name = $mediaData['audio'];
$uri =  substr($name,strpos($name,",")+1);
$encodedData = str_replace(' ','+',$uri);
try 
{
    $name = md5(time() . rand(1, 1000));
    if(!file_put_contents('uploads/' . $name.'.mp3', $decodedData)) 
    {
    }
}
catch(Exception $e)
{
}
$name = $name . '.mp3' ;

Wrong destination on MacOS

Hello does anybody see any error in this?

[!] Unable to find the Xcode project /Users/macbookpro/Desktop/project/platforms/ios/C:\Users\Simos\project\platforms\ios\Project.xcodeproj for the target Pods-C:\Users\Simos\project\platforms\ios\Project.

I copied my project from my PC to my Mac in a usb drive. THERE IS NO C:\Users\Simos\ directory on mac. Why ai i getting this?

Show message if length of array is 0 in Angular 5

I have a search script that a user may search persons etc. I want to display a message if what he or types doesn't exist in the array. By default, I display some results and it displays the desired person when one writes on searchbar. but I want to show a message if what the user writes on searchbar doesn't much the array. the ngfor works perfectly I just can't show the message.

I did a ngIf but doesn't show the #noThings when I type for example djlsklkssk.

Note that userSet always has length > 0 because I call the API anyway.

<ion-searchbar style="height: 30px" showCancelButton="focus" cancelButtonText="Custom Cancel" animated placeholder="Search Rovespier" [(ngModel)]="terms"></ion-searchbar>

<ion-card *ngFor="let item of userSet | search : terms">
    <div *ngIf="item; else noThings">
        {{item.name}}
    </div>
</ion-card>
<ng-template #noThings>
    <div>
        No Result
    </div>
</ng-template>

TS

I have a search script that a user may search persons etc. I want to display a message if what he or types doesn't exist in the array. By default, I display some results and it displays the desired person when one writes on searchbar. but I want to show a message if what the user writes on searchbar doesn't much the array. the ngfor works perfectly I just can't show the message.

I did a ngIf but doesn't show the #noThings when I type for example djlsklkssk.

Note that userSet always has length > 0 because I call the API anyway.

<ion-searchbar style="height: 30px" showCancelButton="focus" cancelButtonText="Custom Cancel" animated placeholder="Search Rovespier" [(ngModel)]="terms"></ion-searchbar>

<ion-card *ngFor="let item of userSet | search : terms">
    <div *ngIf="item; else noThings">
        {{}item.name}}
    </div>
</ion-card>
<ng-template #noThings>
    <div>
        No Result
    </div>
</ng-template>

.ts

userSet: any = [];

constructor() {
    this.searchSet();
}

searchSet() {
    this.userData.searchUser()
        .map(res => res.json())
        .subscribe(data => {

            if (data.success) {
                this.userSet = data.searchDetails; // then it is uid_fk
            }
        });
}

set html5 <video> as background to div

Hello i want to show html5 video with content over it . Like background image. The whole div html5 video must be of 400px height

        <div style="height: 400px">
         <video controls poster="{{item.media_pic}}">
        <source src="{{item.image_path}}" type="video/webm" />
        <source src="{{item.image_path}}" type="video/mp4">
        <source src="{{item.image_path}}" type="video/ogg">
        Your browser does not support HTML5 video.
      </video>
      <ion-row>
        <ion-col col-4>
          some text
        </ion-col>
        <ion-col col-8>
        button         
        </ion-col>
      </ion-row>
    </div>