当前位置: 首页>>代码示例>>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;未经允许,请勿转载。