当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Contacts.find方法代码示例

本文整理汇总了TypeScript中ionic-native.Contacts.find方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Contacts.find方法的具体用法?TypeScript Contacts.find怎么用?TypeScript Contacts.find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ionic-native.Contacts的用法示例。


在下文中一共展示了Contacts.find方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例4: 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

示例5: 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.find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。