當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ionic-native.Contacts類代碼示例

本文整理匯總了TypeScript中ionic-native.Contacts的典型用法代碼示例。如果您正苦於以下問題:TypeScript Contacts類的具體用法?TypeScript Contacts怎麽用?TypeScript Contacts使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Contacts類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: getContacts

  getContacts(state: number) {
    if (state == 0) {
      let loading = this.loadingCtrl.create({
        spinner: 'crescent',
        content: this.lgnUsed.loader_config,
        duration: 10000
      });

      loading.present();
    }

    Contacts.find(['phoneNumbers', 'displayName'], { multiple: true, hasPhoneNumber: true, desiredFields: ['phoneNumbers', 'displayName'] })
      .then((contacts) => {
        let contactsList;
        contactsList = contacts;
        this.setPermissionCache(true);
        this.formatPhoneNumbers(contactsList);
      },
      (err) => {
        if (err) {
          console.log(err);
          err >= 0 && err <= 20 ? this.setPermissionCache(false) : null;
        }
      });
  }
開發者ID:ColinJS,項目名稱:Chillter,代碼行數:25,代碼來源:contacts.ts

示例2: getContacts

 getContacts() {
     Contacts.find(["*"]).then((contact) => {
         console.log(contact)
     }, (err) => {
         console.log(err)
     })
 }
開發者ID:Muhammadmavia,項目名稱:ITKA,代碼行數:7,代碼來源:camera.ts

示例3: addContact

    addContact(store){
        var contact = Contacts.create({
            displayName: store.name,
            nickname: store.name,
            phoneNumbers: [{type: "work", value:store.phone}],
            emails: [{type: "work", value:store.email}]
        });
        contact.birthday = new Date();
        contact.save((contact) => { this.nav.present(Alert.create({ title:"Contacto Guardado", message: JSON.stringify(contact) , buttons: ["ok"]}))},(error: Error) => {});

    }
開發者ID:seedgabo,項目名稱:Prestashop-Mobile,代碼行數:11,代碼來源:page3.ts

示例4: ionViewDidLoad

	ionViewDidLoad() {
		Contacts.find(['displayName'], {
			filter: this.node.name,
			multiple: true,
			desiredFields: ['name', 'displayName', 'photos', 'birthday', 'phoneNumbers'],
			hasPhoneNumber: true
		})
		.then((contacts) => {
			if (contacts) {
				this.contacts.push.apply(this.contacts, contacts);
				this.backService.trackAction('contacts', 'ok');
			}
		}, () => {
			this.backService.trackAction('contacts', 'error');
		});
	}
開發者ID:xuender,項目名稱:family,代碼行數:16,代碼來源:select-contact.ts

示例5: fixContacts

  fixContacts() {
    let fixed = 0;
    console.log('ok so wtf');
    Contacts.find(["name"]).then((res) => {
      //console.log(res);
      res.forEach( (contact:Contact) => {
        if(!contact.photos) {
          console.log('FIXING '+contact.name.formatted);
          console.log(contact);

          var f = new ContactField('url',this.randomCat(),true);

          contact.photos = [];
          contact.photos.push(f);
          contact.save();
          fixed++;
        }
   
      });

      let subTitle, button;

      if(fixed === 0) {
        subTitle = "Sorry, but every single one of your contacts had a picture. I did nothing.";
        button = "Sad Face";
      } else {
        subTitle = `I've updated ${fixed} contact(s). Enjoy!`;
        button = "Awesome";      
      }

      this.alertCtrl.create({
          title:'Contacts Updated',
          subTitle:subTitle,
          buttons:[button]
      }).present();

    });

  }
開發者ID:anatoliWeb,項目名稱:Cordova-Examples,代碼行數:39,代碼來源:home.ts

示例6: fixContacts

  fixContacts() {

    let loader = this.loadingCtrl.create({
      content: "Doing important work...",
    });
    loader.present();


    let fixed = 0;
    let proms = [];

    Contacts.find(["name"]).then((res) => {

      res.forEach( (contact:Contact) => {

        if(!contact.photos) {
          console.log('FIXING '+contact.name.formatted);
          //console.log(contact);

          proms.push(new Promise( (resolve, reject) => {

            
            this.toDataUrl(this.randomCat(), function(s) {

              var f = new ContactField('base64',s,true);

              contact.photos = [];
              contact.photos.push(f);
              console.log('FIXED '+contact.name.formatted);
              contact.save();
              fixed++;
              resolve();
              
            });
            
          }));
        }

      });

      Promise.all(proms).then( (res) => {
        
        loader.dismissAll();

        console.log('all done, fixed is  '+fixed);
        let subTitle, button;

        if(fixed === 0) {
          subTitle = "Sorry, but every single one of your contacts had a picture. I did nothing.";
          button = "Sad Face";
        } else {
          subTitle = `I've updated ${fixed} contact(s). Enjoy!`;
          button = "Awesome";      
        }

        this.alertCtrl.create({
            title:'Contacts Updated',
            subTitle:subTitle,
            buttons:[button]
        }).present();

      });

    });
  
  }
開發者ID:anatoliWeb,項目名稱:Cordova-Examples,代碼行數:66,代碼來源:home.ts


注:本文中的ionic-native.Contacts類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。