|
22 | 22 | static NSString *canonicalUrl = @"https://dev.branch.io/getting-started/deep-link-routing/guide/ios/"; |
23 | 23 | static NSString *contentTitle = @"Branch 0.19 TestBed Content Title"; |
24 | 24 | static NSString *contentDescription = @"My Content Description"; |
25 | | -//static NSString *imageUrl = @"https://pbs.twimg.com/profile_images/658759610220703744/IO1HUADP.png"; |
26 | 25 | static NSString *imageUrl = @"http://www.theweddingplayers.com/wp-content/new_folder/Mr_Wompy_web2.jpg"; |
27 | 26 | static NSString *feature = @"Sharing Feature"; |
28 | 27 | static NSString *channel = @"Distribution Channel"; |
@@ -321,36 +320,6 @@ - (NSDateFormatter*) dateFormatter { |
321 | 320 |
|
322 | 321 | #pragma mark - Share a Branch Link |
323 | 322 |
|
324 | | -//- (IBAction)oldShareLinkButtonTouchUpInside:(id)sender { |
325 | | -// // This method uses the old way of sharing Branch links. |
326 | | -// [activityIndicator startAnimating]; |
327 | | -// |
328 | | -// BranchLinkProperties *linkProperties = [[BranchLinkProperties alloc] init]; |
329 | | -// linkProperties.feature = feature; |
330 | | -// linkProperties.campaign = @"sharing campaign"; |
331 | | -// [linkProperties addControlParam:@"$desktop_url" withValue: desktop_url]; |
332 | | -// [linkProperties addControlParam:@"$ios_url" withValue: ios_url]; |
333 | | -// |
334 | | -//#pragma clang diagnostic push |
335 | | -//#pragma clang diagnostic ignored "-Wdeprecated-declarations" |
336 | | -// |
337 | | -// [self.branchUniversalObject showShareSheetWithLinkProperties:linkProperties |
338 | | -// andShareText:shareText |
339 | | -// fromViewController:self.parentViewController |
340 | | -// completion:^(NSString *activityType, BOOL completed) { |
341 | | -// [activityIndicator stopAnimating]; |
342 | | -// |
343 | | -// if (completed) { |
344 | | -// NSLog(@"Branch TestBed: Completed sharing to %@", activityType); |
345 | | -// } else { |
346 | | -// NSLog(@"Branch TestBed: Sharing failed"); |
347 | | -// } |
348 | | -// } |
349 | | -// ]; |
350 | | -// |
351 | | -//#pragma clang diagnostic pop |
352 | | -//} |
353 | | - |
354 | 323 | - (IBAction)shareLinkButtonTouchUpInside:(id)sender { |
355 | 324 | // The new hotness. |
356 | 325 | [activityIndicator startAnimating]; |
@@ -425,40 +394,6 @@ - (IBAction)shareLinkButtonTouchUpInside:(id)sender { |
425 | 394 | [activityIndicator stopAnimating]; |
426 | 395 | } |
427 | 396 |
|
428 | | -//- (IBAction)shareLinkAsActivityItem:(id)sender { |
429 | | -// // Share as an activity item. Doesn't receive all share started / completed events. |
430 | | -// [activityIndicator startAnimating]; |
431 | | -// |
432 | | -// BranchLinkProperties *linkProperties = [[BranchLinkProperties alloc] init]; |
433 | | -// linkProperties.feature = feature; |
434 | | -// linkProperties.campaign = @"sharing campaign"; |
435 | | -// [linkProperties addControlParam:@"$desktop_url" withValue: desktop_url]; |
436 | | -// [linkProperties addControlParam:@"$ios_url" withValue: ios_url]; |
437 | | -// [linkProperties addControlParam:@"$android_deeplink_path" withValue:@"custom/path/*"]; |
438 | | -// |
439 | | -// BranchShareLink *shareLink = |
440 | | -// [[BranchShareLink alloc] |
441 | | -// initWithUniversalObject:self.branchUniversalObject |
442 | | -// linkProperties:linkProperties]; |
443 | | -// |
444 | | -// shareLink.title = @"Share your test link!"; |
445 | | -// shareLink.delegate = self; |
446 | | -// shareLink.shareText = [NSString stringWithFormat: |
447 | | -// @"Shared from Branch's Branch-TestBed at %@.", |
448 | | -// [self.dateFormatter stringFromDate:[NSDate date]]]; |
449 | | -// |
450 | | -// UIActivityViewController *activityController = |
451 | | -// [[UIActivityViewController alloc] |
452 | | -// initWithActivityItems:shareLink.activityItems |
453 | | -// applicationActivities:nil]; |
454 | | -// |
455 | | -// if (activityController) { |
456 | | -// [self presentViewController:activityController animated:YES completion:nil]; |
457 | | -// [activityIndicator stopAnimating]; |
458 | | -// |
459 | | -// } |
460 | | -//} |
461 | | - |
462 | 397 | - (void) branchShareLinkWillShare:(BranchShareLink*)shareLink { |
463 | 398 | // This delegate example shows changing the share text. |
464 | 399 | // |
@@ -683,162 +618,6 @@ - (IBAction)sendLifecycleEvent:(id)sender { |
683 | 618 | [self presentViewController:actionSheet animated:YES completion:nil]; |
684 | 619 | } |
685 | 620 |
|
686 | | -//- (IBAction) sendV2EventAction:(id)sender { |
687 | | -// NSMutableArray<NSString*> *eventNames = [NSMutableArray arrayWithArray:BranchEvent.standardEvents]; |
688 | | -// [eventNames sortUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) { |
689 | | -// return [(NSString *)obj1 compare:(NSString *)obj2 options:NSNumericSearch]; |
690 | | -// }]; |
691 | | -// [eventNames addObject:@"iOS-CustomEvent"]; |
692 | | -// |
693 | | -// __weak __typeof(self) weakSelf = self; |
694 | | -// ArrayPickerView *picker = [[ArrayPickerView alloc] initWithArray:eventNames]; |
695 | | -// picker.doneButtonTitle = @"Send"; |
696 | | -// [picker presentFromViewController:self withCompletion:^ (NSString*pickedString) { |
697 | | -// if (pickedString) { |
698 | | -// __strong __typeof(self) strongSelf = weakSelf; |
699 | | -// [strongSelf sendV2EventWithName:pickedString]; |
700 | | -// } |
701 | | -// }]; |
702 | | -//} |
703 | | -// |
704 | | -//- (void)sendV2EventWithName:(NSString *)eventName { |
705 | | -// |
706 | | -// [appDelegate setLogFile:eventName]; |
707 | | -// // standard events with data requirements |
708 | | -// if ([eventName isEqualToString:BranchStandardEventInvite]) { |
709 | | -// [self sendInviteEvent]; |
710 | | -// } else if ([eventName isEqualToString:BranchStandardEventLogin]) { |
711 | | -// [self sendLoginEvent]; |
712 | | -// } else if ([eventName isEqualToString:BranchStandardEventSubscribe]) { |
713 | | -// [self sendSubscribeEvent]; |
714 | | -// } else if ([eventName isEqualToString:BranchStandardEventStartTrial]) { |
715 | | -// [self sendStartTrialEvent]; |
716 | | -// } else if ([eventName isEqualToString:BranchStandardEventClickAd]) { |
717 | | -// [self sendClickAdEvent]; |
718 | | -// } else if ([eventName isEqualToString:BranchStandardEventViewAd]) { |
719 | | -// [self sendViewAdEvent]; |
720 | | -// |
721 | | -// // other standard events |
722 | | -// } else if ([[BranchEvent standardEvents] containsObject:eventName]) { |
723 | | -// [self sendStandardV2Event:eventName]; |
724 | | -// |
725 | | -// // custom events |
726 | | -// } else { |
727 | | -// [self sendCustomV2Event:eventName]; |
728 | | -// } |
729 | | -//} |
730 | | -// |
731 | | -//- (void)sendInviteEvent { |
732 | | -// BranchEvent *event = [BranchEvent standardEvent:BranchStandardEventInvite]; |
733 | | -// [event logEventWithCompletion:self.completionBlock]; |
734 | | -//} |
735 | | -// |
736 | | -//- (void)sendLoginEvent { |
737 | | -// BranchEvent *event = [BranchEvent standardEvent:BranchStandardEventLogin]; |
738 | | -// [event logEventWithCompletion:self.completionBlock]; |
739 | | -//} |
740 | | -// |
741 | | -//- (void)sendSubscribeEvent { |
742 | | -// BranchEvent *event = [BranchEvent standardEvent:BranchStandardEventSubscribe]; |
743 | | -// event.currency = BNCCurrencyUSD; |
744 | | -// event.revenue = [NSDecimalNumber decimalNumberWithString:@"1.0"]; |
745 | | -// [event logEventWithCompletion:self.completionBlock]; |
746 | | -//} |
747 | | -// |
748 | | -//- (void)sendStartTrialEvent { |
749 | | -// BranchEvent *event = [BranchEvent standardEvent:BranchStandardEventStartTrial]; |
750 | | -// event.currency = BNCCurrencyUSD; |
751 | | -// event.revenue = [NSDecimalNumber decimalNumberWithString:@"1.0"]; |
752 | | -// [event logEventWithCompletion:self.completionBlock]; |
753 | | -// |
754 | | -//} |
755 | | -// |
756 | | -//- (void)sendClickAdEvent { |
757 | | -// BranchEvent *event = [BranchEvent standardEvent:BranchStandardEventClickAd]; |
758 | | -// event.adType = BranchEventAdTypeBanner; |
759 | | -// [event logEventWithCompletion:self.completionBlock]; |
760 | | -//} |
761 | | -// |
762 | | -//- (void)sendViewAdEvent { |
763 | | -// BranchEvent *event = [BranchEvent standardEvent:BranchStandardEventClickAd]; |
764 | | -// event.adType = BranchEventAdTypeBanner; |
765 | | -// [event logEventWithCompletion:self.completionBlock]; |
766 | | -//} |
767 | | -// |
768 | | -//- (void)sendStandardV2Event:(BranchStandardEvent)event { |
769 | | -// [self sendGenericV2EventWithName:event isStandardEvent:YES]; |
770 | | -//} |
771 | | -// |
772 | | -//- (void)sendCustomV2Event:(NSString *)eventName { |
773 | | -// [self sendGenericV2EventWithName:eventName isStandardEvent:NO]; |
774 | | -//} |
775 | | -// |
776 | | -//- (void) sendGenericV2EventWithName:(NSString*)eventName isStandardEvent:(BOOL)isStandardEvent { |
777 | | -// BranchUniversalObject *buo = [BranchUniversalObject new]; |
778 | | -// |
779 | | -// buo.contentMetadata.contentSchema = BranchContentSchemaCommerceProduct; |
780 | | -// buo.contentMetadata.quantity = 2; |
781 | | -// buo.contentMetadata.price = [NSDecimalNumber decimalNumberWithString:@"23.20"]; |
782 | | -// buo.contentMetadata.currency = BNCCurrencyUSD; |
783 | | -// buo.contentMetadata.sku = @"1994320302"; |
784 | | -// buo.contentMetadata.productName = @"my_product_name1"; |
785 | | -// buo.contentMetadata.productBrand = @"my_prod_Brand1"; |
786 | | -// buo.contentMetadata.productCategory = BNCProductCategoryBabyToddler; |
787 | | -// buo.contentMetadata.productVariant = @"3T"; |
788 | | -// buo.contentMetadata.condition = BranchConditionFair; |
789 | | -// |
790 | | -// buo.contentMetadata.ratingAverage = 5; |
791 | | -// buo.contentMetadata.ratingCount = 5; |
792 | | -// buo.contentMetadata.ratingMax = 7; |
793 | | -// buo.contentMetadata.rating = 6; |
794 | | -// buo.contentMetadata.addressStreet = @"Street_name1"; |
795 | | -// buo.contentMetadata.addressCity = @"city1"; |
796 | | -// buo.contentMetadata.addressRegion = @"Region1"; |
797 | | -// buo.contentMetadata.addressCountry = @"Country1"; |
798 | | -// buo.contentMetadata.addressPostalCode= @"postal_code"; |
799 | | -// buo.contentMetadata.latitude = 12.07; |
800 | | -// buo.contentMetadata.longitude = -97.5; |
801 | | -// buo.contentMetadata.imageCaptions = (id) @[@"my_img_caption1", @"my_img_caption_2"]; |
802 | | -// buo.contentMetadata.customMetadata = (id) @{ |
803 | | -// @"Custom_Content_metadata_key1": @"Custom_Content_metadata_val1", |
804 | | -// @"Custom_Content_metadata_key2": @"Custom_Content_metadata_val2", |
805 | | -// @"~campaign": @"Parul's campaign" |
806 | | -// }; |
807 | | -// buo.title = @"Parul Title"; |
808 | | -// buo.canonicalIdentifier = @"item/12345"; |
809 | | -// buo.canonicalUrl = @"https://branch.io/deepviews"; |
810 | | -// buo.keywords = @[@"My_Keyword1", @"My_Keyword2"]; |
811 | | -// buo.contentDescription = @"my_product_description1"; |
812 | | -// buo.imageUrl = @"https://test_img_url"; |
813 | | -// buo.expirationDate = [NSDate dateWithTimeIntervalSinceNow:24*60*60]; |
814 | | -// buo.publiclyIndex = NO; |
815 | | -// buo.locallyIndex = YES; |
816 | | -// buo.creationDate = [NSDate date]; |
817 | | -// |
818 | | -// BranchEvent *event; |
819 | | -// if (isStandardEvent) { |
820 | | -// event = [BranchEvent standardEvent:eventName]; |
821 | | -// } else { |
822 | | -// event = [BranchEvent customEventWithName:eventName]; |
823 | | -// } |
824 | | -// event.transactionID = @"12344555"; |
825 | | -// event.currency = BNCCurrencyUSD; |
826 | | -// event.revenue = [NSDecimalNumber decimalNumberWithString:@"1.5"]; |
827 | | -// event.shipping = [NSDecimalNumber decimalNumberWithString:@"10.2"]; |
828 | | -// event.tax = [NSDecimalNumber decimalNumberWithString:@"12.3"]; |
829 | | -// event.coupon = @"test_coupon"; |
830 | | -// event.affiliation = @"test_affiliation"; |
831 | | -// event.eventDescription= @"Event _description"; |
832 | | -// event.customData = (NSMutableDictionary*) @{ |
833 | | -// @"Custom_Event_Property_Key1": @"Custom_Event_Property_val1", |
834 | | -// @"Custom_Event_Property_Key2": @"Custom_Event_Property_val2" |
835 | | -// }; |
836 | | -// event.contentItems = (id) @[ buo ]; |
837 | | -// event.alias = @"event alias"; |
838 | | -// |
839 | | -// [event logEventWithCompletion:self.completionBlock]; |
840 | | -//} |
841 | | - |
842 | 621 | #pragma mark - Spotlight |
843 | 622 |
|
844 | 623 | - (IBAction)registerWithSpotlightButtonTouchUpInside:(id)sender { |
@@ -1020,24 +799,6 @@ - (IBAction)createQRCode:(id)sender { |
1020 | 799 | }]; |
1021 | 800 | } |
1022 | 801 |
|
1023 | | -//- (IBAction)shareQRCode:(id)sender { |
1024 | | -// [activityIndicator startAnimating]; |
1025 | | -// |
1026 | | -// BranchQRCode *qrCode = [BranchQRCode new]; |
1027 | | -// qrCode.centerLogo = @"https://cdn.branch.io/branch-assets/1598575682753-og_image.png"; |
1028 | | -// qrCode.codeColor = [[UIColor new] initWithRed:0.1 green:0.8392 blue:0.8667 alpha:1.0]; |
1029 | | -// qrCode.width = @700; |
1030 | | -// |
1031 | | -// BranchUniversalObject *buo = [BranchUniversalObject new]; |
1032 | | -// buo.title = @"My QR Code"; |
1033 | | -// BranchLinkProperties *lp = [BranchLinkProperties new]; |
1034 | | -// |
1035 | | -// [qrCode showShareSheetWithQRCodeFromViewController:self anchor:nil universalObject:buo linkProperties:lp completion:^(NSError * _Nullable error) { |
1036 | | -// NSLog(@"Showing QR Code."); |
1037 | | -// [activityIndicator stopAnimating]; |
1038 | | -// }]; |
1039 | | -//} |
1040 | | - |
1041 | 802 | - (IBAction)shareLinkWithMetadata:(id)sender { |
1042 | 803 |
|
1043 | 804 | NSURL *iconURL = [NSURL URLWithString:@"https://cdn.branch.io/branch-assets/1598575682753-og_image.png"]; |
|
0 commit comments